Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
lourenco-pacheco committed May 19, 2024
1 parent 38f4253 commit f71c851
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions plugins/obs-filters/color-correction-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,12 @@ static void color_correction_filter_update_v1(void *data, obs_data_t *settings)
filter->color_matrix.t.z = color_v4.w * color_v4.z;

/* Now we retrieve the white balance settings */
float white_balance_red = (float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_RED);
float white_balance_green = (float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_GREEN);
float white_balance_blue = (float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_BLUE);
float white_balance_red =
(float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_RED);
float white_balance_green = (float)obs_data_get_double(
settings, SETTING_WHITE_BALANCE_GREEN);
float white_balance_blue = (float)obs_data_get_double(
settings, SETTING_WHITE_BALANCE_BLUE);

/* Next we calculate gains for red, green, and blue channels */
float red_gain = 1.0f + white_balance_red;
Expand All @@ -264,11 +267,8 @@ static void color_correction_filter_update_v1(void *data, obs_data_t *settings)

/* Finally we construct the white balance matrix */
struct matrix4 white_balance_matrix = {
red_gain, 0.0f, 0.0f, 0.0f,
0.0f, green_gain,0.0f, 0.0f,
0.0f, 0.0f, blue_gain, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
red_gain, 0.0f, 0.0f, 0.0f, 0.0f, green_gain, 0.0f, 0.0f,
0.0f, 0.0f, blue_gain, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};

/* First we apply the Contrast & Brightness matrix. */
matrix4_mul(&filter->final_matrix, &filter->bright_matrix,
Expand Down Expand Up @@ -430,9 +430,12 @@ static void color_correction_filter_update_v2(void *data, obs_data_t *settings)
filter->color_matrix.t.z = color_add_v4.z;

/* Now we retrieve the white balance settings */
float white_balance_red = (float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_RED);
float white_balance_green = (float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_GREEN);
float white_balance_blue = (float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_BLUE);
float white_balance_red =
(float)obs_data_get_double(settings, SETTING_WHITE_BALANCE_RED);
float white_balance_green = (float)obs_data_get_double(
settings, SETTING_WHITE_BALANCE_GREEN);
float white_balance_blue = (float)obs_data_get_double(
settings, SETTING_WHITE_BALANCE_BLUE);

/* Next we calculate gains for red, green, and blue channels */
float red_gain = 1.0f + white_balance_red;
Expand All @@ -441,11 +444,8 @@ static void color_correction_filter_update_v2(void *data, obs_data_t *settings)

/* Finally we construct the white balance matrix */
struct matrix4 white_balance_matrix = {
red_gain, 0.0f, 0.0f, 0.0f,
0.0f, green_gain,0.0f, 0.0f,
0.0f, 0.0f, blue_gain, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
red_gain, 0.0f, 0.0f, 0.0f, 0.0f, green_gain, 0.0f, 0.0f,
0.0f, 0.0f, blue_gain, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};

/* First we apply the Contrast & Brightness matrix. */
matrix4_mul(&filter->final_matrix, &filter->con_matrix,
Expand Down Expand Up @@ -716,11 +716,14 @@ static obs_properties_t *color_correction_filter_properties_v1(void *data)
obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, 0,
100, 1);
obs_properties_add_float_slider(props, SETTING_WHITE_BALANCE_RED,
TEXT_WHITE_BALANCE_RED, -1.0, 1.0, 0.01);
TEXT_WHITE_BALANCE_RED, -1.0, 1.0,
0.01);
obs_properties_add_float_slider(props, SETTING_WHITE_BALANCE_GREEN,
TEXT_WHITE_BALANCE_GREEN, -1.0, 1.0, 0.01);
TEXT_WHITE_BALANCE_GREEN, -1.0, 1.0,
0.01);
obs_properties_add_float_slider(props, SETTING_WHITE_BALANCE_BLUE,
TEXT_WHITE_BALANCE_BLUE, -1.0, 1.0, 0.01);
TEXT_WHITE_BALANCE_BLUE, -1.0, 1.0,
0.01);

obs_properties_add_color_alpha(props, SETTING_COLOR, TEXT_COLOR);

Expand Down Expand Up @@ -749,11 +752,14 @@ static obs_properties_t *color_correction_filter_properties_v2(void *data)
obs_properties_add_float_slider(props, SETTING_OPACITY, TEXT_OPACITY,
0.0, 1.0, 0.0001);
obs_properties_add_float_slider(props, SETTING_WHITE_BALANCE_RED,
TEXT_WHITE_BALANCE_RED, -1.0, 1.0, 0.01);
TEXT_WHITE_BALANCE_RED, -1.0, 1.0,
0.01);
obs_properties_add_float_slider(props, SETTING_WHITE_BALANCE_GREEN,
TEXT_WHITE_BALANCE_GREEN, -1.0, 1.0, 0.01);
TEXT_WHITE_BALANCE_GREEN, -1.0, 1.0,
0.01);
obs_properties_add_float_slider(props, SETTING_WHITE_BALANCE_BLUE,
TEXT_WHITE_BALANCE_BLUE, -1.0, 1.0, 0.01);
TEXT_WHITE_BALANCE_BLUE, -1.0, 1.0,
0.01);

obs_properties_add_color(props, SETTING_COLOR_MULTIPLY,
TEXT_COLOR_MULTIPLY);
Expand Down

0 comments on commit f71c851

Please sign in to comment.