(RPNG) cleanups

This commit is contained in:
twinaphex 2016-03-21 19:43:29 +01:00
parent 4d30df7a64
commit 483699357d
3 changed files with 18 additions and 17 deletions

View File

@ -23,9 +23,9 @@
#ifndef _RPNG_COMMON_H
#define _RPNG_COMMON_H
#include <retro_inline.h>
#include <formats/rpng.h>
#include <stdint.h>
#include <filters.h>
#include <formats/rpng.h>
#undef GOTO_END_ERROR
#define GOTO_END_ERROR() do { \
@ -53,19 +53,4 @@ struct png_ihdr
uint8_t interlace;
};
/* Paeth prediction filter. */
static INLINE int paeth(int a, int b, int c)
{
int p = a + b - c;
int pa = abs(p - a);
int pb = abs(p - b);
int pc = abs(p - c);
if (pa <= pb && pa <= pc)
return a;
else if (pb <= pc)
return b;
return c;
}
#endif

View File

@ -21,6 +21,7 @@ SOURCES_C := \
$(LIBRETRO_COMM_DIR)/file/archive_file.c \
$(LIBRETRO_COMM_DIR)/file/archive_file_zlib.c \
$(LIBRETRO_COMM_DIR)//file/file_path.c \
$(LIBRETRO_COMM_DIR)//file/retro_stat.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
$(LIBRETRO_COMM_DIR)/lists/string_list.c

View File

@ -33,6 +33,21 @@ static INLINE double sinc(double val)
return sin(val) / val;
}
/* Paeth prediction filter. */
static INLINE int paeth(int a, int b, int c)
{
int p = a + b - c;
int pa = abs(p - a);
int pb = abs(p - b);
int pc = abs(p - c);
if (pa <= pb && pa <= pc)
return a;
else if (pb <= pc)
return b;
return c;
}
/* Modified Bessel function of first order.
* Check Wiki for mathematical definition ... */
static INLINE double besseli0(double x)