Cleanups/style nits

This commit is contained in:
libretroadmin 2023-02-23 13:15:14 +01:00
parent 3f3262fba3
commit 7ebab640d7
121 changed files with 1501 additions and 1765 deletions

View File

@ -69,7 +69,7 @@ static void *alsa_qsa_init(const char *device,
goto error; goto error;
} }
if((err = snd_pcm_nonblock_mode(alsa->pcm, 1)) < 0) if ((err = snd_pcm_nonblock_mode(alsa->pcm, 1)) < 0)
{ {
RARCH_ERR("[ALSA QSA]: Can't set blocking mode: %s\n", RARCH_ERR("[ALSA QSA]: Can't set blocking mode: %s\n",
snd_strerror(err)); snd_strerror(err));
@ -313,11 +313,10 @@ static bool alsa_qsa_start(void *data, bool is_shutdown)
static void alsa_qsa_set_nonblock_state(void *data, bool state) static void alsa_qsa_set_nonblock_state(void *data, bool state)
{ {
int err;
alsa_qsa_t *alsa = (alsa_qsa_t*)data; alsa_qsa_t *alsa = (alsa_qsa_t*)data;
int err; if ((err = snd_pcm_nonblock_mode(alsa->pcm, state)) < 0)
if((err = snd_pcm_nonblock_mode(alsa->pcm, state)) < 0)
{ {
RARCH_ERR("Can't set blocking mode to %d: %s\n", state, RARCH_ERR("Can't set blocking mode to %d: %s\n", state,
snd_strerror(err)); snd_strerror(err));

View File

@ -170,14 +170,9 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
const uint16_t *src = buf; const uint16_t *src = buf;
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data; 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); ctr_csnd_audio_update_playpos(ctr);
if((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) || if ((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
(((ctr->pos - ctr->playpos ) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)) || (((ctr->pos - ctr->playpos ) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)) ||
(((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (size >> 2))) (((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (size >> 2)))
{ {

View File

@ -97,7 +97,7 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
ctr_dsp_audio_t * ctr = (ctr_dsp_audio_t*)data; ctr_dsp_audio_t * ctr = (ctr_dsp_audio_t*)data;
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel); uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);
if((((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 2)) || if ((((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 2)) ||
(((ctr->pos - sample_pos ) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 4)) || (((ctr->pos - sample_pos ) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 4)) ||
(((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (size >> 2))) (((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (size >> 2)))
{ {
@ -105,26 +105,27 @@ 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; ctr->pos = (sample_pos + (CTR_DSP_AUDIO_COUNT >> 1)) & CTR_DSP_AUDIO_COUNT_MASK;
else else
{ {
do{ do
{
svcSleepThread(100000); svcSleepThread(100000);
/* Run aptMainLoop to update APT state if DSP state /* Run aptMainLoop to update APT state if DSP state
* changed, this prevents a hang on sleep. */ * changed, this prevents a hang on sleep. */
if(!aptMainLoop()) if (!aptMainLoop())
{ {
command_event(CMD_EVENT_QUIT, NULL); command_event(CMD_EVENT_QUIT, NULL);
return true; return true;
} }
sample_pos = ndspChnGetSamplePos(ctr->channel); sample_pos = ndspChnGetSamplePos(ctr->channel);
}while (((sample_pos - (ctr->pos + (size >>2))) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1) }while ( ((sample_pos - (ctr->pos + (size >>2))) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1)
|| (((ctr->pos - (CTR_DSP_AUDIO_COUNT >> 4) - sample_pos) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1))); || (((ctr->pos - (CTR_DSP_AUDIO_COUNT >> 4) - sample_pos) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1)));
} }
} }
pos = ctr->pos << 2; pos = ctr->pos << 2;
if((pos + size) > CTR_DSP_AUDIO_SIZE) if ((pos + size) > CTR_DSP_AUDIO_SIZE)
{ {
memcpy(ctr->dsp_buf.data_pcm8 + pos, buf, memcpy(ctr->dsp_buf.data_pcm8 + pos, buf,
(CTR_DSP_AUDIO_SIZE - pos)); (CTR_DSP_AUDIO_SIZE - pos));

View File

@ -110,7 +110,7 @@ static void *ps3_audio_init(const char *device,
params.param_attrib = 0; params.param_attrib = 0;
#if 0 #if 0
#ifdef HAVE_HEADSET #ifdef HAVE_HEADSET
if(global->console.sound.mode == SOUND_MODE_HEADSET) if (global->console.sound.mode == SOUND_MODE_HEADSET)
params.param_attrib = CELL_AUDIO_PORTATTR_OUT_SECONDARY; params.param_attrib = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
#endif #endif
#endif #endif

View File

@ -166,10 +166,11 @@ static void *psp_audio_init(const char *device,
static void psp_audio_free(void *data) static void psp_audio_free(void *data)
{ {
psp_audio_t* psp = (psp_audio_t*)data; psp_audio_t* psp = (psp_audio_t*)data;
if(!psp) if (!psp)
return; return;
if(psp->running){ if (psp->running)
{
if (psp->worker_thread) if (psp->worker_thread)
{ {
psp->running = false; psp->running = false;
@ -222,7 +223,7 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
slock_unlock(psp->cond_lock); slock_unlock(psp->cond_lock);
slock_lock(psp->fifo_lock); slock_lock(psp->fifo_lock);
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE) if ((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
{ {
memcpy(psp->buffer + write_pos, buf, memcpy(psp->buffer + write_pos, buf,
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t)); (AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
@ -274,14 +275,14 @@ static bool psp_audio_start(void *data, bool is_shutdown)
{ {
psp_audio_t* psp = (psp_audio_t*)data; psp_audio_t* psp = (psp_audio_t*)data;
if(psp && psp->running) if (psp && !psp->running)
return true; {
if (!psp->worker_thread) if (!psp->worker_thread)
{ {
psp->running = true; psp->running = true;
psp->worker_thread = sthread_create(audioMainLoop, psp); psp->worker_thread = sthread_create(audioMainLoop, psp);
} }
}
return true; 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) static bool psp_audio_use_float(void *data)
{ {
(void)data;
return false; return false;
} }
@ -315,7 +315,7 @@ static size_t psp_write_avail(void *data)
static size_t psp_buffer_size(void *data) static size_t psp_buffer_size(void *data)
{ {
/* TODO */ /* TODO/FIXME - implement? */
return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/; return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/;
} }

View File

@ -1675,7 +1675,7 @@ static void decode_thread_seek(double time)
decode_last_audio_time = time; decode_last_audio_time = time;
if(avformat_seek_file(fctx, -1, INT64_MIN, seek_to, INT64_MAX, 0) < 0) if (avformat_seek_file(fctx, -1, INT64_MIN, seek_to, INT64_MAX, 0) < 0)
log_cb(RETRO_LOG_ERROR, "[FFMPEG] av_seek_frame() failed.\n"); log_cb(RETRO_LOG_ERROR, "[FFMPEG] av_seek_frame() failed.\n");
if (video_stream_index >= 0) if (video_stream_index >= 0)

View File

@ -265,7 +265,7 @@ const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8};
void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor) void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor)
{ {
u32 param[0x5]; u32 param[0x5];
if(id > 6) if (id > 6)
return; return;
param[0x0] = (alphaSources << 16) | (rgbSources); param[0x0] = (alphaSources << 16) | (rgbSources);

View File

@ -377,7 +377,7 @@ u8* gfxBottomFramebuffers[2];
void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id) void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id)
{ {
if(screen==GFX_TOP) if (screen==GFX_TOP)
{ {
u8 enable3d = 0; u8 enable3d = 0;
u8 bit5=(enable3d != 0); u8 bit5=(enable3d != 0);
@ -387,7 +387,9 @@ void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id)
enable3d ? (u32*)gfxTopRightFramebuffers[id] : (u32*)gfxTopLeftFramebuffers[id], enable3d ? (u32*)gfxTopRightFramebuffers[id] : (u32*)gfxTopLeftFramebuffers[id],
240 * 3, 240 * 3,
((1)<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES); ((1)<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES);
} else { }
else
{
gspPresentBuffer(GFX_BOTTOM, gspPresentBuffer(GFX_BOTTOM,
id, id,
(u32*)gfxBottomFramebuffers[id], (u32*)gfxBottomFramebuffers[id],

View File

@ -123,19 +123,17 @@ static void CFSearchPathForDirectoriesInDomains(
#else #else
NSSearchPathDirectory dir = NSDocumentDirectory; NSSearchPathDirectory dir = NSDocumentDirectory;
#endif #endif
CFStringRef array_val;
#if __has_feature(objc_arc) #if __has_feature(objc_arc)
array_val = (__bridge CFStringRef)[ CFStringRef array_val = (__bridge CFStringRef)[
NSSearchPathForDirectoriesInDomains(dir, NSSearchPathForDirectoriesInDomains(dir,
NSUserDomainMask, YES) firstObject]; NSUserDomainMask, YES) firstObject];
#else #else
NSArray *arr = NSSearchPathForDirectoriesInDomains(dir, CFStringRef array_val = nil;
NSArray *arr =
NSSearchPathForDirectoriesInDomains(dir,
NSUserDomainMask, YES); NSUserDomainMask, YES);
if ([arr count] == 0) { if ([arr count] != 0)
array_val = nil;
} else{
array_val = (CFStringRef)[arr objectAtIndex:0]; array_val = (CFStringRef)[arr objectAtIndex:0];
}
#endif #endif
if (array_val) if (array_val)
CFStringGetCString(array_val, s, len, kCFStringEncodingUTF8); 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_STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo)
#define PMGMT_GETVAL(k,v) CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v) #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. */ /* Note that AC power sources also include a
static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, * laptop battery it is charging. */
bool * charging, int *seconds, int *percent) 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. */ CFStringRef strval; /* don't CFRelease() this. */
CFBooleanRef bval; CFBooleanRef bval;
@ -183,7 +187,7 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
if (PMGMT_STRMATCH(strval, CFSTR(kIOPSACPowerValue))) if (PMGMT_STRMATCH(strval, CFSTR(kIOPSACPowerValue)))
is_ac = *have_ac = true; is_ac = *have_ac = true;
else if (!PMGMT_STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue))) else if (!PMGMT_STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue)))
return; /* not a battery? */ return; /* Not a battery? */
if ((PMGMT_GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue)) if ((PMGMT_GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue))
charge = true; charge = true;
@ -195,7 +199,7 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
if (val > 0) if (val > 0)
{ {
*have_battery = true; *have_battery = true;
maxpct = (int) val; maxpct = (int)val;
} }
} }
@ -206,7 +210,7 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
if (val > 0) if (val > 0)
{ {
*have_battery = true; *have_battery = true;
maxpct = (int) val; maxpct = (int)val;
} }
} }
@ -216,10 +220,10 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
CFNumberGetValue(numval, kCFNumberSInt32Type, &val); CFNumberGetValue(numval, kCFNumberSInt32Type, &val);
/* Mac OS X reports 0 minutes until empty if you're plugged in. :( */ /* 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? */ val = -1; /* !!! FIXME: calc from timeToFull and capacity? */
secs = (int) val; secs = (int)val;
if (secs > 0) if (secs > 0)
secs *= 60; /* value is in minutes, so convert to seconds. */ secs *= 60; /* value is in minutes, so convert to seconds. */
} }
@ -264,10 +268,7 @@ static void frontend_darwin_get_name(char *s, size_t len)
{ {
#if defined(IOS) #if defined(IOS)
struct utsname buffer; struct utsname buffer;
if (uname(&buffer) == 0)
if (uname(&buffer) != 0)
return;
strlcpy(s, buffer.machine, len); strlcpy(s, buffer.machine, len);
#elif defined(OSX) #elif defined(OSX)
size_t length = 0; size_t length = 0;
@ -450,14 +451,18 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
int major, minor; int major, minor;
get_ios_version(&major, &minor); get_ios_version(&major, &minor);
if (major > 8) 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 #endif
#if TARGET_OS_IOS #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 #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 #endif
if (path_is_valid(assets_zip_path)) if (path_is_valid(assets_zip_path))
@ -616,7 +621,8 @@ static int frontend_darwin_get_rating(void)
return -1; 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; enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE;
#if defined(OSX) #if defined(OSX)
@ -629,12 +635,13 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
*percent = -1; *percent = -1;
if (!blob) if (!blob)
goto end; return FRONTEND_POWERSTATE_NONE
list = IOPSCopyPowerSourcesList(blob); if (!(list = IOPSCopyPowerSourcesList(blob)))
{
if (!list) CFRelease(blob);
goto end; return FRONTEND_POWERSTATE_NONE;
}
/* don't CFRelease() the list items, or dictionaries! */ /* don't CFRelease() the list items, or dictionaries! */
have_ac = false; have_ac = false;
@ -647,7 +654,7 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i); CFTypeRef ps = (CFTypeRef)CFArrayGetValueAtIndex(list, i);
CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps); CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps);
if (dict) if (dict)
checkps(dict, &have_ac, &have_battery, &charging, darwin_check_power_source(dict, &have_ac, &have_battery, &charging,
seconds, percent); seconds, percent);
} }
@ -661,16 +668,12 @@ static enum frontend_powerstate frontend_darwin_get_powerstate(int *seconds, int
ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE;
CFRelease(list); CFRelease(list);
end:
if (blob)
CFRelease(blob); CFRelease(blob);
#elif TARGET_OS_IOS #elif TARGET_OS_IOS
float level; float level;
UIDevice *uidev = [UIDevice currentDevice]; UIDevice *uidev = [UIDevice currentDevice];
if (uidev)
if (!uidev) {
return ret;
[uidev setBatteryMonitoringEnabled:true]; [uidev setBatteryMonitoringEnabled:true];
switch (uidev.batteryState) switch (uidev.batteryState)
@ -693,6 +696,7 @@ end:
*percent = ((level < 0.0f) ? -1 : ((int)((level * 100) + 0.5f))); *percent = ((level < 0.0f) ? -1 : ((int)((level * 100) + 0.5f)));
[uidev setBatteryMonitoringEnabled:false]; [uidev setBatteryMonitoringEnabled:false];
}
#endif #endif
return ret; return ret;
} }
@ -778,26 +782,24 @@ static int frontend_darwin_parse_drive_list(void *data, bool load_content)
CFRelease(bundle_url); CFRelease(bundle_url);
#endif #endif
#endif #endif
return ret; return ret;
} }
/* TODO/FIXME - is adding iOS/tvOS support possible here? */
static uint64_t frontend_darwin_get_total_mem(void) static uint64_t frontend_darwin_get_total_mem(void)
{ {
#if defined(OSX) #if defined(OSX)
uint64_t size; uint64_t size;
int mib[2] = { CTL_HW, HW_MEMSIZE }; 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); size_t len = sizeof(size);
if (sysctl(mib, namelen, &size, &len, NULL, 0) >= 0)
if (sysctl(mib, namelen, &size, &len, NULL, 0) < 0)
return 0;
return size; return size;
#else
return 0;
#endif #endif
return 0;
} }
/* TODO/FIXME - is adding iOS/tvOS support possible here? */
static uint64_t frontend_darwin_get_free_mem(void) static uint64_t frontend_darwin_get_free_mem(void)
{ {
#if (defined(OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)) #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, KERN_SUCCESS == host_statistics64(mach_port, HOST_VM_INFO,
(host_info64_t)&vm_stats, &count)) (host_info64_t)&vm_stats, &count))
{ {
long long used_memory = (
long long used_memory = ((int64_t)vm_stats.active_count + (int64_t)vm_stats.active_count +
(int64_t)vm_stats.inactive_count + (int64_t)vm_stats.inactive_count +
(int64_t)vm_stats.wire_count) * (int64_t)page_size; (int64_t)vm_stats.wire_count) * (int64_t)page_size;
return used_memory; 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) 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; return darwin_cpu_model_name;
} }
@ -851,7 +854,8 @@ static char* accessibility_mac_language_code(const char* language)
return "Ioana"; return "Ioana";
else if (string_is_equal(language,"pt_pt")) else if (string_is_equal(language,"pt_pt"))
return "Joana"; 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"; return "Luciana";
else if (string_is_equal(language,"th")) else if (string_is_equal(language,"th"))
return "Kanya"; return "Kanya";
@ -865,7 +869,8 @@ static char* accessibility_mac_language_code(const char* language)
return "Maged"; return "Maged";
else if (string_is_equal(language,"hu")) else if (string_is_equal(language,"hu"))
return "Mariska"; 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"; return "Mei-Jia";
else if (string_is_equal(language,"el")) else if (string_is_equal(language,"el"))
return "Melina"; return "Melina";
@ -889,7 +894,6 @@ static char* accessibility_mac_language_code(const char* language)
return "Zosia"; return "Zosia";
else if (string_is_equal(language,"cs")) else if (string_is_equal(language,"cs"))
return "Zuzana"; return "Zuzana";
else
return ""; return "";
} }
@ -904,8 +908,8 @@ static bool accessibility_speak_macos(int speed,
int pid; int pid;
const char *voice = get_user_language_iso639_1(false); const char *voice = get_user_language_iso639_1(false);
char* language_speaker = accessibility_mac_language_code(voice); 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) if (speed < 1)
speed = 1; speed = 1;
else if (speed > 10) else if (speed > 10)

View File

@ -274,11 +274,10 @@ static void frontend_psp_init(void *data)
memset(&appUtilBootParam, 0, sizeof(SceAppUtilBootParam)); memset(&appUtilBootParam, 0, sizeof(SceAppUtilBootParam));
sceAppUtilInit(&appUtilParam, &appUtilBootParam); sceAppUtilInit(&appUtilParam, &appUtilBootParam);
#if defined(HAVE_VITAGLES) #if defined(HAVE_VITAGLES)
if(pibInit(PIB_SHACCCG|PIB_ENABLE_MSAA|PIB_GET_PROC_ADDR_CORE)) if (pibInit(PIB_SHACCCG|PIB_ENABLE_MSAA|PIB_GET_PROC_ADDR_CORE))
return; return;
#endif #endif
#else #else
(void)data;
/* initialize debug screen */ /* initialize debug screen */
pspDebugScreenInit(); pspDebugScreenInit();
pspDebugScreenClear(); pspDebugScreenClear();

View File

@ -163,11 +163,11 @@ enum frontend_powerstate frontend_uwp_get_powerstate(
int *seconds, int *percent) int *seconds, int *percent)
{ {
SYSTEM_POWER_STATUS status; SYSTEM_POWER_STATUS status;
enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; enum frontend_powerstate
ret = FRONTEND_POWERSTATE_NONE;
if (!GetSystemPowerStatus(&status))
return ret;
if (GetSystemPowerStatus(&status))
{
if (status.BatteryFlag == 0xFF) if (status.BatteryFlag == 0xFF)
ret = FRONTEND_POWERSTATE_NONE; ret = FRONTEND_POWERSTATE_NONE;
else if (status.BatteryFlag & (1 << 7)) else if (status.BatteryFlag & (1 << 7))
@ -186,6 +186,7 @@ enum frontend_powerstate frontend_uwp_get_powerstate(
if (*percent == 255) if (*percent == 255)
*percent = 0; *percent = 0;
#endif #endif
}
return ret; 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")) if (string_is_equal(uwp_device_family, "Windows.Desktop"))
{ {
menu_entries_append(list, menu_entries_append(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FILE_BROWSER_OPEN_UWP_PERMISSIONS), msg_hash_to_str(
msg_hash_to_str(MENU_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS), 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_ENUM_LABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS,
MENU_SETTING_ACTION, 0, 0, NULL); MENU_SETTING_ACTION, 0, 0, NULL);
} }

View File

@ -469,7 +469,8 @@ static void init_nvda(void)
/* The above code is executed on each accessibility speak event, so /* The above code is executed on each accessibility speak event, so
* we should only revert to powershell if nvda_lib wasn't loaded previously, * 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 */ * 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_NVDA;
g_plat_win32_flags |= PLAT_WIN32_FLAG_USE_POWERSHELL; g_plat_win32_flags |= PLAT_WIN32_FLAG_USE_POWERSHELL;
} }

View File

@ -582,7 +582,7 @@ void frontend_driver_attach_console(void)
For now, we do this hack, but this absolutely should be redesigned For now, we do this hack, but this absolutely should be redesigned
as soon as possible. as soon as possible.
*/ */
if( frontend_driver_st.current_frontend_ctx if ( frontend_driver_st.current_frontend_ctx
&& frontend_driver_st.current_frontend_ctx->attach_console) && frontend_driver_st.current_frontend_ctx->attach_console)
frontend_driver_st.current_frontend_ctx->attach_console(); frontend_driver_st.current_frontend_ctx->attach_console();
} }

View File

@ -167,7 +167,7 @@ d3d10_get_closest_match(D3D10Device device,
DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN}; DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN};
DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format); DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format);
if(!format) if (!format)
format = default_list; format = default_list;
while (*format != DXGI_FORMAT_UNKNOWN) while (*format != DXGI_FORMAT_UNKNOWN)

View File

@ -188,7 +188,7 @@ d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT des
DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN}; DXGI_FORMAT default_list[] = {desired_format, DXGI_FORMAT_UNKNOWN};
DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format); DXGI_FORMAT* format = dxgi_get_format_fallback_list(desired_format);
if(!format) if (!format)
format = default_list; format = default_list;
while (*format != DXGI_FORMAT_UNKNOWN) while (*format != DXGI_FORMAT_UNKNOWN)

View File

@ -57,8 +57,7 @@ bool d3d8_initialize_symbols(enum gfx_ctx_api api)
return true; return true;
#if defined(DEBUG) || defined(_DEBUG) #if defined(DEBUG) || defined(_DEBUG)
g_d3d8_dll = dylib_load("d3d8d.dll"); if (!(g_d3d8_dll = dylib_load("d3d8d.dll")))
if(!g_d3d8_dll)
#endif #endif
g_d3d8_dll = dylib_load("d3d8.dll"); g_d3d8_dll = dylib_load("d3d8.dll");

View File

@ -592,7 +592,7 @@ static void d3d9_get_video_size(d3d9_video_t *d3d,
d3d->resolution_hd_enable = false; d3d->resolution_hd_enable = false;
if(video_mode.fIsHiDef) if (video_mode.fIsHiDef)
{ {
*width = 1280; *width = 1280;
*height = 720; *height = 720;
@ -1196,17 +1196,15 @@ static void d3d9_video_texture_load_d3d(
if (!ti) if (!ti)
return; return;
if((info->type == TEXTURE_FILTER_MIPMAP_LINEAR) || if ( (info->type == TEXTURE_FILTER_MIPMAP_LINEAR)
(info->type == TEXTURE_FILTER_MIPMAP_NEAREST)) || (info->type == TEXTURE_FILTER_MIPMAP_NEAREST))
want_mipmap = true; want_mipmap = true;
tex = (LPDIRECT3DTEXTURE9)d3d9_texture_new(d3d->dev, if (!(tex = (LPDIRECT3DTEXTURE9)d3d9_texture_new(d3d->dev,
ti->width, ti->height, 0, ti->width, ti->height, 0,
usage, D3D9_ARGB8888_FORMAT, usage, D3D9_ARGB8888_FORMAT,
D3DPOOL_MANAGED, 0, 0, 0, D3DPOOL_MANAGED, 0, 0, 0,
NULL, NULL, want_mipmap); NULL, NULL, want_mipmap)))
if (!tex)
return; return;
IDirect3DTexture9_LockRect(tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK); IDirect3DTexture9_LockRect(tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);

View File

@ -734,7 +734,7 @@ void dxgi_set_hdr_metadata(
hdr10_meta_data.MaxFrameAverageLightLevel = hdr10_meta_data.MaxFrameAverageLightLevel =
(UINT16)(max_fall); (UINT16)(max_fall);
if(g_hdr10_meta_data.RedPrimary != hdr10_meta_data.RedPrimary || if (g_hdr10_meta_data.RedPrimary != hdr10_meta_data.RedPrimary ||
g_hdr10_meta_data.GreenPrimary != hdr10_meta_data.GreenPrimary || g_hdr10_meta_data.GreenPrimary != hdr10_meta_data.GreenPrimary ||
g_hdr10_meta_data.BluePrimary != hdr10_meta_data.BluePrimary || g_hdr10_meta_data.BluePrimary != hdr10_meta_data.BluePrimary ||
g_hdr10_meta_data.WhitePoint != hdr10_meta_data.WhitePoint || g_hdr10_meta_data.WhitePoint != hdr10_meta_data.WhitePoint ||

View File

@ -206,7 +206,7 @@ fragment float4 bokeh_fragment(FontFragmentIn in [[ stage_in ]],
float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0; float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0;
float2 pos = float2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz))); float2 pos = float2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz)));
float dis = length(uv - pos); float dis = length(uv - pos);
if(dis < rad) if (dis < rad)
{ {
float3 col = mix(float3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), float3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i))); float3 col = mix(float3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), float3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i)));
color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis)); color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis));
@ -230,17 +230,13 @@ float snow(float3 pos, float2 uv, float o, float atime)
float dist = d.x*d.x + d.y*d.y; float dist = d.x*d.x + d.y*d.y;
if(dist < pos.z/400.0) if (dist < pos.z/400.0)
{ {
float col = 0.0; float col = 0.0;
if(sin(a * 8.0) < 0.0) if (sin(a * 8.0) < 0.0)
{ col = 1.0;
col=1.0; if (dist < pos.z/800.0)
} col += 1.0;
if(dist < pos.z/800.0)
{
col+=1.0;
}
return col * pos.z; return col * pos.z;
} }

View File

@ -660,7 +660,7 @@ bool x11_alive(void *data)
* is a key press of the same key combination, * is a key press of the same key combination,
* then it's auto-repeat and the key wasn't * then it's auto-repeat and the key wasn't
* actually released. */ * actually released. */
if(XEventsQueued(g_x11_dpy, QueuedAfterReading)) if (XEventsQueued(g_x11_dpy, QueuedAfterReading))
{ {
XEvent next_event; XEvent next_event;
XPeekEvent(g_x11_dpy, &next_event); XPeekEvent(g_x11_dpy, &next_event);

View File

@ -573,14 +573,14 @@ static void d3d8_get_video_size(d3d8_video_t *d3d,
/* Only valid in PAL mode, not valid for HDTV modes! */ /* Only valid in PAL mode, not valid for HDTV modes! */
if(XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I) if (XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I)
{ {
/* Check for 16:9 mode (PAL REGION) */ /* Check for 16:9 mode (PAL REGION) */
if(video_mode & XC_VIDEO_FLAGS_WIDESCREEN) if (video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{ {
*width = 720; *width = 720;
/* 60 Hz, 720x480i */ /* 60 Hz, 720x480i */
if(video_mode & XC_VIDEO_FLAGS_PAL_60Hz) if (video_mode & XC_VIDEO_FLAGS_PAL_60Hz)
*height = 480; *height = 480;
else /* 50 Hz, 720x576i */ else /* 50 Hz, 720x576i */
*height = 576; *height = 576;
@ -590,7 +590,7 @@ static void d3d8_get_video_size(d3d8_video_t *d3d,
else else
{ {
/* Check for 16:9 mode (NTSC REGIONS) */ /* Check for 16:9 mode (NTSC REGIONS) */
if(video_mode & XC_VIDEO_FLAGS_WIDESCREEN) if (video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{ {
*width = 720; *width = 720;
*height = 480; *height = 480;
@ -598,23 +598,23 @@ static void d3d8_get_video_size(d3d8_video_t *d3d,
} }
} }
if(XGetAVPack() == XC_AV_PACK_HDTV) if (XGetAVPack() == XC_AV_PACK_HDTV)
{ {
if(video_mode & XC_VIDEO_FLAGS_HDTV_480p) if (video_mode & XC_VIDEO_FLAGS_HDTV_480p)
{ {
*width = 640; *width = 640;
*height = 480; *height = 480;
d3d->widescreen_mode = false; d3d->widescreen_mode = false;
d3d->resolution_hd_enable = true; d3d->resolution_hd_enable = true;
} }
else if(video_mode & XC_VIDEO_FLAGS_HDTV_720p) else if (video_mode & XC_VIDEO_FLAGS_HDTV_720p)
{ {
*width = 1280; *width = 1280;
*height = 720; *height = 720;
d3d->widescreen_mode = true; d3d->widescreen_mode = true;
d3d->resolution_hd_enable = true; d3d->resolution_hd_enable = true;
} }
else if(video_mode & XC_VIDEO_FLAGS_HDTV_1080i) else if (video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
{ {
*width = 1920; *width = 1920;
*height = 1080; *height = 1080;

View File

@ -924,12 +924,12 @@ static bool gl1_gfx_frame(void *data, const void *frame,
#ifdef VITA #ifdef VITA
glUseProgram(0); glUseProgram(0);
bool enabled = glIsEnabled(GL_DEPTH_TEST); bool enabled = glIsEnabled(GL_DEPTH_TEST);
if(enabled) if (enabled)
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
#endif #endif
menu_driver_frame(menu_is_alive, video_info); menu_driver_frame(menu_is_alive, video_info);
#ifdef VITA #ifdef VITA
if(enabled) if (enabled)
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
#endif #endif
} }

View File

@ -690,7 +690,7 @@ static void wiiu_free_shader_preset(wiiu_video_t *wiiu)
MEM2_free(wiiu->pass[i].vs_ubos[1]); MEM2_free(wiiu->pass[i].vs_ubos[1]);
MEM2_free(wiiu->pass[i].ps_ubos[0]); MEM2_free(wiiu->pass[i].ps_ubos[0]);
MEM2_free(wiiu->pass[i].ps_ubos[1]); MEM2_free(wiiu->pass[i].ps_ubos[1]);
if(wiiu->pass[i].mem1) if (wiiu->pass[i].mem1)
MEM1_free(wiiu->pass[i].texture.surface.image); MEM1_free(wiiu->pass[i].texture.surface.image);
else else
MEM2_free(wiiu->pass[i].texture.surface.image); MEM2_free(wiiu->pass[i].texture.surface.image);
@ -779,7 +779,7 @@ static bool wiiu_init_frame_textures(wiiu_video_t *wiiu, unsigned width, unsigne
{ {
for (i = 0; i < wiiu->shader_preset->passes; i++) for (i = 0; i < wiiu->shader_preset->passes; i++)
{ {
if(wiiu->pass[i].mem1) if (wiiu->pass[i].mem1)
MEM1_free(wiiu->pass[i].texture.surface.image); MEM1_free(wiiu->pass[i].texture.surface.image);
else else
MEM2_free(wiiu->pass[i].texture.surface.image); MEM2_free(wiiu->pass[i].texture.surface.image);
@ -932,17 +932,17 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
unsigned i; unsigned i;
for (i = 0; i < uniformVarCount; i++) for (i = 0; i < uniformVarCount; i++)
{ {
int k;
float *dst;
const char *id = NULL;
if (uniformVars[i].block != id) if (uniformVars[i].block != id)
continue; continue;
if (!(id = strrchr(uniformVars[i].name, '.')))
const char *id = strrchr(uniformVars[i].name, '.');
if (!id)
continue; continue;
id++; id++;
float *dst = ubo + uniformVars[i].offset; dst = ubo + uniformVars[i].offset;
if (string_is_equal(id, "OutputSize")) if (string_is_equal(id, "OutputSize"))
{ {
@ -1000,15 +1000,16 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
if (!strncmp(id, "OriginalHistorySize", if (!strncmp(id, "OriginalHistorySize",
STRLEN_CONST("OriginalHistorySize"))) STRLEN_CONST("OriginalHistorySize")))
{ {
GX2Surface *source;
unsigned index = strtoul(id + STRLEN_CONST("OriginalHistorySize"), unsigned index = strtoul(id + STRLEN_CONST("OriginalHistorySize"),
NULL, 0); NULL, 0);
if(index > pass) if (index > pass)
index = 0; index = 0;
if(index) if (index)
index = pass - 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)->x = source->width;
((GX2_vec4 *)dst)->y = source->height; ((GX2_vec4 *)dst)->y = source->height;
((GX2_vec4 *)dst)->z = 1.0f / source->width; ((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", if ((pass > 0 ) && !strncmp(id, "PassOutputSize",
STRLEN_CONST("PassOutputSize"))) STRLEN_CONST("PassOutputSize")))
{ {
GX2Surface *output;
unsigned index = strtoul(id + STRLEN_CONST("PassOutputSize"), NULL, 0); unsigned index = strtoul(id + STRLEN_CONST("PassOutputSize"), NULL, 0);
if(index > pass - 1) if (index > pass - 1)
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)->x = output->width;
((GX2_vec4 *)dst)->y = output->height; ((GX2_vec4 *)dst)->y = output->height;
((GX2_vec4 *)dst)->z = 1.0f / output->width; ((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 */ /* feedback not supported yet */
if (!strncmp(id, "PassFeedbackSize", STRLEN_CONST("PassFeedbackSize"))) if (!strncmp(id, "PassFeedbackSize", STRLEN_CONST("PassFeedbackSize")))
{ {
GX2Surface *output;
unsigned index = strtoul(id + STRLEN_CONST("PassFeedbackSize"), NULL, 0); unsigned index = strtoul(id + STRLEN_CONST("PassFeedbackSize"), NULL, 0);
if(index > wiiu->shader_preset->passes - 1) if (index > wiiu->shader_preset->passes - 1)
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)->x = output->width;
((GX2_vec4 *)dst)->y = output->height; ((GX2_vec4 *)dst)->y = output->height;
((GX2_vec4 *)dst)->z = 1.0f / output->width; ((GX2_vec4 *)dst)->z = 1.0f / output->width;
@ -1044,10 +1047,10 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
continue; 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); size_t lut_id_size = strlen(wiiu->shader_preset->lut[k].id);
if (!strncmp(id, wiiu->shader_preset->lut[k].id, lut_id_size) if ( !strncmp(id, wiiu->shader_preset->lut[k].id, lut_id_size)
&& !!strcmp(id + lut_id_size, "Size")) && !!strcmp(id + lut_id_size, "Size"))
{ {
GX2Surface *surface = &wiiu->luts[k].surface; GX2Surface *surface = &wiiu->luts[k].surface;
@ -1064,7 +1067,7 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu,
continue; 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)) 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; break;
} }
} }
} }
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_UNIFORM_BLOCK, ubo, size); 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); wiiu_gfx_update_viewport(wiiu);
GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.0f, 0.0f, 1.0f); 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); GX2SetContextState(wiiu->ctx_state);
if (frame) if (frame)
{ {
if ((width != wiiu->texture.surface.width) || if ( (width != wiiu->texture.surface.width)
(height != wiiu->texture.surface.height)) || (height != wiiu->texture.surface.height))
wiiu_init_frame_textures(wiiu, width, height); wiiu_init_frame_textures(wiiu, width, height);
wiiu->width = width; 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++) 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")) if (string_is_equal(wiiu->pass[i].gfd->ps->samplerVars[j].name, "Source"))
{ {
GX2SetPixelTexture(texture, wiiu->pass[i].gfd->ps->samplerVars[j].location); 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"))) 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); unsigned index = strtoul(wiiu->pass[i].gfd->ps->samplerVars[j].name + STRLEN_CONST("OriginalHistory"), NULL, 0);
if(index > i) if (index > i)
index = 0; index = 0;
if (index)
if(index)
index = i - 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); GX2SetPixelTexture(source, wiiu->pass[i].gfd->ps->samplerVars[j].location);
GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ? GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ?
&wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] : &wiiu->sampler_linear[wiiu->shader_preset->pass[index].wrap] :
@ -1262,7 +1265,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
if ((i > 0) && !strncmp(wiiu->pass[i].gfd->ps->samplerVars[j].name, "PassOutput", STRLEN_CONST("PassOutput"))) if ((i > 0) && !strncmp(wiiu->pass[i].gfd->ps->samplerVars[j].name, "PassOutput", STRLEN_CONST("PassOutput")))
{ {
unsigned index = strtoul(wiiu->pass[i].gfd->ps->samplerVars[j].name + STRLEN_CONST("PassOutput"), NULL, 0); unsigned index = strtoul(wiiu->pass[i].gfd->ps->samplerVars[j].name + STRLEN_CONST("PassOutput"), NULL, 0);
if(index > i - 1) if (index > i - 1)
index = i - 1; index = i - 1;
GX2SetPixelTexture(&wiiu->pass[index].texture, wiiu->pass[i].gfd->ps->samplerVars[j].location); GX2SetPixelTexture(&wiiu->pass[index].texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ? GX2SetPixelSampler(wiiu->shader_preset->pass[index].filter ?
@ -1276,7 +1279,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
if (!strncmp(wiiu->pass[i].gfd->ps->samplerVars[j].name, "PassFeedback", STRLEN_CONST("PassFeedback"))) if (!strncmp(wiiu->pass[i].gfd->ps->samplerVars[j].name, "PassFeedback", STRLEN_CONST("PassFeedback")))
{ {
unsigned index = strtoul(wiiu->pass[i].gfd->ps->samplerVars[j].name + STRLEN_CONST("PassFeedback"), NULL, 0); unsigned index = strtoul(wiiu->pass[i].gfd->ps->samplerVars[j].name + STRLEN_CONST("PassFeedback"), NULL, 0);
if(index > wiiu->shader_preset->passes - 1) if (index > wiiu->shader_preset->passes - 1)
index = wiiu->shader_preset->passes - 1; index = wiiu->shader_preset->passes - 1;
GX2SetPixelTexture(&wiiu->pass[index].texture, wiiu->pass[i].gfd->ps->samplerVars[j].location); GX2SetPixelTexture(&wiiu->pass[index].texture, wiiu->pass[i].gfd->ps->samplerVars[j].location);
@ -1287,7 +1290,7 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
continue; 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 if (wiiu->luts[k].surface.image
&& string_is_equal(wiiu->pass[i].gfd->ps->samplerVars[j].name, wiiu->shader_preset->lut[k].id)) && 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) 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 ? */ GX2SetSwapInterval(!toggle); /* do we need this ? */
} }
static bool wiiu_gfx_alive(void *data) static bool wiiu_gfx_alive(void *data) { return true; }
{ static bool wiiu_gfx_focus(void *data) { return true; }
(void)data;
return true;
}
static bool wiiu_gfx_focus(void *data)
{
(void)data;
return true;
}
static bool wiiu_gfx_suppress_screensaver(void *data, bool enable) static bool wiiu_gfx_suppress_screensaver(void *data, bool enable)
{ {
(void)data;
(void)enable;
return false; return false;
} }
@ -1471,9 +1461,8 @@ static bool wiiu_gfx_set_shader(void *data,
GX2DrawDone(); GX2DrawDone();
wiiu_free_shader_preset(wiiu); wiiu_free_shader_preset(wiiu);
if (string_is_empty(path)) if (!string_is_empty(path))
return true; {
if (type != RARCH_SHADER_SLANG) if (type != RARCH_SHADER_SLANG)
{ {
RARCH_WARN("[GX2] Only Slang shaders are supported. Falling back to stock.\n"); 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); image_texture_free(&image);
} }
} }
}
return true; return true;
} }
@ -1786,16 +1776,11 @@ static const video_poke_interface_t wiiu_poke_interface = {
static void wiiu_gfx_get_poke_interface(void *data, static void wiiu_gfx_get_poke_interface(void *data,
const video_poke_interface_t **iface) const video_poke_interface_t **iface)
{ {
(void)data;
*iface = &wiiu_poke_interface; *iface = &wiiu_poke_interface;
} }
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
static bool wiiu_gfx_widgets_enabled(void *data) static bool wiiu_gfx_widgets_enabled(void *data) { return true; }
{
(void)data;
return true;
}
#endif #endif
video_driver_t video_wiiu = video_driver_t video_wiiu =

View File

@ -118,13 +118,13 @@ static u32 __VISendI2CData(u8 addr,void *val,u32 len)
s32 i,j; s32 i,j;
u32 level,ret; u32 level,ret;
if(i2cIdentFirst==0) if (i2cIdentFirst==0)
{ {
__viOpenI2C(0); __viOpenI2C(0);
udelay(4); udelay(4);
i2cIdentFlag = 0; i2cIdentFlag = 0;
if(__viGetSDA()!=0) if (__viGetSDA()!=0)
i2cIdentFlag = 1; i2cIdentFlag = 1;
i2cIdentFirst = 1; i2cIdentFirst = 1;
} }
@ -137,9 +137,7 @@ static u32 __VISendI2CData(u8 addr,void *val,u32 len)
__viSetSDA(i2cIdentFlag); __viSetSDA(i2cIdentFlag);
udelay(4); udelay(4);
ret = __sendSlaveAddress(addr); if ((ret = __sendSlaveAddress(addr)) == 0)
if(ret == 0)
{ {
_CPU_ISR_Restore(level); _CPU_ISR_Restore(level);
return 0; return 0;
@ -151,7 +149,7 @@ static u32 __VISendI2CData(u8 addr,void *val,u32 len)
c = ((u8*)val)[i]; c = ((u8*)val)[i];
for(j=0;j<8;j++) for(j=0;j<8;j++)
{ {
if(c&0x80) if (c&0x80)
__viSetSDA(i2cIdentFlag); __viSetSDA(i2cIdentFlag);
else else
__viSetSDA(i2cIdentFlag^1); __viSetSDA(i2cIdentFlag^1);
@ -168,7 +166,7 @@ static u32 __VISendI2CData(u8 addr,void *val,u32 len)
__viSetSCL(1); __viSetSCL(1);
udelay(2); udelay(2);
if(i2cIdentFlag == 1 && __viGetSDA()!=0) if (i2cIdentFlag == 1 && __viGetSDA()!=0)
{ {
_CPU_ISR_Restore(level); _CPU_ISR_Restore(level);
return 0; return 0;
@ -407,7 +405,8 @@ static const u8 gamma_coeffs[][33] =
void VIDEO_SetGamma(int gamma) void VIDEO_SetGamma(int gamma)
{ {
u8 *data;
gamma = MAX(0,MIN(30,gamma)); gamma = MAX(0,MIN(30,gamma));
u8 *data = (u8 *)&gamma_coeffs[gamma][0]; data = (u8 *)&gamma_coeffs[gamma][0];
__VIWriteI2CRegisterBuf(0x10, 0x21, data); __VIWriteI2CRegisterBuf(0x10, 0x21, data);
} }

View File

@ -402,7 +402,7 @@ static void *psp_init(const video_info_t *video,
psp->vsync = video->vsync; psp->vsync = video->vsync;
psp->rgb32 = video->rgb32; psp->rgb32 = video->rgb32;
if(psp->rgb32) if (psp->rgb32)
{ {
u32 i; u32 i;
uint32_t* LUT_r_local = (uint32_t*)(SCEGU_VRAM_BP32_2); uint32_t* LUT_r_local = (uint32_t*)(SCEGU_VRAM_BP32_2);
@ -620,7 +620,7 @@ static bool psp_frame(void *data, const void *frame,
menu_driver_frame(menu_is_alive, video_info); menu_driver_frame(menu_is_alive, video_info);
#endif #endif
if(psp->menu.active) if (psp->menu.active)
{ {
sceGuSendList(GU_TAIL, psp->menu.dList, &(psp->menu.context_storage)); sceGuSendList(GU_TAIL, psp->menu.dList, &(psp->menu.context_storage));
sceGuSync(0, 0); sceGuSync(0, 0);
@ -646,7 +646,7 @@ static void psp_free(void *data)
{ {
psp1_video_t *psp = (psp1_video_t*)data; psp1_video_t *psp = (psp1_video_t*)data;
if(!(psp) || !(psp->main_dList)) if (!(psp) || !(psp->main_dList))
return; return;
sceDisplayWaitVblankStart(); sceDisplayWaitVblankStart();

View File

@ -777,7 +777,7 @@ static void rsx_unload_texture(void *data,
{ {
#if 0 #if 0
/* TODO fix crash on loading core */ /* TODO fix crash on loading core */
if(texture->data) if (texture->data)
rsxFree(texture->data); rsxFree(texture->data);
#endif #endif
free(texture); free(texture);
@ -1177,7 +1177,7 @@ static bool rsx_frame(void* data, const void* frame,
vp.offset[3] = 0.0f; vp.offset[3] = 0.0f;
rsxSetViewport(gcm->context, vp.x, vp.y, vp.w, vp.h, vp.min, vp.max, vp.scale, vp.offset); rsxSetViewport(gcm->context, vp.x, vp.y, vp.w, vp.h, vp.min, vp.max, vp.scale, vp.offset);
if(frame && width && height) if (frame && width && height)
{ {
gcm->tex_index = ((gcm->tex_index + 1) % RSX_MAX_TEXTURES); gcm->tex_index = ((gcm->tex_index + 1) % RSX_MAX_TEXTURES);
rsx_load_texture_data(gcm, &gcm->texture[gcm->tex_index], frame, width, height, pitch, gcm->rgb32, false, rsx_load_texture_data(gcm, &gcm->texture[gcm->tex_index], frame, width, height, pitch, gcm->rgb32, false,
@ -1324,7 +1324,7 @@ static void rsx_set_aspect_ratio(void* data, unsigned aspect_ratio_idx)
{ {
rsx_t* gcm = (rsx_t*)data; rsx_t* gcm = (rsx_t*)data;
if(!gcm) if (!gcm)
return; return;
gcm->keep_aspect = true; gcm->keep_aspect = true;

View File

@ -174,10 +174,10 @@ static bool switch_frame(void *data, const void *frame,
for (x = 0; x < 1280; x++) for (x = 0; x < 1280; x++)
sw->image[y*1280+x] = 0xFF000000; sw->image[y*1280+x] = 0xFF000000;
if(width > 0 && height > 0) if (width > 0 && height > 0)
{ {
if(sw->last_width != width || if ( (sw->last_width != width)
sw->last_height != height) || (sw->last_height != height))
{ {
scaler_ctx_gen_reset(&sw->scaler); scaler_ctx_gen_reset(&sw->scaler);
@ -193,7 +193,7 @@ static bool switch_frame(void *data, const void *frame,
sw->scaler.scaler_type = SCALER_TYPE_POINT; sw->scaler.scaler_type = SCALER_TYPE_POINT;
if(!scaler_ctx_gen_filter(&sw->scaler)) if (!scaler_ctx_gen_filter(&sw->scaler))
{ {
RARCH_ERR("failed to generate scaler for main image\n"); RARCH_ERR("failed to generate scaler for main image\n");
return false; return false;
@ -245,11 +245,11 @@ static bool switch_frame(void *data, const void *frame,
#endif #endif
r = surface_dequeue_buffer(&sw->surface, &out_buffer); r = surface_dequeue_buffer(&sw->surface, &out_buffer);
if(r != RESULT_OK) if (r != RESULT_OK)
return true; /* just skip the frame */ return true; /* just skip the frame */
r = surface_wait_buffer(&sw->surface); r = surface_wait_buffer(&sw->surface);
if(r != RESULT_OK) if (r != RESULT_OK)
return true; return true;
gfx_slow_swizzling_blit(out_buffer, sw->image, 1280, 720, 0, 0); gfx_slow_swizzling_blit(out_buffer, sw->image, 1280, 720, 0, 0);

View File

@ -171,7 +171,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
if (frame) if (frame)
{ {
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)) if (!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame))
{ {
unsigned i; unsigned i;
unsigned int stride; unsigned int stride;
@ -252,7 +252,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
menu_driver_frame(menu_is_alive, video_info); menu_driver_frame(menu_is_alive, video_info);
#endif #endif
if(vita->menu.texture) if (vita->menu.texture)
{ {
if (vita->fullscreen) if (vita->fullscreen)
vita2d_draw_texture_scale(vita->menu.texture, vita2d_draw_texture_scale(vita->menu.texture,
@ -297,7 +297,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
gfx_widgets_frame(video_info); gfx_widgets_frame(video_info);
#endif #endif
if(!string_is_empty(msg)) if (!string_is_empty(msg))
font_driver_render_msg(vita, msg, NULL, NULL); font_driver_render_msg(vita, msg, NULL, NULL);
vita2d_end_drawing(); vita2d_end_drawing();
@ -782,7 +782,7 @@ static bool vita_get_current_sw_framebuffer(void *data,
if (!vita->texture || vita->width != framebuffer->width || if (!vita->texture || vita->width != framebuffer->width ||
vita->height != framebuffer->height) vita->height != framebuffer->height)
{ {
if(vita->texture) if (vita->texture)
{ {
vita2d_wait_rendering_done(); vita2d_wait_rendering_done();
vita2d_free_texture(vita->texture); vita2d_free_texture(vita->texture);

View File

@ -24,7 +24,7 @@ vec3 InverseTonemap(vec3 sdr)
{ {
vec3 hdr; vec3 hdr;
if(global.inverse_tonemap > 0.0f) if (global.inverse_tonemap > 0.0f)
{ {
sdr = pow(abs(sdr), vec3(global.contrast / 2.2f)); /* Display Gamma - needs to be determined by calibration screen */ sdr = pow(abs(sdr), vec3(global.contrast / 2.2f)); /* Display Gamma - needs to be determined by calibration screen */
@ -83,23 +83,19 @@ vec3 Hdr10(vec3 hdr)
{ {
vec3 hdr10; vec3 hdr10;
if(global.hdr10 > 0.0f) if (global.hdr10 > 0.0f)
{ {
/* Now convert into HDR10 */ /* Now convert into HDR10 */
vec3 rec2020 = hdr * k709to2020; vec3 rec2020 = hdr * k709to2020;
if(global.expand_gamut > 0.0f) if (global.expand_gamut > 0.0f)
{
rec2020 = hdr * kExpanded709to2020; rec2020 = hdr * kExpanded709to2020;
}
vec3 linearColour = rec2020 * (global.paper_white_nits / kMaxNitsFor2084); vec3 linearColour = rec2020 * (global.paper_white_nits / kMaxNitsFor2084);
hdr10 = LinearToST2084(linearColour); hdr10 = LinearToST2084(linearColour);
} }
else else
{
hdr10 = hdr; hdr10 = hdr;
}
return hdr10; return hdr10;
} }

View File

@ -28,7 +28,7 @@ for( int i=0; i < 8; i++ )
float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0; float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0;
vec2 pos = vec2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz))); vec2 pos = vec2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz)));
float dis = length(uv - pos); float dis = length(uv - pos);
if(dis < rad) if (dis < rad)
{ {
vec3 col = mix(vec3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), vec3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i))); vec3 col = mix(vec3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), vec3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i)));
color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis)); color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis));

View File

@ -132,7 +132,7 @@ static void *gfx_ctx_qnx_init(void *video_driver)
goto error; goto error;
#endif #endif
if(!screen_win) if (!screen_win)
{ {
if (screen_create_window(&screen_win, screen_ctx)) if (screen_create_window(&screen_win, screen_ctx))
{ {
@ -308,7 +308,7 @@ static int dpi_get_density(qnx_ctx_data_t *qnx)
{ {
int screen_dpi[2]; int screen_dpi[2];
if(!qnx) if (!qnx)
return -1; return -1;
if (screen_get_display_property_iv(qnx->screen_disp, if (screen_get_display_property_iv(qnx->screen_disp,

View File

@ -216,7 +216,7 @@ static void d3d12_font_render_line(
font->atlas->dirty = false; font->atlas->dirty = false;
} }
if(font->texture.dirty) if (font->texture.dirty)
d3d12_upload_texture(d3d12->queue.cmd, &font->texture, d3d12_upload_texture(d3d12->queue.cmd, &font->texture,
d3d12); d3d12);

View File

@ -213,7 +213,7 @@ static void wiiu_font_render_line(
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.v + wiiu->vertex_cache.current, count * sizeof(wiiu->vertex_cache.v)); GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.v + wiiu->vertex_cache.current, count * sizeof(wiiu->vertex_cache.v));
if(font->atlas->dirty) if (font->atlas->dirty)
{ {
for (i = 0; (i < font->atlas->height) && (i < font->texture.surface.height); i++) for (i = 0; (i < font->atlas->height) && (i < font->texture.surface.height); i++)
memcpy(font->texture.surface.image + (i * font->texture.surface.pitch), memcpy(font->texture.surface.image + (i * font->texture.surface.pitch),

View File

@ -300,11 +300,11 @@ static bool gl_glsl_load_binary_shader(GLuint shader, char *save_path)
GLint status; GLint status;
FILE *shader_binary = fopen(save_path, "rb" ); FILE *shader_binary = fopen(save_path, "rb" );
if(shader_binary) if (shader_binary)
{ {
char *shader_data = NULL; char *shader_data = NULL;
fseek (shader_binary, 0, SEEK_END); fseek(shader_binary, 0, SEEK_END);
shader_size=ftell (shader_binary); shader_size=ftell (shader_binary);
fseek(shader_binary, 0, SEEK_SET); fseek(shader_binary, 0, SEEK_SET);
@ -414,7 +414,7 @@ static bool gl_glsl_compile_shader(glsl_shader_data_t *glsl,
gl_glsl_hash_shader(source, ARRAY_SIZE(source)); gl_glsl_hash_shader(source, ARRAY_SIZE(source));
snprintf(save_path, sizeof(save_path), snprintf(save_path, sizeof(save_path),
"/data/retroarch/temp/%lx.sb", hash); "/data/retroarch/temp/%lx.sb", hash);
if(gl_glsl_load_binary_shader(shader, save_path)) if (gl_glsl_load_binary_shader(shader, save_path))
return true; return true;
} }
#endif #endif
@ -427,7 +427,7 @@ static bool gl_glsl_compile_shader(glsl_shader_data_t *glsl,
#if 0 #if 0
#if defined(ORBIS) #if defined(ORBIS)
if(status == GL_TRUE) if (status == GL_TRUE)
gl_glsl_dump_shader(shader, save_path); gl_glsl_dump_shader(shader, save_path);
#endif #endif
#endif #endif

View File

@ -68,21 +68,18 @@ static void *twoxsai_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
(void)config;
(void)userdata;
if (!filt) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*) if (!(filt->workers = (struct softfilter_thread_data*)
calloc(threads, sizeof(struct softfilter_thread_data)); calloc(threads, sizeof(struct softfilter_thread_data))))
filt->threads = 1;
filt->in_fmt = in_fmt;
if (!filt->workers)
{ {
free(filt); free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe,
* so force single threaded operation... */
filt->threads = 1;
filt->in_fmt = in_fmt;
return filt; 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)) \ if ((colorA == colorE && colorB == colorL) || (colorA == colorC && colorA == colorF && colorB != colorE && colorB == colorJ)) \
product = colorA; \ product = colorA; \
else \ else \
{ \
product = interpolate_cb(colorA, colorB); \ product = interpolate_cb(colorA, colorB); \
} \
if ((colorA == colorG && colorC == colorO) || (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM)) \ if ((colorA == colorG && colorC == colorO) || (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM)) \
product1 = colorA; \ product1 = colorA; \
else \ else \
{ \
product1 = interpolate_cb(colorA, colorC); \ product1 = interpolate_cb(colorA, colorC); \
} \
product2 = colorA; \ product2 = colorA; \
} else if (colorB == colorC && colorA != colorD) \ } else if (colorB == colorC && colorA != colorD) \
{ \ { \
if ((colorB == colorF && colorA == colorH) || (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI)) \ if ((colorB == colorF && colorA == colorH) || (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI)) \
product = colorB; \ product = colorB; \
else \ else \
{ \
product = interpolate_cb(colorA, colorB); \ product = interpolate_cb(colorA, colorB); \
} \
if ((colorC == colorH && colorA == colorF) || (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI)) \ if ((colorC == colorH && colorA == colorF) || (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI)) \
product1 = colorC; \ product1 = colorC; \
else \ else \
{ \
product1 = interpolate_cb(colorA, colorC); \ product1 = interpolate_cb(colorA, colorC); \
} \
product2 = colorB; \ product2 = colorB; \
} \ } \
else if (colorA == colorD && colorB == colorC) \ else if (colorA == colorD && colorB == colorC) \
@ -191,11 +180,9 @@ static void twoxsai_generic_destroy(void *data)
else if (r < 0) \ else if (r < 0) \
product2 = colorB; \ product2 = colorB; \
else \ else \
{ \
product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \ product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \
} \ } \
} \ } \
} \
else \ else \
{ \ { \
product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \ 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) \ else if (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI) \
product = colorB; \ product = colorB; \
else \ else \
{ \
product = interpolate_cb(colorA, colorB); \ product = interpolate_cb(colorA, colorB); \
} \
if (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM) \ if (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM) \
product1 = colorA; \ product1 = colorA; \
else if (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI) \ else if (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI) \
product1 = colorC; \ product1 = colorC; \
else \ else \
{ \
product1 = interpolate_cb(colorA, colorC); \ product1 = interpolate_cb(colorA, colorC); \
} \ } \
} \
out[0] = colorA; \ out[0] = colorA; \
out[1] = product; \ out[1] = product; \
out[dst_stride] = product1; \ 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; uint16_t *output = (uint16_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
twoxsai_generic_rgb565(width, height, twoxsai_generic_rgb565(width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), (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; uint32_t *output = (uint32_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
twoxsai_generic_xrgb8888(width, height, twoxsai_generic_xrgb8888(width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), (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_start = (height * i) / filt->threads;
unsigned y_end = (height * (i + 1)) / filt->threads; unsigned y_end = (height * (i + 1)) / filt->threads;
thr->out_data = (uint8_t*)output + y_start * thr->out_data = (uint8_t*)output + y_start *
TWOXSAI_SCALE * output_stride; TWOXSAI_SCALE * output_stride;
thr->in_data = (const uint8_t*)input + y_start * input_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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &twoxsai_generic; return &twoxsai_generic;
} }

View File

@ -46,10 +46,10 @@ struct softfilter_thread_data
struct filter_data struct filter_data
{ {
unsigned threads;
struct softfilter_thread_data *workers; struct softfilter_thread_data *workers;
unsigned in_fmt;
struct snes_ntsc_t *ntsc; struct snes_ntsc_t *ntsc;
unsigned threads;
unsigned in_fmt;
int burst; int burst;
int burst_toggle; 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) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
if (!filt) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*) if (!(filt->workers = (struct softfilter_thread_data*)
calloc(threads, sizeof(struct softfilter_thread_data)); calloc(threads, sizeof(struct softfilter_thread_data))))
filt->threads = 1;
filt->in_fmt = in_fmt;
if (!filt->workers)
{ {
free(filt); free(filt);
return NULL; 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); blargg_ntsc_snes_initialize(filt, config, userdata);
@ -195,7 +195,7 @@ static void blargg_ntsc_snes_generic_destroy(void *data)
if (!filt) if (!filt)
return; return;
if(filt->ntsc) if (filt->ntsc)
free(filt->ntsc); free(filt->ntsc);
free(filt->workers); free(filt->workers);
@ -207,7 +207,7 @@ static void blargg_ntsc_snes_render_rgb565(void *data, int width, int height,
uint16_t *input, int pitch, uint16_t *output, int outpitch) uint16_t *input, int pitch, uint16_t *output, int outpitch)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if(width <= 256 || !hires_blit) if (width <= 256 || !hires_blit)
retroarch_snes_ntsc_blit(filt->ntsc, input, pitch, filt->burst, retroarch_snes_ntsc_blit(filt->ntsc, input, pitch, filt->burst,
width, height, output, outpitch * 2, first, last); width, height, output, outpitch * 2, first, last);
else else
@ -225,7 +225,6 @@ static void blargg_ntsc_snes_rgb565(void *data, unsigned width, unsigned height,
first, last, first, last,
src, src_stride, src, src_stride,
dst, dst_stride); dst, dst_stride);
} }
static void blargg_ntsc_snes_work_cb_rgb565(void *data, void *thread_data) 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; uint16_t *output = (uint16_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
blargg_ntsc_snes_rgb565(data, width, height, blargg_ntsc_snes_rgb565(data, width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), (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, void *output, size_t output_stride,
const void *input, unsigned width, unsigned height, size_t input_stride) const void *input, unsigned width, unsigned height, size_t input_stride)
{ {
struct filter_data *filt = (struct filter_data*)data;
unsigned i; unsigned i;
struct filter_data *filt = (struct filter_data*)data;
for (i = 0; i < filt->threads; i++) for (i = 0; i < filt->threads; i++)
{ {
struct softfilter_thread_data *thr = struct softfilter_thread_data *thr =
@ -270,6 +268,7 @@ static void blargg_ntsc_snes_generic_packets(void *data,
thr->first = y_start; thr->first = y_start;
thr->last = y_end == height; thr->last = y_end == height;
/* TODO/FIXME - no XRGB8888 codepath? */
if (filt->in_fmt == SOFTFILTER_FMT_RGB565) if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
packets[i].work = blargg_ntsc_snes_work_cb_rgb565; packets[i].work = blargg_ntsc_snes_work_cb_rgb565;
packets[i].thread_data = thr; 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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &blargg_ntsc_snes_generic; return &blargg_ntsc_snes_generic;
} }

View File

@ -40,8 +40,8 @@ struct softfilter_thread_data
struct filter_data struct filter_data
{ {
unsigned threads;
struct softfilter_thread_data *workers; struct softfilter_thread_data *workers;
unsigned threads;
unsigned in_fmt; 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) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
(void)config;
(void)userdata;
if (!filt) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*) if (!(filt->workers = (struct softfilter_thread_data*)
calloc(threads, sizeof(struct softfilter_thread_data)); calloc(threads, sizeof(struct softfilter_thread_data))))
filt->threads = threads;
filt->in_fmt = in_fmt;
if (!filt->workers)
{ {
free(filt); free(filt);
return NULL; return NULL;
} }
filt->threads = threads;
filt->in_fmt = in_fmt;
return filt; return filt;
} }
@ -104,14 +100,13 @@ static void darken_destroy(void *data)
static void darken_work_cb_xrgb8888(void *data, void *thread_data) static void darken_work_cb_xrgb8888(void *data, void *thread_data)
{ {
unsigned x, y;
struct softfilter_thread_data *thr = struct softfilter_thread_data *thr =
(struct softfilter_thread_data*)thread_data; (struct softfilter_thread_data*)thread_data;
const uint32_t *input = (const uint32_t*)thr->in_data; const uint32_t *input = (const uint32_t*)thr->in_data;
uint32_t *output = (uint32_t*)thr->out_data; uint32_t *output = (uint32_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
unsigned x, y;
for (y = 0; y < height; for (y = 0; y < height;
y++, input += thr->in_pitch >> 2, output += thr->out_pitch >> 2) y++, input += thr->in_pitch >> 2, output += thr->out_pitch >> 2)
for (x = 0; x < width; x++) 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) static void darken_work_cb_rgb565(void *data, void *thread_data)
{ {
unsigned x, y;
struct softfilter_thread_data *thr = struct softfilter_thread_data *thr =
(struct softfilter_thread_data*)thread_data; (struct softfilter_thread_data*)thread_data;
const uint16_t *input = (const uint16_t*)thr->in_data; const uint16_t *input = (const uint16_t*)thr->in_data;
uint16_t *output = (uint16_t*)thr->out_data; uint16_t *output = (uint16_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
unsigned x, y;
for (y = 0; y < height; for (y = 0; y < height;
y++, input += thr->in_pitch >> 1, output += thr->out_pitch >> 1) y++, input += thr->in_pitch >> 1, output += thr->out_pitch >> 1)
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
@ -147,6 +141,7 @@ static void darken_packets(void *data,
(struct softfilter_thread_data*)&filt->workers[i]; (struct softfilter_thread_data*)&filt->workers[i];
unsigned y_start = (height * i) / filt->threads; unsigned y_start = (height * i) / filt->threads;
unsigned y_end = (height * (i + 1)) / filt->threads; unsigned y_end = (height * (i + 1)) / filt->threads;
thr->out_data = (uint8_t*)output + y_start * output_stride; thr->out_data = (uint8_t*)output + y_start * output_stride;
thr->in_data = (const uint8_t*)input + y_start * input_stride; thr->in_data = (const uint8_t*)input + y_start * input_stride;
thr->out_pitch = output_stride; thr->out_pitch = output_stride;
@ -180,7 +175,6 @@ static const struct softfilter_implementation darken = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &darken; return &darken;
} }

View File

@ -87,9 +87,9 @@ static void dot_matrix_3x_initialize(struct filter_data *filt,
/* Convert to RGB565 */ /* Convert to RGB565 */
filt->grid_color.rgb565 = filt->grid_color.rgb565 =
(((grid_color >> 19) & 0x1F) << 11) | ( ((grid_color >> 19) & 0x1F) << 11)
(((grid_color >> 11) & 0x1F) << 6) | | (((grid_color >> 11) & 0x1F) << 6)
((grid_color >> 3) & 0x1F); | ((grid_color >> 3) & 0x1F);
} }
static void *dot_matrix_3x_generic_create(const struct softfilter_config *config, 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) if (!filt)
return NULL; return NULL;
/* Apparently the code is not thread-safe, if (!(filt->workers = (struct softfilter_thread_data*)
* so force single threaded operation... */ calloc(1, sizeof(struct softfilter_thread_data))))
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); free(filt);
return NULL; 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 */ /* Initialise colour lookup tables */
dot_matrix_3x_initialize(filt, config, userdata); 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) static void dot_matrix_3x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -327,7 +326,6 @@ static const struct softfilter_implementation dot_matrix_3x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &dot_matrix_3x_generic; return &dot_matrix_3x_generic;
} }

View File

@ -50,10 +50,10 @@ struct softfilter_thread_data
struct filter_data struct filter_data
{ {
unsigned threads;
struct softfilter_thread_data *workers; struct softfilter_thread_data *workers;
dot_matrix_4x_grid_color_t grid_color; /* uint32_t alignment */
unsigned threads;
unsigned in_fmt; unsigned in_fmt;
dot_matrix_4x_grid_color_t grid_color;
}; };
static unsigned dot_matrix_4x_generic_input_fmts(void) 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 */ /* Convert to RGB565 */
filt->grid_color.rgb565 = filt->grid_color.rgb565 =
(((grid_color >> 19) & 0x1F) << 11) | (((grid_color >> 19) & 0x1F) << 11)
(((grid_color >> 11) & 0x1F) << 6) | | (((grid_color >> 11) & 0x1F) << 6)
((grid_color >> 3) & 0x1F); | ((grid_color >> 3) & 0x1F);
} }
static void *dot_matrix_4x_generic_create(const struct softfilter_config *config, 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) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
if (!filt) if (!filt)
return NULL; return NULL;
if (!(filt->workers = (struct softfilter_thread_data*)
/* Apparently the code is not thread-safe, calloc(1, sizeof(struct softfilter_thread_data))))
* 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); free(filt);
return NULL; 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 */ /* Initialise colour lookup tables */
dot_matrix_4x_initialize(filt, config, userdata); 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) static void dot_matrix_4x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -367,7 +363,6 @@ static const struct softfilter_implementation dot_matrix_4x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &dot_matrix_4x_generic; return &dot_matrix_4x_generic;
} }

View File

@ -70,20 +70,17 @@ static void *epx_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
(void)config;
(void)userdata;
if (!filt) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*) filt->workers = (struct softfilter_thread_data*)
calloc(threads, sizeof(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)
{ {
free(filt); free(filt);
return NULL; return NULL;
} }
filt->threads = 1;
filt->in_fmt = in_fmt;
return filt; return filt;
} }
@ -110,35 +107,32 @@ static void epx_generic_rgb565 (unsigned width, unsigned height,
int first, int lsat, uint16_t *src, int first, int lsat, uint16_t *src,
unsigned src_stride, uint16_t *dst, unsigned dst_stride) unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{ {
uint16_t colorX, colorA, colorB, colorC, colorD; uint16_t colorA;
uint16_t *sP, *uP, *lP;
uint32_t*dP1, *dP2;
int w; int w;
for (; height; height--) for (; height; height--)
{ {
sP = (uint16_t *) src; uint16_t *sP = (uint16_t *) src;
uP = (uint16_t *) (src - src_stride); uint16_t *uP = (uint16_t *) (src - src_stride);
lP = (uint16_t *) (src + src_stride); uint16_t *lP = (uint16_t *) (src + src_stride);
dP1 = (uint32_t *) dst; uint32_t *dP1 = (uint32_t *) dst;
dP2 = (uint32_t *) (dst + dst_stride); uint32_t *dP2 = (uint32_t *) (dst + dst_stride);
/* left edge */ /* left edge */
uint16_t colorX = *sP;
colorX = *sP; uint16_t colorC = *++sP;
colorC = *++sP; uint16_t colorB = *lP++;
colorB = *lP++; uint16_t colorD = *uP++;
colorD = *uP++;
if ((colorX != colorC) && (colorB != colorD)) if ((colorX != colorC) && (colorB != colorD))
{ {
#ifdef MSB_FIRST #ifdef MSB_FIRST
*dP1 = (colorX << 16) + ((colorC == colorD) ? colorC : colorX); *dP1 = (colorX << 16) + ((colorC == colorD) ? colorC : colorX);
*dP2 = (colorX << 16) + ((colorB == colorC) ? colorB : colorX); *dP2 = (colorX << 16) + ((colorB == colorC) ? colorB : colorX);
#else #else
*dP1 = colorX + (((colorC == colorD) ? colorC : colorX) << 16); *dP1 = colorX + (((colorC == colorD) ? colorC : colorX) << 16);
*dP2 = colorX + (((colorB == colorC) ? colorB : colorX) << 16); *dP2 = colorX + (((colorB == colorC) ? colorB : colorX) << 16);
#endif #endif
} }
else else
*dP1 = *dP2 = (colorX << 16) + colorX; *dP1 = *dP2 = (colorX << 16) + colorX;
@ -172,7 +166,6 @@ static void epx_generic_rgb565 (unsigned width, unsigned height,
} }
/* right edge */ /* right edge */
colorA = colorX; colorA = colorX;
colorX = colorC; colorX = colorC;
colorB = *lP; colorB = *lP;
@ -263,7 +256,6 @@ static const struct softfilter_implementation epx_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &epx_generic; return &epx_generic;
} }

View File

@ -152,22 +152,19 @@ static void *gameboy3x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
if (!filt) if (!filt)
return NULL; return NULL;
if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
/* 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); free(filt);
return NULL; 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 */ /* Initialise colour lookup tables */
gameboy3x_initialize(filt, config, userdata); gameboy3x_initialize(filt, config, userdata);
@ -185,9 +182,8 @@ static void gameboy3x_generic_output(void *data,
static void gameboy3x_generic_destroy(void *data) static void gameboy3x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -391,7 +387,6 @@ static const struct softfilter_implementation gameboy3x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &gameboy3x_generic; return &gameboy3x_generic;
} }

View File

@ -170,21 +170,18 @@ static void *gameboy4x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
if (!filt) if (!filt)
return NULL; return NULL;
if (!(filt->workers = (struct softfilter_thread_data*)
/* Apparently the code is not thread-safe, calloc(1, sizeof(struct softfilter_thread_data))))
* 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); free(filt);
return NULL; 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 */ /* Initialise colour lookup tables */
gameboy4x_initialize(filt, config, userdata); gameboy4x_initialize(filt, config, userdata);
@ -203,9 +200,8 @@ static void gameboy4x_generic_output(void *data,
static void gameboy4x_generic_destroy(void *data) static void gameboy4x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -449,7 +445,6 @@ static const struct softfilter_implementation gameboy4x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &gameboy4x_generic; return &gameboy4x_generic;
} }

View File

@ -68,22 +68,17 @@ static void *grid2x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void grid2x_generic_output(void *data,
static void grid2x_generic_destroy(void *data) static void grid2x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -213,11 +207,10 @@ static void grid2x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
packets[0].work = grid2x_work_cb_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].work = grid2x_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -240,7 +233,6 @@ static const struct softfilter_implementation grid2x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &grid2x_generic; return &grid2x_generic;
} }

View File

@ -68,22 +68,17 @@ static void *grid3x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void grid3x_generic_output(void *data,
static void grid3x_generic_destroy(void *data) static void grid3x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -229,11 +223,10 @@ static void grid3x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
packets[0].work = grid3x_work_cb_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].work = grid3x_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -256,7 +249,6 @@ static const struct softfilter_implementation grid3x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &grid3x_generic; return &grid3x_generic;
} }

View File

@ -67,20 +67,18 @@ static void *lq2x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
(void)config;
(void)userdata;
if (!filt) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*) if (!(filt->workers = (struct softfilter_thread_data*)
calloc(threads, sizeof(struct softfilter_thread_data)); calloc(threads, sizeof(struct softfilter_thread_data))))
filt->threads = 1;
filt->in_fmt = in_fmt;
if (!filt->workers)
{ {
free(filt); free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe,
* so force single threaded operation... */
filt->threads = 1;
filt->in_fmt = in_fmt;
return filt; 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; uint16_t *output = (uint16_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
lq2x_generic_rgb565(width, height, lq2x_generic_rgb565(width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), (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; uint32_t *output = (uint32_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
(void)data;
lq2x_generic_xrgb8888(width, height, lq2x_generic_xrgb8888(width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), (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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &lq2x_generic; return &lq2x_generic;
} }

View File

@ -68,22 +68,17 @@ static void *normal2x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void normal2x_generic_output(void *data,
static void normal2x_generic_destroy(void *data) static void normal2x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -119,9 +113,9 @@ static void normal2x_work_cb_xrgb8888(void *data, void *thread_data)
uint32_t *out_ptr = output; uint32_t *out_ptr = output;
for (x = 0; x < thr->width; ++x) for (x = 0; x < thr->width; ++x)
{ {
uint32_t row_color[2];
uint32_t *out_line_ptr = out_ptr; uint32_t *out_line_ptr = out_ptr;
uint32_t color = *(input + x); uint32_t color = *(input + x);
uint32_t row_color[2];
row_color[0] = color; row_color[0] = color;
row_color[1] = 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; uint16_t *out_ptr = output;
for (x = 0; x < thr->width; ++x) for (x = 0; x < thr->width; ++x)
{ {
uint16_t row_color[2];
uint16_t *out_line_ptr = out_ptr; uint16_t *out_line_ptr = out_ptr;
uint16_t color = *(input + x); uint16_t color = *(input + x);
uint16_t row_color[2];
row_color[0] = color; row_color[0] = color;
row_color[1] = color; row_color[1] = color;
@ -197,11 +191,10 @@ static void normal2x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
packets[0].work = normal2x_work_cb_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].work = normal2x_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -224,7 +217,6 @@ static const struct softfilter_implementation normal2x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &normal2x_generic; return &normal2x_generic;
} }

View File

@ -68,22 +68,17 @@ static void *normal2x_height_generic_create(const struct softfilter_config *conf
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void normal2x_height_generic_output(void *data,
static void normal2x_height_generic_destroy(void *data) static void normal2x_height_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -181,11 +175,10 @@ static void normal2x_height_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; 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; 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].work = normal2x_height_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -208,7 +201,6 @@ static const struct softfilter_implementation normal2x_height_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &normal2x_height_generic; return &normal2x_height_generic;
} }

View File

@ -41,8 +41,8 @@ struct softfilter_thread_data
struct filter_data struct filter_data
{ {
unsigned threads;
struct softfilter_thread_data *workers; struct softfilter_thread_data *workers;
unsigned threads;
unsigned in_fmt; 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) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void normal2x_width_generic_output(void *data,
static void normal2x_width_generic_destroy(void *data) static void normal2x_width_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -183,11 +177,10 @@ static void normal2x_width_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; 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; 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].work = normal2x_width_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -210,7 +203,6 @@ static const struct softfilter_implementation normal2x_width_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &normal2x_width_generic; return &normal2x_width_generic;
} }

View File

@ -68,22 +68,17 @@ static void *normal4x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void normal4x_generic_output(void *data,
static void normal4x_generic_destroy(void *data) static void normal4x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -165,9 +159,9 @@ static void normal4x_work_cb_rgb565(void *data, void *thread_data)
uint16_t *out_ptr = output; uint16_t *out_ptr = output;
for (x = 0; x < thr->width; ++x) for (x = 0; x < thr->width; ++x)
{ {
uint16_t row_color[4];
uint16_t *out_line_ptr = out_ptr; uint16_t *out_line_ptr = out_ptr;
uint16_t color = *(input + x); uint16_t color = *(input + x);
uint16_t row_color[4];
row_color[0] = color; row_color[0] = color;
row_color[1] = color; row_color[1] = color;
@ -217,11 +211,10 @@ static void normal4x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
packets[0].work = normal4x_work_cb_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].work = normal4x_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -244,7 +237,6 @@ static const struct softfilter_implementation normal4x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &normal4x_generic; return &normal4x_generic;
} }

View File

@ -44,8 +44,8 @@ struct softfilter_thread_data
struct filter_data struct filter_data
{ {
unsigned threads;
struct softfilter_thread_data *workers; struct softfilter_thread_data *workers;
unsigned threads;
unsigned in_fmt; unsigned in_fmt;
float phosphor_bleed; float phosphor_bleed;
float scale_add; float scale_add;
@ -234,25 +234,18 @@ static void *phosphor2x_generic_create(const struct softfilter_config *config,
{ {
unsigned i; unsigned i;
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); 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) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*) if (!(filt->workers = (struct softfilter_thread_data*)
calloc(threads, sizeof(struct softfilter_thread_data)); calloc(threads, sizeof(struct softfilter_thread_data))))
filt->threads = 1;
filt->in_fmt = in_fmt;
if (!filt->workers)
{ {
free(filt); free(filt);
return NULL; 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->phosphor_bleed = 0.78;
filt->scale_add = 1.0; filt->scale_add = 1.0;
@ -292,7 +285,6 @@ static void phosphor2x_generic_output(void *data,
unsigned *out_width, unsigned *out_height, unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
(void)data;
*out_width = width * PHOSPHOR2X_SCALE; *out_width = width * PHOSPHOR2X_SCALE;
*out_height = height * PHOSPHOR2X_SCALE; *out_height = height * PHOSPHOR2X_SCALE;
} }
@ -316,9 +308,6 @@ static void phosphor2x_generic_xrgb8888(void *data,
unsigned y; unsigned y;
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
(void)first;
(void)last;
memset(dst, 0, height * dst_stride); memset(dst, 0, height * dst_stride);
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
@ -364,9 +353,6 @@ static void phosphor2x_generic_rgb565(void *data,
unsigned y; unsigned y;
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
(void)first;
(void)last;
memset(dst, 0, height * dst_stride); memset(dst, 0, height * dst_stride);
for (y = 0; y < height; y++) 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; uint32_t *output = (uint32_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
phosphor2x_generic_xrgb8888(data, width, height, phosphor2x_generic_xrgb8888(data, width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), (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; uint16_t *output = (uint16_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
phosphor2x_generic_rgb565(data, width, height, phosphor2x_generic_rgb565(data, width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), (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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &phosphor2x_generic; return &phosphor2x_generic;
} }

View File

@ -63,10 +63,10 @@ struct softfilter_thread_data
struct filter_data struct filter_data
{ {
unsigned threads;
struct softfilter_thread_data *workers;
unsigned in_fmt;
picoscale_functions_t functions; 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)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
if (!filt) if (!filt)
return NULL; return NULL;
/* Apparently the code is not thread-safe, if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
* 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); free(filt);
return NULL; 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 */ /* Assign scaling functions */
picoscale_256x_320x240_initialize(filt, config, userdata); picoscale_256x_320x240_initialize(filt, config, userdata);
@ -514,6 +513,7 @@ static void picoscale_256x_320x240_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
/* TODO/FIXME - no XRGB8888 codepath? */
if (filt->in_fmt == SOFTFILTER_FMT_RGB565) if (filt->in_fmt == SOFTFILTER_FMT_RGB565)
packets[0].work = picoscale_256x_320x240_work_cb_rgb565; packets[0].work = picoscale_256x_320x240_work_cb_rgb565;
packets[0].thread_data = thr; 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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &picoscale_256x_320x240_generic; return &picoscale_256x_320x240_generic;
} }

View File

@ -68,22 +68,17 @@ static void *scale2x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void scale2x_generic_output(void *data,
static void scale2x_generic_destroy(void *data) static void scale2x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -221,11 +215,10 @@ static void scale2x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
packets[0].work = scale2x_work_cb_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].work = scale2x_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -248,7 +241,6 @@ static const struct softfilter_implementation scale2x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &scale2x_generic; return &scale2x_generic;
} }

View File

@ -68,22 +68,17 @@ static void *scanline2x_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void scanline2x_generic_output(void *data,
static void scanline2x_generic_destroy(void *data) static void scanline2x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -213,11 +207,10 @@ static void scanline2x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; thr->height = height;
if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888) { if (filt->in_fmt == SOFTFILTER_FMT_XRGB8888)
packets[0].work = scanline2x_work_cb_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].work = scanline2x_work_cb_rgb565;
}
packets[0].thread_data = thr; packets[0].thread_data = thr;
} }
@ -240,7 +233,6 @@ static const struct softfilter_implementation scanline2x_generic = {
const struct softfilter_implementation *softfilter_get_implementation( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &scanline2x_generic; return &scanline2x_generic;
} }

View File

@ -72,19 +72,16 @@ static void *supertwoxsai_generic_create(const struct softfilter_config *config,
if (!filt) if (!filt)
return NULL; return NULL;
(void)simd; if (!(filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data))))
(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)
{ {
free(filt); free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe,
* so force single threaded operation... */
filt->threads = 1;
filt->in_fmt = in_fmt;
return filt; 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; uint16_t *output = (uint16_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
supertwoxsai_generic_rgb565(width, height, supertwoxsai_generic_rgb565(width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), (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; uint32_t *output = (uint32_t*)thr->out_data;
unsigned width = thr->width; unsigned width = thr->width;
unsigned height = thr->height; unsigned height = thr->height;
supertwoxsai_generic_xrgb8888(width, height, supertwoxsai_generic_xrgb8888(width, height,
thr->first, thr->last, input, thr->first, thr->last, input,
(unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), (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) const struct softfilter_implementation *softfilter_get_implementation(softfilter_simd_mask_t simd)
{ {
(void)simd;
return &supertwoxsai_generic; return &supertwoxsai_generic;
} }

View File

@ -69,19 +69,15 @@ static void *supereagle_generic_create(const struct softfilter_config *config,
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd;
(void)config;
(void)userdata;
if (!filt) if (!filt)
return NULL; return NULL;
filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data)); if (!(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); free(filt);
return NULL; return NULL;
} }
filt->threads = 1;
filt->in_fmt = in_fmt;
return filt; return filt;
} }
@ -229,7 +225,6 @@ static void supereagle_generic_xrgb8888(unsigned width, unsigned height,
for (finish = width; finish; finish -= 1) for (finish = width; finish; finish -= 1)
{ {
supereagle_declare_variables(uint32_t, in, nextline); supereagle_declare_variables(uint32_t, in, nextline);
supereagle_function(supereagle_result, supereagle_interpolate_xrgb8888, supereagle_interpolate2_xrgb8888); 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) for (finish = width; finish; finish -= 1)
{ {
supereagle_declare_variables(uint16_t, in, nextline); supereagle_declare_variables(uint16_t, in, nextline);
supereagle_function(supereagle_result, supereagle_interpolate_rgb565, supereagle_interpolate2_rgb565); 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) const struct softfilter_implementation *softfilter_get_implementation(softfilter_simd_mask_t simd)
{ {
(void)simd;
return &supereagle_generic; return &supereagle_generic;
} }

View File

@ -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) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -98,9 +93,8 @@ static void upscale_1_5x_generic_output(void *data,
static void upscale_1_5x_generic_destroy(void *data) static void upscale_1_5x_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -263,11 +257,10 @@ static void upscale_1_5x_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; 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; 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].work = upscale_1_5x_work_cb_rgb565;
}
packets[0].thread_data = thr; 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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &upscale_1_5x_generic; return &upscale_1_5x_generic;
} }

View File

@ -333,22 +333,17 @@ static void *upscale_240x160_320x240_generic_create(const struct softfilter_conf
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
/* Assign scaling functions */ /* Assign scaling functions */
upscale_240x160_320x240_initialize(filt, config, userdata); 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) static void upscale_240x160_320x240_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -439,9 +433,9 @@ static void upscale_240x160_320x240_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; 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].work = upscale_240x160_320x240_work_cb_rgb565;
}
packets[0].thread_data = thr; 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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &upscale_240x160_320x240_generic; return &upscale_240x160_320x240_generic;
} }

View File

@ -574,22 +574,17 @@ static void *upscale_256x_320x240_generic_create(const struct softfilter_config
unsigned threads, softfilter_simd_mask_t simd, void *userdata) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
return filt; return filt;
} }
@ -613,9 +608,8 @@ static void upscale_256x_320x240_generic_output(void *data,
static void upscale_256x_320x240_generic_destroy(void *data) static void upscale_256x_320x240_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -689,9 +683,9 @@ static void upscale_256x_320x240_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; 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].work = upscale_256x_320x240_work_cb_rgb565;
}
packets[0].thread_data = thr; 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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &upscale_256x_320x240_generic; return &upscale_256x_320x240_generic;
} }

View File

@ -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++) for (block_x = 0; block_x < 80; block_x++)
{ {
const uint16_t *block_src_ptr = block_src; uint16_t _4, _5, _6;
uint16_t *block_dst_ptr = block_dst;
uint16_t _1, _2, _3,
_4, _5, _6;
uint16_t _1_2_weight_1_3; uint16_t _1_2_weight_1_3;
uint16_t _2_3_weight_1_1; uint16_t _2_3_weight_1_1;
uint16_t _4_5_weight_1_3; uint16_t _4_5_weight_1_3;
uint16_t _5_6_weight_1_1; uint16_t _5_6_weight_1_1;
uint16_t tmp; uint16_t tmp;
const uint16_t *block_src_ptr = block_src;
uint16_t *block_dst_ptr = block_dst;
/* Horizontally: /* Horizontally:
* Before(3): * Before(3):
@ -116,9 +112,9 @@ void upscale_mix_240x160_to_320x240(uint16_t *dst, const uint16_t *src,
*/ */
/* -- Row 1 -- */ /* -- Row 1 -- */
_1 = *(block_src_ptr ); uint16_t _1 = *(block_src_ptr );
_2 = *(block_src_ptr + 1); uint16_t _2 = *(block_src_ptr + 1);
_3 = *(block_src_ptr + 2); uint16_t _3 = *(block_src_ptr + 2);
*(block_dst_ptr ) = _1; *(block_dst_ptr ) = _1;
UPSCALE_240__WEIGHT_1_3(_1, _2, block_dst_ptr + 1, tmp); 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++) for (block_x = 0; block_x < 80; block_x++)
{ {
uint16_t tmp;
const uint16_t *block_src_ptr = block_src; const uint16_t *block_src_ptr = block_src;
uint16_t *block_dst_ptr = block_dst; uint16_t *block_dst_ptr = block_dst;
uint16_t _1, _2, _3;
uint16_t tmp;
/* Horizontally: /* Horizontally:
* Before(3): * Before(3):
* (a)(b)(c) * (a)(b)(c)
@ -291,9 +285,9 @@ void upscale_mix_240x160_to_320x240_aspect(uint16_t *dst, const uint16_t *src,
*/ */
/* -- Row 1 -- */ /* -- Row 1 -- */
_1 = *(block_src_ptr ); uint16_t _1 = *(block_src_ptr );
_2 = *(block_src_ptr + 1); uint16_t _2 = *(block_src_ptr + 1);
_3 = *(block_src_ptr + 2); uint16_t _3 = *(block_src_ptr + 2);
*(block_dst_ptr ) = _1; *(block_dst_ptr ) = _1;
UPSCALE_240__WEIGHT_1_3(_1, _2, block_dst_ptr + 1, tmp); 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; filt->function.upscale_mix_240x160_320x240 = upscale_mix_240x160_to_320x240_aspect;
/* Read aspect ratio correction setting */ /* Read aspect ratio correction setting */
if (config->get_int(userdata, "keep_aspect", &keep_aspect, 1) && if (config->get_int(userdata, "keep_aspect", &keep_aspect, 1) && !keep_aspect)
!keep_aspect)
filt->function.upscale_mix_240x160_320x240 = upscale_mix_240x160_to_320x240; 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) unsigned threads, softfilter_simd_mask_t simd, void *userdata)
{ {
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt)); struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
(void)simd; if (!filt)
(void)config; return NULL;
(void)userdata; if (!(filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data))))
{
if (!filt) { free(filt);
return NULL; return NULL;
} }
/* Apparently the code is not thread-safe, /* Apparently the code is not thread-safe,
* so force single threaded operation... */ * so force single threaded operation... */
filt->workers = (struct softfilter_thread_data*)calloc(1, sizeof(struct softfilter_thread_data));
filt->threads = 1; filt->threads = 1;
filt->in_fmt = in_fmt; filt->in_fmt = in_fmt;
if (!filt->workers) {
free(filt);
return NULL;
}
/* Assign scaling functions */ /* Assign scaling functions */
upscale_mix_240x160_320x240_initialize(filt, config, userdata); 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) static void upscale_mix_240x160_320x240_generic_destroy(void *data)
{ {
struct filter_data *filt = (struct filter_data*)data; struct filter_data *filt = (struct filter_data*)data;
if (!filt) { if (!filt)
return; return;
}
free(filt->workers); free(filt->workers);
free(filt); free(filt);
} }
@ -454,9 +440,9 @@ static void upscale_mix_240x160_320x240_generic_packets(void *data,
thr->width = width; thr->width = width;
thr->height = height; 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].work = upscale_mix_240x160_320x240_work_cb_rgb565;
}
packets[0].thread_data = thr; 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( const struct softfilter_implementation *softfilter_get_implementation(
softfilter_simd_mask_t simd) softfilter_simd_mask_t simd)
{ {
(void)simd;
return &upscale_mix_240x160_320x240_generic; return &upscale_mix_240x160_320x240_generic;
} }

View File

@ -134,7 +134,7 @@ void scope_repeat(scope_t *scope)
else else
{ {
gen->value.val_int += gen->increment.val_int; gen->value.val_int += gen->increment.val_int;
if(gen->shift > 0) if (gen->shift > 0)
gen->value.val_int <<= gen->shift; gen->value.val_int <<= gen->shift;
else if (gen->shift < 0) else if (gen->shift < 0)
gen->value.val_int >>= -gen->shift; gen->value.val_int >>= -gen->shift;

View File

@ -92,7 +92,7 @@ static void hidpad_retrode_get_buttons(void *pad_data, input_bits_t *state)
retrode_pad_data_t *pad = (retrode_pad_data_t *)pad_data; retrode_pad_data_t *pad = (retrode_pad_data_t *)pad_data;
if (pad) if (pad)
{ {
if(pad->datatype == RETRODE_TYPE_PAD) if (pad->datatype == RETRODE_TYPE_PAD)
{ {
BITS_COPY16_PTR(state, pad->buttons); BITS_COPY16_PTR(state, pad->buttons);
} }
@ -117,7 +117,7 @@ static int16_t hidpad_retrode_get_axis(void *pad_data, unsigned axis)
if (!pad || axis >= 2) if (!pad || axis >= 2)
return 0; return 0;
if(pad->datatype == RETRODE_TYPE_PAD) if (pad->datatype == RETRODE_TYPE_PAD)
val = pad->data[2 + axis]; val = pad->data[2 + axis];
else else
val = device->pad_data[0].data[2 + axis]; val = device->pad_data[0].data[2 + axis];
@ -228,7 +228,7 @@ static void *hidpad_retrode_pad_init(void *device_data, int pad_index, joypad_co
{ {
retrode_device_data_t *device = (retrode_device_data_t *)device_data; retrode_device_data_t *device = (retrode_device_data_t *)device_data;
if(!device || pad_index < 0 || pad_index >= RETRODE_MAX_PAD || !joypad || device->pad_data[pad_index].joypad) if (!device || pad_index < 0 || pad_index >= RETRODE_MAX_PAD || !joypad || device->pad_data[pad_index].joypad)
return NULL; return NULL;
device->pad_data[pad_index].joypad = joypad; device->pad_data[pad_index].joypad = joypad;
@ -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) static void hidpad_retrode_pad_deinit(void *pad_data)
{ {
retrode_pad_data_t *pad = (retrode_pad_data_t *)pad_data; retrode_pad_data_t *pad = (retrode_pad_data_t *)pad_data;
if (pad)
if(!pad)
return;
pad->joypad = NULL; pad->joypad = NULL;
} }
@ -250,7 +247,7 @@ static int8_t hidpad_retrode_status(void *device_data, int pad_index)
retrode_device_data_t *device = (retrode_device_data_t *)device_data; retrode_device_data_t *device = (retrode_device_data_t *)device_data;
int8_t result = 0; int8_t result = 0;
if(!device || pad_index < 0 || pad_index >= RETRODE_MAX_PAD) if (!device || pad_index < 0 || pad_index >= RETRODE_MAX_PAD)
return 0; return 0;
result |= PAD_CONNECT_READY; result |= PAD_CONNECT_READY;
@ -265,7 +262,7 @@ static joypad_connection_t *hidpad_retrode_joypad(void *device_data, int pad_ind
{ {
retrode_device_data_t *device = (retrode_device_data_t *)device_data; retrode_device_data_t *device = (retrode_device_data_t *)device_data;
if(!device || pad_index < 0 || pad_index >= RETRODE_MAX_PAD) if (!device || pad_index < 0 || pad_index >= RETRODE_MAX_PAD)
return 0; return 0;
return device->pad_data[pad_index].joypad; return device->pad_data[pad_index].joypad;
} }

View File

@ -420,8 +420,7 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
/* estamos haciendo handshake o bien se necesita iniciar un /* estamos haciendo handshake o bien se necesita iniciar un
* nuevo handshake ya que se inserta(quita una expansion. */ * nuevo handshake ya que se inserta(quita una expansion. */
int attachment = 0; int attachment = 0;
if (event != WM_RPT_CTRL_STATUS)
if(event != WM_RPT_CTRL_STATUS)
return 0; return 0;
/* Is an attachment connected to /* Is an attachment connected to
@ -440,7 +439,7 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
/* Send the initialization code for the attachment */ /* Send the initialization code for the attachment */
if(WIIMOTE_IS_SET(wm,WIIMOTE_STATE_HANDSHAKE_COMPLETE)) if (WIIMOTE_IS_SET(wm,WIIMOTE_STATE_HANDSHAKE_COMPLETE))
{ {
/* Rehandshake. */ /* Rehandshake. */
@ -481,7 +480,7 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP); WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP);
wm->exp.type = EXP_NONE; wm->exp.type = EXP_NONE;
if(WIIMOTE_IS_SET(wm,WIIMOTE_STATE_HANDSHAKE_COMPLETE)) if (WIIMOTE_IS_SET(wm,WIIMOTE_STATE_HANDSHAKE_COMPLETE))
{ {
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE); WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_HANDSHAKE_COMPLETE);
/* forzamos un handshake por si venimos /* forzamos un handshake por si venimos
@ -490,7 +489,7 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
} }
} }
if(!attachment && WIIMOTE_IS_SET(wm,WIIMOTE_STATE_HANDSHAKE)) if (!attachment && WIIMOTE_IS_SET(wm,WIIMOTE_STATE_HANDSHAKE))
{ {
wm->handshake_state = 2; wm->handshake_state = 2;
continue; continue;
@ -536,7 +535,7 @@ static int wiimote_handshake(struct connect_wii_wiimote_t* wm,
} }
return 0; return 0;
case 5: case 5:
if(event != WM_RPT_READ) if (event != WM_RPT_READ)
return 0; return 0;
wiimote_classic_ctrl_handshake(wm, &wm->exp.cc.classic, data,len); wiimote_classic_ctrl_handshake(wm, &wm->exp.cc.classic, data,len);

View File

@ -108,7 +108,7 @@ static void hidpad_wiiugca_get_buttons(void *pad_data, input_bits_t *state)
gca_pad_data_t *pad = (gca_pad_data_t *)pad_data; gca_pad_data_t *pad = (gca_pad_data_t *)pad_data;
if (pad) if (pad)
{ {
if(pad->datatype == GCA_TYPE_PAD) if (pad->datatype == GCA_TYPE_PAD)
{ {
BITS_COPY16_PTR(state, pad->buttons); BITS_COPY16_PTR(state, pad->buttons);
} }
@ -134,10 +134,8 @@ static int16_t hidpad_wiiugca_get_axis(void *pad_data, unsigned axis)
if (!pad || axis_data.axis >= 4) if (!pad || axis_data.axis >= 4)
return 0; return 0;
if (pad->datatype == GCA_TYPE_PAD)
if(pad->datatype == GCA_TYPE_PAD)
return gamepad_get_axis_value(pad->analog, &axis_data); return gamepad_get_axis_value(pad->analog, &axis_data);
return gamepad_get_axis_value(device->pad_data[0].analog, &axis_data); return gamepad_get_axis_value(device->pad_data[0].analog, &axis_data);
} }
@ -244,7 +242,7 @@ static void hidpad_wiiugca_set_rumble(void *data,
const char *hidpad_wiiugca_get_name(void *pad_data) const char *hidpad_wiiugca_get_name(void *pad_data)
{ {
gca_pad_data_t *pad = (gca_pad_data_t *)pad_data; gca_pad_data_t *pad = (gca_pad_data_t *)pad_data;
if(!pad || pad->datatype != GCA_TYPE_PAD) if (!pad || pad->datatype != GCA_TYPE_PAD)
return DEVICE_NAME; return DEVICE_NAME;
switch(pad->device_data->connected[pad->pad_index]) switch(pad->device_data->connected[pad->pad_index])
@ -284,7 +282,7 @@ static void *hidpad_wiiugca_pad_init(void *device_data, int pad_index, joypad_co
{ {
gca_device_data_t *device = (gca_device_data_t *)device_data; gca_device_data_t *device = (gca_device_data_t *)device_data;
if(!device || pad_index < 0 || pad_index >= GCA_MAX_PAD || !joypad || device->pad_data[pad_index].joypad || !device->connected[pad_index]) if (!device || pad_index < 0 || pad_index >= GCA_MAX_PAD || !joypad || device->pad_data[pad_index].joypad || !device->connected[pad_index])
return NULL; return NULL;
device->pad_data[pad_index].joypad = joypad; device->pad_data[pad_index].joypad = joypad;
@ -295,18 +293,16 @@ static void hidpad_wiiugca_pad_deinit(void *pad_data)
{ {
gca_pad_data_t *pad = (gca_pad_data_t *)pad_data; gca_pad_data_t *pad = (gca_pad_data_t *)pad_data;
if(!pad) if (pad)
return;
pad->joypad = NULL; pad->joypad = NULL;
} }
static int8_t hidpad_wiiugca_status(void *device_data, int pad_index) 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; 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) if (!device || pad_index < 0 || pad_index >= GCA_MAX_PAD)
return 0; return 0;
if (device->connected[pad_index]) if (device->connected[pad_index])
@ -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) static joypad_connection_t *hidpad_wiiugca_joypad(void *device_data, int pad_index)
{ {
gca_device_data_t *device = (gca_device_data_t *)device_data; gca_device_data_t *device = (gca_device_data_t *)device_data;
if (!device || pad_index < 0 || pad_index >= GCA_MAX_PAD)
if(!device || pad_index < 0 || pad_index >= GCA_MAX_PAD)
return 0; return 0;
return device->pad_data[pad_index].joypad; return device->pad_data[pad_index].joypad;
} }

View File

@ -219,7 +219,7 @@ static void hidpad_wiiupro_packet_handler(void *data,
device->data.btn.home = (packet[0x0C] & 0x8) ? 1 : 0; device->data.btn.home = (packet[0x0C] & 0x8) ? 1 : 0;
if(device->calib.calib_round < 5) if (device->calib.calib_round < 5)
{ {
device->calib.hatvalue_calib[0] = (packet[4] | (packet[4 + 1] << 8)); device->calib.hatvalue_calib[0] = (packet[4] | (packet[4 + 1] << 8));
device->calib.hatvalue_calib[1] = (packet[8] | (packet[8 + 1] << 8)); device->calib.hatvalue_calib[1] = (packet[8] | (packet[8 + 1] << 8));

View File

@ -1132,7 +1132,7 @@ static void handle_hotplug(android_input_t *android,
* This device is composed of two hid devices * This device is composed of two hid devices
* We make it look like one device * We make it look like one device
*/ */
else if( else if (
( (
string_starts_with_size(device_model, "R800", STRLEN_CONST("R800")) || string_starts_with_size(device_model, "R800", STRLEN_CONST("R800")) ||
strstr(device_model, "Xperia Play") || strstr(device_model, "Xperia Play") ||
@ -1326,17 +1326,17 @@ static void engine_handle_touchpad(
int action = AMOTION_EVENT_ACTION_MASK int action = AMOTION_EVENT_ACTION_MASK
& AMotionEvent_getAction(event); & AMotionEvent_getAction(event);
int raw_action = AMotionEvent_getAction(event); int raw_action = AMotionEvent_getAction(event);
if( action == AMOTION_EVENT_ACTION_POINTER_DOWN if ( action == AMOTION_EVENT_ACTION_POINTER_DOWN
|| action == AMOTION_EVENT_ACTION_POINTER_UP ) || action == AMOTION_EVENT_ACTION_POINTER_UP )
{ {
int pointer_index = (AMotionEvent_getAction( event ) & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; int pointer_index = (AMotionEvent_getAction( event ) & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
pointer_id = AMotionEvent_getPointerId( event, pointer_index); pointer_id = AMotionEvent_getPointerId( event, pointer_index);
} }
if( action == AMOTION_EVENT_ACTION_DOWN if ( action == AMOTION_EVENT_ACTION_DOWN
|| action == AMOTION_EVENT_ACTION_POINTER_DOWN ) || action == AMOTION_EVENT_ACTION_POINTER_DOWN )
touchstate[pointer_id].down = 1; touchstate[pointer_id].down = 1;
else if( action == AMOTION_EVENT_ACTION_UP else if (action == AMOTION_EVENT_ACTION_UP
|| action == AMOTION_EVENT_ACTION_POINTER_UP || action == AMOTION_EVENT_ACTION_POINTER_UP
|| action == AMOTION_EVENT_ACTION_CANCEL ) || action == AMOTION_EVENT_ACTION_CANCEL )
touchstate[pointer_id].down = 0; touchstate[pointer_id].down = 0;
@ -1669,8 +1669,9 @@ static int16_t android_input_state(
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
{ {
int val = 0; int val = 0;
if(port > 0) if (port > 0)
break; /* TODO: implement mouse for additional ports/players */ break; /* TODO: implement mouse for additional ports/players */
switch (id) switch (id)
{ {
case RETRO_DEVICE_ID_MOUSE_LEFT: case RETRO_DEVICE_ID_MOUSE_LEFT:
@ -1703,7 +1704,7 @@ static int16_t android_input_state(
case RETRO_DEVICE_LIGHTGUN: case RETRO_DEVICE_LIGHTGUN:
{ {
int val = 0; int val = 0;
if(port > 0) if (port > 0)
break; /* TODO: implement lightgun for additional ports/players */ break; /* TODO: implement lightgun for additional ports/players */
switch (id) switch (id)
{ {

View File

@ -1004,7 +1004,7 @@ bool dinput_handle_message(void *data,
wParam == DBT_DEVICEREMOVECOMPLETE) wParam == DBT_DEVICEREMOVECOMPLETE)
{ {
PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam; PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam;
if(pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) if (pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
{ {
#if 0 #if 0
PDEV_BROADCAST_DEVICEINTERFACE pDevInf = PDEV_BROADCAST_DEVICEINTERFACE pDevInf =

View File

@ -325,7 +325,7 @@ static bool psp_input_set_sensor_state(void *data, unsigned port,
return true; return true;
case RETRO_SENSOR_ACCELEROMETER_DISABLE: case RETRO_SENSOR_ACCELEROMETER_DISABLE:
case RETRO_SENSOR_GYROSCOPE_DISABLE: case RETRO_SENSOR_GYROSCOPE_DISABLE:
if(psp->sensors_enabled) if (psp->sensors_enabled)
{ {
psp->sensors_enabled = false; psp->sensors_enabled = false;
sceMotionMagnetometerOff(); sceMotionMagnetometerOff();
@ -334,7 +334,7 @@ static bool psp_input_set_sensor_state(void *data, unsigned port,
return true; return true;
case RETRO_SENSOR_ACCELEROMETER_ENABLE: case RETRO_SENSOR_ACCELEROMETER_ENABLE:
case RETRO_SENSOR_GYROSCOPE_ENABLE: case RETRO_SENSOR_GYROSCOPE_ENABLE:
if(!psp->sensors_enabled) if (!psp->sensors_enabled)
{ {
psp->sensors_enabled = true; psp->sensors_enabled = true;
sceMotionStartSampling(); sceMotionStartSampling();
@ -357,10 +357,10 @@ static float psp_input_get_sensor_input(void *data,
psp_input_t *psp = (psp_input_t*)data; psp_input_t *psp = (psp_input_t*)data;
if(!psp || !psp->sensors_enabled) if (!psp || !psp->sensors_enabled)
return 0.0f; return 0.0f;
if(id >= RETRO_SENSOR_ACCELEROMETER_X && id <= RETRO_SENSOR_GYROSCOPE_Z) if (id >= RETRO_SENSOR_ACCELEROMETER_X && id <= RETRO_SENSOR_GYROSCOPE_Z)
{ {
sceMotionGetSensorState(&sixaxis, port); sceMotionGetSensorState(&sixaxis, port);

View File

@ -412,7 +412,7 @@ static int16_t udev_mouse_get_pointer_x(const udev_input_mouse_t *mouse, bool sc
if (x < -0x7fff) if (x < -0x7fff)
return -0x7fff; return -0x7fff;
else if(x > 0x7fff) else if (x > 0x7fff)
return 0x7fff; return 0x7fff;
return x; return x;
@ -457,7 +457,7 @@ static int16_t udev_mouse_get_pointer_y(const udev_input_mouse_t *mouse, bool sc
if (y < -0x7fff) if (y < -0x7fff)
return -0x7fff; return -0x7fff;
else if(y > 0x7fff) else if (y > 0x7fff)
return 0x7fff; return 0x7fff;
return y; return y;
@ -1064,7 +1064,7 @@ static int16_t udev_pointer_state(udev_input_t *udev,
case RETRO_DEVICE_ID_POINTER_Y: case RETRO_DEVICE_ID_POINTER_Y:
return udev_mouse_get_pointer_y(mouse, screen); return udev_mouse_get_pointer_y(mouse, screen);
case RETRO_DEVICE_ID_POINTER_PRESSED: case RETRO_DEVICE_ID_POINTER_PRESSED:
if(mouse->abs == 1) if (mouse->abs == 1)
return mouse->pp; return mouse->pp;
return mouse->l; return mouse->l;
} }

View File

@ -174,7 +174,7 @@ static int16_t input_wl_state(
} }
} }
if(!keyboard_mapping_blocked) if (!keyboard_mapping_blocked)
{ {
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
@ -194,14 +194,14 @@ static int16_t input_wl_state(
{ {
if (binds[port][id].valid && binds[port][id].key < RETROK_LAST) if (binds[port][id].valid && binds[port][id].key < RETROK_LAST)
{ {
if(id != RARCH_GAME_FOCUS_TOGGLE && !keyboard_mapping_blocked) if (id != RARCH_GAME_FOCUS_TOGGLE && !keyboard_mapping_blocked)
{ {
if(BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key])) if (BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key]))
return 1; return 1;
} }
else if(id == RARCH_GAME_FOCUS_TOGGLE) else if (id == RARCH_GAME_FOCUS_TOGGLE)
{ {
if(BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key])) if (BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key]))
return 1; return 1;
} }

View File

@ -1390,7 +1390,7 @@ static int16_t btstack_hid_joypad_axis(void *data,
if (val < 0) if (val < 0)
return val; return val;
} }
else if(AXIS_POS_GET(joyaxis) < 4) else if (AXIS_POS_GET(joyaxis) < 4)
{ {
int16_t val = pad_connection_get_axis( int16_t val = pad_connection_get_axis(
&slots[port], port, AXIS_POS_GET(joyaxis)); &slots[port], port, AXIS_POS_GET(joyaxis));

View File

@ -340,7 +340,7 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result,
if (range == 3) if (range == 3)
val *= 2; val *= 2;
if(min == 1) if (min == 1)
val--; val--;
switch(val) switch(val)

View File

@ -493,7 +493,7 @@ static int16_t libusb_hid_joypad_axis(void *data,
if (val < 0) if (val < 0)
return val; return val;
} }
else if(AXIS_POS_GET(joyaxis) < 4) else if (AXIS_POS_GET(joyaxis) < 4)
{ {
int16_t val = pad_connection_get_axis(&hid->slots[port], int16_t val = pad_connection_get_axis(&hid->slots[port],
port, AXIS_POS_GET(joyaxis)); port, AXIS_POS_GET(joyaxis));

View File

@ -227,7 +227,7 @@ static void check_port0_active(uint8_t pad_count)
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
int idx = settings->uints.input_joypad_index[0]; int idx = settings->uints.input_joypad_index[0];
if(pad_count < 2 && idx != 0) if (pad_count < 2 && idx != 0)
{ {
#ifdef HW_RVL #ifdef HW_RVL
pad_type[0] = WPAD_EXP_NONE; pad_type[0] = WPAD_EXP_NONE;
@ -588,7 +588,7 @@ static void gx_joypad_poll(void)
#endif #endif
/* Count active controllers */ /* Count active controllers */
if(gx_joypad_query_pad(port)) if (gx_joypad_query_pad(port))
pad_count++; pad_count++;
/* Always enable 1 pad in port 0 if there's only 1 controller connected. /* Always enable 1 pad in port 0 if there's only 1 controller connected.

View File

@ -535,7 +535,7 @@ static int16_t apple_gamecontroller_joypad_axis(
if (val < 0) if (val < 0)
return val; return val;
} }
else if(AXIS_POS_GET(joyaxis) < 4) else if (AXIS_POS_GET(joyaxis) < 4)
{ {
int16_t axis = AXIS_POS_GET(joyaxis); int16_t axis = AXIS_POS_GET(joyaxis);
int16_t val = mfi_axes[port][axis]; int16_t val = mfi_axes[port][axis];

View File

@ -80,8 +80,7 @@ static void *ps2_joypad_init(void *data)
Port 0,3 -> Connector 7 Port 0,3 -> Connector 7
Port 1,3 -> Connector 8 Port 1,3 -> Connector 8
*/ */
if ((ret = padPortOpen(port, slot, padBuf[port][slot])) == 0)
if((ret = padPortOpen(port, slot, padBuf[port][slot])) == 0)
return NULL; return NULL;
} }
} }

View File

@ -368,7 +368,7 @@ static bool psp_joypad_rumble(unsigned pad,
#ifdef VITA #ifdef VITA
if (psp2_model != SCE_KERNEL_MODEL_VITATV) if (psp2_model != SCE_KERNEL_MODEL_VITATV)
return false; return false;
if(pad >= DEFAULT_MAX_PADS) if (pad >= DEFAULT_MAX_PADS)
return false; return false;
switch (effect) switch (effect)
{ {

View File

@ -68,7 +68,7 @@ static void *switch_joypad_init(void *data)
for (i = 0; i < DEFAULT_MAX_PADS; i++) for (i = 0; i < DEFAULT_MAX_PADS; i++)
{ {
if(i == 0) if (i == 0)
padInitializeDefault(&pad_states[0]); padInitializeDefault(&pad_states[0]);
else else
padInitialize(&pad_states[i], i); padInitialize(&pad_states[i], i);

View File

@ -4776,7 +4776,7 @@ void bsv_movie_handle_push_key_event(bsv_movie_t *movie, uint8_t down, uint16_t
void bsv_movie_finish_rewind(input_driver_state_t *input_st) void bsv_movie_finish_rewind(input_driver_state_t *input_st)
{ {
bsv_movie_t *handle = input_st->bsv_movie_state_handle; bsv_movie_t *handle = input_st->bsv_movie_state_handle;
if(!handle) if (!handle)
return; return;
handle->frame_ptr = (handle->frame_ptr + 1) & handle->frame_mask; handle->frame_ptr = (handle->frame_ptr + 1) & handle->frame_mask;
handle->first_rewind = !handle->did_rewind; handle->first_rewind = !handle->did_rewind;
@ -4803,7 +4803,7 @@ void bsv_movie_next_frame(input_driver_state_t *input_st)
if (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK) if (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_PLAYBACK)
{ {
/* read next key events, a frame happened for sure? but don't apply them yet */ /* read next key events, a frame happened for sure? but don't apply them yet */
if(handle->key_event_count != 0) if (handle->key_event_count != 0)
{ {
RARCH_ERR("[Movie] BSV keyboard replay reading next frame while some unused keys still in queue\n"); RARCH_ERR("[Movie] BSV keyboard replay reading next frame while some unused keys still in queue\n");
} }
@ -5289,7 +5289,7 @@ void input_driver_poll(void)
runloop_state_t *runloop_st = runloop_state_get_ptr(); runloop_state_t *runloop_st = runloop_state_get_ptr();
retro_keyboard_event_t *key_event = &runloop_st->key_event; retro_keyboard_event_t *key_event = &runloop_st->key_event;
if(*key_event && *key_event == runloop_st->frontend_key_event) if (*key_event && *key_event == runloop_st->frontend_key_event)
{ {
int i; int i;
bsv_key_data_t k; bsv_key_data_t k;
@ -6301,7 +6301,7 @@ void input_keyboard_event(bool down, unsigned code,
if (*key_event) if (*key_event)
{ {
if(*key_event == runloop_st->frontend_key_event) if (*key_event == runloop_st->frontend_key_event)
{ {
#ifdef HAVE_BSV_MOVIE #ifdef HAVE_BSV_MOVIE
/* Save input to BSV record, if recording */ /* Save input to BSV record, if recording */

View File

@ -403,7 +403,8 @@ static const char *menu_hash_to_str_el_label_enum(enum msg_hash_enums msg)
} }
#endif #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 #ifdef HAVE_MENU
const char *ret = menu_hash_to_str_el_label_enum(msg); 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; return ret;
#endif #endif
switch (msg) { switch (msg)
{
#include "msg_hash_el.h" #include "msg_hash_el.h"
default: default:
#if 0 #if 0

View File

@ -2373,7 +2373,8 @@ static const char *menu_hash_to_str_pt_br_label_enum(enum msg_hash_enums msg)
} }
#endif #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 #ifdef HAVE_MENU
const char *ret = menu_hash_to_str_pt_br_label_enum(msg); 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; return ret;
#endif #endif
switch (msg) { switch (msg)
{
#include "msg_hash_pt_br.h" #include "msg_hash_pt_br.h"
default: default:
#if 0 #if 0

View File

@ -1911,7 +1911,8 @@ static const char *menu_hash_to_str_tr_label_enum(enum msg_hash_enums msg)
} }
#endif #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 #ifdef HAVE_MENU
const char *ret = menu_hash_to_str_tr_label_enum(msg); 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; return ret;
#endif #endif
switch (msg) { switch (msg)
{
#include "msg_hash_tr.h" #include "msg_hash_tr.h"
default: default:
#if 0 #if 0

View File

@ -106,16 +106,16 @@ static void rpi_set(int led, int state)
int gpio = 0; int gpio = 0;
/* Invalid LED? */ /* Invalid LED? */
if((led < 0) || (led >= MAX_LEDS)) if ((led < 0) || (led >= MAX_LEDS))
return; return;
gpio = rpi_cur->map[led]; gpio = rpi_cur->map[led];
if(gpio <= 0) if (gpio <= 0)
return; return;
if(rpi_cur->setup[led] == 0) if (rpi_cur->setup[led] == 0)
rpi_cur->setup[led] = setup_gpio(gpio); rpi_cur->setup[led] = setup_gpio(gpio);
if(rpi_cur->setup[led] > 0) if (rpi_cur->setup[led] > 0)
set_gpio(gpio, state); set_gpio(gpio, state);
} }

View File

@ -93,16 +93,16 @@ static void sys_led_set(int led, int state)
int sysled = 0; int sysled = 0;
/* Invalid LED? */ /* Invalid LED? */
if((led < 0) || (led >= MAX_LEDS)) if ((led < 0) || (led >= MAX_LEDS))
return; return;
sysled = sys_cur->map[led]; sysled = sys_cur->map[led];
if(sysled < 0) if (sysled < 0)
return; return;
if(sys_cur->setup[led] == 0) if (sys_cur->setup[led] == 0)
sys_cur->setup[led] = setup_sysled(sysled); sys_cur->setup[led] = setup_sysled(sysled);
if(sys_cur->setup[led] > 0) if (sys_cur->setup[led] > 0)
set_sysled(sysled, state); set_sysled(sysled, state);
} }

View File

@ -923,7 +923,7 @@ audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound,
} }
else else
{ {
if(i < AUDIO_MIXER_MAX_VOICES) if (i < AUDIO_MIXER_MAX_VOICES)
{ {
audio_mixer_release(voice); audio_mixer_release(voice);
AUDIO_MIXER_UNLOCK(voice); AUDIO_MIXER_UNLOCK(voice);

View File

@ -33,13 +33,12 @@
struct chorus_data struct chorus_data
{ {
float old[2][CHORUS_MAX_DELAY]; float old[2][CHORUS_MAX_DELAY];
unsigned old_ptr;
float delay; float delay;
float depth; float depth;
float input_rate; float input_rate;
float mix_dry; float mix_dry;
float mix_wet; float mix_wet;
unsigned old_ptr;
unsigned lfo_ptr; unsigned lfo_ptr;
unsigned lfo_period; unsigned lfo_period;
}; };
@ -151,10 +150,6 @@ static const struct dspfilter_implementation chorus_plug = {
#endif #endif
const struct dspfilter_implementation * const struct dspfilter_implementation *
dspfilter_get_implementation(dspfilter_simd_mask_t mask) dspfilter_get_implementation(dspfilter_simd_mask_t mask) { return &chorus_plug; }
{
(void)mask;
return &chorus_plug;
}
#undef dspfilter_get_implementation #undef dspfilter_get_implementation

View File

@ -83,7 +83,6 @@ static const struct dspfilter_implementation delta_plug = {
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &delta_plug; return &delta_plug;
} }

View File

@ -123,10 +123,8 @@ static void *echo_init(const struct dspfilter_info *info,
channels = num_feedback = num_delay = MIN(num_delay, num_feedback); channels = num_feedback = num_delay = MIN(num_delay, num_feedback);
echo_channels = (struct echo_channel*)calloc(channels, if (!(echo_channels = (struct echo_channel*)calloc(channels,
sizeof(*echo_channels)); sizeof(*echo_channels))))
if (!echo_channels)
goto error; goto error;
echo->channels = echo_channels; echo->channels = echo_channels;
@ -138,8 +136,7 @@ static void *echo_init(const struct dspfilter_info *info,
if (!frames) if (!frames)
goto error; goto error;
echo->channels[i].buffer = (float*)calloc(frames, 2 * sizeof(float)); if (!(echo->channels[i].buffer = (float*)calloc(frames, 2 * sizeof(float))))
if (!echo->channels[i].buffer)
goto error; goto error;
echo->channels[i].frames = frames; 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) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &echo_plug; return &echo_plug;
} }

View File

@ -34,12 +34,11 @@
struct eq_data struct eq_data
{ {
fft_t *fft; fft_t *fft;
float buffer[8 * 1024];
float *save; float *save;
float *block; float *block;
fft_complex_t *filter; fft_complex_t *filter;
fft_complex_t *fftblock; fft_complex_t *fftblock;
float buffer[8 * 1024];
unsigned block_size; unsigned block_size;
unsigned block_ptr; unsigned block_ptr;
}; };
@ -92,7 +91,7 @@ static void eq_process(void *data, struct dspfilter_output *output,
input_frames -= write_avail; input_frames -= write_avail;
eq->block_ptr += write_avail; eq->block_ptr += write_avail;
// Convolve a new block. /* Convolve a new block. */
if (eq->block_ptr == eq->block_size) if (eq->block_ptr == eq->block_size)
{ {
unsigned i, c; 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); 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++) for (i = 0; i < 2 * eq->block_size; i++)
out[i] += eq->save[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)); memcpy(eq->save, out + 2 * eq->block_size, 2 * eq->block_size * sizeof(float));
out += eq->block_size * 2; out += eq->block_size * 2;
@ -197,7 +196,6 @@ static void create_filter(struct eq_data *eq, unsigned size_log2,
int i; int i;
int half_block_size = eq->block_size >> 1; int half_block_size = eq->block_size >> 1;
double window_mod = 1.0 / kaiser_window_function(0.0, beta); double window_mod = 1.0 / kaiser_window_function(0.0, beta);
fft_t *fft = fft_new(size_log2); fft_t *fft = fft_new(size_log2);
float *time_filter = (float*)calloc(eq->block_size * 2 + 1, sizeof(*time_filter)); float *time_filter = (float*)calloc(eq->block_size * 2 + 1, sizeof(*time_filter));
if (!fft || !time_filter) if (!fft || !time_filter)
@ -261,10 +259,10 @@ end:
static void *eq_init(const struct dspfilter_info *info, static void *eq_init(const struct dspfilter_info *info,
const struct dspfilter_config *config, void *userdata) const struct dspfilter_config *config, void *userdata)
{ {
float *frequencies, *gain;
unsigned num_freq, num_gain, i, size;
int size_log2; int size_log2;
float beta; float beta;
float *frequencies, *gain;
unsigned num_freq, num_gain, i, size;
struct eq_gain *gains = NULL; struct eq_gain *gains = NULL;
char *filter_path = NULL; char *filter_path = NULL;
const float default_freq[] = { 0.0f, info->input_rate }; 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); num_gain = num_freq = MIN(num_gain, num_freq);
gains = (struct eq_gain*)calloc(num_gain, sizeof(*gains)); if (!(gains = (struct eq_gain*)calloc(num_gain, sizeof(*gains))))
if (!gains)
goto error; goto error;
for (i = 0; i < num_gain; i++) 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) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &eq_plug; return &eq_plug;
} }

View File

@ -364,7 +364,6 @@ static const struct dspfilter_implementation iir_plug = {
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &iir_plug; return &iir_plug;
} }

View File

@ -104,7 +104,6 @@ static const struct dspfilter_implementation panning = {
const struct dspfilter_implementation * const struct dspfilter_implementation *
dspfilter_get_implementation(dspfilter_simd_mask_t mask) dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &panning; return &panning;
} }

View File

@ -27,8 +27,8 @@
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <libretro_dspfilter.h> #include <libretro_dspfilter.h>
#define phaserlfoshape 4.0 #define PHASER_LFO_SHAPE 4.0
#define phaserlfoskipsamples 20 #define PHASER_LFO_SKIP_SAMPLES 20
struct phaser_data struct phaser_data
{ {
@ -71,10 +71,10 @@ static void phaser_process(void *data, struct dspfilter_output *output,
for (c = 0; c < 2; c++) for (c = 0; c < 2; c++)
m[c] = in[c] + ph->fbout[c] * ph->fb * 0.01f; 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 = 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; 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) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &phaser_plug; return &phaser_plug;
} }

View File

@ -186,7 +186,7 @@ static void revmodel_setmode(struct revmodel *rev, float value)
revmodel_update(rev); revmodel_update(rev);
} }
static void revmodel_init(struct revmodel *rev,int srate, bool right) static void revmodel_init(struct revmodel *rev, int srate, bool right)
{ {
unsigned c; unsigned c;
static const int comb_lengths[8] = { 1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 }; static const int comb_lengths[8] = { 1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 };
@ -196,18 +196,18 @@ static void revmodel_init(struct revmodel *rev,int srate, bool right)
for (c = 0; c < NUMCOMBS; ++c) for (c = 0; c < NUMCOMBS; ++c)
{ {
rev->bufcomb[c] = malloc(r*comb_lengths[c]+stereosep*sizeof(float)); rev->bufcomb[c] = malloc(r * comb_lengths[c] + stereosep * sizeof(float));
rev->combL[c].buffer = rev->bufcomb[c]; rev->combL[c].buffer = rev->bufcomb[c];
memset(rev->combL[c].buffer,0,r*comb_lengths[c]+stereosep*sizeof(float)); memset(rev->combL[c].buffer, 0, r * comb_lengths[c] + stereosep * sizeof(float));
rev->combL[c].bufsize=r*comb_lengths[c]+stereosep; rev->combL[c].bufsize = r * comb_lengths[c] + stereosep;
} }
for (c = 0; c < NUMALLPASSES; ++c) for (c = 0; c < NUMALLPASSES; ++c)
{ {
rev->bufallpass[c] = malloc(r*allpass_lengths[c]+stereosep*sizeof(float)); rev->bufallpass[c] = malloc(r * allpass_lengths[c] + stereosep * sizeof(float));
rev->allpassL[c].buffer = rev->bufallpass[c]; rev->allpassL[c].buffer = rev->bufallpass[c];
memset(rev->allpassL[c].buffer,0,r*allpass_lengths[c]+stereosep*sizeof(float)); memset(rev->allpassL[c].buffer, 0, r * allpass_lengths[c] + stereosep * sizeof(float));
rev->allpassL[c].bufsize=r*allpass_lengths[c]+stereosep; rev->allpassL[c].bufsize = r * allpass_lengths[c] + stereosep;
rev->allpassL[c].feedback = 0.5f; rev->allpassL[c].feedback = 0.5f;
} }
@ -226,8 +226,8 @@ struct reverb_data
static void reverb_free(void *data) static void reverb_free(void *data)
{ {
struct reverb_data *rev = (struct reverb_data*)data;
unsigned i; unsigned i;
struct reverb_data *rev = (struct reverb_data*)data;
for (i = 0; i < NUMCOMBS; i++) for (i = 0; i < NUMCOMBS; i++)
{ {

View File

@ -32,9 +32,9 @@
struct tremolo_core struct tremolo_core
{ {
float *wavetable;
float freq; float freq;
float depth; float depth;
float* wavetable;
int index; int index;
int maxindex; 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) static void tremolocore_init(struct tremolo_core *core,float depth,int samplerate,float freq)
{ {
const double offset = 1. - depth / 2.;
unsigned i;
double env; double env;
unsigned i;
const double offset = 1. - depth / 2.;
core->index = 0; core->index = 0;
core->maxindex = samplerate/freq; core->maxindex = samplerate / freq;
core->wavetable = malloc(core->maxindex*sizeof(float)); core->wavetable = malloc(core->maxindex * sizeof(float));
memset(core->wavetable, 0, 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 = freq * i / samplerate;
env = sin((M_PI*2) * fmod(env + 0.25, 1.0)); env = sin((M_PI*2) * fmod(env + 0.25, 1.0));
core->wavetable[i] = env * (1 - fabs(offset)) + offset; 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) for (i = 0; i < input->frames; i++, out += 2)
{ {
float in[2] = { out[0], out[1] }; float in[2] = { out[0], out[1] };
out[0] = tremolocore_core(&tre->left, in[0]); out[0] = tremolocore_core(&tre->left, in[0]);
out[1] = tremolocore_core(&tre->right, in[1]); 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) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &tremolo_plug; return &tremolo_plug;
} }

View File

@ -30,29 +30,28 @@
#define sqr(a) ((a) * (a)) #define sqr(a) ((a) * (a))
const float BASE_DELAY_SEC = 0.002; // 2 ms static const float BASE_DELAY_SEC = 0.002; /* 2 ms */
const float VIBRATO_FREQUENCY_DEFAULT_HZ = 2; static const float VIBRATO_FREQUENCY_DEFAULT_HZ = 2;
const float VIBRATO_FREQUENCY_MAX_HZ = 14; static const float VIBRATO_FREQUENCY_MAX_HZ = 14;
const float VIBRATO_DEPTH_DEFAULT_PERCENT = 50; static const float VIBRATO_DEPTH_DEFAULT_PERCENT = 50;
const int add_delay = 3; 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; float c0 = y[1];
c0 = y[1]; float c1 = (1.0f / 2.0f) * (y[2] - y[0]);
c1 = (1.0 / 2.0)*(y[2] - y[0]); float c2 = (y[0] - (5.0f / 2.0f) * y[1]) + (2.0f * y[2] - (1.0f / 2.0f) * y[3]);
c2 = (y[0] - (5.0 / 2.0)*y[1]) + (2.0*y[2] - (1.0 / 2.0)*y[3]); float c3 = (1.0f / 2.0f) * (y[3] - y[0]) + (3.0f / 2.0f) * (y[1] - y[2]);
c3 = (1.0 / 2.0)*(y[3] - y[0]) + (3.0 / 2.0)*(y[1] - y[2]); return ((c3 * x + c2) * x + c1) * x + c0;
return ((c3*x + c2)*x + c1)*x + c0;
} }
struct vibrato_core struct vibrato_core
{ {
float* buffer;
float freq; float freq;
float samplerate; float samplerate;
int phase;
float depth; float depth;
float* buffer; int phase;
int writeindex; int writeindex;
int size; int size;
}; };
@ -73,7 +72,7 @@ static void vibrato_free(void *data)
static void vibratocore_init(struct vibrato_core *core,float depth,int samplerate,float freq) static void vibratocore_init(struct vibrato_core *core,float depth,int samplerate,float freq)
{ {
core->size = BASE_DELAY_SEC * samplerate * 2; core->size = BASE_DELAY_SEC * samplerate * 2;
core->buffer = malloc((core->size + add_delay)*sizeof(float)); core->buffer = malloc((core->size + add_delay) * sizeof(float));
memset(core->buffer, 0, (core->size + add_delay) * sizeof(float)); memset(core->buffer, 0, (core->size + add_delay) * sizeof(float));
core->samplerate = samplerate; core->samplerate = samplerate;
core->freq = freq; core->freq = freq;
@ -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) float vibratocore_core(struct vibrato_core *core,float in)
{ {
int ipart;
float delay, readindex, fpart, value;
float M = core->freq / core->samplerate; float M = core->freq / core->samplerate;
int maxphase = core->samplerate / core->freq; int maxphase = core->samplerate / core->freq;
float lfo = sin(M * 2. * M_PI * core->phase++); float lfo = sin(M * 2. * M_PI * core->phase++);
int maxdelay = BASE_DELAY_SEC * core->samplerate;
core->phase = core->phase % maxphase; core->phase = core->phase % maxphase;
lfo = (lfo + 1) * 1.; // transform from [-1; 1] to [0; 1] lfo = (lfo + 1) * 1.; // transform from [-1; 1] to [0; 1]
int maxdelay = BASE_DELAY_SEC * core->samplerate; delay = lfo * core->depth * maxdelay;
float delay = lfo * core->depth * maxdelay;
delay += add_delay; delay += add_delay;
float readindex = core->writeindex - 1 - delay; readindex = core->writeindex - 1 - delay;
while (readindex < 0)readindex += core->size; while (readindex < 0)
while (readindex >= core->size)readindex -= core->size; readindex += core->size;
int ipart = (int)readindex; // integer part of the delay while (readindex >= core->size)
float fpart = readindex - ipart; // fractional part of the delay readindex -= core->size;
float value = hermite_interp(fpart, &(core->buffer[ipart])); 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; core->buffer[core->writeindex] = in;
if (core->writeindex < add_delay){ if (core->writeindex < add_delay)
core->buffer[core->size + core->writeindex] = in; core->buffer[core->size + core->writeindex] = in;
}
core->writeindex++; core->writeindex++;
if (core->writeindex == core->size) { if (core->writeindex == core->size)
core->writeindex = 0; core->writeindex = 0;
}
return value; 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) const struct dspfilter_input *input)
{ {
unsigned i; 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) for (i = 0; i < input->frames; i++, out += 2)
{ {
float in[2] = { out[0], out[1] }; float in[2] = { out[0], out[1] };
out[0] = vibratocore_core(&vib->left, in[0]); out[0] = vibratocore_core(&vib->left, in[0]);
out[1] = vibratocore_core(&vib->right, in[1]); 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) const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
{ {
(void)mask;
return &vibrato_plug; return &vibrato_plug;
} }

View File

@ -68,22 +68,22 @@ static void wahwah_process(void *data, struct dspfilter_output *output,
if ((wah->skipcount++ % WAHWAH_LFO_SKIP_SAMPLES) == 0) if ((wah->skipcount++ % WAHWAH_LFO_SKIP_SAMPLES) == 0)
{ {
float omega, sn, cs, alpha; 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 = frequency * wah->depth * (1.0f - wah->freqofs) + wah->freqofs;
frequency = exp((frequency - 1.0) * 6.0); frequency = exp((frequency - 1.0f) * 6.0f);
omega = M_PI * frequency; omega = M_PI * frequency;
sn = sin(omega); sn = sin(omega);
cs = cos(omega); cs = cos(omega);
alpha = sn / (2.0 * wah->res); alpha = sn / (2.0f * wah->res);
wah->b0 = (1.0 - cs) / 2.0; wah->b0 = (1.0f - cs) / 2.0f;
wah->b1 = 1.0 - cs; wah->b1 = 1.0f - cs;
wah->b2 = (1.0 - cs) / 2.0; wah->b2 = (1.0f - cs) / 2.0f;
wah->a0 = 1.0 + alpha; wah->a0 = 1.0f + alpha;
wah->a1 = -2.0 * cs; wah->a1 = -2.0f * cs;
wah->a2 = 1.0 - alpha; 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; 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, "depth", &wah->depth, 0.7f);
config->get_float(userdata, "resonance", &wah->res, 2.5f); config->get_float(userdata, "resonance", &wah->res, 2.5f);
wah->lfoskip = wah->freq * 2.0 * M_PI / info->input_rate; wah->lfoskip = wah->freq * 2.0f * M_PI / info->input_rate;
wah->phase = wah->startphase * M_PI / 180.0; wah->phase = wah->startphase * M_PI / 180.0f;
return wah; return wah;
} }

View File

@ -68,24 +68,17 @@ const static unsigned char unb64[]={
*/ */
char* base64(const void* binaryData, int len, int *flen) char* base64(const void* binaryData, int len, int *flen)
{ {
const unsigned char* bin = (const unsigned char*) binaryData;
char* res; char* res;
int rc = 0; /* result counter */
int byteNo; /* I need this after the loop */ 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 ; int modulusLen = len % 3 ;
/* 2 gives 1 and 1 gives 2, but 0 gives 0. */ /* 2 gives 1 and 1 gives 2, but 0 gives 0. */
int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1); int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1);
*flen = 4*(len + pad)/3; *flen = 4*(len + pad)/3;
res = (char*) malloc(*flen + 1); /* and one for the null */ if (!(res = (char*) malloc(*flen + 1))) /* and one for the NULL */
if (!res)
{
/* ERROR: base64 could not allocate enough memory. */
return 0; return 0;
}
for (byteNo=0; byteNo <= len-3; byteNo+=3) for (byteNo=0; byteNo <= len-3; byteNo+=3)
{ {
@ -120,34 +113,29 @@ char* base64(const void* binaryData, int len, int *flen)
unsigned char* unbase64(const char* ascii, 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; int charNo;
unsigned char *bin;
const unsigned char *safeAsciiPtr = (const unsigned char*) ascii;
int cb = 0;
int pad = 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. */ /* catch empty string, return NULL as result. */
/* ERROR: You passed an invalid base64 string (too short). /* ERROR: You passed an invalid base64 string (too short).
* You get NULL back. */ * You get NULL back. */
*flen = 0; *flen = 0;
return 0; return 0;
} }
if(safeAsciiPtr[len-1]=='=') if (safeAsciiPtr[len-1]=='=')
++pad; ++pad;
if(safeAsciiPtr[len-2]=='=') if (safeAsciiPtr[len-2]=='=')
++pad; ++pad;
*flen = 3*len/4 - pad; *flen = 3*len/4 - pad;
bin = (unsigned char*)malloc(*flen); if (!(bin = (unsigned char*)malloc(*flen)))
if (!bin)
{
/* ERROR: unbase64 could not allocate enough memory. */
return 0; return 0;
}
for (charNo=0; charNo <= len-4-pad; charNo+=4) for (charNo=0; charNo <= len-4-pad; charNo+=4)
{ {

View File

@ -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. */ /* BGR24 byte order input matches output. Can directly copy, but... need to make sure we pad it. */
uint32_t zeros = 0; 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) for (j = 0; j < height; j++, u.u8 += pitch)
{ {
filestream_write(file, u.u8, pitch); filestream_write(file, u.u8, pitch);
if(pad != 0) if (padding != 0)
filestream_write(file, &zeros, pad); filestream_write(file, &zeros, padding);
} }
} }
break; 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 */ /* allocate line buffer, and initialize the final four bytes to zero, for deterministic padding */
line = (uint8_t*)malloc(line_size); if (!(line = (uint8_t*)malloc(line_size)))
if (!line)
return; return;
*(uint32_t*)(line + line_size - 4) = 0; *(uint32_t*)(line + line_size - 4) = 0;

View File

@ -118,7 +118,7 @@ rxml_document_t *rxml_load_document(const char *path)
error: error:
free(memory_buffer); free(memory_buffer);
if(file) if (file)
filestream_close(file); filestream_close(file);
return NULL; return NULL;
} }

View File

@ -75,22 +75,22 @@ static INLINE int16_t tofloat16(float f)
e = ((i >> 23) & 0x000000ff) - (127 - 15); e = ((i >> 23) & 0x000000ff) - (127 - 15);
m = i & 0x007fffff; m = i & 0x007fffff;
if(e <= 0) if (e <= 0)
{ {
if(e < -10) if (e < -10)
return (int16_t)(s); return (int16_t)(s);
m = (m | 0x00800000) >> (1 - e); m = (m | 0x00800000) >> (1 - e);
if(m & 0x00001000) if (m & 0x00001000)
m += 0x00002000; m += 0x00002000;
return (int16_t)(s | (m >> 13)); return (int16_t)(s | (m >> 13));
} }
if(e == 0xff - (127 - 15)) if (e == 0xff - (127 - 15))
{ {
if(m == 0) if (m == 0)
return (int16_t)(s | 0x7c00); return (int16_t)(s | 0x7c00);
m >>= 13; m >>= 13;
@ -98,11 +98,11 @@ static INLINE int16_t tofloat16(float f)
return (int16_t)(s | 0x7c00 | m | (m == 0)); return (int16_t)(s | 0x7c00 | m | (m == 0));
} }
if(m & 0x00001000) if (m & 0x00001000)
{ {
m += 0x00002000; m += 0x00002000;
if(m & 0x00800000) if (m & 0x00800000)
{ {
m = 0; m = 0;
e += 1; e += 1;

View File

@ -66,8 +66,9 @@ static void crash(void)
cothread_t co_create(unsigned int size, void (*entrypoint)(void)) cothread_t co_create(unsigned int size, void (*entrypoint)(void))
{ {
size = (size + 1023) & ~1023; uint64_t *ptr = NULL;
cothread_t handle = 0; cothread_t handle = 0;
size = (size + 1023) & ~1023;
#if HAVE_POSIX_MEMALIGN >= 1 #if HAVE_POSIX_MEMALIGN >= 1
if (posix_memalign(&handle, 1024, size + 512) < 0) if (posix_memalign(&handle, 1024, size + 512) < 0)
return 0; return 0;
@ -78,7 +79,7 @@ cothread_t co_create(unsigned int size, void (*entrypoint)(void))
if (!handle) if (!handle)
return handle; return handle;
uint64_t *ptr = (uint64_t*)handle; ptr = (uint64_t*)handle;
/* Non-volatiles. */ /* Non-volatiles. */
ptr[0] = 0; /* x8 */ ptr[0] = 0; /* x8 */
ptr[1] = 0; /* x9 */ ptr[1] = 0; /* x9 */

Some files were not shown because too many files have changed in this diff Show More