diff --git a/Core/HW/Atrac3Standalone.cpp b/Core/HW/Atrac3Standalone.cpp index eecc5a9c97..df763de6c0 100644 --- a/Core/HW/Atrac3Standalone.cpp +++ b/Core/HW/Atrac3Standalone.cpp @@ -1,5 +1,3 @@ -#pragma once - #include "SimpleAudioDec.h" #include "ext/at3_standalone/at3_decoders.h" @@ -99,7 +97,7 @@ public: // Hmm. ignore for now. } - void SetExtraData(const uint8_t *data, int size, int wav_bytes_per_packet) { + void SetExtraData(const uint8_t *data, int size, int wav_bytes_per_packet) override { // if (audioType_ == PSP_CODEC_AT3PLUS) { _dbg_assert_(ctx_); _dbg_assert_(!codecOpen_); diff --git a/ext/at3_standalone/compat.cpp b/ext/at3_standalone/compat.cpp index a9c1f1c056..319d22b3db 100644 --- a/ext/at3_standalone/compat.cpp +++ b/ext/at3_standalone/compat.cpp @@ -5,17 +5,3 @@ #include "ext/at3_standalone/compat.h" void av_log(int level, const char *fmt, ...) {} - -int av_get_cpu_flags(void) { - return 0; -} - -size_t av_strlcpy(char *dst, const char *src, size_t size) -{ - size_t len = 0; - while (++len < size && *src) - *dst++ = *src++; - if (len <= size) - *dst = 0; - return len + strlen(src) - 1; -} diff --git a/ext/at3_standalone/compat.h b/ext/at3_standalone/compat.h index 2632af72c9..4e85bb35b6 100644 --- a/ext/at3_standalone/compat.h +++ b/ext/at3_standalone/compat.h @@ -1,5 +1,7 @@ #pragma once +#include + // Compat hacks #if defined(__GNUC__) @@ -13,6 +15,8 @@ #define DECLARE_ASM_CONST(n,t,v) static const t v #endif +#define AV_HAVE_FAST_UNALIGNED 0 + #define LOCAL_ALIGNED(bits, type, name, subscript) type name subscript #define av_restrict #define av_alias @@ -72,35 +76,6 @@ void av_log(int level, const char *fmt, ...) av_printf_format(3, 4); #pragma warning(disable:4305) #pragma warning(disable:4244) -int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc); - -/** - * Copy the string src to dst, but no more than size - 1 bytes, and - * null-terminate dst. - * - * This function is the same as BSD strlcpy(). - * - * @param dst destination buffer - * @param src source string - * @param size size of destination buffer - * @return the length of src - * - * @warning since the return value is the length of src, src absolutely - * _must_ be a properly 0-terminated string, otherwise this will read beyond - * the end of the buffer and possibly crash. - */ -size_t av_strlcpy(char *dst, const char *src, size_t size); - -/** - * Locale-independent conversion of ASCII characters to uppercase. - */ -static inline int av_toupper(int c) -{ - if (c >= 'a' && c <= 'z') - c ^= 0x20; - return c; -} - #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) #define av_be2ne32(x) AV_BSWAP32C((x)) diff --git a/ext/at3_standalone/fft.cpp b/ext/at3_standalone/fft.cpp index 10914d0504..c638b9be87 100644 --- a/ext/at3_standalone/fft.cpp +++ b/ext/at3_standalone/fft.cpp @@ -54,7 +54,7 @@ COSTABLE(16384); COSTABLE(32768); COSTABLE(65536); -FFTSample * const ff_cos_tabs[] = { +static FFTSample * const ff_cos_tabs[] = { NULL, NULL, NULL, NULL, ff_cos_16, ff_cos_32, diff --git a/ext/at3_standalone/fft.h b/ext/at3_standalone/fft.h index 79725efcbf..65e7b3a1fb 100644 --- a/ext/at3_standalone/fft.h +++ b/ext/at3_standalone/fft.h @@ -88,7 +88,6 @@ extern COSTABLE(8192); extern COSTABLE(16384); extern COSTABLE(32768); extern COSTABLE(65536); -extern FFTSample* const ff_cos_tabs[17]; /** * Initialize the cosine table in ff_cos_tabs[index] diff --git a/ext/at3_standalone/intreadwrite.h b/ext/at3_standalone/intreadwrite.h index 21ea176213..c6d776c10e 100644 --- a/ext/at3_standalone/intreadwrite.h +++ b/ext/at3_standalone/intreadwrite.h @@ -16,9 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVUTIL_INTREADWRITE_H -#define AVUTIL_INTREADWRITE_H - +#pragma once #include #include "compat.h" @@ -44,45 +42,7 @@ typedef union { uint8_t u8 [2]; } av_alias av_alias16; -/* - * Arch-specific headers can provide any combination of - * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. - * Preprocessor symbols must be defined, even if these are implemented - * as inline functions. - * - * R/W means read/write, B/L/N means big/little/native endianness. - * The following macros require aligned access, compared to their - * unaligned variants: AV_(COPY|SWAP|ZERO)(64|128), AV_[RW]N[8-64]A. - * Incorrect usage may range from abysmal performance to crash - * depending on the platform. - * - * The unaligned variants are AV_[RW][BLN][8-64] and AV_COPY*U. - */ - -#ifdef HAVE_AV_CONFIG_H - -#include "config.h" - -#if ARCH_ARM -# include "arm/intreadwrite.h" -#elif ARCH_AVR32 -# include "avr32/intreadwrite.h" -#elif ARCH_MIPS -# include "mips/intreadwrite.h" -#elif ARCH_PPC -# include "ppc/intreadwrite.h" -#elif ARCH_TOMI -# include "tomi/intreadwrite.h" -#elif ARCH_X86 -# include "x86/intreadwrite.h" -#endif - -#endif /* HAVE_AV_CONFIG_H */ - -/* - * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. - */ - +#include "compat.h" # if defined(AV_RN16) && !defined(AV_RL16) # define AV_RL16(p) AV_RN16(p) @@ -148,22 +108,7 @@ typedef union { * Define AV_[RW]N helper macros to simplify definitions not provided * by per-arch headers. */ - -#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) - -union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; -union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; -union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; - -# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) -# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) - -#elif defined(__DECC) - -# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) -# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) - -#elif AV_HAVE_FAST_UNALIGNED +#if AV_HAVE_FAST_UNALIGNED # define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) # define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) @@ -280,13 +225,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; } while(0) #endif -#if AV_HAVE_BIGENDIAN -# define AV_RN(s, p) AV_RB##s(p) -# define AV_WN(s, p, v) AV_WB##s(p, v) -#else # define AV_RN(s, p) AV_RL##s(p) # define AV_WN(s, p, v) AV_WL##s(p, v) -#endif #endif /* HAVE_FAST_UNALIGNED */ @@ -314,17 +254,10 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; # define AV_WN64(p, v) AV_WN(64, p, v) #endif -#if AV_HAVE_BIGENDIAN -# define AV_RB(s, p) AV_RN##s(p) -# define AV_WB(s, p, v) AV_WN##s(p, v) -# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) -# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) -#else # define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) # define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) # define AV_RL(s, p) AV_RN##s(p) # define AV_WL(s, p, v) AV_WN##s(p, v) -#endif #define AV_RB8(x) (((const uint8_t*)(x))[0]) #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) @@ -401,5 +334,3 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; ((uint8_t*)(p))[2] = (d)>>16; \ } while(0) #endif - -#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/ext/at3_standalone/sinewin.cpp b/ext/at3_standalone/sinewin.cpp index 3af4289101..fa154184a8 100644 --- a/ext/at3_standalone/sinewin.cpp +++ b/ext/at3_standalone/sinewin.cpp @@ -38,7 +38,9 @@ SINETABLE(2048); SINETABLE(4096); SINETABLE(8192); -float * const ff_sine_windows[] = { +// Thie array is only accessed in init. However, not so for the +// sine tables it points to. +static float *ff_sine_windows[] = { NULL, NULL, NULL, NULL, NULL, // unused ff_sine_32 , ff_sine_64, ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, diff --git a/ext/at3_standalone/sinewin.h b/ext/at3_standalone/sinewin.h index bf2b2efc17..2aec7727f2 100644 --- a/ext/at3_standalone/sinewin.h +++ b/ext/at3_standalone/sinewin.h @@ -44,5 +44,3 @@ extern SINETABLE(1024); extern SINETABLE(2048); extern SINETABLE(4096); extern SINETABLE(8192); - -extern float * const ff_sine_windows[14];