Start implementing video softfilters - move it to Video Options
This commit is contained in:
parent
3ce7ada790
commit
be5f3254ba
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "softfilter.h"
|
#include "softfilter.h"
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef RARCH_INTERNAL
|
#ifdef RARCH_INTERNAL
|
||||||
|
@ -75,7 +76,7 @@ static void *epx_generic_create(const struct softfilter_config *config,
|
||||||
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 = threads;
|
filt->threads = 1;
|
||||||
filt->in_fmt = in_fmt;
|
filt->in_fmt = in_fmt;
|
||||||
if (!filt->workers)
|
if (!filt->workers)
|
||||||
{
|
{
|
||||||
|
@ -104,15 +105,19 @@ static void epx_generic_destroy(void *data)
|
||||||
free(filt);
|
free(filt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EPX_16 (int width, int height,
|
static void EPX_16(int width, int height,
|
||||||
int first, int last,
|
int first, int last,
|
||||||
uint16_t *src, int src_stride, uint16_t *dst, int dst_stride)
|
uint16_t *src, unsigned src_stride, uint16_t *dst,
|
||||||
|
unsigned dst_stride)
|
||||||
{
|
{
|
||||||
uint16_t colorX, colorA, colorB, colorC, colorD;
|
uint16_t colorX, colorA, colorB, colorC, colorD;
|
||||||
uint16_t *sP, *uP, *lP;
|
uint16_t *sP = NULL, *uP = NULL, *lP = NULL;
|
||||||
uint32_t *dP1, *dP2;
|
uint32_t *dP1 = NULL, *dP2 = NULL;
|
||||||
int w, prevline;
|
int w, prevline;
|
||||||
|
|
||||||
|
if (!src || !dst)
|
||||||
|
return;
|
||||||
|
|
||||||
prevline = (first) ? 0 : src_stride;
|
prevline = (first) ? 0 : src_stride;
|
||||||
|
|
||||||
height -= 2;
|
height -= 2;
|
||||||
|
@ -125,9 +130,9 @@ static void EPX_16 (int width, int height,
|
||||||
/* top edge */
|
/* top edge */
|
||||||
|
|
||||||
sP = (uint16_t *)(src - prevline);
|
sP = (uint16_t *)(src - prevline);
|
||||||
lP = (uint16_t *) (src + src_stride);
|
lP = (uint16_t *)(src + src_stride);
|
||||||
dP1 = (uint32_t *) dst;
|
dP1 = (uint32_t *)(dst);
|
||||||
dP2 = (uint32_t *) (dst + dst_stride);
|
dP2 = (uint32_t *)(dst + dst_stride);
|
||||||
|
|
||||||
// left edge
|
// left edge
|
||||||
|
|
||||||
|
|
|
@ -455,13 +455,6 @@ static int action_ok_cheat_file(const char *path,
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!path_file_exists(g_settings.cheat_database))
|
|
||||||
{
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue, "Cheat Directory doesn't exist or cannot be accessed.\n", 1, 180);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return menu_list_push_stack_refresh(
|
return menu_list_push_stack_refresh(
|
||||||
menu->menu_list,
|
menu->menu_list,
|
||||||
g_settings.cheat_database,
|
g_settings.cheat_database,
|
||||||
|
@ -471,25 +464,21 @@ static int action_ok_cheat_file(const char *path,
|
||||||
static int action_ok_audio_dsp_plugin(const char *path,
|
static int action_ok_audio_dsp_plugin(const char *path,
|
||||||
const char *label, unsigned type, size_t idx)
|
const char *label, unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
if (!path_file_exists(path))
|
|
||||||
{
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue, "Audio Filter Directory doesn't exist or cannot be accessed.\n", 1, 180);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_video_filter(const char *path,
|
static int action_ok_video_filter(const char *path,
|
||||||
const char *label, unsigned type, size_t idx)
|
const char *label, unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
if (!path_file_exists(path))
|
menu_handle_t *menu = menu_driver_resolve();
|
||||||
{
|
if (!menu)
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue, "Video Filter Directory doesn't exist or cannot be accessed.\n", 1, 180);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
return 0;
|
return menu_list_push_stack_refresh(
|
||||||
|
menu->menu_list,
|
||||||
|
g_settings.video.filter_dir,
|
||||||
|
"deferred_video_filter",
|
||||||
|
0, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_ok_remap_file(const char *path,
|
static int action_ok_remap_file(const char *path,
|
||||||
|
@ -499,12 +488,6 @@ static int action_ok_remap_file(const char *path,
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!path_file_exists(g_settings.input_remapping_directory))
|
|
||||||
{
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue, "Remapping Directory doesn't exist or cannot be accessed.\n", 1, 180);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return menu_list_push_stack_refresh(
|
return menu_list_push_stack_refresh(
|
||||||
menu->menu_list,
|
menu->menu_list,
|
||||||
g_settings.input_remapping_directory,
|
g_settings.input_remapping_directory,
|
||||||
|
@ -518,12 +501,6 @@ static int action_ok_core_list(const char *path,
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!path_file_exists(g_settings.libretro_directory))
|
|
||||||
{
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue, "Core Directory doesn't exist or cannot be accessed.\n", 1, 180);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return menu_list_push_stack_refresh(
|
return menu_list_push_stack_refresh(
|
||||||
menu->menu_list,
|
menu->menu_list,
|
||||||
g_settings.libretro_directory,
|
g_settings.libretro_directory,
|
||||||
|
@ -553,6 +530,33 @@ static int action_ok_remap_file_load(const char *path,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int action_ok_video_filter_file_load(const char *path,
|
||||||
|
const char *label, unsigned type, size_t idx)
|
||||||
|
{
|
||||||
|
const char *menu_path = NULL;
|
||||||
|
char filter_path[PATH_MAX_LENGTH];
|
||||||
|
menu_handle_t *menu = menu_driver_resolve();
|
||||||
|
if (!menu)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
(void)filter_path;
|
||||||
|
(void)menu_path;
|
||||||
|
|
||||||
|
menu_list_get_last_stack(menu->menu_list, &menu_path, NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
fill_pathname_join(filter_path, menu_path, path, sizeof(filter_path));
|
||||||
|
|
||||||
|
strlcpy(g_settings.video.softfilter_plugin, filter_path,
|
||||||
|
sizeof(g_settings.video.softfilter_plugin));
|
||||||
|
|
||||||
|
rarch_main_command(RARCH_CMD_REINIT);
|
||||||
|
|
||||||
|
menu_list_flush_stack_by_needle(menu->menu_list, "video_options");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int action_ok_cheat_file_load(const char *path,
|
static int action_ok_cheat_file_load(const char *path,
|
||||||
const char *label, unsigned type, size_t idx)
|
const char *label, unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
|
@ -1358,14 +1362,6 @@ static int action_ok_database_manager_list(const char *path,
|
||||||
fill_pathname_join(rdb_path, g_settings.content_database,
|
fill_pathname_join(rdb_path, g_settings.content_database,
|
||||||
path, sizeof(rdb_path));
|
path, sizeof(rdb_path));
|
||||||
|
|
||||||
if (!path_file_exists(rdb_path))
|
|
||||||
{
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue,
|
|
||||||
"Database Directory doesn't exist or cannot be accessed.\n",
|
|
||||||
1, 180);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return menu_list_push_stack_refresh(
|
return menu_list_push_stack_refresh(
|
||||||
menu->menu_list,
|
menu->menu_list,
|
||||||
rdb_path,
|
rdb_path,
|
||||||
|
@ -1385,14 +1381,6 @@ static int action_ok_cursor_manager_list(const char *path,
|
||||||
fill_pathname_join(cursor_path, g_settings.cursor_directory,
|
fill_pathname_join(cursor_path, g_settings.cursor_directory,
|
||||||
path, sizeof(cursor_path));
|
path, sizeof(cursor_path));
|
||||||
|
|
||||||
if (!path_file_exists(cursor_path))
|
|
||||||
{
|
|
||||||
msg_queue_clear(g_extern.msg_queue);
|
|
||||||
msg_queue_push(g_extern.msg_queue,
|
|
||||||
"Cursor Directory doesn't exist or cannot be accessed.\n",
|
|
||||||
1, 180);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return menu_list_push_stack_refresh(
|
return menu_list_push_stack_refresh(
|
||||||
menu->menu_list,
|
menu->menu_list,
|
||||||
cursor_path,
|
cursor_path,
|
||||||
|
@ -3228,6 +3216,10 @@ static int deferred_push_video_options(void *data, void *userdata,
|
||||||
#endif
|
#endif
|
||||||
menu_list_push(list, "Custom Ratio", "",
|
menu_list_push(list, "Custom Ratio", "",
|
||||||
MENU_SETTINGS_CUSTOM_VIEWPORT, 0);
|
MENU_SETTINGS_CUSTOM_VIEWPORT, 0);
|
||||||
|
#ifndef HAVE_FILTERS_BUILTIN
|
||||||
|
menu_list_push(list, "Video Filter", "video_filter",
|
||||||
|
0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (driver.menu_ctx && driver.menu_ctx->populate_entries)
|
if (driver.menu_ctx && driver.menu_ctx->populate_entries)
|
||||||
driver.menu_ctx->populate_entries(path, label, type);
|
driver.menu_ctx->populate_entries(path, label, type);
|
||||||
|
@ -5580,9 +5572,11 @@ static void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs,
|
||||||
case MENU_FILE_FONT:
|
case MENU_FILE_FONT:
|
||||||
case MENU_FILE_OVERLAY:
|
case MENU_FILE_OVERLAY:
|
||||||
case MENU_FILE_AUDIOFILTER:
|
case MENU_FILE_AUDIOFILTER:
|
||||||
case MENU_FILE_VIDEOFILTER:
|
|
||||||
cbs->action_ok = action_ok_set_path;
|
cbs->action_ok = action_ok_set_path;
|
||||||
break;
|
break;
|
||||||
|
case MENU_FILE_VIDEOFILTER:
|
||||||
|
cbs->action_ok = action_ok_video_filter_file_load;
|
||||||
|
break;
|
||||||
#ifdef HAVE_COMPRESSION
|
#ifdef HAVE_COMPRESSION
|
||||||
case MENU_FILE_IN_CARCHIVE:
|
case MENU_FILE_IN_CARCHIVE:
|
||||||
#endif
|
#endif
|
||||||
|
@ -5933,6 +5927,8 @@ static void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
|
||||||
cbs->action_deferred_push = deferred_push_category;
|
cbs->action_deferred_push = deferred_push_category;
|
||||||
else if (!strcmp(label, "deferred_core_list"))
|
else if (!strcmp(label, "deferred_core_list"))
|
||||||
cbs->action_deferred_push = deferred_push_core_list_deferred;
|
cbs->action_deferred_push = deferred_push_core_list_deferred;
|
||||||
|
else if (!strcmp(label, "deferred_video_filter"))
|
||||||
|
cbs->action_deferred_push = deferred_push_video_filter;
|
||||||
else if (!strcmp(label, "deferred_database_manager_list"))
|
else if (!strcmp(label, "deferred_database_manager_list"))
|
||||||
cbs->action_deferred_push = deferred_push_database_manager_list_deferred;
|
cbs->action_deferred_push = deferred_push_database_manager_list_deferred;
|
||||||
else if (!strcmp(label, "deferred_cursor_manager_list"))
|
else if (!strcmp(label, "deferred_cursor_manager_list"))
|
||||||
|
|
|
@ -2255,9 +2255,8 @@ bool rarch_main_command(unsigned cmd)
|
||||||
driver.input->poll(driver.input_data);
|
driver.input->poll(driver.input_data);
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
if (g_extern.is_menu) {
|
if (g_extern.is_menu)
|
||||||
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
|
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_CHEATS_DEINIT:
|
case RARCH_CMD_CHEATS_DEINIT:
|
||||||
|
|
|
@ -4274,21 +4274,6 @@ static bool setting_data_append_list_video_options(
|
||||||
general_write_handler,
|
general_write_handler,
|
||||||
general_read_handler);
|
general_read_handler);
|
||||||
|
|
||||||
#ifndef HAVE_FILTERS_BUILTIN
|
|
||||||
CONFIG_PATH(
|
|
||||||
g_settings.video.softfilter_plugin,
|
|
||||||
"video_filter",
|
|
||||||
"Software filter",
|
|
||||||
g_settings.video.filter_dir,
|
|
||||||
group_info.name,
|
|
||||||
subgroup_info.name,
|
|
||||||
general_write_handler,
|
|
||||||
general_read_handler);
|
|
||||||
settings_list_current_add_values(list, list_info, "filt");
|
|
||||||
settings_list_current_add_cmd(list, list_info, RARCH_CMD_REINIT);
|
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_XBOX1) || defined(HW_RVL)
|
#if defined(_XBOX1) || defined(HW_RVL)
|
||||||
CONFIG_BOOL(
|
CONFIG_BOOL(
|
||||||
g_extern.console.softfilter_enable,
|
g_extern.console.softfilter_enable,
|
||||||
|
|
Loading…
Reference in New Issue