Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/test_ported_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"obs-source-conversion-plan.c.h.o",
"obs-source-deinterlace-draw.c.h.o",
"obs-source-deinterlace-pacing.c.h.o",
"obs-source-draw-plan.c.h.o",
"obs-source-load.c.h.o",
"obs-source-ptm-gate.c.h.o",
"obs-source-size.c.h.o",
Expand Down
11 changes: 11 additions & 0 deletions libobs/build/libobs-ported-source-draw-plan.pch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Precompiled header (BUILD.md) for the libobs unity group
* libobs.ported-source-draw-plan. obs-source-draw-plan.c needs its
* declarations (obs-source-draw-plan.h, which brings
* obs-source-draw-technique.h) and the gs_color_space enum (obs.h), so the C
* oracle and the C test can compile it on their own. The implementation file
* includes this header and nothing else. */

#pragma once

#include "obs.h"
#include "obs-source-draw-plan.h"
1 change: 1 addition & 0 deletions libobs/build/libobs.pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
#include "obs-source-audio-timing.h"
#include "obs-source-color-space.h"
#include "obs-source-conversion-plan.h"
#include "obs-source-draw-plan.h"
#include "obs-source-ptm-gate.h"
#include "obs-source-size.h"
#include "obs-source-volume.h"
Expand Down
5 changes: 5 additions & 0 deletions libobs/build/libobs.ported-source-draw-plan+.h.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Unity group (BUILD.md): ported obs-source-draw-plan.c. */

#include "libobs/build/libobs-ported-source-draw-plan.pch.h"

#include "libobs/obs-source-draw-plan.c.h"
3 changes: 3 additions & 0 deletions libobs/build/source-sets.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
"obs-source-conversion-plan.h",
"obs-source-deinterlace-draw.h",
"obs-source-deinterlace-pacing.h",
"obs-source-draw-plan.h",
"obs-source-draw-technique.h",
"obs-source-load.h",
"obs-source-ptm-gate.h",
"obs-source-size.h",
Expand Down Expand Up @@ -190,6 +192,7 @@
"build/libobs.ported-source-conversion-plan+.h.c",
"build/libobs.ported-source-deinterlace-draw+.h.c",
"build/libobs.ported-source-deinterlace-pacing+.h.c",
"build/libobs.ported-source-draw-plan+.h.c",
"build/libobs.ported-source-load+.h.c",
"build/libobs.ported-source-profiler+.h.c",
"build/libobs.ported-source-ptm-gate+.h.c",
Expand Down
10 changes: 10 additions & 0 deletions libobs/cmake/rust-exports.map
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@
obs_source_deinterlace_pacing_half_duration;
obs_source_deinterlace_pacing_buffered_offset;
obs_source_deinterlace_pacing_reanchor;
/* obs-source-draw-plan.c. obs-source.c calls them inside libobs. Not
* EXPORT. */
obs_source_draw_plan_rotation_x;
obs_source_draw_plan_rotation_y;
obs_source_draw_plan_async_linear_srgb;
obs_source_draw_plan_async_nonlinear_alpha;
obs_source_draw_plan_technique;
obs_source_draw_plan_reads_white_level;
obs_source_draw_plan_multiplier;
obs_source_draw_plan_convert;
/* obs-source-ptm-gate.c. obs-source.c calls them inside libobs. Not
* EXPORT. */
obs_source_ptm_gate_stop_time;
Expand Down
12 changes: 12 additions & 0 deletions libobs/cmake/rust-hidden.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ obs_source_deinterlace_pacing_waiting_frame_ts
obs_source_deinterlace_pacing_half_duration
obs_source_deinterlace_pacing_buffered_offset
obs_source_deinterlace_pacing_reanchor
# obs-source-draw-plan.c: rotate_async_video(),
# obs_source_render_async_video() and source_render() in obs-source.c call
# them inside libobs. Declared in obs-source-draw-plan.h without EXPORT, so the
# shims stay hidden the same way.
obs_source_draw_plan_rotation_x
obs_source_draw_plan_rotation_y
obs_source_draw_plan_async_linear_srgb
obs_source_draw_plan_async_nonlinear_alpha
obs_source_draw_plan_technique
obs_source_draw_plan_reads_white_level
obs_source_draw_plan_multiplier
obs_source_draw_plan_convert
# obs-source-ptm-gate.c: source_muted() and get_source_volume() in
# obs-source.c call them inside libobs. Declared in obs-source-ptm-gate.h
# without EXPORT, so the shims stay hidden the same way.
Expand Down
9 changes: 9 additions & 0 deletions libobs/cmake/rust-unexports-macos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ _obs_source_deinterlace_pacing_waiting_frame_ts
_obs_source_deinterlace_pacing_half_duration
_obs_source_deinterlace_pacing_buffered_offset
_obs_source_deinterlace_pacing_reanchor
# obs-source-draw-plan.c: obs-source.c calls them inside libobs. Not EXPORT.
_obs_source_draw_plan_rotation_x
_obs_source_draw_plan_rotation_y
_obs_source_draw_plan_async_linear_srgb
_obs_source_draw_plan_async_nonlinear_alpha
_obs_source_draw_plan_technique
_obs_source_draw_plan_reads_white_level
_obs_source_draw_plan_multiplier
_obs_source_draw_plan_convert
# obs-source-ptm-gate.c: obs-source.c calls them inside libobs. Not EXPORT.
_obs_source_ptm_gate_stop_time
_obs_source_ptm_gate_held
Expand Down
24 changes: 13 additions & 11 deletions libobs/obs-source-deinterlace-draw.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,23 @@ bool obs_source_deinterlace_draw_linear_srgb(int source_space, bool gs_linear_sr
obs_source_deinterlace_draw_linear_required(mode);
}

enum obs_source_deinterlace_draw_technique obs_source_deinterlace_draw_technique(int source_space, int current_space)
enum obs_source_draw_technique obs_source_deinterlace_draw_technique(int source_space, int current_space)
{
enum obs_source_deinterlace_draw_technique technique = OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW;
enum obs_source_draw_technique technique = OBS_SOURCE_DRAW_TECH_DRAW;
switch ((enum gs_color_space)source_space) {
case GS_CS_SRGB:
case GS_CS_SRGB_16F:
if ((enum gs_color_space)current_space == GS_CS_709_SCRGB)
technique = OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY;
technique = OBS_SOURCE_DRAW_TECH_DRAW_MULTIPLY;
break;
case GS_CS_709_EXTENDED:
switch ((enum gs_color_space)current_space) {
case GS_CS_SRGB:
case GS_CS_SRGB_16F:
technique = OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_TONEMAP;
technique = OBS_SOURCE_DRAW_TECH_DRAW_TONEMAP;
break;
case GS_CS_709_SCRGB:
technique = OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY;
technique = OBS_SOURCE_DRAW_TECH_DRAW_MULTIPLY;
break;
case GS_CS_709_EXTENDED:
break;
Expand All @@ -135,10 +135,10 @@ enum obs_source_deinterlace_draw_technique obs_source_deinterlace_draw_technique
switch ((enum gs_color_space)current_space) {
case GS_CS_SRGB:
case GS_CS_SRGB_16F:
technique = OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY_TONEMAP;
technique = OBS_SOURCE_DRAW_TECH_DRAW_MULTIPLY_TONEMAP;
break;
case GS_CS_709_EXTENDED:
technique = OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY;
technique = OBS_SOURCE_DRAW_TECH_DRAW_MULTIPLY;
break;
case GS_CS_709_SCRGB:
break;
Expand All @@ -151,11 +151,13 @@ enum obs_source_deinterlace_draw_technique obs_source_deinterlace_draw_technique
bool obs_source_deinterlace_draw_reads_white_level(int source_space, int current_space)
{
switch (obs_source_deinterlace_draw_technique(source_space, current_space)) {
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY:
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY_TONEMAP:
case OBS_SOURCE_DRAW_TECH_DRAW_MULTIPLY:
case OBS_SOURCE_DRAW_TECH_DRAW_MULTIPLY_TONEMAP:
case OBS_SOURCE_DRAW_TECH_DRAW_NONLINEAR_ALPHA_MULTIPLY:
return true;
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW:
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_TONEMAP:
case OBS_SOURCE_DRAW_TECH_DRAW:
case OBS_SOURCE_DRAW_TECH_DRAW_TONEMAP:
case OBS_SOURCE_DRAW_TECH_DRAW_NONLINEAR_ALPHA:
break;
}

Expand Down
17 changes: 3 additions & 14 deletions libobs/obs-source-deinterlace-draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <stdbool.h>
#include <stdint.h>

#include "obs-source-draw-technique.h"

/* The deinterlace draw decisions of obs-source-deinterlace.c, on plain values
* (obs-source-deinterlace-draw.c):
* - obs_source_deinterlace_draw_effect(): which effect a mode draws with
Expand Down Expand Up @@ -63,19 +65,6 @@ enum obs_source_deinterlace_draw_effect {
OBS_SOURCE_DEINTERLACE_DRAW_EFFECT_YADIF_2X,
};

/* The technique deinterlace_render() draws with; obs-source-deinterlace.c
* maps it to the name. */
enum obs_source_deinterlace_draw_technique {
/* "Draw" */
OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW,
/* "DrawMultiply" */
OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY,
/* "DrawTonemap" */
OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_TONEMAP,
/* "DrawMultiplyTonemap" */
OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY_TONEMAP,
};

/* What obs_source_set_deinterlace_mode() does. */
enum obs_source_deinterlace_draw_mode_change {
/* nothing: the mode is the current one */
Expand Down Expand Up @@ -114,7 +103,7 @@ bool obs_source_deinterlace_draw_linear_srgb(int source_space, bool gs_linear_sr
* GS_CS_709_SCRGB, DrawTonemap for GS_CS_709_EXTENDED into SDR,
* DrawMultiplyTonemap for GS_CS_709_SCRGB into SDR, DrawMultiply for
* GS_CS_709_SCRGB into GS_CS_709_EXTENDED, Draw for any other pair. */
enum obs_source_deinterlace_draw_technique obs_source_deinterlace_draw_technique(int source_space, int current_space);
enum obs_source_draw_technique obs_source_deinterlace_draw_technique(int source_space, int current_space);

/* Whether deinterlace_render() reads obs_get_video_sdr_white_level() for the
* pair: when the technique multiplies. */
Expand Down
19 changes: 1 addition & 18 deletions libobs/obs-source-deinterlace.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,23 +281,6 @@ static inline gs_effect_t *get_effect(enum obs_deinterlace_mode mode)
return NULL;
}

/* The names of enum obs_source_deinterlace_draw_technique. */
static const char *deinterlace_technique_name(enum obs_source_deinterlace_draw_technique technique)
{
switch (technique) {
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW:
return "Draw";
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY:
return "DrawMultiply";
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_TONEMAP:
return "DrawTonemap";
case OBS_SOURCE_DEINTERLACE_DRAW_TECH_DRAW_MULTIPLY_TONEMAP:
return "DrawMultiplyTonemap";
}

return "Draw";
}

void deinterlace_render(obs_source_t *s)
{
gs_effect_t *effect = s->deinterlace_effect;
Expand Down Expand Up @@ -326,7 +309,7 @@ void deinterlace_render(obs_source_t *s)

const enum gs_color_space current_space = gs_get_color_space();
const char *tech_name =
deinterlace_technique_name(obs_source_deinterlace_draw_technique(source_space, current_space));
obs_source_draw_technique_name(obs_source_deinterlace_draw_technique(source_space, current_space));
const float multiplier = obs_source_deinterlace_draw_reads_white_level(source_space, current_space)
? obs_source_deinterlace_draw_multiplier(source_space, current_space,
obs_get_video_sdr_white_level())
Expand Down
Loading
Loading