Merge pull request #1715 from jpark37/area-filter

Add "Area" scale filter
This commit is contained in:
Colin Edwards
2019-03-13 23:30:25 -05:00
committed by GitHub
10 changed files with 166 additions and 4 deletions

View File

@@ -65,6 +65,7 @@ ScaleFiltering.Point="Point"
ScaleFiltering.Bilinear="Bilinear"
ScaleFiltering.Bicubic="Bicubic"
ScaleFiltering.Lanczos="Lanczos"
ScaleFiltering.Area="Area"
NoiseSuppress.SuppressLevel="Suppression Level (dB)"
Saturation="Saturation"
HueShift="Hue Shift"

View File

@@ -17,6 +17,7 @@
#define T_SAMPLING_BILINEAR obs_module_text("ScaleFiltering.Bilinear")
#define T_SAMPLING_BICUBIC obs_module_text("ScaleFiltering.Bicubic")
#define T_SAMPLING_LANCZOS obs_module_text("ScaleFiltering.Lanczos")
#define T_SAMPLING_AREA obs_module_text("ScaleFiltering.Area")
#define T_UNDISTORT obs_module_text("UndistortCenter")
#define T_BASE obs_module_text("Base.Canvas")
@@ -24,6 +25,7 @@
#define S_SAMPLING_BILINEAR "bilinear"
#define S_SAMPLING_BICUBIC "bicubic"
#define S_SAMPLING_LANCZOS "lanczos"
#define S_SAMPLING_AREA "area"
struct scale_filter_data {
obs_source_t *context;
@@ -95,6 +97,9 @@ static void scale_filter_update(void *data, obs_data_t *settings)
} else if (astrcmpi(sampling, S_SAMPLING_LANCZOS) == 0) {
filter->sampling = OBS_SCALE_LANCZOS;
} else if (astrcmpi(sampling, S_SAMPLING_AREA) == 0) {
filter->sampling = OBS_SCALE_AREA;
} else { /* S_SAMPLING_BICUBIC */
filter->sampling = OBS_SCALE_BICUBIC;
}
@@ -218,6 +223,7 @@ static void scale_filter_tick(void *data, float seconds)
case OBS_SCALE_BILINEAR: type = OBS_EFFECT_DEFAULT; break;
case OBS_SCALE_BICUBIC: type = OBS_EFFECT_BICUBIC; break;
case OBS_SCALE_LANCZOS: type = OBS_EFFECT_LANCZOS; break;
case OBS_SCALE_AREA: type = OBS_EFFECT_AREA; break;
}
}
@@ -309,15 +315,15 @@ static bool sampling_modified(obs_properties_t *props, obs_property_t *p,
bool has_undistort;
if (astrcmpi(sampling, S_SAMPLING_POINT) == 0) {
has_undistort = false;
}
else if (astrcmpi(sampling, S_SAMPLING_BILINEAR) == 0) {
has_undistort = false;
}
else if (astrcmpi(sampling, S_SAMPLING_LANCZOS) == 0) {
has_undistort = true;
}
else if (astrcmpi(sampling, S_SAMPLING_AREA) == 0) {
has_undistort = false;
}
else { /* S_SAMPLING_BICUBIC */
has_undistort = true;
@@ -360,6 +366,7 @@ static obs_properties_t *scale_filter_properties(void *data)
obs_property_list_add_string(p, T_SAMPLING_BILINEAR, S_SAMPLING_BILINEAR);
obs_property_list_add_string(p, T_SAMPLING_BICUBIC, S_SAMPLING_BICUBIC);
obs_property_list_add_string(p, T_SAMPLING_LANCZOS, S_SAMPLING_LANCZOS);
obs_property_list_add_string(p, T_SAMPLING_AREA, S_SAMPLING_AREA);
/* ----------------- */