This commit is contained in:
twinaphex 2015-09-13 09:23:48 +02:00
parent 2269aff9aa
commit b5f7ccab22
5 changed files with 29 additions and 28 deletions

View File

@ -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)
{
long ret = 0;
size_t bytes_read = 0;
ssize_t content_buf_size = 0;
void *content_buf = NULL;
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)
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");
*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");
if (len)
*len = ret;
*len = bytes_read;
return 1;

View File

@ -109,15 +109,13 @@ static void lq2x_generic_rgb565(unsigned width, unsigned height,
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{
unsigned x, y;
uint16_t *out0, *out1;
out0 = (uint16_t*)dst;
out1 = (uint16_t*)(dst + dst_stride);
uint16_t *out0 = (uint16_t*)dst;
uint16_t *out1 = (uint16_t*)(dst + dst_stride);
for(y = 0; y < height; y++)
{
int prevline, nextline;
prevline = (y == 0 ? 0 : src_stride);
nextline = (y == height - 1 || last) ? 0 : src_stride;
int prevline = (y == 0 ? 0 : src_stride);
int nextline = (y == height - 1 || last) ? 0 : src_stride;
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 x, y;
uint32_t *out0, *out1;
out0 = (uint32_t*)dst;
out1 = (uint32_t*)(dst + dst_stride);
uint32_t *out0 = (uint32_t*)dst;
uint32_t *out1 = (uint32_t*)(dst + dst_stride);
for(y = 0; y < height; y++)
{

View File

@ -101,9 +101,9 @@ static void scale2x_generic_xrgb8888(unsigned width, unsigned height,
uint32_t *dst, unsigned dst_stride)
{
unsigned x, y;
uint32_t *out0, *out1;
out0 = (uint32_t*)dst;
out1 = (uint32_t*)(dst + dst_stride);
uint32_t *out0 = (uint32_t*)dst;
uint32_t *out1 = (uint32_t*)(dst + dst_stride);
SCALE2X_GENERIC(uint32_t, width, height, first, last,
src, src_stride, dst, dst_stride, out0, out1);
}

View File

@ -68,16 +68,18 @@ static void *supertwoxsai_generic_create(const struct softfilter_config *config,
unsigned max_width, unsigned max_height,
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)config;
(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->threads = 1;
filt->in_fmt = in_fmt;
if (!filt->workers)
{
free(filt);
@ -202,8 +204,8 @@ static void supertwoxsai_generic_xrgb8888(unsigned width, unsigned height,
int first, int last, uint32_t *src,
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
{
unsigned nextline, finish;
nextline = (last) ? 0 : src_stride;
unsigned finish;
unsigned nextline = (last) ? 0 : src_stride;
for (; height; height--)
{
@ -232,8 +234,8 @@ static void supertwoxsai_generic_rgb565(unsigned width, unsigned height,
int first, int last, uint16_t *src,
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{
unsigned nextline, finish;
nextline = (last) ? 0 : src_stride;
unsigned finish;
unsigned nextline = (last) ? 0 : src_stride;
for (; height; height--)
{
@ -287,8 +289,9 @@ static void supertwoxsai_generic_packets(void *data,
void *output, size_t output_stride,
const void *input, unsigned width, unsigned height, size_t input_stride)
{
struct filter_data *filt = (struct filter_data*)data;
unsigned i;
struct filter_data *filt = (struct filter_data*)data;
for (i = 0; i < filt->threads; i++)
{
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)&filt->workers[i];

View File

@ -219,8 +219,8 @@ static void supereagle_generic_xrgb8888(unsigned width, unsigned height,
int first, int last, uint32_t *src,
unsigned src_stride, uint32_t *dst, unsigned dst_stride)
{
unsigned finish, nextline;
nextline = (last) ? 0 : src_stride;
unsigned finish;
unsigned nextline = (last) ? 0 : src_stride;
for (; height; height--)
{
@ -243,8 +243,8 @@ static void supereagle_generic_rgb565(unsigned width, unsigned height,
int first, int last, uint16_t *src,
unsigned src_stride, uint16_t *dst, unsigned dst_stride)
{
unsigned nextline, finish;
nextline = (last) ? 0 : src_stride;
unsigned finish;
unsigned nextline = (last) ? 0 : src_stride;
for (; height; height--)
{
@ -292,8 +292,9 @@ static void supereagle_generic_packets(void *data,
void *output, size_t output_stride,
const void *input, unsigned width, unsigned height, size_t input_stride)
{
struct filter_data *filt = (struct filter_data*)data;
unsigned i;
struct filter_data *filt = (struct filter_data*)data;
for (i = 0; i < filt->threads; i++)
{
struct softfilter_thread_data *thr = (struct softfilter_thread_data*)&filt->workers[i];