Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for compiling for Windows on ARM #10997

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion deps/w32-pthreads/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#define PTW32_PROGCTR(Context) ((Context).Rip)
#endif

#if defined(_ARM_) || defined(ARM)
#if defined(_ARM_) || defined(ARM) || defined(_M_ARM) || defined(_M_ARM64)
#define PTW32_PROGCTR(Context) ((Context).Pc)
#endif

Expand Down
2 changes: 2 additions & 0 deletions frontend/dialogs/OBSBasicFilters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#include <QLineEdit>

#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <Windows.h>
#endif

Expand Down
2 changes: 2 additions & 0 deletions frontend/dialogs/OBSBasicInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include <QInputEvent>

#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <Windows.h>
#endif

Expand Down
2 changes: 2 additions & 0 deletions frontend/dialogs/OBSBasicProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include <QPushButton>

#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <Windows.h>
#endif

Expand Down
8 changes: 7 additions & 1 deletion libobs/obs-win-crash-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ static inline bool get_dbghelp_imports(struct exception_handler_data *data)

static inline void init_instruction_data(struct stack_trace *trace)
{
#ifdef _WIN64
#if defined(_M_ARM64)
trace->instruction_ptr = trace->context.Pc;
trace->frame.AddrPC.Offset = trace->instruction_ptr;
trace->frame.AddrFrame.Offset = trace->context.Fp;
trace->frame.AddrStack.Offset = trace->context.Sp;
trace->image_type = IMAGE_FILE_MACHINE_ARM64;
#elif defined(_WIN64)
trace->instruction_ptr = trace->context.Rip;
trace->frame.AddrPC.Offset = trace->instruction_ptr;
trace->frame.AddrFrame.Offset = trace->context.Rbp;
Expand Down
10 changes: 5 additions & 5 deletions plugins/obs-filters/compressor-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/* clang-format off */

#define S_RATIO "ratio"
#define S_THRESHOLD "threshold"
#define S_FILTER_THRESHOLD "threshold"
#define S_ATTACK_TIME "attack_time"
#define S_RELEASE_TIME "release_time"
#define S_OUTPUT_GAIN "output_gain"
Expand Down Expand Up @@ -190,7 +190,7 @@ static void compressor_update(void *data, obs_data_t *s)
const char *sidechain_name = obs_data_get_string(s, S_SIDECHAIN_SOURCE);

cd->ratio = (float)obs_data_get_double(s, S_RATIO);
cd->threshold = (float)obs_data_get_double(s, S_THRESHOLD);
cd->threshold = (float)obs_data_get_double(s, S_FILTER_THRESHOLD);
cd->attack_gain = gain_coefficient(sample_rate, attack_time_ms / MS_IN_S_F);
cd->release_gain = gain_coefficient(sample_rate, release_time_ms / MS_IN_S_F);
cd->output_gain = db_to_mul(output_gain_db);
Expand Down Expand Up @@ -438,7 +438,7 @@ static struct obs_audio_data *compressor_filter_audio(void *data, struct obs_aud
static void compressor_defaults(obs_data_t *s)
{
obs_data_set_default_double(s, S_RATIO, 10.0f);
obs_data_set_default_double(s, S_THRESHOLD, -18.0f);
obs_data_set_default_double(s, S_FILTER_THRESHOLD, -18.0f);
obs_data_set_default_int(s, S_ATTACK_TIME, 6);
obs_data_set_default_int(s, S_RELEASE_TIME, 60);
obs_data_set_default_double(s, S_OUTPUT_GAIN, 0.0f);
Expand Down Expand Up @@ -477,8 +477,8 @@ static obs_properties_t *compressor_properties(void *data)

p = obs_properties_add_float_slider(props, S_RATIO, TEXT_RATIO, MIN_RATIO, MAX_RATIO, 0.5);
obs_property_float_set_suffix(p, ":1");
p = obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB, MAX_THRESHOLD_DB,
0.1);
p = obs_properties_add_float_slider(props, S_FILTER_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB,
MAX_THRESHOLD_DB, 0.1);
obs_property_float_set_suffix(p, " dB");
p = obs_properties_add_int_slider(props, S_ATTACK_TIME, TEXT_ATTACK_TIME, MIN_ATK_RLS_MS, MAX_ATK_MS, 1);
obs_property_int_set_suffix(p, " ms");
Expand Down
12 changes: 6 additions & 6 deletions plugins/obs-filters/expander-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/* clang-format off */

#define S_RATIO "ratio"
#define S_THRESHOLD "threshold"
#define S_FILTER_THRESHOLD "threshold"
#define S_ATTACK_TIME "attack_time"
#define S_RELEASE_TIME "release_time"
#define S_OUTPUT_GAIN "output_gain"
Expand Down Expand Up @@ -158,7 +158,7 @@ static void expander_defaults(obs_data_t *s)
is_expander_preset = false;
obs_data_set_default_string(s, S_PRESETS, is_expander_preset ? "expander" : "gate");
obs_data_set_default_double(s, S_RATIO, is_expander_preset ? 2.0 : 10.0);
obs_data_set_default_double(s, S_THRESHOLD, -40.0f);
obs_data_set_default_double(s, S_FILTER_THRESHOLD, -40.0f);
obs_data_set_default_int(s, S_ATTACK_TIME, 10);
obs_data_set_default_int(s, S_RELEASE_TIME, is_expander_preset ? 50 : 125);
obs_data_set_default_double(s, S_OUTPUT_GAIN, 0.0);
Expand All @@ -168,7 +168,7 @@ static void expander_defaults(obs_data_t *s)
static void upward_compressor_defaults(obs_data_t *s)
{
obs_data_set_default_double(s, S_RATIO, 0.5);
obs_data_set_default_double(s, S_THRESHOLD, -20.0f);
obs_data_set_default_double(s, S_FILTER_THRESHOLD, -20.0f);
obs_data_set_default_int(s, S_ATTACK_TIME, 10);
obs_data_set_default_int(s, S_RELEASE_TIME, 50);
obs_data_set_default_double(s, S_OUTPUT_GAIN, 0.0);
Expand Down Expand Up @@ -204,7 +204,7 @@ static void expander_update(void *data, obs_data_t *s)

cd->ratio = (float)obs_data_get_double(s, S_RATIO);

cd->threshold = (float)obs_data_get_double(s, S_THRESHOLD);
cd->threshold = (float)obs_data_get_double(s, S_FILTER_THRESHOLD);
cd->attack_gain = gain_coefficient(sample_rate, attack_time_ms / MS_IN_S_F);
cd->release_gain = gain_coefficient(sample_rate, release_time_ms / MS_IN_S_F);
cd->output_gain = db_to_mul(output_gain_db);
Expand Down Expand Up @@ -445,8 +445,8 @@ static obs_properties_t *expander_properties(void *data)
p = obs_properties_add_float_slider(props, S_RATIO, TEXT_RATIO, !cd->is_upwcomp ? MIN_RATIO : MIN_RATIO_UPW,
!cd->is_upwcomp ? MAX_RATIO : MAX_RATIO_UPW, 0.1);
obs_property_float_set_suffix(p, ":1");
p = obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB, MAX_THRESHOLD_DB,
0.1);
p = obs_properties_add_float_slider(props, S_FILTER_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB,
MAX_THRESHOLD_DB, 0.1);
obs_property_float_set_suffix(p, " dB");
p = obs_properties_add_int_slider(props, S_ATTACK_TIME, TEXT_ATTACK_TIME, MIN_ATK_RLS_MS, MAX_ATK_MS, 1);
obs_property_int_set_suffix(p, " ms");
Expand Down
10 changes: 5 additions & 5 deletions plugins/obs-filters/limiter-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/* clang-format off */

#define S_THRESHOLD "threshold"
#define S_FILTER_THRESHOLD "threshold"
#define S_RELEASE_TIME "release_time"

#define MT_ obs_module_text
Expand Down Expand Up @@ -90,7 +90,7 @@ static void limiter_update(void *data, obs_data_t *s)
const float release_time_ms = (float)obs_data_get_int(s, S_RELEASE_TIME);
const float output_gain_db = 0;

cd->threshold = (float)obs_data_get_double(s, S_THRESHOLD);
cd->threshold = (float)obs_data_get_double(s, S_FILTER_THRESHOLD);

cd->attack_gain = gain_coefficient(sample_rate, attack_time_ms / MS_IN_S_F);
cd->release_gain = gain_coefficient(sample_rate, release_time_ms / MS_IN_S_F);
Expand Down Expand Up @@ -181,7 +181,7 @@ static struct obs_audio_data *limiter_filter_audio(void *data, struct obs_audio_

static void limiter_defaults(obs_data_t *s)
{
obs_data_set_default_double(s, S_THRESHOLD, -6.0f);
obs_data_set_default_double(s, S_FILTER_THRESHOLD, -6.0f);
obs_data_set_default_int(s, S_RELEASE_TIME, 60);
}

Expand All @@ -190,8 +190,8 @@ static obs_properties_t *limiter_properties(void *data)
obs_properties_t *props = obs_properties_create();
obs_property_t *p;

p = obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB, MAX_THRESHOLD_DB,
0.1);
p = obs_properties_add_float_slider(props, S_FILTER_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB,
MAX_THRESHOLD_DB, 0.1);
obs_property_float_set_suffix(p, " dB");
p = obs_properties_add_int_slider(props, S_RELEASE_TIME, TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, MAX_RLS_MS, 1);
obs_property_int_set_suffix(p, " ms");
Expand Down
4 changes: 4 additions & 0 deletions plugins/obs-outputs/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ static inline uint32_t clz32(unsigned long val)

static inline uint32_t ctz32(unsigned long val)
{
#if defined(_M_ARM64)
return _CountTrailingZeros(val);
#else
return _tzcnt_u32(val);
#endif
}
#else
static uint32_t popcnt(uint32_t x)
Expand Down
Loading