mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-13 13:28:49 +00:00
Cleanups
This commit is contained in:
parent
2269aff9aa
commit
b5f7ccab22
@ -653,7 +653,7 @@ bool write_file(const char *path, const void *data, ssize_t size)
|
|||||||
*/
|
*/
|
||||||
static int read_generic_file(const char *path, void **buf, ssize_t *len)
|
static int read_generic_file(const char *path, void **buf, ssize_t *len)
|
||||||
{
|
{
|
||||||
long ret = 0;
|
size_t bytes_read = 0;
|
||||||
ssize_t content_buf_size = 0;
|
ssize_t content_buf_size = 0;
|
||||||
void *content_buf = NULL;
|
void *content_buf = NULL;
|
||||||
FILE *file = fopen(path, "rb");
|
FILE *file = fopen(path, "rb");
|
||||||
@ -675,7 +675,7 @@ static int read_generic_file(const char *path, void **buf, ssize_t *len)
|
|||||||
if (!content_buf)
|
if (!content_buf)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if ((ret = fread(content_buf, 1, content_buf_size, file)) < content_buf_size)
|
if ((bytes_read = fread(content_buf, 1, content_buf_size, file)) < content_buf_size)
|
||||||
RARCH_WARN("Didn't read whole file.\n");
|
RARCH_WARN("Didn't read whole file.\n");
|
||||||
|
|
||||||
*buf = content_buf;
|
*buf = content_buf;
|
||||||
@ -688,7 +688,7 @@ static int read_generic_file(const char *path, void **buf, ssize_t *len)
|
|||||||
RARCH_WARN("Failed to close file stream.\n");
|
RARCH_WARN("Failed to close file stream.\n");
|
||||||
|
|
||||||
if (len)
|
if (len)
|
||||||
*len = ret;
|
*len = bytes_read;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -109,15 +109,13 @@ static void lq2x_generic_rgb565(unsigned width, unsigned height,
|
|||||||
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned x, y;
|
unsigned x, y;
|
||||||
uint16_t *out0, *out1;
|
uint16_t *out0 = (uint16_t*)dst;
|
||||||
out0 = (uint16_t*)dst;
|
uint16_t *out1 = (uint16_t*)(dst + dst_stride);
|
||||||
out1 = (uint16_t*)(dst + dst_stride);
|
|
||||||
|
|
||||||
for(y = 0; y < height; y++)
|
for(y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
int prevline, nextline;
|
int prevline = (y == 0 ? 0 : src_stride);
|
||||||
prevline = (y == 0 ? 0 : src_stride);
|
int nextline = (y == height - 1 || last) ? 0 : src_stride;
|
||||||
nextline = (y == height - 1 || last) ? 0 : src_stride;
|
|
||||||
|
|
||||||
for(x = 0; x < width; x++)
|
for(x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
@ -156,9 +154,8 @@ static void lq2x_generic_xrgb8888(unsigned width, unsigned height,
|
|||||||
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned x, y;
|
unsigned x, y;
|
||||||
uint32_t *out0, *out1;
|
uint32_t *out0 = (uint32_t*)dst;
|
||||||
out0 = (uint32_t*)dst;
|
uint32_t *out1 = (uint32_t*)(dst + dst_stride);
|
||||||
out1 = (uint32_t*)(dst + dst_stride);
|
|
||||||
|
|
||||||
for(y = 0; y < height; y++)
|
for(y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
|
@ -101,9 +101,9 @@ static void scale2x_generic_xrgb8888(unsigned width, unsigned height,
|
|||||||
uint32_t *dst, unsigned dst_stride)
|
uint32_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned x, y;
|
unsigned x, y;
|
||||||
uint32_t *out0, *out1;
|
uint32_t *out0 = (uint32_t*)dst;
|
||||||
out0 = (uint32_t*)dst;
|
uint32_t *out1 = (uint32_t*)(dst + dst_stride);
|
||||||
out1 = (uint32_t*)(dst + dst_stride);
|
|
||||||
SCALE2X_GENERIC(uint32_t, width, height, first, last,
|
SCALE2X_GENERIC(uint32_t, width, height, first, last,
|
||||||
src, src_stride, dst, dst_stride, out0, out1);
|
src, src_stride, dst, dst_stride, out0, out1);
|
||||||
}
|
}
|
||||||
|
@ -68,16 +68,18 @@ static void *supertwoxsai_generic_create(const struct softfilter_config *config,
|
|||||||
unsigned max_width, unsigned max_height,
|
unsigned max_width, unsigned max_height,
|
||||||
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));
|
||||||
|
if (!filt)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
(void)simd;
|
(void)simd;
|
||||||
(void)config;
|
(void)config;
|
||||||
(void)userdata;
|
(void)userdata;
|
||||||
|
|
||||||
struct filter_data *filt = (struct filter_data*)calloc(1, sizeof(*filt));
|
|
||||||
if (!filt)
|
|
||||||
return NULL;
|
|
||||||
filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data));
|
filt->workers = (struct softfilter_thread_data*)calloc(threads, sizeof(struct softfilter_thread_data));
|
||||||
filt->threads = 1;
|
filt->threads = 1;
|
||||||
filt->in_fmt = in_fmt;
|
filt->in_fmt = in_fmt;
|
||||||
|
|
||||||
if (!filt->workers)
|
if (!filt->workers)
|
||||||
{
|
{
|
||||||
free(filt);
|
free(filt);
|
||||||
@ -202,8 +204,8 @@ static void supertwoxsai_generic_xrgb8888(unsigned width, unsigned height,
|
|||||||
int first, int last, uint32_t *src,
|
int first, int last, uint32_t *src,
|
||||||
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned nextline, finish;
|
unsigned finish;
|
||||||
nextline = (last) ? 0 : src_stride;
|
unsigned nextline = (last) ? 0 : src_stride;
|
||||||
|
|
||||||
for (; height; height--)
|
for (; height; height--)
|
||||||
{
|
{
|
||||||
@ -232,8 +234,8 @@ static void supertwoxsai_generic_rgb565(unsigned width, unsigned height,
|
|||||||
int first, int last, uint16_t *src,
|
int first, int last, uint16_t *src,
|
||||||
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned nextline, finish;
|
unsigned finish;
|
||||||
nextline = (last) ? 0 : src_stride;
|
unsigned nextline = (last) ? 0 : src_stride;
|
||||||
|
|
||||||
for (; height; height--)
|
for (; height; height--)
|
||||||
{
|
{
|
||||||
@ -287,8 +289,9 @@ static void supertwoxsai_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*)&filt->workers[i];
|
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)&filt->workers[i];
|
||||||
|
@ -219,8 +219,8 @@ static void supereagle_generic_xrgb8888(unsigned width, unsigned height,
|
|||||||
int first, int last, uint32_t *src,
|
int first, int last, uint32_t *src,
|
||||||
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned finish, nextline;
|
unsigned finish;
|
||||||
nextline = (last) ? 0 : src_stride;
|
unsigned nextline = (last) ? 0 : src_stride;
|
||||||
|
|
||||||
for (; height; height--)
|
for (; height; height--)
|
||||||
{
|
{
|
||||||
@ -243,8 +243,8 @@ static void supereagle_generic_rgb565(unsigned width, unsigned height,
|
|||||||
int first, int last, uint16_t *src,
|
int first, int last, uint16_t *src,
|
||||||
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
|
||||||
{
|
{
|
||||||
unsigned nextline, finish;
|
unsigned finish;
|
||||||
nextline = (last) ? 0 : src_stride;
|
unsigned nextline = (last) ? 0 : src_stride;
|
||||||
|
|
||||||
for (; height; height--)
|
for (; height; height--)
|
||||||
{
|
{
|
||||||
@ -292,8 +292,9 @@ static void supereagle_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*)&filt->workers[i];
|
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)&filt->workers[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user