mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 01:21:03 +00:00
Cleanups/style nits
This commit is contained in:
parent
3f3262fba3
commit
7ebab640d7
@ -313,9 +313,8 @@ static bool alsa_qsa_start(void *data, bool is_shutdown)
|
||||
|
||||
static void alsa_qsa_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
|
||||
int err;
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
|
||||
if ((err = snd_pcm_nonblock_mode(alsa->pcm, state)) < 0)
|
||||
{
|
||||
|
@ -170,11 +170,6 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
|
||||
const uint16_t *src = buf;
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
(void)data;
|
||||
(void)buf;
|
||||
(void)samples_played;
|
||||
(void)current_tick;
|
||||
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
|
||||
if ((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
|
||||
|
@ -105,7 +105,8 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
ctr->pos = (sample_pos + (CTR_DSP_AUDIO_COUNT >> 1)) & CTR_DSP_AUDIO_COUNT_MASK;
|
||||
else
|
||||
{
|
||||
do{
|
||||
do
|
||||
{
|
||||
svcSleepThread(100000);
|
||||
|
||||
/* Run aptMainLoop to update APT state if DSP state
|
||||
|
@ -169,7 +169,8 @@ static void psp_audio_free(void *data)
|
||||
if (!psp)
|
||||
return;
|
||||
|
||||
if(psp->running){
|
||||
if (psp->running)
|
||||
{
|
||||
if (psp->worker_thread)
|
||||
{
|
||||
psp->running = false;
|
||||
@ -274,14 +275,14 @@ static bool psp_audio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
if(psp && psp->running)
|
||||
return true;
|
||||
|
||||
if (psp && !psp->running)
|
||||
{
|
||||
if (!psp->worker_thread)
|
||||
{
|
||||
psp->running = true;
|
||||
psp->worker_thread = sthread_create(audioMainLoop, psp);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -295,7 +296,6 @@ static void psp_audio_set_nonblock_state(void *data, bool toggle)
|
||||
|
||||
static bool psp_audio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ static size_t psp_write_avail(void *data)
|
||||
|
||||
static size_t psp_buffer_size(void *data)
|
||||
{
|
||||
/* TODO */
|
||||
/* TODO/FIXME - implement? */
|
||||
return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/;
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,9 @@ void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id)
|
||||
enable3d ? (u32*)gfxTopRightFramebuffers[id] : (u32*)gfxTopLeftFramebuffers[id],
|
||||
240 * 3,
|
||||
((1)<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
gspPresentBuffer(GFX_BOTTOM,
|
||||
id,
|
||||
(u32*)gfxBottomFramebuffers[id],
|
||||
|
@ -123,19 +123,17 @@ static void CFSearchPathForDirectoriesInDomains(
|
||||
#else
|
||||
NSSearchPathDirectory dir = NSDocumentDirectory;
|
||||
#endif
|
||||
CFStringRef array_val;
|
||||
#if __has_feature(objc_arc)
|
||||
array_val = (__bridge CFStringRef)[
|
||||
CFStringRef array_val = (__bridge CFStringRef)[
|
||||
NSSearchPathForDirectoriesInDomains(dir,
|
||||
NSUserDomainMask, YES) firstObject];
|
||||
#else
|
||||
NSArray *arr = NSSearchPathForDirectoriesInDomains(dir,
|
||||
CFStringRef array_val = nil;
|
||||
NSArray *arr =
|
||||
NSSearchPathForDirectoriesInDomains(dir,
|
||||
NSUserDomainMask, YES);
|
||||
if ([arr count] == 0) {
|
||||
array_val = nil;
|
||||
} else{
|
||||
if ([arr count] != 0)
|
||||
array_val = (CFStringRef)[arr objectAtIndex:0];
|
||||
}
|
||||
#endif
|
||||
if (array_val)
|
||||
CFStringGetCString(array_val, s, len, kCFStringEncodingUTF8);
|
||||
@ -160,9 +158,15 @@ void get_ios_version(int *major, int *minor);
|
||||
#define PMGMT_STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo)
|
||||
#define PMGMT_GETVAL(k,v) CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v)
|
||||
|
||||
/* Note that AC power sources also include a laptop battery it is charging. */
|
||||
static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
|
||||
bool * charging, int *seconds, int *percent)
|
||||
/* Note that AC power sources also include a
|
||||
* laptop battery it is charging. */
|
||||
static void darwin_check_power_source(
|
||||
CFDictionaryRef dict,
|
||||
bool *have_ac,
|
||||
bool *have_battery,
|
||||
bool *charging,
|
||||
int *seconds,
|
||||
int *percent)
|
||||
{
|
||||
CFStringRef strval; /* don't CFRelease() this. */
|
||||
CFBooleanRef bval;
|
||||
@ -183,7 +187,7 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
|
||||
if (PMGMT_STRMATCH(strval, CFSTR(kIOPSACPowerValue)))
|
||||
is_ac = *have_ac = true;
|
||||
else if (!PMGMT_STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue)))
|
||||
return; /* not a battery? */
|
||||
return; /* Not a battery? */
|
||||
|
||||
if ((PMGMT_GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue))
|
||||
charge = true;
|
||||
@ -216,7 +220,7 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
|
||||
CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
|
||||
|
||||
/* Mac OS X reports 0 minutes until empty if you're plugged in. :( */
|
||||
if ((val == 0) && (is_ac))
|
||||
if ((val == 0) && is_ac)
|
||||
val = -1; /* !!! FIXME: calc from timeToFull and capacity? */
|
||||
|
||||
secs = (int)val;
|
||||
@ -264,10 +268,7 @@ static void frontend_darwin_get_name(char *s, size_t len)
|
||||
{
|
||||
#if defined(IOS)
|
||||
struct utsname buffer;
|
||||
|
||||
if (uname(&buffer) != 0)
|
||||
return;
|
||||
|
||||
if (uname(&buffer) == 0)
|
||||
strlcpy(s, buffer.machine, len);
|
||||
#elif defined(OSX)
|
||||
size_t length = 0;
|
||||
@ -450,14 +451,18 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
|
||||
int major, minor;
|
||||
get_ios_version(&major, &minor);
|
||||
if (major > 8)
|
||||
strlcpy(g_defaults.path_buildbot_server_url, "http://buildbot.libretro.com/nightly/apple/ios9/latest/", sizeof(g_defaults.path_buildbot_server_url));
|
||||
strlcpy(g_defaults.path_buildbot_server_url,
|
||||
"http://buildbot.libretro.com/nightly/apple/ios9/latest/",
|
||||
sizeof(g_defaults.path_buildbot_server_url));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
fill_pathname_join_special(assets_zip_path, bundle_path_buf, "assets.zip", sizeof(assets_zip_path));
|
||||
fill_pathname_join_special(assets_zip_path,
|
||||
bundle_path_buf, "assets.zip", sizeof(assets_zip_path));
|
||||
#else
|
||||
fill_pathname_join_special(assets_zip_path, full_resource_path_buf, "assets.zip", sizeof(assets_zip_path));
|
||||
fill_pathname_join_special(assets_zip_path,
|
||||
full_resource_path_buf, "assets.zip", sizeof(assets_zip_path));
|
||||
#endif
|
||||
|
||||
if (path_is_valid(assets_zip_path))
|
||||
@ -616,7 +621,8 @@ static int frontend_darwin_get_rating(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int *percent)
|
||||
static enum frontend_powerstate frontend_darwin_get_powerstate(
|
||||
int *seconds, int *percent)
|
||||
{
|
||||
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
|
||||
#if defined(OSX)
|
||||
@ -629,12 +635,13 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
|
||||
*percent = -1;
|
||||
|
||||
if (!blob)
|
||||
goto end;
|
||||
return FRONTEND_POWERSTATE_NONE
|
||||
|
||||
list = IOPSCopyPowerSourcesList(blob);
|
||||
|
||||
if (!list)
|
||||
goto end;
|
||||
if (!(list = IOPSCopyPowerSourcesList(blob)))
|
||||
{
|
||||
CFRelease(blob);
|
||||
return FRONTEND_POWERSTATE_NONE;
|
||||
}
|
||||
|
||||
/* don't CFRelease() the list items, or dictionaries! */
|
||||
have_ac = false;
|
||||
@ -647,7 +654,7 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
|
||||
CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i);
|
||||
CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps);
|
||||
if (dict)
|
||||
checkps(dict, &have_ac, &have_battery, &charging,
|
||||
darwin_check_power_source(dict, &have_ac, &have_battery, &charging,
|
||||
seconds, percent);
|
||||
}
|
||||
|
||||
@ -661,16 +668,12 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
|
||||
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
|
||||
|
||||
CFRelease(list);
|
||||
end:
|
||||
if (blob)
|
||||
CFRelease(blob);
|
||||
#elif TARGET_OS_IOS
|
||||
float level;
|
||||
UIDevice *uidev = [UIDevice currentDevice];
|
||||
|
||||
if (!uidev)
|
||||
return ret;
|
||||
|
||||
if (uidev)
|
||||
{
|
||||
[uidev setBatteryMonitoringEnabled:true];
|
||||
|
||||
switch (uidev.batteryState)
|
||||
@ -693,6 +696,7 @@ end:
|
||||
*percent = ((level < 0.0f) ? -1 : ((int)((level * 100) + 0.5f)));
|
||||
|
||||
[uidev setBatteryMonitoringEnabled:false];
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
@ -778,26 +782,24 @@ static int frontend_darwin_parse_drive_list(void *data, bool load_content)
|
||||
CFRelease(bundle_url);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* TODO/FIXME - is adding iOS/tvOS support possible here? */
|
||||
static uint64_t frontend_darwin_get_total_mem(void)
|
||||
{
|
||||
#if defined(OSX)
|
||||
uint64_t size;
|
||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||
u_int namelen = ARRAY_SIZE(mib);
|
||||
size_t len = sizeof(size);
|
||||
|
||||
if (sysctl(mib, namelen, &size, &len, NULL, 0) < 0)
|
||||
return 0;
|
||||
if (sysctl(mib, namelen, &size, &len, NULL, 0) >= 0)
|
||||
return size;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* TODO/FIXME - is adding iOS/tvOS support possible here? */
|
||||
static uint64_t frontend_darwin_get_free_mem(void)
|
||||
{
|
||||
#if (defined(OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200))
|
||||
@ -810,8 +812,8 @@ static uint64_t frontend_darwin_get_free_mem(void)
|
||||
KERN_SUCCESS == host_statistics64(mach_port, HOST_VM_INFO,
|
||||
(host_info64_t)&vm_stats, &count))
|
||||
{
|
||||
|
||||
long long used_memory = ((int64_t)vm_stats.active_count +
|
||||
long long used_memory = (
|
||||
(int64_t)vm_stats.active_count +
|
||||
(int64_t)vm_stats.inactive_count +
|
||||
(int64_t)vm_stats.wire_count) * (int64_t)page_size;
|
||||
return used_memory;
|
||||
@ -822,7 +824,8 @@ static uint64_t frontend_darwin_get_free_mem(void)
|
||||
|
||||
static const char* frontend_darwin_get_cpu_model_name(void)
|
||||
{
|
||||
cpu_features_get_model_name(darwin_cpu_model_name, sizeof(darwin_cpu_model_name));
|
||||
cpu_features_get_model_name(darwin_cpu_model_name,
|
||||
sizeof(darwin_cpu_model_name));
|
||||
return darwin_cpu_model_name;
|
||||
}
|
||||
|
||||
@ -851,7 +854,8 @@ static char* accessibility_mac_language_code(const char* language)
|
||||
return "Ioana";
|
||||
else if (string_is_equal(language,"pt_pt"))
|
||||
return "Joana";
|
||||
else if (string_is_equal(language,"pt_bt") || string_is_equal(language,"pt"))
|
||||
else if (string_is_equal(language,"pt_bt")
|
||||
|| string_is_equal(language,"pt"))
|
||||
return "Luciana";
|
||||
else if (string_is_equal(language,"th"))
|
||||
return "Kanya";
|
||||
@ -865,7 +869,8 @@ static char* accessibility_mac_language_code(const char* language)
|
||||
return "Maged";
|
||||
else if (string_is_equal(language,"hu"))
|
||||
return "Mariska";
|
||||
else if (string_is_equal(language,"zh_tw") || string_is_equal(language,"zh"))
|
||||
else if (string_is_equal(language,"zh_tw")
|
||||
|| string_is_equal(language,"zh"))
|
||||
return "Mei-Jia";
|
||||
else if (string_is_equal(language,"el"))
|
||||
return "Melina";
|
||||
@ -889,7 +894,6 @@ static char* accessibility_mac_language_code(const char* language)
|
||||
return "Zosia";
|
||||
else if (string_is_equal(language,"cs"))
|
||||
return "Zuzana";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -904,8 +908,8 @@ static bool accessibility_speak_macos(int speed,
|
||||
int pid;
|
||||
const char *voice = get_user_language_iso639_1(false);
|
||||
char* language_speaker = accessibility_mac_language_code(voice);
|
||||
char* speeds[10] = {"80", "100", "125", "150", "170", "210", "260", "310", "380", "450"};
|
||||
|
||||
char* speeds[10] = {"80", "100", "125", "150", "170", "210",
|
||||
"260", "310", "380", "450"};
|
||||
if (speed < 1)
|
||||
speed = 1;
|
||||
else if (speed > 10)
|
||||
|
@ -278,7 +278,6 @@ static void frontend_psp_init(void *data)
|
||||
return;
|
||||
#endif
|
||||
#else
|
||||
(void)data;
|
||||
/* initialize debug screen */
|
||||
pspDebugScreenInit();
|
||||
pspDebugScreenClear();
|
||||
|
@ -163,11 +163,11 @@ enum frontend_powerstate frontend_uwp_get_powerstate(
|
||||
int *seconds, int *percent)
|
||||
{
|
||||
SYSTEM_POWER_STATUS status;
|
||||
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
|
||||
|
||||
if (!GetSystemPowerStatus(&status))
|
||||
return ret;
|
||||
enum frontend_powerstate
|
||||
ret = FRONTEND_POWERSTATE_NONE;
|
||||
|
||||
if (GetSystemPowerStatus(&status))
|
||||
{
|
||||
if (status.BatteryFlag == 0xFF)
|
||||
ret = FRONTEND_POWERSTATE_NONE;
|
||||
else if (status.BatteryFlag & (1 << 7))
|
||||
@ -186,6 +186,7 @@ enum frontend_powerstate frontend_uwp_get_powerstate(
|
||||
if (*percent == 255)
|
||||
*percent = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -259,8 +260,10 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
|
||||
if (string_is_equal(uwp_device_family, "Windows.Desktop"))
|
||||
{
|
||||
menu_entries_append(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS),
|
||||
MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL);
|
||||
}
|
||||
|
@ -469,7 +469,8 @@ static void init_nvda(void)
|
||||
/* The above code is executed on each accessibility speak event, so
|
||||
* we should only revert to powershell if nvda_lib wasn't loaded previously,
|
||||
* and we weren't able to load it on this call, or we don't HAVE_DYLIB */
|
||||
if ((g_plat_win32_flags & PLAT_WIN32_FLAG_USE_NVDA) && !nvda_lib) {
|
||||
if ((g_plat_win32_flags & PLAT_WIN32_FLAG_USE_NVDA) && !nvda_lib)
|
||||
{
|
||||
g_plat_win32_flags &= ~PLAT_WIN32_FLAG_USE_NVDA;
|
||||
g_plat_win32_flags |= PLAT_WIN32_FLAG_USE_POWERSHELL;
|
||||
}
|
||||
|
@ -57,8 +57,7 @@ bool d3d8_initialize_symbols(enum gfx_ctx_api api)
|
||||
return true;
|
||||
|
||||
#if defined(DEBUG) || defined(_DEBUG)
|
||||
g_d3d8_dll = dylib_load("d3d8d.dll");
|
||||
if(!g_d3d8_dll)
|
||||
if (!(g_d3d8_dll = dylib_load("d3d8d.dll")))
|
||||
#endif
|
||||
g_d3d8_dll = dylib_load("d3d8.dll");
|
||||
|
||||
|
@ -1196,17 +1196,15 @@ static void d3d9_video_texture_load_d3d(
|
||||
if (!ti)
|
||||
return;
|
||||
|
||||
if((info->type == TEXTURE_FILTER_MIPMAP_LINEAR) ||
|
||||
(info->type == TEXTURE_FILTER_MIPMAP_NEAREST))
|
||||
if ( (info->type == TEXTURE_FILTER_MIPMAP_LINEAR)
|
||||
|| (info->type == TEXTURE_FILTER_MIPMAP_NEAREST))
|
||||
want_mipmap = true;
|
||||
|
||||
tex = (LPDIRECT3DTEXTURE9)d3d9_texture_new(d3d->dev,
|
||||
if (!(tex = (LPDIRECT3DTEXTURE9)d3d9_texture_new(d3d->dev,
|
||||
ti->width, ti->height, 0,
|
||||
usage, D3D9_ARGB8888_FORMAT,
|
||||
D3DPOOL_MANAGED, 0, 0, 0,
|
||||
NULL, NULL, want_mipmap);
|
||||
|
||||
if (!tex)
|
||||
NULL, NULL, want_mipmap)))
|
||||
return;
|
||||
|
||||
IDirect3DTexture9_LockRect(tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
|
@ -234,13 +234,9 @@ float snow(float3 pos, float2 uv, float o, float atime)
|
||||
{
|
||||
float col = 0.0;
|
||||
if (sin(a * 8.0) < 0.0)
|
||||
{
|
||||
col = 1.0;
|
||||
}
|
||||
if (dist < pos.z/800.0)
|
||||
{
|
||||
col += 1.0;
|
||||
}
|
||||
return col * pos.z;
|
||||
}
|
||||
|
||||
|
@ -932,17 +932,17 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
unsigned i;
|
||||
for (i = 0; i < uniformVarCount; i++)
|
||||
{
|
||||
int k;
|
||||
float *dst;
|
||||
const char *id = NULL;
|
||||
if (uniformVars[i].block != id)
|
||||
continue;
|
||||
|
||||
const char *id = strrchr(uniformVars[i].name, '.');
|
||||
|
||||
if (!id)
|
||||
if (!(id = strrchr(uniformVars[i].name, '.')))
|
||||
continue;
|
||||
|
||||
id++;
|
||||
|
||||
float *dst = ubo + uniformVars[i].offset;
|
||||
dst = ubo + uniformVars[i].offset;
|
||||
|
||||
if (string_is_equal(id, "OutputSize"))
|
||||
{
|
||||
@ -1000,6 +1000,7 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
if (!strncmp(id, "OriginalHistorySize",
|
||||
STRLEN_CONST("OriginalHistorySize")))
|
||||
{
|
||||
GX2Surface *source;
|
||||
unsigned index = strtoul(id + STRLEN_CONST("OriginalHistorySize"),
|
||||
NULL, 0);
|
||||
if (index > pass)
|
||||
@ -1008,7 +1009,7 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
if (index)
|
||||
index = pass - index;
|
||||
|
||||
GX2Surface *source = (index > 0) ? &wiiu->pass[index - 1].texture.surface : &wiiu->texture.surface;
|
||||
source = (index > 0) ? &wiiu->pass[index - 1].texture.surface : &wiiu->texture.surface;
|
||||
((GX2_vec4 *)dst)->x = source->width;
|
||||
((GX2_vec4 *)dst)->y = source->height;
|
||||
((GX2_vec4 *)dst)->z = 1.0f / source->width;
|
||||
@ -1019,10 +1020,11 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
if ((pass > 0 ) && !strncmp(id, "PassOutputSize",
|
||||
STRLEN_CONST("PassOutputSize")))
|
||||
{
|
||||
GX2Surface *output;
|
||||
unsigned index = strtoul(id + STRLEN_CONST("PassOutputSize"), NULL, 0);
|
||||
if (index > pass - 1)
|
||||
index = pass - 1;
|
||||
GX2Surface *output = &wiiu->pass[index].texture.surface;
|
||||
output = &wiiu->pass[index].texture.surface;
|
||||
((GX2_vec4 *)dst)->x = output->width;
|
||||
((GX2_vec4 *)dst)->y = output->height;
|
||||
((GX2_vec4 *)dst)->z = 1.0f / output->width;
|
||||
@ -1033,10 +1035,11 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
/* feedback not supported yet */
|
||||
if (!strncmp(id, "PassFeedbackSize", STRLEN_CONST("PassFeedbackSize")))
|
||||
{
|
||||
GX2Surface *output;
|
||||
unsigned index = strtoul(id + STRLEN_CONST("PassFeedbackSize"), NULL, 0);
|
||||
if (index > wiiu->shader_preset->passes - 1)
|
||||
index = wiiu->shader_preset->passes - 1;
|
||||
GX2Surface *output = &wiiu->pass[index].texture.surface;
|
||||
output = &wiiu->pass[index].texture.surface;
|
||||
((GX2_vec4 *)dst)->x = output->width;
|
||||
((GX2_vec4 *)dst)->y = output->height;
|
||||
((GX2_vec4 *)dst)->z = 1.0f / output->width;
|
||||
@ -1044,7 +1047,7 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int k = 0; k < wiiu->shader_preset->luts; k++)
|
||||
for (k = 0; k < wiiu->shader_preset->luts; k++)
|
||||
{
|
||||
size_t lut_id_size = strlen(wiiu->shader_preset->lut[k].id);
|
||||
if ( !strncmp(id, wiiu->shader_preset->lut[k].id, lut_id_size)
|
||||
@ -1064,7 +1067,7 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int k = 0; k < wiiu->shader_preset->num_parameters; k++)
|
||||
for (k = 0; k < wiiu->shader_preset->num_parameters; k++)
|
||||
{
|
||||
if (string_is_equal(id, wiiu->shader_preset->parameters[k].id))
|
||||
{
|
||||
@ -1073,7 +1076,6 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_UNIFORM_BLOCK, ubo, size);
|
||||
@ -1122,13 +1124,13 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
wiiu_gfx_update_viewport(wiiu);
|
||||
|
||||
GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
/* can't call GX2ClearColor after GX2SetContextState for whatever reason */
|
||||
/* Can't call GX2ClearColor after GX2SetContextState for whatever reason */
|
||||
GX2SetContextState(wiiu->ctx_state);
|
||||
|
||||
if (frame)
|
||||
{
|
||||
if ((width != wiiu->texture.surface.width) ||
|
||||
(height != wiiu->texture.surface.height))
|
||||
if ( (width != wiiu->texture.surface.width)
|
||||
|| (height != wiiu->texture.surface.height))
|
||||
wiiu_init_frame_textures(wiiu, width, height);
|
||||
|
||||
wiiu->width = width;
|
||||
@ -1221,6 +1223,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
|
||||
for (j = 0; j < wiiu->pass[i].gfd->ps->samplerVarCount; j++)
|
||||
{
|
||||
int k;
|
||||
if (string_is_equal(wiiu->pass[i].gfd->ps->samplerVars[j].name, "Source"))
|
||||
{
|
||||
GX2SetPixelTexture(texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
@ -1243,14 +1246,14 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
|
||||
if (!strncmp(wiiu->pass[i].gfd->ps->samplerVars[j].name, "OriginalHistory", STRLEN_CONST("OriginalHistory")))
|
||||
{
|
||||
GX2Texture *source;
|
||||
unsigned index = strtoul(wiiu->pass[i].gfd->ps->samplerVars[j].name + STRLEN_CONST("OriginalHistory"), NULL, 0);
|
||||
if (index > i)
|
||||
index = 0;
|
||||
|
||||
if (index)
|
||||
index = i - index;
|
||||
|
||||
GX2Texture *source = (index > 0) ? &wiiu->pass[index - 1].texture : &wiiu->texture;
|
||||
source = (index > 0) ? &wiiu->pass[index - 1].texture : &wiiu->texture;
|
||||
GX2SetPixelTexture(source, wiiu->pass[i].gfd->ps->samplerVars[j].location);
|
||||
GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ?
|
||||
&wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] :
|
||||
@ -1287,7 +1290,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int k = 0; k < wiiu->shader_preset->luts; k++)
|
||||
for (k = 0; k < wiiu->shader_preset->luts; k++)
|
||||
{
|
||||
if (wiiu->luts[k].surface.image
|
||||
&& string_is_equal(wiiu->pass[i].gfd->ps->samplerVars[j].name, wiiu->shader_preset->lut[k].id))
|
||||
@ -1300,7 +1303,6 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (wiiu->pass[i].color_buffer.surface.image)
|
||||
@ -1440,22 +1442,10 @@ static void wiiu_gfx_set_nonblock_state(void *data, bool toggle,
|
||||
GX2SetSwapInterval(!toggle); /* do we need this ? */
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_alive(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_alive(void *data) { return true; }
|
||||
static bool wiiu_gfx_focus(void *data) { return true; }
|
||||
static bool wiiu_gfx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1471,9 +1461,8 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
GX2DrawDone();
|
||||
wiiu_free_shader_preset(wiiu);
|
||||
|
||||
if (string_is_empty(path))
|
||||
return true;
|
||||
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
if (type != RARCH_SHADER_SLANG)
|
||||
{
|
||||
RARCH_WARN("[GX2] Only Slang shaders are supported. Falling back to stock.\n");
|
||||
@ -1567,6 +1556,7 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
image_texture_free(&image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1786,16 +1776,11 @@ static const video_poke_interface_t wiiu_poke_interface = {
|
||||
static void wiiu_gfx_get_poke_interface(void *data,
|
||||
const video_poke_interface_t **iface)
|
||||
{
|
||||
(void)data;
|
||||
*iface = &wiiu_poke_interface;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
static bool wiiu_gfx_widgets_enabled(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
static bool wiiu_gfx_widgets_enabled(void *data) { return true; }
|
||||
#endif
|
||||
|
||||
video_driver_t video_wiiu =
|
||||
|
@ -137,9 +137,7 @@ static u32 __VISendI2CData(u8 addr,void *val,u32 len)
|
||||
__viSetSDA(i2cIdentFlag);
|
||||
udelay(4);
|
||||
|
||||
ret = __sendSlaveAddress(addr);
|
||||
|
||||
if(ret == 0)
|
||||
if ((ret = __sendSlaveAddress(addr)) == 0)
|
||||
{
|
||||
_CPU_ISR_Restore(level);
|
||||
return 0;
|
||||
@ -407,7 +405,8 @@ static const u8 gamma_coeffs[][33] =
|
||||
|
||||
void VIDEO_SetGamma(int gamma)
|
||||
{
|
||||
u8 *data;
|
||||
gamma = MAX(0,MIN(30,gamma));
|
||||
u8 *data = (u8 *)&gamma_coeffs[gamma][0];
|
||||
data = (u8 *)&gamma_coeffs[gamma][0];
|
||||
__VIWriteI2CRegisterBuf(0x10, 0x21, data);
|
||||
}
|
||||
|
@ -176,8 +176,8 @@ static bool switch_frame(void *data, const void *frame,
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
if(sw->last_width != width ||
|
||||
sw->last_height != height)
|
||||
if ( (sw->last_width != width)
|
||||
|| (sw->last_height != height))
|
||||
{
|
||||
scaler_ctx_gen_reset(&sw->scaler);
|
||||
|
||||
|
@ -89,17 +89,13 @@ vec3 Hdr10(vec3 hdr)
|
||||
vec3 rec2020 = hdr * k709to2020;
|
||||
|
||||
if (global.expand_gamut > 0.0f)
|
||||
{
|
||||
rec2020 = hdr * kExpanded709to2020;
|
||||
}
|
||||
|
||||
vec3 linearColour = rec2020 * (global.paper_white_nits / kMaxNitsFor2084);
|
||||
hdr10 = LinearToST2084(linearColour);
|
||||
}
|
||||
else
|
||||
{
|
||||
hdr10 = hdr;
|
||||
}
|
||||
|
||||
return hdr10;
|
||||
}
|
||||
|
@ -68,21 +68,18 @@ static void *twoxsai_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -143,30 +140,22 @@ static void twoxsai_generic_destroy(void *data)
|
||||
if ((colorA == colorE && colorB == colorL) || (colorA == colorC && colorA == colorF && colorB != colorE && colorB == colorJ)) \
|
||||
product = colorA; \
|
||||
else \
|
||||
{ \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
} \
|
||||
if ((colorA == colorG && colorC == colorO) || (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM)) \
|
||||
product1 = colorA; \
|
||||
else \
|
||||
{ \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
} \
|
||||
product2 = colorA; \
|
||||
} else if (colorB == colorC && colorA != colorD) \
|
||||
{ \
|
||||
if ((colorB == colorF && colorA == colorH) || (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI)) \
|
||||
product = colorB; \
|
||||
else \
|
||||
{ \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
} \
|
||||
if ((colorC == colorH && colorA == colorF) || (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI)) \
|
||||
product1 = colorC; \
|
||||
else \
|
||||
{ \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
} \
|
||||
product2 = colorB; \
|
||||
} \
|
||||
else if (colorA == colorD && colorB == colorC) \
|
||||
@ -191,11 +180,9 @@ static void twoxsai_generic_destroy(void *data)
|
||||
else if (r < 0) \
|
||||
product2 = colorB; \
|
||||
else \
|
||||
{ \
|
||||
product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \
|
||||
@ -204,18 +191,14 @@ static void twoxsai_generic_destroy(void *data)
|
||||
else if (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI) \
|
||||
product = colorB; \
|
||||
else \
|
||||
{ \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
} \
|
||||
if (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM) \
|
||||
product1 = colorA; \
|
||||
else if (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI) \
|
||||
product1 = colorC; \
|
||||
else \
|
||||
{ \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
} \
|
||||
} \
|
||||
out[0] = colorA; \
|
||||
out[1] = product; \
|
||||
out[dst_stride] = product1; \
|
||||
@ -296,7 +279,6 @@ static void twoxsai_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *output = (uint16_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
twoxsai_generic_rgb565(width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565),
|
||||
@ -312,7 +294,6 @@ static void twoxsai_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
uint32_t *output = (uint32_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
twoxsai_generic_xrgb8888(width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888),
|
||||
@ -336,6 +317,7 @@ static void twoxsai_generic_packets(void *data,
|
||||
|
||||
unsigned y_start = (height * i) / filt->threads;
|
||||
unsigned y_end = (height * (i + 1)) / filt->threads;
|
||||
|
||||
thr->out_data = (uint8_t*)output + y_start *
|
||||
TWOXSAI_SCALE * output_stride;
|
||||
thr->in_data = (const uint8_t*)input + y_start * input_stride;
|
||||
@ -380,7 +362,6 @@ static const struct softfilter_implementation twoxsai_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &twoxsai_generic;
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ struct softfilter_thread_data
|
||||
|
||||
struct filter_data
|
||||
{
|
||||
unsigned threads;
|
||||
struct softfilter_thread_data *workers;
|
||||
unsigned in_fmt;
|
||||
struct snes_ntsc_t *ntsc;
|
||||
unsigned threads;
|
||||
unsigned in_fmt;
|
||||
int burst;
|
||||
int burst_toggle;
|
||||
};
|
||||
@ -162,18 +162,18 @@ static void *blargg_ntsc_snes_generic_create(const struct softfilter_config *con
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
blargg_ntsc_snes_initialize(filt, config, userdata);
|
||||
|
||||
@ -225,7 +225,6 @@ static void blargg_ntsc_snes_rgb565(void *data, unsigned width, unsigned height,
|
||||
first, last,
|
||||
src, src_stride,
|
||||
dst, dst_stride);
|
||||
|
||||
}
|
||||
|
||||
static void blargg_ntsc_snes_work_cb_rgb565(void *data, void *thread_data)
|
||||
@ -236,7 +235,6 @@ static void blargg_ntsc_snes_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *output = (uint16_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
blargg_ntsc_snes_rgb565(data, width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565),
|
||||
@ -249,8 +247,8 @@ static void blargg_ntsc_snes_generic_packets(void *data,
|
||||
void *output, size_t output_stride,
|
||||
const void *input, unsigned width, unsigned height, size_t input_stride)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
unsigned i;
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
for (i = 0; i < filt->threads; i++)
|
||||
{
|
||||
struct softfilter_thread_data *thr =
|
||||
@ -270,6 +268,7 @@ static void blargg_ntsc_snes_generic_packets(void *data,
|
||||
thr->first = y_start;
|
||||
thr->last = y_end == height;
|
||||
|
||||
/* TODO/FIXME - no XRGB8888 codepath? */
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[i].work = blargg_ntsc_snes_work_cb_rgb565;
|
||||
packets[i].thread_data = thr;
|
||||
@ -294,7 +293,6 @@ static const struct softfilter_implementation blargg_ntsc_snes_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &blargg_ntsc_snes_generic;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ struct softfilter_thread_data
|
||||
|
||||
struct filter_data
|
||||
{
|
||||
unsigned threads;
|
||||
struct softfilter_thread_data *workers;
|
||||
unsigned threads;
|
||||
unsigned in_fmt;
|
||||
};
|
||||
|
||||
@ -67,20 +67,16 @@ static void *darken_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = threads;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
filt->threads = threads;
|
||||
filt->in_fmt = in_fmt;
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -104,14 +100,13 @@ static void darken_destroy(void *data)
|
||||
|
||||
static void darken_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
{
|
||||
unsigned x, y;
|
||||
struct softfilter_thread_data *thr =
|
||||
(struct softfilter_thread_data*)thread_data;
|
||||
const uint32_t *input = (const uint32_t*)thr->in_data;
|
||||
uint32_t *output = (uint32_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
unsigned x, y;
|
||||
for (y = 0; y < height;
|
||||
y++, input += thr->in_pitch >> 2, output += thr->out_pitch >> 2)
|
||||
for (x = 0; x < width; x++)
|
||||
@ -120,14 +115,13 @@ static void darken_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
|
||||
static void darken_work_cb_rgb565(void *data, void *thread_data)
|
||||
{
|
||||
unsigned x, y;
|
||||
struct softfilter_thread_data *thr =
|
||||
(struct softfilter_thread_data*)thread_data;
|
||||
const uint16_t *input = (const uint16_t*)thr->in_data;
|
||||
uint16_t *output = (uint16_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
unsigned x, y;
|
||||
for (y = 0; y < height;
|
||||
y++, input += thr->in_pitch >> 1, output += thr->out_pitch >> 1)
|
||||
for (x = 0; x < width; x++)
|
||||
@ -147,6 +141,7 @@ static void darken_packets(void *data,
|
||||
(struct softfilter_thread_data*)&filt->workers[i];
|
||||
unsigned y_start = (height * i) / filt->threads;
|
||||
unsigned y_end = (height * (i + 1)) / filt->threads;
|
||||
|
||||
thr->out_data = (uint8_t*)output + y_start * output_stride;
|
||||
thr->in_data = (const uint8_t*)input + y_start * input_stride;
|
||||
thr->out_pitch = output_stride;
|
||||
@ -180,7 +175,6 @@ static const struct softfilter_implementation darken = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &darken;
|
||||
}
|
||||
|
||||
|
@ -87,9 +87,9 @@ static void dot_matrix_3x_initialize(struct filter_data *filt,
|
||||
|
||||
/* Convert to RGB565 */
|
||||
filt->grid_color.rgb565 =
|
||||
(((grid_color >> 19) & 0x1F) << 11) |
|
||||
(((grid_color >> 11) & 0x1F) << 6) |
|
||||
((grid_color >> 3) & 0x1F);
|
||||
( ((grid_color >> 19) & 0x1F) << 11)
|
||||
| (((grid_color >> 11) & 0x1F) << 6)
|
||||
| ((grid_color >> 3) & 0x1F);
|
||||
}
|
||||
|
||||
static void *dot_matrix_3x_generic_create(const struct softfilter_config *config,
|
||||
@ -103,16 +103,16 @@ static void *dot_matrix_3x_generic_create(const struct softfilter_config *config
|
||||
if (!filt)
|
||||
return NULL;
|
||||
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
/* Initialise colour lookup tables */
|
||||
dot_matrix_3x_initialize(filt, config, userdata);
|
||||
@ -131,9 +131,8 @@ static void dot_matrix_3x_generic_output(void *data,
|
||||
static void dot_matrix_3x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -327,7 +326,6 @@ static const struct softfilter_implementation dot_matrix_3x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &dot_matrix_3x_generic;
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,10 @@ struct softfilter_thread_data
|
||||
|
||||
struct filter_data
|
||||
{
|
||||
unsigned threads;
|
||||
struct softfilter_thread_data *workers;
|
||||
dot_matrix_4x_grid_color_t grid_color; /* uint32_t alignment */
|
||||
unsigned threads;
|
||||
unsigned in_fmt;
|
||||
dot_matrix_4x_grid_color_t grid_color;
|
||||
};
|
||||
|
||||
static unsigned dot_matrix_4x_generic_input_fmts(void)
|
||||
@ -87,9 +87,9 @@ static void dot_matrix_4x_initialize(struct filter_data *filt,
|
||||
|
||||
/* Convert to RGB565 */
|
||||
filt->grid_color.rgb565 =
|
||||
(((grid_color >> 19) & 0x1F) << 11) |
|
||||
(((grid_color >> 11) & 0x1F) << 6) |
|
||||
((grid_color >> 3) & 0x1F);
|
||||
(((grid_color >> 19) & 0x1F) << 11)
|
||||
| (((grid_color >> 11) & 0x1F) << 6)
|
||||
| ((grid_color >> 3) & 0x1F);
|
||||
}
|
||||
|
||||
static void *dot_matrix_4x_generic_create(const struct softfilter_config *config,
|
||||
@ -98,21 +98,18 @@ static void *dot_matrix_4x_generic_create(const struct softfilter_config *config
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
|
||||
if (!filt)
|
||||
return NULL;
|
||||
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
/* Initialise colour lookup tables */
|
||||
dot_matrix_4x_initialize(filt, config, userdata);
|
||||
@ -131,9 +128,8 @@ static void dot_matrix_4x_generic_output(void *data,
|
||||
static void dot_matrix_4x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -367,7 +363,6 @@ static const struct softfilter_implementation dot_matrix_4x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &dot_matrix_4x_generic;
|
||||
}
|
||||
|
||||
|
@ -70,20 +70,17 @@ static void *epx_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -110,25 +107,22 @@ static void epx_generic_rgb565 (unsigned width, unsigned height,
|
||||
int first, int lsat, uint16_t *src,
|
||||
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
||||
{
|
||||
uint16_t colorX, colorA, colorB, colorC, colorD;
|
||||
uint16_t *sP, *uP, *lP;
|
||||
uint32_t*dP1, *dP2;
|
||||
uint16_t colorA;
|
||||
int w;
|
||||
|
||||
for (; height; height--)
|
||||
{
|
||||
sP = (uint16_t *) src;
|
||||
uP = (uint16_t *) (src - src_stride);
|
||||
lP = (uint16_t *) (src + src_stride);
|
||||
dP1 = (uint32_t *) dst;
|
||||
dP2 = (uint32_t *) (dst + dst_stride);
|
||||
uint16_t *sP = (uint16_t *) src;
|
||||
uint16_t *uP = (uint16_t *) (src - src_stride);
|
||||
uint16_t *lP = (uint16_t *) (src + src_stride);
|
||||
uint32_t *dP1 = (uint32_t *) dst;
|
||||
uint32_t *dP2 = (uint32_t *) (dst + dst_stride);
|
||||
|
||||
/* left edge */
|
||||
|
||||
colorX = *sP;
|
||||
colorC = *++sP;
|
||||
colorB = *lP++;
|
||||
colorD = *uP++;
|
||||
uint16_t colorX = *sP;
|
||||
uint16_t colorC = *++sP;
|
||||
uint16_t colorB = *lP++;
|
||||
uint16_t colorD = *uP++;
|
||||
|
||||
if ((colorX != colorC) && (colorB != colorD))
|
||||
{
|
||||
@ -172,7 +166,6 @@ static void epx_generic_rgb565 (unsigned width, unsigned height,
|
||||
}
|
||||
|
||||
/* right edge */
|
||||
|
||||
colorA = colorX;
|
||||
colorX = colorC;
|
||||
colorB = *lP;
|
||||
@ -263,7 +256,6 @@ static const struct softfilter_implementation epx_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &epx_generic;
|
||||
}
|
||||
|
||||
|
@ -152,22 +152,19 @@ static void *gameboy3x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
|
||||
if (!filt)
|
||||
return NULL;
|
||||
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
/* Initialise colour lookup tables */
|
||||
gameboy3x_initialize(filt, config, userdata);
|
||||
|
||||
@ -185,9 +182,8 @@ static void gameboy3x_generic_output(void *data,
|
||||
static void gameboy3x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -391,7 +387,6 @@ static const struct softfilter_implementation gameboy3x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &gameboy3x_generic;
|
||||
}
|
||||
|
||||
|
@ -170,21 +170,18 @@ static void *gameboy4x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
|
||||
if (!filt)
|
||||
return NULL;
|
||||
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
/* Initialise colour lookup tables */
|
||||
gameboy4x_initialize(filt, config, userdata);
|
||||
@ -203,9 +200,8 @@ static void gameboy4x_generic_output(void *data,
|
||||
static void gameboy4x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -449,7 +445,6 @@ static const struct softfilter_implementation gameboy4x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &gameboy4x_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *grid2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void grid2x_generic_output(void *data,
|
||||
static void grid2x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -213,11 +207,10 @@ static void grid2x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = grid2x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = grid2x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -240,7 +233,6 @@ static const struct softfilter_implementation grid2x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &grid2x_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *grid3x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void grid3x_generic_output(void *data,
|
||||
static void grid3x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -229,11 +223,10 @@ static void grid3x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = grid3x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = grid3x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -256,7 +249,6 @@ static const struct softfilter_implementation grid3x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &grid3x_generic;
|
||||
}
|
||||
|
||||
|
@ -67,20 +67,18 @@ static void *lq2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -199,7 +197,6 @@ static void lq2x_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *output = (uint16_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
lq2x_generic_rgb565(width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565),
|
||||
@ -215,9 +212,6 @@ static void lq2x_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
uint32_t *output = (uint32_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
(void)data;
|
||||
|
||||
lq2x_generic_xrgb8888(width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888),
|
||||
@ -282,7 +276,6 @@ static const struct softfilter_implementation lq2x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &lq2x_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *normal2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void normal2x_generic_output(void *data,
|
||||
static void normal2x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -119,9 +113,9 @@ static void normal2x_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
uint32_t *out_ptr = output;
|
||||
for (x = 0; x < thr->width; ++x)
|
||||
{
|
||||
uint32_t row_color[2];
|
||||
uint32_t *out_line_ptr = out_ptr;
|
||||
uint32_t color = *(input + x);
|
||||
uint32_t row_color[2];
|
||||
|
||||
row_color[0] = color;
|
||||
row_color[1] = color;
|
||||
@ -155,9 +149,9 @@ static void normal2x_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *out_ptr = output;
|
||||
for (x = 0; x < thr->width; ++x)
|
||||
{
|
||||
uint16_t row_color[2];
|
||||
uint16_t *out_line_ptr = out_ptr;
|
||||
uint16_t color = *(input + x);
|
||||
uint16_t row_color[2];
|
||||
|
||||
row_color[0] = color;
|
||||
row_color[1] = color;
|
||||
@ -197,11 +191,10 @@ static void normal2x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = normal2x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = normal2x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -224,7 +217,6 @@ static const struct softfilter_implementation normal2x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &normal2x_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *normal2x_height_generic_create(const struct softfilter_config *conf
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void normal2x_height_generic_output(void *data,
|
||||
static void normal2x_height_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -181,11 +175,10 @@ static void normal2x_height_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = normal2x_height_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = normal2x_height_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -208,7 +201,6 @@ static const struct softfilter_implementation normal2x_height_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &normal2x_height_generic;
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ struct softfilter_thread_data
|
||||
|
||||
struct filter_data
|
||||
{
|
||||
unsigned threads;
|
||||
struct softfilter_thread_data *workers;
|
||||
unsigned threads;
|
||||
unsigned in_fmt;
|
||||
};
|
||||
|
||||
@ -68,22 +68,17 @@ static void *normal2x_width_generic_create(const struct softfilter_config *confi
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void normal2x_width_generic_output(void *data,
|
||||
static void normal2x_width_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -183,11 +177,10 @@ static void normal2x_width_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = normal2x_width_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = normal2x_width_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -210,7 +203,6 @@ static const struct softfilter_implementation normal2x_width_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &normal2x_width_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *normal4x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void normal4x_generic_output(void *data,
|
||||
static void normal4x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -165,9 +159,9 @@ static void normal4x_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *out_ptr = output;
|
||||
for (x = 0; x < thr->width; ++x)
|
||||
{
|
||||
uint16_t row_color[4];
|
||||
uint16_t *out_line_ptr = out_ptr;
|
||||
uint16_t color = *(input + x);
|
||||
uint16_t row_color[4];
|
||||
|
||||
row_color[0] = color;
|
||||
row_color[1] = color;
|
||||
@ -217,11 +211,10 @@ static void normal4x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = normal4x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = normal4x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -244,7 +237,6 @@ static const struct softfilter_implementation normal4x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &normal4x_generic;
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ struct softfilter_thread_data
|
||||
|
||||
struct filter_data
|
||||
{
|
||||
unsigned threads;
|
||||
struct softfilter_thread_data *workers;
|
||||
unsigned threads;
|
||||
unsigned in_fmt;
|
||||
float phosphor_bleed;
|
||||
float scale_add;
|
||||
@ -234,25 +234,18 @@ static void *phosphor2x_generic_create(const struct softfilter_config *config,
|
||||
{
|
||||
unsigned i;
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
|
||||
(void)simd;
|
||||
(void)out_fmt;
|
||||
(void)max_width;
|
||||
(void)max_height;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)
|
||||
calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
filt->phosphor_bleed = 0.78;
|
||||
filt->scale_add = 1.0;
|
||||
@ -292,7 +285,6 @@ static void phosphor2x_generic_output(void *data,
|
||||
unsigned *out_width, unsigned *out_height,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
(void)data;
|
||||
*out_width = width * PHOSPHOR2X_SCALE;
|
||||
*out_height = height * PHOSPHOR2X_SCALE;
|
||||
}
|
||||
@ -316,9 +308,6 @@ static void phosphor2x_generic_xrgb8888(void *data,
|
||||
unsigned y;
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
|
||||
(void)first;
|
||||
(void)last;
|
||||
|
||||
memset(dst, 0, height * dst_stride);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
@ -364,9 +353,6 @@ static void phosphor2x_generic_rgb565(void *data,
|
||||
unsigned y;
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
|
||||
(void)first;
|
||||
(void)last;
|
||||
|
||||
memset(dst, 0, height * dst_stride);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
@ -410,7 +396,6 @@ static void phosphor2x_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
uint32_t *output = (uint32_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
phosphor2x_generic_xrgb8888(data, width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888),
|
||||
@ -426,7 +411,6 @@ static void phosphor2x_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *output = (uint16_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
phosphor2x_generic_rgb565(data, width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565),
|
||||
@ -490,7 +474,6 @@ static const struct softfilter_implementation phosphor2x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &phosphor2x_generic;
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ struct softfilter_thread_data
|
||||
|
||||
struct filter_data
|
||||
{
|
||||
unsigned threads;
|
||||
struct softfilter_thread_data *workers;
|
||||
unsigned in_fmt;
|
||||
picoscale_functions_t functions;
|
||||
struct softfilter_thread_data *workers;
|
||||
unsigned threads;
|
||||
unsigned in_fmt;
|
||||
};
|
||||
|
||||
/*******************************************************************
|
||||
@ -391,16 +391,15 @@ static void *picoscale_256x_320x240_generic_create(const struct softfilter_confi
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
return NULL;
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
/* Assign scaling functions */
|
||||
picoscale_256x_320x240_initialize(filt, config, userdata);
|
||||
@ -514,6 +513,7 @@ static void picoscale_256x_320x240_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
/* TODO/FIXME - no XRGB8888 codepath? */
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = picoscale_256x_320x240_work_cb_rgb565;
|
||||
packets[0].thread_data = thr;
|
||||
@ -538,7 +538,6 @@ static const struct softfilter_implementation picoscale_256x_320x240_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &picoscale_256x_320x240_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *scale2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void scale2x_generic_output(void *data,
|
||||
static void scale2x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -221,11 +215,10 @@ static void scale2x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = scale2x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = scale2x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -248,7 +241,6 @@ static const struct softfilter_implementation scale2x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &scale2x_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *scanline2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void scanline2x_generic_output(void *data,
|
||||
static void scanline2x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -213,11 +207,10 @@ static void scanline2x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = scanline2x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = scanline2x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -240,7 +233,6 @@ static const struct softfilter_implementation scanline2x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &scanline2x_generic;
|
||||
}
|
||||
|
||||
|
@ -72,19 +72,16 @@ static void *supertwoxsai_generic_create(const struct softfilter_config *config,
|
||||
if (!filt)
|
||||
return NULL;
|
||||
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -269,7 +266,6 @@ static void supertwoxsai_work_cb_rgb565(void *data, void *thread_data)
|
||||
uint16_t *output = (uint16_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
supertwoxsai_generic_rgb565(width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565),
|
||||
@ -284,7 +280,6 @@ static void supertwoxsai_work_cb_xrgb8888(void *data, void *thread_data)
|
||||
uint32_t *output = (uint32_t*)thr->out_data;
|
||||
unsigned width = thr->width;
|
||||
unsigned height = thr->height;
|
||||
|
||||
supertwoxsai_generic_xrgb8888(width, height,
|
||||
thr->first, thr->last, input,
|
||||
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888),
|
||||
@ -343,7 +338,6 @@ static const struct softfilter_implementation supertwoxsai_generic = {
|
||||
|
||||
const struct softfilter_implementation *softfilter_get_implementation(softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &supertwoxsai_generic;
|
||||
}
|
||||
|
||||
|
@ -69,19 +69,15 @@ static void *supereagle_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
if (!filt)
|
||||
return NULL;
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers)
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -229,7 +225,6 @@ static void supereagle_generic_xrgb8888(unsigned width, unsigned height,
|
||||
for (finish = width; finish; finish -= 1)
|
||||
{
|
||||
supereagle_declare_variables(uint32_t, in, nextline);
|
||||
|
||||
supereagle_function(supereagle_result, supereagle_interpolate_xrgb8888, supereagle_interpolate2_xrgb8888);
|
||||
}
|
||||
|
||||
@ -253,7 +248,6 @@ static void supereagle_generic_rgb565(unsigned width, unsigned height,
|
||||
for (finish = width; finish; finish -= 1)
|
||||
{
|
||||
supereagle_declare_variables(uint16_t, in, nextline);
|
||||
|
||||
supereagle_function(supereagle_result, supereagle_interpolate_rgb565, supereagle_interpolate2_rgb565);
|
||||
}
|
||||
|
||||
@ -342,7 +336,6 @@ static const struct softfilter_implementation supereagle_generic = {
|
||||
|
||||
const struct softfilter_implementation *softfilter_get_implementation(softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &supereagle_generic;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ static void *upscale_1_5x_generic_create(const struct softfilter_config *config,
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -98,9 +93,8 @@ static void upscale_1_5x_generic_output(void *data,
|
||||
static void upscale_1_5x_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -263,11 +257,10 @@ static void upscale_1_5x_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) {
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
|
||||
packets[0].work = upscale_1_5x_work_cb_xrgb8888;
|
||||
} else if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
else if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = upscale_1_5x_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -290,7 +283,6 @@ static const struct softfilter_implementation upscale_1_5x_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &upscale_1_5x_generic;
|
||||
}
|
||||
|
||||
|
@ -333,22 +333,17 @@ static void *upscale_240x160_320x240_generic_create(const struct softfilter_conf
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Assign scaling functions */
|
||||
upscale_240x160_320x240_initialize(filt, config, userdata);
|
||||
@ -375,9 +370,8 @@ static void upscale_240x160_320x240_generic_output(void *data,
|
||||
static void upscale_240x160_320x240_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -439,9 +433,9 @@ static void upscale_240x160_320x240_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
/* TODO/FIXME - no XRGB8888 codepath? */
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = upscale_240x160_320x240_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -464,7 +458,6 @@ static const struct softfilter_implementation upscale_240x160_320x240_generic =
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &upscale_240x160_320x240_generic;
|
||||
}
|
||||
|
||||
|
@ -574,22 +574,17 @@ static void *upscale_256x_320x240_generic_create(const struct softfilter_config
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
return filt;
|
||||
}
|
||||
|
||||
@ -613,9 +608,8 @@ static void upscale_256x_320x240_generic_output(void *data,
|
||||
static void upscale_256x_320x240_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -689,9 +683,9 @@ static void upscale_256x_320x240_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
/* TODO/FIXME - no XRGB8888 codepath? */
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = upscale_256x_320x240_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -714,7 +708,6 @@ static const struct softfilter_implementation upscale_256x_320x240_generic = {
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &upscale_256x_320x240_generic;
|
||||
}
|
||||
|
||||
|
@ -89,18 +89,14 @@ void upscale_mix_240x160_to_320x240(uint16_t *dst, const uint16_t *src,
|
||||
|
||||
for (block_x = 0; block_x < 80; block_x++)
|
||||
{
|
||||
const uint16_t *block_src_ptr = block_src;
|
||||
uint16_t *block_dst_ptr = block_dst;
|
||||
|
||||
uint16_t _1, _2, _3,
|
||||
_4, _5, _6;
|
||||
|
||||
uint16_t _4, _5, _6;
|
||||
uint16_t _1_2_weight_1_3;
|
||||
uint16_t _2_3_weight_1_1;
|
||||
uint16_t _4_5_weight_1_3;
|
||||
uint16_t _5_6_weight_1_1;
|
||||
|
||||
uint16_t tmp;
|
||||
const uint16_t *block_src_ptr = block_src;
|
||||
uint16_t *block_dst_ptr = block_dst;
|
||||
|
||||
/* Horizontally:
|
||||
* Before(3):
|
||||
@ -116,9 +112,9 @@ void upscale_mix_240x160_to_320x240(uint16_t *dst, const uint16_t *src,
|
||||
*/
|
||||
|
||||
/* -- Row 1 -- */
|
||||
_1 = *(block_src_ptr );
|
||||
_2 = *(block_src_ptr + 1);
|
||||
_3 = *(block_src_ptr + 2);
|
||||
uint16_t _1 = *(block_src_ptr );
|
||||
uint16_t _2 = *(block_src_ptr + 1);
|
||||
uint16_t _3 = *(block_src_ptr + 2);
|
||||
|
||||
*(block_dst_ptr ) = _1;
|
||||
UPSCALE_240__WEIGHT_1_3(_1, _2, block_dst_ptr + 1, tmp);
|
||||
@ -277,12 +273,10 @@ void upscale_mix_240x160_to_320x240_aspect(uint16_t *dst, const uint16_t *src,
|
||||
|
||||
for (block_x = 0; block_x < 80; block_x++)
|
||||
{
|
||||
uint16_t tmp;
|
||||
const uint16_t *block_src_ptr = block_src;
|
||||
uint16_t *block_dst_ptr = block_dst;
|
||||
|
||||
uint16_t _1, _2, _3;
|
||||
uint16_t tmp;
|
||||
|
||||
/* Horizontally:
|
||||
* Before(3):
|
||||
* (a)(b)(c)
|
||||
@ -291,9 +285,9 @@ void upscale_mix_240x160_to_320x240_aspect(uint16_t *dst, const uint16_t *src,
|
||||
*/
|
||||
|
||||
/* -- Row 1 -- */
|
||||
_1 = *(block_src_ptr );
|
||||
_2 = *(block_src_ptr + 1);
|
||||
_3 = *(block_src_ptr + 2);
|
||||
uint16_t _1 = *(block_src_ptr );
|
||||
uint16_t _2 = *(block_src_ptr + 1);
|
||||
uint16_t _3 = *(block_src_ptr + 2);
|
||||
|
||||
*(block_dst_ptr ) = _1;
|
||||
UPSCALE_240__WEIGHT_1_3(_1, _2, block_dst_ptr + 1, tmp);
|
||||
@ -337,8 +331,7 @@ static void upscale_mix_240x160_320x240_initialize(struct filter_data *filt,
|
||||
filt->function.upscale_mix_240x160_320x240 = upscale_mix_240x160_to_320x240_aspect;
|
||||
|
||||
/* Read aspect ratio correction setting */
|
||||
if (config->get_int(userdata, "keep_aspect", &keep_aspect, 1) &&
|
||||
!keep_aspect)
|
||||
if (config->get_int(userdata, "keep_aspect", &keep_aspect, 1) && !keep_aspect)
|
||||
filt->function.upscale_mix_240x160_320x240 = upscale_mix_240x160_to_320x240;
|
||||
}
|
||||
|
||||
@ -348,23 +341,17 @@ static void *upscale_mix_240x160_320x240_generic_create(const struct softfilter_
|
||||
unsigned threads, softfilter_simd_mask_t simd, void *userdata)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
(void)simd;
|
||||
(void)config;
|
||||
(void)userdata;
|
||||
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return NULL;
|
||||
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
|
||||
{
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
/* Apparently the code is not thread-safe,
|
||||
* so force single threaded operation... */
|
||||
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
|
||||
filt->threads = 1;
|
||||
filt->in_fmt = in_fmt;
|
||||
if (!filt->workers) {
|
||||
free(filt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Assign scaling functions */
|
||||
upscale_mix_240x160_320x240_initialize(filt, config, userdata);
|
||||
|
||||
@ -390,9 +377,8 @@ static void upscale_mix_240x160_320x240_generic_output(void *data,
|
||||
static void upscale_mix_240x160_320x240_generic_destroy(void *data)
|
||||
{
|
||||
struct filter_data *filt = (struct filter_data*)data;
|
||||
if (!filt) {
|
||||
if (!filt)
|
||||
return;
|
||||
}
|
||||
free(filt->workers);
|
||||
free(filt);
|
||||
}
|
||||
@ -454,9 +440,9 @@ static void upscale_mix_240x160_320x240_generic_packets(void *data,
|
||||
thr->width = width;
|
||||
thr->height = height;
|
||||
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565) {
|
||||
/* TODO/FIXME - no XRGB8888 codepath? */
|
||||
if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
|
||||
packets[0].work = upscale_mix_240x160_320x240_work_cb_rgb565;
|
||||
}
|
||||
packets[0].thread_data = thr;
|
||||
}
|
||||
|
||||
@ -479,7 +465,6 @@ static const struct softfilter_implementation upscale_mix_240x160_320x240_generi
|
||||
const struct softfilter_implementation *softfilter_get_implementation(
|
||||
softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
return &upscale_mix_240x160_320x240_generic;
|
||||
}
|
||||
|
||||
|
@ -238,10 +238,7 @@ static void *hidpad_retrode_pad_init(void *device_data, int pad_index, joypad_co
|
||||
static void hidpad_retrode_pad_deinit(void *pad_data)
|
||||
{
|
||||
retrode_pad_data_t *pad = (retrode_pad_data_t *)pad_data;
|
||||
|
||||
if(!pad)
|
||||
return;
|
||||
|
||||
if (pad)
|
||||
pad->joypad = NULL;
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,6 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
|
||||
/* estamos haciendo handshake o bien se necesita iniciar un
|
||||
* nuevo handshake ya que se inserta(quita una expansion. */
|
||||
int attachment = 0;
|
||||
|
||||
if (event != WM_RPT_CTRL_STATUS)
|
||||
return 0;
|
||||
|
||||
|
@ -134,10 +134,8 @@ static int16_t hidpad_wiiugca_get_axis(void *pad_data, unsigned axis)
|
||||
|
||||
if (!pad || axis_data.axis >= 4)
|
||||
return 0;
|
||||
|
||||
if (pad->datatype == GCA_TYPE_PAD)
|
||||
return gamepad_get_axis_value(pad->analog, &axis_data);
|
||||
|
||||
return gamepad_get_axis_value(device->pad_data[0].analog, &axis_data);
|
||||
}
|
||||
|
||||
@ -295,16 +293,14 @@ static void hidpad_wiiugca_pad_deinit(void *pad_data)
|
||||
{
|
||||
gca_pad_data_t *pad = (gca_pad_data_t *)pad_data;
|
||||
|
||||
if(!pad)
|
||||
return;
|
||||
|
||||
if (pad)
|
||||
pad->joypad = NULL;
|
||||
}
|
||||
|
||||
static int8_t hidpad_wiiugca_status(void *device_data, int pad_index)
|
||||
{
|
||||
gca_device_data_t *device = (gca_device_data_t *)device_data;
|
||||
int8_t result = 0;
|
||||
gca_device_data_t *device = (gca_device_data_t *)device_data;
|
||||
|
||||
if (!device || pad_index < 0 || pad_index >= GCA_MAX_PAD)
|
||||
return 0;
|
||||
@ -321,10 +317,8 @@ static int8_t hidpad_wiiugca_status(void *device_data, int pad_index)
|
||||
static joypad_connection_t *hidpad_wiiugca_joypad(void *device_data, int pad_index)
|
||||
{
|
||||
gca_device_data_t *device = (gca_device_data_t *)device_data;
|
||||
|
||||
if (!device || pad_index < 0 || pad_index >= GCA_MAX_PAD)
|
||||
return 0;
|
||||
|
||||
return device->pad_data[pad_index].joypad;
|
||||
}
|
||||
|
||||
|
@ -1671,6 +1671,7 @@ static int16_t android_input_state(
|
||||
int val = 0;
|
||||
if (port > 0)
|
||||
break; /* TODO: implement mouse for additional ports/players */
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
||||
|
@ -80,7 +80,6 @@ static void *ps2_joypad_init(void *data)
|
||||
Port 0,3 -> Connector 7
|
||||
Port 1,3 -> Connector 8
|
||||
*/
|
||||
|
||||
if ((ret = padPortOpen(port, slot, padBuf[port][slot])) == 0)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -403,7 +403,8 @@ static const char *menu_hash_to_str_el_label_enum(enum msg_hash_enums msg)
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *msg_hash_to_str_el(enum msg_hash_enums msg) {
|
||||
const char *msg_hash_to_str_el(enum msg_hash_enums msg)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
const char *ret = menu_hash_to_str_el_label_enum(msg);
|
||||
|
||||
@ -411,7 +412,8 @@ const char *msg_hash_to_str_el(enum msg_hash_enums msg) {
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
switch (msg) {
|
||||
switch (msg)
|
||||
{
|
||||
#include "msg_hash_el.h"
|
||||
default:
|
||||
#if 0
|
||||
|
@ -2373,7 +2373,8 @@ static const char *menu_hash_to_str_pt_br_label_enum(enum msg_hash_enums msg)
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *msg_hash_to_str_pt_br(enum msg_hash_enums msg) {
|
||||
const char *msg_hash_to_str_pt_br(enum msg_hash_enums msg)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
const char *ret = menu_hash_to_str_pt_br_label_enum(msg);
|
||||
|
||||
@ -2381,7 +2382,8 @@ const char *msg_hash_to_str_pt_br(enum msg_hash_enums msg) {
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
switch (msg) {
|
||||
switch (msg)
|
||||
{
|
||||
#include "msg_hash_pt_br.h"
|
||||
default:
|
||||
#if 0
|
||||
|
@ -1911,7 +1911,8 @@ static const char *menu_hash_to_str_tr_label_enum(enum msg_hash_enums msg)
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *msg_hash_to_str_tr(enum msg_hash_enums msg) {
|
||||
const char *msg_hash_to_str_tr(enum msg_hash_enums msg)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
const char *ret = menu_hash_to_str_tr_label_enum(msg);
|
||||
|
||||
@ -1919,7 +1920,8 @@ const char *msg_hash_to_str_tr(enum msg_hash_enums msg) {
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
switch (msg) {
|
||||
switch (msg)
|
||||
{
|
||||
#include "msg_hash_tr.h"
|
||||
default:
|
||||
#if 0
|
||||
|
@ -33,13 +33,12 @@
|
||||
struct chorus_data
|
||||
{
|
||||
float old[2][CHORUS_MAX_DELAY];
|
||||
unsigned old_ptr;
|
||||
|
||||
float delay;
|
||||
float depth;
|
||||
float input_rate;
|
||||
float mix_dry;
|
||||
float mix_wet;
|
||||
unsigned old_ptr;
|
||||
unsigned lfo_ptr;
|
||||
unsigned lfo_period;
|
||||
};
|
||||
@ -151,10 +150,6 @@ static const struct dspfilter_implementation chorus_plug = {
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *
|
||||
dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &chorus_plug;
|
||||
}
|
||||
dspfilter_get_implementation(dspfilter_simd_mask_t mask) { return &chorus_plug; }
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
@ -83,7 +83,6 @@ static const struct dspfilter_implementation delta_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &delta_plug;
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,8 @@ static void *echo_init(const struct dspfilter_info *info,
|
||||
|
||||
channels = num_feedback = num_delay = MIN(num_delay, num_feedback);
|
||||
|
||||
echo_channels = (struct echo_channel*)calloc(channels,
|
||||
sizeof(*echo_channels));
|
||||
|
||||
if (!echo_channels)
|
||||
if (!(echo_channels = (struct echo_channel*)calloc(channels,
|
||||
sizeof(*echo_channels))))
|
||||
goto error;
|
||||
|
||||
echo->channels = echo_channels;
|
||||
@ -138,8 +136,7 @@ static void *echo_init(const struct dspfilter_info *info,
|
||||
if (!frames)
|
||||
goto error;
|
||||
|
||||
echo->channels[i].buffer = (float*)calloc(frames, 2 * sizeof(float));
|
||||
if (!echo->channels[i].buffer)
|
||||
if (!(echo->channels[i].buffer = (float*)calloc(frames, 2 * sizeof(float))))
|
||||
goto error;
|
||||
|
||||
echo->channels[i].frames = frames;
|
||||
@ -173,7 +170,6 @@ static const struct dspfilter_implementation echo_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &echo_plug;
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,11 @@
|
||||
struct eq_data
|
||||
{
|
||||
fft_t *fft;
|
||||
float buffer[8 * 1024];
|
||||
|
||||
float *save;
|
||||
float *block;
|
||||
fft_complex_t *filter;
|
||||
fft_complex_t *fftblock;
|
||||
float buffer[8 * 1024];
|
||||
unsigned block_size;
|
||||
unsigned block_ptr;
|
||||
};
|
||||
@ -92,7 +91,7 @@ static void eq_process(void *data, struct dspfilter_output *output,
|
||||
input_frames -= write_avail;
|
||||
eq->block_ptr += write_avail;
|
||||
|
||||
// Convolve a new block.
|
||||
/* Convolve a new block. */
|
||||
if (eq->block_ptr == eq->block_size)
|
||||
{
|
||||
unsigned i, c;
|
||||
@ -105,11 +104,11 @@ static void eq_process(void *data, struct dspfilter_output *output,
|
||||
fft_process_inverse(eq->fft, out + c, eq->fftblock, 2);
|
||||
}
|
||||
|
||||
// Overlap add method, so add in saved block now.
|
||||
/* Overlap add method, so add in saved block now. */
|
||||
for (i = 0; i < 2 * eq->block_size; i++)
|
||||
out[i] += eq->save[i];
|
||||
|
||||
// Save block for later.
|
||||
/* Save block for later. */
|
||||
memcpy(eq->save, out + 2 * eq->block_size, 2 * eq->block_size * sizeof(float));
|
||||
|
||||
out += eq->block_size * 2;
|
||||
@ -197,7 +196,6 @@ static void create_filter(struct eq_data *eq, unsigned size_log2,
|
||||
int i;
|
||||
int half_block_size = eq->block_size >> 1;
|
||||
double window_mod = 1.0 / kaiser_window_function(0.0, beta);
|
||||
|
||||
fft_t *fft = fft_new(size_log2);
|
||||
float *time_filter = (float*)calloc(eq->block_size * 2 + 1, sizeof(*time_filter));
|
||||
if (!fft || !time_filter)
|
||||
@ -261,10 +259,10 @@ end:
|
||||
static void *eq_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float *frequencies, *gain;
|
||||
unsigned num_freq, num_gain, i, size;
|
||||
int size_log2;
|
||||
float beta;
|
||||
float *frequencies, *gain;
|
||||
unsigned num_freq, num_gain, i, size;
|
||||
struct eq_gain *gains = NULL;
|
||||
char *filter_path = NULL;
|
||||
const float default_freq[] = { 0.0f, info->input_rate };
|
||||
@ -289,8 +287,7 @@ static void *eq_init(const struct dspfilter_info *info,
|
||||
|
||||
num_gain = num_freq = MIN(num_gain, num_freq);
|
||||
|
||||
gains = (struct eq_gain*)calloc(num_gain, sizeof(*gains));
|
||||
if (!gains)
|
||||
if (!(gains = (struct eq_gain*)calloc(num_gain, sizeof(*gains))))
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < num_gain; i++)
|
||||
@ -345,7 +342,6 @@ static const struct dspfilter_implementation eq_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &eq_plug;
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,6 @@ static const struct dspfilter_implementation iir_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &iir_plug;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,6 @@ static const struct dspfilter_implementation panning = {
|
||||
const struct dspfilter_implementation *
|
||||
dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &panning;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#define phaserlfoshape 4.0
|
||||
#define phaserlfoskipsamples 20
|
||||
#define PHASER_LFO_SHAPE 4.0
|
||||
#define PHASER_LFO_SKIP_SAMPLES 20
|
||||
|
||||
struct phaser_data
|
||||
{
|
||||
@ -71,10 +71,10 @@ static void phaser_process(void *data, struct dspfilter_output *output,
|
||||
for (c = 0; c < 2; c++)
|
||||
m[c] = in[c] + ph->fbout[c] * ph->fb * 0.01f;
|
||||
|
||||
if ((ph->skipcount++ % phaserlfoskipsamples) == 0)
|
||||
if ((ph->skipcount++ % PHASER_LFO_SKIP_SAMPLES) == 0)
|
||||
{
|
||||
ph->gain = 0.5 * (1.0 + cos(ph->skipcount * ph->lfoskip + ph->phase));
|
||||
ph->gain = (exp(ph->gain * phaserlfoshape) - 1.0) / (exp(phaserlfoshape) - 1);
|
||||
ph->gain = (exp(ph->gain * PHASER_LFO_SHAPE) - 1.0) / (exp(PHASER_LFO_SHAPE) - 1);
|
||||
ph->gain = 1.0 - ph->gain * ph->depth;
|
||||
}
|
||||
|
||||
@ -138,7 +138,6 @@ static const struct dspfilter_implementation phaser_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &phaser_plug;
|
||||
}
|
||||
|
||||
|
@ -226,8 +226,8 @@ struct reverb_data
|
||||
|
||||
static void reverb_free(void *data)
|
||||
{
|
||||
struct reverb_data *rev = (struct reverb_data*)data;
|
||||
unsigned i;
|
||||
struct reverb_data *rev = (struct reverb_data*)data;
|
||||
|
||||
for (i = 0; i < NUMCOMBS; i++)
|
||||
{
|
||||
|
@ -32,9 +32,9 @@
|
||||
|
||||
struct tremolo_core
|
||||
{
|
||||
float *wavetable;
|
||||
float freq;
|
||||
float depth;
|
||||
float* wavetable;
|
||||
int index;
|
||||
int maxindex;
|
||||
};
|
||||
@ -54,14 +54,15 @@ static void tremolo_free(void *data)
|
||||
|
||||
static void tremolocore_init(struct tremolo_core *core,float depth,int samplerate,float freq)
|
||||
{
|
||||
const double offset = 1. - depth / 2.;
|
||||
unsigned i;
|
||||
double env;
|
||||
unsigned i;
|
||||
const double offset = 1. - depth / 2.;
|
||||
core->index = 0;
|
||||
core->maxindex = samplerate / freq;
|
||||
core->wavetable = malloc(core->maxindex * sizeof(float));
|
||||
memset(core->wavetable, 0, core->maxindex * sizeof(float));
|
||||
for (i = 0; i < core->maxindex; i++) {
|
||||
for (i = 0; i < core->maxindex; i++)
|
||||
{
|
||||
env = freq * i / samplerate;
|
||||
env = sin((M_PI*2) * fmod(env + 0.25, 1.0));
|
||||
core->wavetable[i] = env * (1 - fabs(offset)) + offset;
|
||||
@ -88,7 +89,6 @@ static void tremolo_process(void *data, struct dspfilter_output *output,
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
out[0] = tremolocore_core(&tre->left, in[0]);
|
||||
out[1] = tremolocore_core(&tre->right, in[1]);
|
||||
}
|
||||
@ -125,7 +125,6 @@ static const struct dspfilter_implementation tremolo_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &tremolo_plug;
|
||||
}
|
||||
|
||||
|
@ -30,29 +30,28 @@
|
||||
|
||||
#define sqr(a) ((a) * (a))
|
||||
|
||||
const float BASE_DELAY_SEC = 0.002; // 2 ms
|
||||
const float VIBRATO_FREQUENCY_DEFAULT_HZ = 2;
|
||||
const float VIBRATO_FREQUENCY_MAX_HZ = 14;
|
||||
const float VIBRATO_DEPTH_DEFAULT_PERCENT = 50;
|
||||
const int add_delay = 3;
|
||||
static const float BASE_DELAY_SEC = 0.002; /* 2 ms */
|
||||
static const float VIBRATO_FREQUENCY_DEFAULT_HZ = 2;
|
||||
static const float VIBRATO_FREQUENCY_MAX_HZ = 14;
|
||||
static const float VIBRATO_DEPTH_DEFAULT_PERCENT = 50;
|
||||
static const int add_delay = 3;
|
||||
|
||||
float hermite_interp(float x, float *y)
|
||||
static float hermite_interp(float x, float *y)
|
||||
{
|
||||
float c0, c1, c2, c3;
|
||||
c0 = y[1];
|
||||
c1 = (1.0 / 2.0)*(y[2] - y[0]);
|
||||
c2 = (y[0] - (5.0 / 2.0)*y[1]) + (2.0*y[2] - (1.0 / 2.0)*y[3]);
|
||||
c3 = (1.0 / 2.0)*(y[3] - y[0]) + (3.0 / 2.0)*(y[1] - y[2]);
|
||||
float c0 = y[1];
|
||||
float c1 = (1.0f / 2.0f) * (y[2] - y[0]);
|
||||
float c2 = (y[0] - (5.0f / 2.0f) * y[1]) + (2.0f * y[2] - (1.0f / 2.0f) * y[3]);
|
||||
float c3 = (1.0f / 2.0f) * (y[3] - y[0]) + (3.0f / 2.0f) * (y[1] - y[2]);
|
||||
return ((c3 * x + c2) * x + c1) * x + c0;
|
||||
}
|
||||
|
||||
struct vibrato_core
|
||||
{
|
||||
float* buffer;
|
||||
float freq;
|
||||
float samplerate;
|
||||
int phase;
|
||||
float depth;
|
||||
float* buffer;
|
||||
int phase;
|
||||
int writeindex;
|
||||
int size;
|
||||
};
|
||||
@ -84,32 +83,35 @@ static void vibratocore_init(struct vibrato_core *core,float depth,int samplerat
|
||||
|
||||
float vibratocore_core(struct vibrato_core *core,float in)
|
||||
{
|
||||
int ipart;
|
||||
float delay, readindex, fpart, value;
|
||||
float M = core->freq / core->samplerate;
|
||||
int maxphase = core->samplerate / core->freq;
|
||||
float lfo = sin(M * 2. * M_PI * core->phase++);
|
||||
int maxdelay = BASE_DELAY_SEC * core->samplerate;
|
||||
core->phase = core->phase % maxphase;
|
||||
lfo = (lfo + 1) * 1.; // transform from [-1; 1] to [0; 1]
|
||||
int maxdelay = BASE_DELAY_SEC * core->samplerate;
|
||||
float delay = lfo * core->depth * maxdelay;
|
||||
delay = lfo * core->depth * maxdelay;
|
||||
delay += add_delay;
|
||||
float readindex = core->writeindex - 1 - delay;
|
||||
while (readindex < 0)readindex += core->size;
|
||||
while (readindex >= core->size)readindex -= core->size;
|
||||
int ipart = (int)readindex; // integer part of the delay
|
||||
float fpart = readindex - ipart; // fractional part of the delay
|
||||
float value = hermite_interp(fpart, &(core->buffer[ipart]));
|
||||
readindex = core->writeindex - 1 - delay;
|
||||
while (readindex < 0)
|
||||
readindex += core->size;
|
||||
while (readindex >= core->size)
|
||||
readindex -= core->size;
|
||||
ipart = (int)readindex; /* Integer part of the delay */
|
||||
fpart = readindex - ipart; /* fractional part of the delay */
|
||||
value = hermite_interp(fpart, &(core->buffer[ipart]));
|
||||
core->buffer[core->writeindex] = in;
|
||||
if (core->writeindex < add_delay){
|
||||
if (core->writeindex < add_delay)
|
||||
core->buffer[core->size + core->writeindex] = in;
|
||||
}
|
||||
core->writeindex++;
|
||||
if (core->writeindex == core->size) {
|
||||
if (core->writeindex == core->size)
|
||||
core->writeindex = 0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static void vibrato_process(void *data, struct dspfilter_output *output,
|
||||
static void vibrato_process(void *data,
|
||||
struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
@ -123,7 +125,6 @@ static void vibrato_process(void *data, struct dspfilter_output *output,
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
out[0] = vibratocore_core(&vib->left, in[0]);
|
||||
out[1] = vibratocore_core(&vib->right, in[1]);
|
||||
}
|
||||
@ -160,7 +161,6 @@ static const struct dspfilter_implementation vibrato_plug = {
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &vibrato_plug;
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,22 @@ static void wahwah_process(void *data, struct dspfilter_output *output,
|
||||
if ((wah->skipcount++ % WAHWAH_LFO_SKIP_SAMPLES) == 0)
|
||||
{
|
||||
float omega, sn, cs, alpha;
|
||||
float frequency = (1.0 + cos(wah->skipcount * wah->lfoskip + wah->phase)) / 2.0;
|
||||
float frequency = (1.0f + cos(wah->skipcount * wah->lfoskip + wah->phase)) / 2.0f;
|
||||
|
||||
frequency = frequency * wah->depth * (1.0 - wah->freqofs) + wah->freqofs;
|
||||
frequency = exp((frequency - 1.0) * 6.0);
|
||||
frequency = frequency * wah->depth * (1.0f - wah->freqofs) + wah->freqofs;
|
||||
frequency = exp((frequency - 1.0f) * 6.0f);
|
||||
|
||||
omega = M_PI * frequency;
|
||||
sn = sin(omega);
|
||||
cs = cos(omega);
|
||||
alpha = sn / (2.0 * wah->res);
|
||||
alpha = sn / (2.0f * wah->res);
|
||||
|
||||
wah->b0 = (1.0 - cs) / 2.0;
|
||||
wah->b1 = 1.0 - cs;
|
||||
wah->b2 = (1.0 - cs) / 2.0;
|
||||
wah->a0 = 1.0 + alpha;
|
||||
wah->a1 = -2.0 * cs;
|
||||
wah->a2 = 1.0 - alpha;
|
||||
wah->b0 = (1.0f - cs) / 2.0f;
|
||||
wah->b1 = 1.0f - cs;
|
||||
wah->b2 = (1.0f - cs) / 2.0f;
|
||||
wah->a0 = 1.0f + alpha;
|
||||
wah->a1 = -2.0f * cs;
|
||||
wah->a2 = 1.0f - alpha;
|
||||
}
|
||||
|
||||
out_l = (wah->b0 * in[0] + wah->b1 * wah->l.xn1 + wah->b2 * wah->l.xn2 - wah->a1 * wah->l.yn1 - wah->a2 * wah->l.yn2) / wah->a0;
|
||||
@ -117,8 +117,8 @@ static void *wahwah_init(const struct dspfilter_info *info,
|
||||
config->get_float(userdata, "depth", &wah->depth, 0.7f);
|
||||
config->get_float(userdata, "resonance", &wah->res, 2.5f);
|
||||
|
||||
wah->lfoskip = wah->freq * 2.0 * M_PI / info->input_rate;
|
||||
wah->phase = wah->startphase * M_PI / 180.0;
|
||||
wah->lfoskip = wah->freq * 2.0f * M_PI / info->input_rate;
|
||||
wah->phase = wah->startphase * M_PI / 180.0f;
|
||||
|
||||
return wah;
|
||||
}
|
||||
|
@ -68,24 +68,17 @@ const static unsigned char unb64[]={
|
||||
*/
|
||||
char* base64(const void* binaryData, int len, int *flen)
|
||||
{
|
||||
const unsigned char* bin = (const unsigned char*) binaryData;
|
||||
char* res;
|
||||
|
||||
int rc = 0; /* result counter */
|
||||
int byteNo; /* I need this after the loop */
|
||||
|
||||
const unsigned char* bin = (const unsigned char*) binaryData;
|
||||
int rc = 0; /* result counter */
|
||||
int modulusLen = len % 3 ;
|
||||
|
||||
/* 2 gives 1 and 1 gives 2, but 0 gives 0. */
|
||||
int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1);
|
||||
|
||||
*flen = 4*(len + pad)/3;
|
||||
res = (char*) malloc(*flen + 1); /* and one for the null */
|
||||
if (!res)
|
||||
{
|
||||
/* ERROR: base64 could not allocate enough memory. */
|
||||
if (!(res = (char*) malloc(*flen + 1))) /* and one for the NULL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (byteNo=0; byteNo <= len-3; byteNo+=3)
|
||||
{
|
||||
@ -120,15 +113,15 @@ char* base64(const void* binaryData, int len, int *flen)
|
||||
|
||||
unsigned char* unbase64(const char* ascii, int len, int *flen)
|
||||
{
|
||||
const unsigned char *safeAsciiPtr = (const unsigned char*) ascii;
|
||||
unsigned char *bin;
|
||||
int cb = 0;
|
||||
int charNo;
|
||||
unsigned char *bin;
|
||||
const unsigned char *safeAsciiPtr = (const unsigned char*) ascii;
|
||||
int cb = 0;
|
||||
int pad = 0;
|
||||
|
||||
if (len < 2) { /* 2 accesses below would be OOB. */
|
||||
if (len < 2) /* 2 accesses below would be OOB (Out Of Bounds). */
|
||||
{
|
||||
/* catch empty string, return NULL as result. */
|
||||
|
||||
/* ERROR: You passed an invalid base64 string (too short).
|
||||
* You get NULL back. */
|
||||
*flen = 0;
|
||||
@ -141,13 +134,8 @@ unsigned char* unbase64(const char* ascii, int len, int *flen)
|
||||
++pad;
|
||||
|
||||
*flen = 3*len/4 - pad;
|
||||
bin = (unsigned char*)malloc(*flen);
|
||||
|
||||
if (!bin)
|
||||
{
|
||||
/* ERROR: unbase64 could not allocate enough memory. */
|
||||
if (!(bin = (unsigned char*)malloc(*flen)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (charNo=0; charNo <= len-4-pad; charNo+=4)
|
||||
{
|
||||
|
@ -165,12 +165,12 @@ static void dump_content(RFILE *file, const void *frame,
|
||||
{
|
||||
/* BGR24 byte order input matches output. Can directly copy, but... need to make sure we pad it. */
|
||||
uint32_t zeros = 0;
|
||||
int pad = (int)(line_size-pitch);
|
||||
int padding = (int)(line_size-pitch);
|
||||
for (j = 0; j < height; j++, u.u8 += pitch)
|
||||
{
|
||||
filestream_write(file, u.u8, pitch);
|
||||
if(pad != 0)
|
||||
filestream_write(file, &zeros, pad);
|
||||
if (padding != 0)
|
||||
filestream_write(file, &zeros, padding);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -184,8 +184,7 @@ static void dump_content(RFILE *file, const void *frame,
|
||||
}
|
||||
|
||||
/* allocate line buffer, and initialize the final four bytes to zero, for deterministic padding */
|
||||
line = (uint8_t*)malloc(line_size);
|
||||
if (!line)
|
||||
if (!(line = (uint8_t*)malloc(line_size)))
|
||||
return;
|
||||
*(uint32_t*)(line + line_size - 4) = 0;
|
||||
|
||||
|
@ -66,8 +66,9 @@ static void crash(void)
|
||||
|
||||
cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
{
|
||||
size = (size + 1023) & ~1023;
|
||||
uint64_t *ptr = NULL;
|
||||
cothread_t handle = 0;
|
||||
size = (size + 1023) & ~1023;
|
||||
#if HAVE_POSIX_MEMALIGN >= 1
|
||||
if (posix_memalign(&handle, 1024, size + 512) < 0)
|
||||
return 0;
|
||||
@ -78,7 +79,7 @@ cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
if (!handle)
|
||||
return handle;
|
||||
|
||||
uint64_t *ptr = (uint64_t*)handle;
|
||||
ptr = (uint64_t*)handle;
|
||||
/* Non-volatiles. */
|
||||
ptr[0] = 0; /* x8 */
|
||||
ptr[1] = 0; /* x9 */
|
||||
|
@ -137,7 +137,6 @@ cothread_t co_active(void)
|
||||
cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
{
|
||||
cothread_t handle;
|
||||
|
||||
#ifndef CO_USE_INLINE_ASM
|
||||
if (!co_swap)
|
||||
{
|
||||
|
@ -58,8 +58,9 @@ void co_switch_arm(cothread_t handle, cothread_t current);
|
||||
|
||||
cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
{
|
||||
size = (size + 1023) & ~1023;
|
||||
uint32_t *ptr = NULL;
|
||||
cothread_t handle = 0;
|
||||
size = (size + 1023) & ~1023;
|
||||
#if defined(__APPLE__) || HAVE_POSIX_MEMALIGN >= 1
|
||||
if (posix_memalign(&handle, 1024, size + 256) < 0)
|
||||
return 0;
|
||||
@ -70,7 +71,7 @@ cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
if (!handle)
|
||||
return handle;
|
||||
|
||||
uint32_t *ptr = (uint32_t*)handle;
|
||||
ptr = (uint32_t*)handle;
|
||||
/* Non-volatiles. */
|
||||
ptr[0] = 0; /* r4 */
|
||||
ptr[1] = 0; /* r5 */
|
||||
|
@ -13,13 +13,15 @@
|
||||
extern "C"
|
||||
void *genode_alloc_secondary_stack(unsigned long stack_size)
|
||||
{
|
||||
try {
|
||||
return Genode::Thread::myself()->alloc_secondary_stack("libco", stack_size); }
|
||||
catch (...) {
|
||||
try
|
||||
{
|
||||
return Genode::Thread::myself()->alloc_secondary_stack("libco", stack_size);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Genode::error("libco: failed to allocate ", stack_size, " byte secondary stack");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
@ -286,8 +286,6 @@ static uint32_t* co_create_( unsigned size, uintptr_t entry )
|
||||
{
|
||||
uint32_t *t = (uint32_t*)malloc(size);
|
||||
|
||||
(void) entry;
|
||||
|
||||
#if LIBCO_PPCDESC
|
||||
if (t)
|
||||
{
|
||||
@ -321,8 +319,11 @@ cothread_t co_create( unsigned int size, void (*entry_)( void ) )
|
||||
if (t)
|
||||
{
|
||||
uintptr_t sp;
|
||||
int shift;
|
||||
|
||||
#if LIBCO_PPC64
|
||||
int shift = 16;
|
||||
#else
|
||||
int shift = 0;
|
||||
#endif
|
||||
/* Save current registers into new thread, so that any special ones will
|
||||
have proper values when thread is begun */
|
||||
CO_SWAP_ASM(t, t);
|
||||
@ -344,11 +345,6 @@ cothread_t co_create( unsigned int size, void (*entry_)( void ) )
|
||||
|
||||
/* If uintptr_t is 32 bits, >>32 is undefined behavior, so we do two shifts
|
||||
and don't have to care how many bits uintptr_t is. */
|
||||
#if LIBCO_PPC64
|
||||
shift = 16;
|
||||
#else
|
||||
shift = 0;
|
||||
#endif
|
||||
|
||||
/* Set up so entry will be called on next swap */
|
||||
t [8] = (uint32_t) (entry >> shift >> shift);
|
||||
@ -402,6 +398,5 @@ void co_switch(cothread_t t)
|
||||
{
|
||||
cothread_t old = co_active_handle;
|
||||
co_active_handle = t;
|
||||
|
||||
CO_SWAP_ASM(t, old);
|
||||
}
|
||||
|
@ -23,17 +23,13 @@ cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
* new threads each with their own handle, so we create them on the heap instead and delete them manually when they're
|
||||
* no longer needed in co_delete().
|
||||
*/
|
||||
cothread_t handle = malloc(sizeof(cothread_t));
|
||||
ee_thread_t thread;
|
||||
|
||||
// u8 threadStack[size/8] __attribute__ ((aligned(16)));
|
||||
int32_t new_thread_id;
|
||||
cothread_t handle = malloc(sizeof(cothread_t));
|
||||
void *threadStack = (void *)malloc(size);
|
||||
|
||||
if ( threadStack== NULL)
|
||||
{
|
||||
printf("libco: ERROR: creating threadStack\n");
|
||||
return(-1);
|
||||
}
|
||||
if (!threadStack)
|
||||
return -1;
|
||||
|
||||
thread.stack_size = size;
|
||||
thread.gp_reg = &_gp;
|
||||
@ -42,10 +38,7 @@ cothread_t co_create(unsigned int size, void (*entrypoint)(void))
|
||||
thread.option = 0;
|
||||
thread.initial_priority = 1;
|
||||
|
||||
int32_t new_thread_id = CreateThread(&thread);
|
||||
if (new_thread_id < 0)
|
||||
printf("libco: ERROR: creating thread\n");
|
||||
|
||||
new_thread_id = CreateThread(&thread);
|
||||
StartThread(new_thread_id, NULL);
|
||||
*(uint32_t *)handle = new_thread_id;
|
||||
return handle;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
typedef void (*entrypoint_t)(void);
|
||||
|
||||
cothread_t co_active()
|
||||
cothread_t co_active(void)
|
||||
{
|
||||
return (void *)sceKernelGetThreadId();
|
||||
}
|
||||
|
@ -45,24 +45,21 @@ extern "C" {
|
||||
if (block < 0)
|
||||
return;
|
||||
|
||||
/* get base address */
|
||||
ret = sceKernelGetMemBlockBase(block, &base);
|
||||
if (ret < 0)
|
||||
/* Get base address */
|
||||
if ((ret = sceKernelGetMemBlockBase(block, &base)) < 0)
|
||||
return;
|
||||
|
||||
/* set domain to be writable by user */
|
||||
ret = sceKernelOpenVMDomain();
|
||||
if (ret < 0)
|
||||
/* Set domain to be writable by user */
|
||||
if ((ret = sceKernelOpenVMDomain()) < 0)
|
||||
return;
|
||||
|
||||
memcpy(base, co_swap_function, sizeof co_swap_function);
|
||||
|
||||
/* set domain back to read-only */
|
||||
ret = sceKernelCloseVMDomain();
|
||||
if (ret < 0)
|
||||
/* Set domain back to read-only */
|
||||
if ((ret = sceKernelCloseVMDomain()) < 0)
|
||||
return;
|
||||
|
||||
/* flush icache */
|
||||
/* Flush icache */
|
||||
ret = sceKernelSyncVMDomain(block, base,
|
||||
MB_ALIGN(FOUR_KB_ALIGN(sizeof co_swap_function)));
|
||||
if (ret < 0)
|
||||
@ -73,7 +70,8 @@ extern "C" {
|
||||
|
||||
cothread_t co_active(void)
|
||||
{
|
||||
if (!co_active_handle) co_active_handle = &co_active_buffer;
|
||||
if (!co_active_handle)
|
||||
co_active_handle = &co_active_buffer;
|
||||
return co_active_handle;
|
||||
}
|
||||
|
||||
@ -82,7 +80,8 @@ extern "C" {
|
||||
unsigned long* handle = 0;
|
||||
if (!co_swap)
|
||||
co_init();
|
||||
if (!co_active_handle) co_active_handle = &co_active_buffer;
|
||||
if (!co_active_handle)
|
||||
co_active_handle = &co_active_buffer;
|
||||
size += 256;
|
||||
size &= ~15;
|
||||
|
||||
|
@ -15,18 +15,17 @@ extern "C" {
|
||||
|
||||
static thread_local cothread_t co_active_ = 0;
|
||||
|
||||
typedef struct SceFiber {
|
||||
typedef struct SceFiber
|
||||
{
|
||||
char reserved[128];
|
||||
} SceFiber __attribute__( ( aligned ( 8 ) ) ) ;
|
||||
|
||||
int32_t _sceFiberInitializeImpl(SceFiber* fiber, char* name, void* entry, uint32_t argOnInitialize, void* addrContext, int32_t sizeContext, void* params);
|
||||
|
||||
/* Forward declarations */
|
||||
int32_t _sceFiberInitializeImpl(SceFiber *fiber, char *name, void *entry, uint32_t argOnInitialize,
|
||||
void* addrContext, int32_t sizeContext, void* params);
|
||||
int32_t sceFiberFinalize(SceFiber* fiber);
|
||||
|
||||
int32_t sceFiberRun(SceFiber* fiber, uint32_t argOnRunTo, uint32_t* argOnRun);
|
||||
|
||||
int32_t sceFiberSwitch(SceFiber* fiber, uint32_t argOnRunTo, uint32_t* argOnRun);
|
||||
|
||||
int32_t sceFiberReturnToThread(uint32_t argOnReturn, uint32_t* argOnRun);
|
||||
|
||||
static void co_thunk(uint32_t argOnInitialize, uint32_t argOnRun)
|
||||
@ -46,48 +45,45 @@ cothread_t co_active(void)
|
||||
|
||||
cothread_t co_create(unsigned int heapsize, void (*coentry)(void))
|
||||
{
|
||||
SceFiber* tailFiber = malloc(sizeof(SceFiber));
|
||||
char * m_contextBuffer = malloc(sizeof(char)*heapsize);
|
||||
int ret;
|
||||
SceFiber* tail_fiber = malloc(sizeof(SceFiber));
|
||||
char * m_ctxbuf = malloc(sizeof(char)*heapsize);
|
||||
if (!co_active_)
|
||||
{
|
||||
sceSysmoduleLoadModule(SCE_SYSMODULE_FIBER);
|
||||
co_active_ = (cothread_t)1;
|
||||
}
|
||||
|
||||
//_sceFiberInitializeImpl
|
||||
int ret = _sceFiberInitializeImpl(tailFiber, "tailFiber", co_thunk, (uint32_t)coentry, (void*) m_contextBuffer, heapsize, NULL);
|
||||
if(ret==0){
|
||||
return (cothread_t)tailFiber;
|
||||
}else{
|
||||
/* _sceFiberInitializeImpl */
|
||||
if ((ret = _sceFiberInitializeImpl(
|
||||
tail_fiber, "tailFiber", co_thunk,
|
||||
(uint32_t)coentry, (void*)m_ctxbuf, heapsize, NULL)) == 0)
|
||||
return (cothread_t)tail_fiber;
|
||||
return (cothread_t)ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void co_delete(cothread_t cothread)
|
||||
{
|
||||
if(cothread == (cothread_t)1){
|
||||
return;
|
||||
}
|
||||
if (cothread != (cothread_t)1)
|
||||
sceFiberFinalize((SceFiber*)cothread);
|
||||
}
|
||||
|
||||
void co_switch(cothread_t cothread)
|
||||
{
|
||||
|
||||
uint32_t argOnReturn = 0;
|
||||
if(cothread == (cothread_t)1){
|
||||
if (cothread == (cothread_t)1)
|
||||
{
|
||||
co_active_ = cothread;
|
||||
sceFiberReturnToThread(0, NULL);
|
||||
}else{
|
||||
SceFiber* theFiber = (SceFiber*)cothread;
|
||||
if(co_active_ == (cothread_t)1){
|
||||
co_active_ = cothread;
|
||||
sceFiberRun(theFiber, 0, &argOnReturn);
|
||||
}else{
|
||||
co_active_ = cothread;
|
||||
sceFiberSwitch(theFiber, 0, &argOnReturn);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceFiber* theFiber = (SceFiber*)cothread;
|
||||
co_active_ = cothread;
|
||||
if (co_active_ == (cothread_t)1)
|
||||
sceFiberRun(theFiber, 0, &argOnReturn);
|
||||
else
|
||||
sceFiberSwitch(theFiber, 0, &argOnReturn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,19 +46,15 @@ cothread_t co_active(void)
|
||||
|
||||
cothread_t co_create(unsigned int size, void (*coentry)(void))
|
||||
{
|
||||
cothread_struct *thread;
|
||||
if (!co_running)
|
||||
co_running = &co_primary;
|
||||
|
||||
cothread_struct *thread = (cothread_struct*)malloc(sizeof(cothread_struct));
|
||||
|
||||
if(thread)
|
||||
if ((thread = (cothread_struct*)malloc(sizeof(cothread_struct))))
|
||||
{
|
||||
stack_t stack;
|
||||
stack_t old_stack;
|
||||
|
||||
struct sigaction handler = {{0}};
|
||||
struct sigaction old_handler = {{0}};
|
||||
|
||||
thread->coentry = thread->stack = 0;
|
||||
|
||||
stack.ss_flags = 0;
|
||||
@ -67,6 +63,8 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
|
||||
|
||||
if (stack.ss_sp && !sigaltstack(&stack, &old_stack))
|
||||
{
|
||||
struct sigaction old_handler = {{0}};
|
||||
struct sigaction handler = {{0}};
|
||||
handler.sa_handler = springboard;
|
||||
handler.sa_flags = SA_ONSTACK;
|
||||
sigemptyset(&handler.sa_mask);
|
||||
|
@ -37,11 +37,11 @@ cothread_t co_active(void)
|
||||
|
||||
cothread_t co_create(unsigned int heapsize, void (*coentry)(void))
|
||||
{
|
||||
ucontext_t *thread;
|
||||
if (!co_running)
|
||||
co_running = &co_primary;
|
||||
ucontext_t *thread = (ucontext_t*)malloc(sizeof(ucontext_t));
|
||||
|
||||
if(thread)
|
||||
if ((thread = (ucontext_t*)malloc(sizeof(ucontext_t))))
|
||||
{
|
||||
if ((!getcontext(thread) && !(thread->uc_stack.ss_sp = 0)) && (thread->uc_stack.ss_sp = malloc(heapsize)))
|
||||
{
|
||||
@ -71,7 +71,6 @@ void co_delete(cothread_t cothread)
|
||||
void co_switch(cothread_t cothread)
|
||||
{
|
||||
ucontext_t *old_thread = co_running;
|
||||
|
||||
co_running = (ucontext_t*)cothread;
|
||||
swapcontext(old_thread, co_running);
|
||||
}
|
||||
|
@ -5910,7 +5910,8 @@ static bool retroarch_parse_input_and_config(
|
||||
if (runloop_st->entry_state_slot)
|
||||
{
|
||||
input_driver_state_t *input_st = input_state_get_ptr();
|
||||
if(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_START_PLAYBACK) {
|
||||
if (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_START_PLAYBACK)
|
||||
{
|
||||
runloop_st->entry_state_slot = 0;
|
||||
RARCH_WARN("Trying to load entry state while BSV playback is active. Ignoring entry state.\n");
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ static void task_wifi_connect_handler(retro_task_t *task)
|
||||
task_set_finished(task, true);
|
||||
}
|
||||
|
||||
bool task_push_wifi_connect(retro_task_callback_t cb, void *netptr) {
|
||||
bool task_push_wifi_connect(retro_task_callback_t cb, void *netptr)
|
||||
{
|
||||
char msg[128];
|
||||
retro_task_t *task = task_init();
|
||||
wifi_network_info_t *netinfo = (wifi_network_info_t*)netptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user