Moved to NEON accelerated memcpy for lodepng.

This commit is contained in:
Rinnegatamante
2020-10-24 16:54:08 +02:00
parent 173c9a14d0
commit 6a495fc939
+8 -4
View File
@@ -28,6 +28,7 @@ The manual and changelog are in the header file "lodepng.h"
Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C. Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C.
*/ */
#include <vitaGL.h>
#include "lodepng.h" #include "lodepng.h"
#ifdef LODEPNG_COMPILE_DISK #ifdef LODEPNG_COMPILE_DISK
@@ -117,7 +118,7 @@ void lodepng_free(void* ptr);
where a full C library is not available. The compiler can recognize them and compile where a full C library is not available. The compiler can recognize them and compile
to something as fast. */ to something as fast. */
static void lodepng_memcpy(void* LODEPNG_RESTRICT dst, /*static void lodepng_memcpy(void* LODEPNG_RESTRICT dst,
const void* LODEPNG_RESTRICT src, size_t size) { const void* LODEPNG_RESTRICT src, size_t size) {
size_t i; size_t i;
for(i = 0; i < size; i++) ((char*)dst)[i] = ((const char*)src)[i]; for(i = 0; i < size; i++) ((char*)dst)[i] = ((const char*)src)[i];
@@ -129,14 +130,17 @@ static void lodepng_memset(void* LODEPNG_RESTRICT dst,
for(i = 0; i < num; i++) ((char*)dst)[i] = (char)value; for(i = 0; i < num; i++) ((char*)dst)[i] = (char)value;
} }
/* does not check memory out of bounds, do not use on untrusted data */ does not check memory out of bounds, do not use on untrusted data
static size_t lodepng_strlen(const char* a) { static size_t lodepng_strlen(const char* a) {
const char* orig = a; const char* orig = a;
/* avoid warning about unused function in case of disabled COMPILE... macros */ /* avoid warning about unused function in case of disabled COMPILE... macros
(void)(&lodepng_strlen); (void)(&lodepng_strlen);
while(*a) a++; while(*a) a++;
return (size_t)(a - orig); return (size_t)(a - orig);
} }*/
#define lodepng_memcpy memcpy_neon
#define lodepng_memset memset
#define lodepng_strlen strlen
#define LODEPNG_MAX(a, b) (((a) > (b)) ? (a) : (b)) #define LODEPNG_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define LODEPNG_MIN(a, b) (((a) < (b)) ? (a) : (b)) #define LODEPNG_MIN(a, b) (((a) < (b)) ? (a) : (b))