mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 03:40:24 +00:00
(SoftFilter) Bump up API version - start supporting config files
(stub for now)
This commit is contained in:
parent
374d9357d4
commit
0bd97eb1ba
@ -101,7 +101,6 @@ static int get_int(void *userdata, const char *key_str, int *value, int default_
|
||||
return got;
|
||||
}
|
||||
|
||||
// Yup, still C >__<
|
||||
#define get_array_setup() \
|
||||
struct dsp_userdata *dsp = (struct dsp_userdata*)userdata; \
|
||||
\
|
||||
|
@ -227,7 +227,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_path,
|
||||
filt->max_width = max_width;
|
||||
filt->max_height = max_height;
|
||||
|
||||
filt->impl_data = filt->impl->create(input_fmt, input_fmt, max_width, max_height,
|
||||
filt->impl_data = filt->impl->create(NULL, input_fmt, input_fmt, max_width, max_height,
|
||||
threads != RARCH_SOFTFILTER_THREADS_AUTO ? threads : rarch_get_cpu_cores(), cpu_features);
|
||||
if (!filt->impl_data)
|
||||
{
|
||||
|
@ -220,11 +220,13 @@ static void SetupFormat(void * data)
|
||||
}
|
||||
}
|
||||
|
||||
static void *twoxbr_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *twoxbr_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -63,11 +63,13 @@ static unsigned twoxsai_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *twoxsai_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *twoxsai_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -80,11 +80,13 @@ static void blargg_ntsc_snes_composite_initialize(void *data)
|
||||
filt->burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
static void *blargg_ntsc_snes_composite_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *blargg_ntsc_snes_composite_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -79,11 +79,13 @@ static void blargg_ntsc_snes_rf_initialize(void *data)
|
||||
filt->burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
static void *blargg_ntsc_snes_rf_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *blargg_ntsc_snes_rf_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -79,11 +79,13 @@ static void blargg_ntsc_snes_rgb_initialize(void *data)
|
||||
filt->burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
static void *blargg_ntsc_snes_rgb_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *blargg_ntsc_snes_rgb_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -79,11 +79,13 @@ static void blargg_ntsc_snes_svideo_initialize(void *data)
|
||||
filt->burst_toggle = (setup.merge_fields ? 0 : 1);
|
||||
}
|
||||
|
||||
static void *blargg_ntsc_snes_svideo_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *blargg_ntsc_snes_svideo_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -63,11 +63,13 @@ static unsigned darken_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *darken_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *darken_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -63,11 +63,13 @@ static unsigned epx_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *epx_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *epx_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -63,11 +63,13 @@ static unsigned lq2x_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *lq2x_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *lq2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -216,7 +216,8 @@ static unsigned phosphor2x_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *phosphor2x_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *phosphor2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
@ -227,6 +228,7 @@ static void *phosphor2x_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
(void)out_fmt;
|
||||
(void)max_width;
|
||||
(void)max_height;
|
||||
(void)config;
|
||||
|
||||
if (!filt)
|
||||
return NULL;
|
||||
|
@ -122,11 +122,13 @@ static unsigned scale2x_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *scale2x_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *scale2x_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -43,12 +43,42 @@ extern "C" {
|
||||
// Allows an implementation to pick different softfilter_implementation structs.
|
||||
typedef unsigned softfilter_simd_mask_t;
|
||||
|
||||
// Returns true if config key was found. Otherwise, returns false, and sets value to default value.
|
||||
typedef int (*softfilter_config_get_float_t)(void *userdata, const char *key, float *value, float default_value);
|
||||
typedef int (*softfilter_config_get_int_t)(void *userdata, const char *key, int *value, int default_value);
|
||||
|
||||
// Allocates an array with values. free() with softfilter_config_free_t.
|
||||
typedef int (*softfilter_config_get_float_array_t)(void *userdata, const char *key,
|
||||
float **values, unsigned *out_num_values,
|
||||
const float *default_values, unsigned num_default_values);
|
||||
|
||||
typedef int (*softfilter_config_get_int_array_t)(void *userdata, const char *key,
|
||||
int **values, unsigned *out_num_values,
|
||||
const int *default_values, unsigned num_default_values);
|
||||
|
||||
typedef int (*softfilter_config_get_string_t)(void *userdata, const char *key, char **output, const char *default_output);
|
||||
|
||||
// Calls free() in host runtime. Sometimes needed on Windows. free() on NULL is fine.
|
||||
typedef void (*softfilter_config_free_t)(void *ptr);
|
||||
|
||||
struct softfilter_config
|
||||
{
|
||||
softfilter_config_get_float_t get_float;
|
||||
softfilter_config_get_int_t get_int;
|
||||
|
||||
softfilter_config_get_float_array_t get_float_array;
|
||||
softfilter_config_get_int_array_t get_int_array;
|
||||
|
||||
softfilter_config_get_string_t get_string;
|
||||
softfilter_config_free_t free; // Avoid problems where softfilter plug and host are linked against different C runtimes.
|
||||
};
|
||||
|
||||
// Dynamic library entrypoint.
|
||||
typedef const struct softfilter_implementation *(*softfilter_get_implementation_t)(softfilter_simd_mask_t);
|
||||
// The same SIMD mask argument is forwarded to create() callback as well to avoid having to keep lots of state around.
|
||||
const struct softfilter_implementation *softfilter_get_implementation(softfilter_simd_mask_t simd);
|
||||
|
||||
#define SOFTFILTER_API_VERSION 1
|
||||
#define SOFTFILTER_API_VERSION 2
|
||||
|
||||
// Required base color formats
|
||||
|
||||
@ -79,7 +109,7 @@ struct softfilter_work_packet
|
||||
|
||||
// Create a filter with given input and output formats as well as maximum possible input size.
|
||||
// Input sizes can very per call to softfilter_process_t, but they will never be larger than the maximum.
|
||||
typedef void *(*softfilter_create_t)(unsigned in_fmt, unsigned out_fmt,
|
||||
typedef void *(*softfilter_create_t)(const struct softfilter_config *config, unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd);
|
||||
typedef void (*softfilter_destroy_t)(void *data);
|
||||
|
@ -63,11 +63,13 @@ static unsigned supertwoxsai_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *supertwoxsai_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *supertwoxsai_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
@ -63,11 +63,13 @@ static unsigned supereagle_generic_threads(void *data)
|
||||
return filt->threads;
|
||||
}
|
||||
|
||||
static void *supereagle_generic_create(unsigned in_fmt, unsigned out_fmt,
|
||||
static void *supereagle_generic_create(const struct softfilter_config *config,
|
||||
unsigned in_fmt, unsigned out_fmt,
|
||||
unsigned max_width, unsigned max_height,
|
||||
unsigned threads, softfilter_simd_mask_t simd)
|
||||
{
|
||||
(void)simd;
|
||||
(void)config;
|
||||
|
||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
||||
if (!filt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user