]> git.sesse.net Git - nageru/commitdiff
Change to using RGBTriplet for white balance.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 9 Feb 2020 22:48:57 +0000 (23:48 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 9 Feb 2020 22:48:57 +0000 (23:48 +0100)
nageru/mixer.cpp
nageru/mjpeg_encoder.h
nageru/scene.cpp
nageru/theme.cpp
nageru/theme.h

index c9f7ed78861b7bf3136c913038eff9c13a0254c5..b0bb58494165d0920a0d0f11bcf4ebc6f65a706c 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <assert.h>
 #include <epoxy/egl.h>
+#include <movit/effect.h>
 #include <movit/effect_chain.h>
 #include <movit/effect_util.h>
 #include <movit/flat_input.h>
index bb783d83b0c76af83c5637f7bc78bfd296542aac..fe41929b0b128c13833b9761ab98766103e48e3e 100644 (file)
@@ -20,6 +20,7 @@ extern "C" {
 #include <string>
 #include <thread>
 
+#include <movit/effect.h>
 #include <va/va.h>
 
 class HTTPD;
index 06392c031e9f7c133547396c1d8caa619825e579..a9268360b97bd34cab472701be2757cef4a1d777 100644 (file)
@@ -542,7 +542,7 @@ Scene::get_chain(Theme *theme, lua_State *L, unsigned num, const InputState &inp
                       chosen_type == LIVE_INPUT_YCBCR_PLANAR ||
                       chosen_type == LIVE_INPUT_BGRA);
                int signal = find_signal_to_connect(L, input);
-               Theme::WhiteBalance wb = theme->get_white_balance_for_signal(signal);
+               RGBTriplet wb = theme->get_white_balance_for_signal(signal);
                if (fabs(wb.r - 1.0) < 1e-3 && fabs(wb.g - 1.0) < 1e-3 && fabs(wb.b - 1.0) < 1e-3) {
                        // Neutral white balance.
                        block->currently_chosen_alternative = find_index_of(block, IDENTITY_EFFECT);
index e3cdac2df54feac52374d623ce36bf34841cabf9..51aacd54bb4e239e9da9d5e75e180366002a1e91 100644 (file)
@@ -1689,7 +1689,7 @@ void Theme::set_wb(unsigned channel, float r, float g, float b)
        lock_guard<mutex> lock(m);
 
        if (channel_signals.count(channel)) {
-               white_balance_for_signal[channel_signals[channel]] = WhiteBalance{ r, g, b };
+               white_balance_for_signal[channel_signals[channel]] = RGBTriplet{ r, g, b };
        }
 
        lua_getglobal(L, "set_wb");
@@ -1711,12 +1711,12 @@ void Theme::set_wb(unsigned channel, float r, float g, float b)
        assert(lua_gettop(L) == 0);
 }
 
-Theme::WhiteBalance Theme::get_white_balance_for_signal(int signal)
+RGBTriplet Theme::get_white_balance_for_signal(int signal)
 {
        if (white_balance_for_signal.count(signal)) {
                return white_balance_for_signal[signal];
        } else {
-               return WhiteBalance{ 1.0, 1.0, 1.0 };
+               return RGBTriplet{ 1.0, 1.0, 1.0 };
        }
 }
 
index 7fd132544264e8283fbc0bd1d13ec6d6dc05a084..46f24892b5569f48dfe9f226331bf5d02f7ddda9 100644 (file)
@@ -2,6 +2,7 @@
 #define _THEME_H 1
 
 #include <lua.hpp>
+#include <movit/effect.h>
 #include <movit/flat_input.h>
 #include <movit/ycbcr_input.h>
 #include <stdbool.h>
@@ -94,9 +95,6 @@ public:
                // for non-interlaced inputs.
                std::vector<RefCountedFrame> input_frames;
        };
-       struct WhiteBalance {
-               float r, g, b;
-       };
 
        Chain get_chain(unsigned num, float t, unsigned width, unsigned height, const InputState &input_state);
 
@@ -107,10 +105,10 @@ public:
        int get_channel_signal(unsigned channel);
        bool get_supports_set_wb(unsigned channel);
        void set_wb(unsigned channel, float r, float g, float b);
-       WhiteBalance get_white_balance_for_signal(int signal);
+       movit::RGBTriplet get_white_balance_for_signal(int signal);
        std::string get_channel_color(unsigned channel);
 
-       std::unordered_map<int, WhiteBalance> white_balance_for_signal;
+       std::unordered_map<int, movit::RGBTriplet> white_balance_for_signal;
 
        std::vector<std::string> get_transition_names(float t);