mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-12 01:25:55 +00:00
Remove more unused code
This commit is contained in:
parent
a93bbf39ba
commit
5536ca4fda
@ -48,12 +48,6 @@ COSTABLE(128);
|
||||
COSTABLE(256);
|
||||
COSTABLE(512);
|
||||
COSTABLE(1024);
|
||||
COSTABLE(2048);
|
||||
COSTABLE(4096);
|
||||
COSTABLE(8192);
|
||||
COSTABLE(16384);
|
||||
COSTABLE(32768);
|
||||
COSTABLE(65536);
|
||||
|
||||
static FFTSample * const av_cos_tabs[] = {
|
||||
NULL, NULL, NULL, NULL,
|
||||
@ -64,12 +58,6 @@ static FFTSample * const av_cos_tabs[] = {
|
||||
av_cos_256,
|
||||
av_cos_512,
|
||||
av_cos_1024,
|
||||
av_cos_2048,
|
||||
av_cos_4096,
|
||||
av_cos_8192,
|
||||
av_cos_16384,
|
||||
av_cos_32768,
|
||||
av_cos_65536,
|
||||
};
|
||||
|
||||
void fft_calc(FFTContext *s, FFTComplex *z);
|
||||
|
@ -61,10 +61,6 @@ struct FFTContext {
|
||||
enum mdct_permutation_type mdct_permutation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Do the permutation needed BEFORE calling fft_calc().
|
||||
*/
|
||||
void fft_permute(struct FFTContext *s, FFTComplex *z);
|
||||
/**
|
||||
* Do a complex FFT with the parameters defined in ff_fft_init(). The
|
||||
* input data must be permuted before. No 1.0/sqrt(n) normalization is done.
|
||||
|
@ -318,7 +318,6 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ff_free_vlc(VLC *vlc)
|
||||
{
|
||||
av_freep(&vlc->table);
|
||||
|
@ -35,23 +35,19 @@
|
||||
#include "intreadwrite.h"
|
||||
#include "mem.h"
|
||||
|
||||
int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
|
||||
/**
|
||||
* Multiply two size_t values checking for overflow.
|
||||
* @return 0 if success, AVERROR(EINVAL) if overflow.
|
||||
*/
|
||||
static inline int av_size_mult(size_t a, size_t b, size_t *r)
|
||||
{
|
||||
void *val;
|
||||
|
||||
memcpy(&val, ptr, sizeof(val));
|
||||
if (min_size <= *size) {
|
||||
av_assert0(val || !min_size);
|
||||
return 0;
|
||||
}
|
||||
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
|
||||
av_freep(ptr);
|
||||
val = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size);
|
||||
memcpy(ptr, &val, sizeof(val));
|
||||
if (!val)
|
||||
min_size = 0;
|
||||
*size = (unsigned int)min_size;
|
||||
return 1;
|
||||
size_t t = a * b;
|
||||
/* Hack inspired from glibc: only try the division if nelem and elsize
|
||||
* are both greater than sqrt(SIZE_MAX). */
|
||||
if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
|
||||
return AVERROR(EINVAL);
|
||||
*r = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ALIGN (HAVE_AVX ? 32 : 16)
|
||||
@ -87,13 +83,6 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
|
||||
return r;
|
||||
}
|
||||
|
||||
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
if (!size || nmemb >= INT_MAX / size)
|
||||
return NULL;
|
||||
return av_realloc(ptr, nmemb * size);
|
||||
}
|
||||
|
||||
void av_free(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
@ -115,106 +104,3 @@ void *av_mallocz(size_t size)
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void fill16(uint8_t *dst, int len)
|
||||
{
|
||||
uint32_t v = AV_RN16(dst - 2);
|
||||
|
||||
v |= v << 16;
|
||||
|
||||
while (len >= 4) {
|
||||
AV_WN32(dst, v);
|
||||
dst += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
while (len--) {
|
||||
*dst = dst[-2];
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
static void fill24(uint8_t *dst, int len)
|
||||
{
|
||||
#if HAVE_BIGENDIAN
|
||||
uint32_t v = AV_RB24(dst - 3);
|
||||
uint32_t a = v << 8 | v >> 16;
|
||||
uint32_t b = v << 16 | v >> 8;
|
||||
uint32_t c = v << 24 | v;
|
||||
#else
|
||||
uint32_t v = AV_RL24(dst - 3);
|
||||
uint32_t a = v | v << 24;
|
||||
uint32_t b = v >> 8 | v << 16;
|
||||
uint32_t c = v >> 16 | v << 8;
|
||||
#endif
|
||||
|
||||
while (len >= 12) {
|
||||
AV_WN32(dst, a);
|
||||
AV_WN32(dst + 4, b);
|
||||
AV_WN32(dst + 8, c);
|
||||
dst += 12;
|
||||
len -= 12;
|
||||
}
|
||||
|
||||
if (len >= 4) {
|
||||
AV_WN32(dst, a);
|
||||
dst += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
if (len >= 4) {
|
||||
AV_WN32(dst, b);
|
||||
dst += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
while (len--) {
|
||||
*dst = dst[-3];
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
static void fill32(uint8_t *dst, int len)
|
||||
{
|
||||
uint32_t v = AV_RN32(dst - 4);
|
||||
|
||||
while (len >= 4) {
|
||||
AV_WN32(dst, v);
|
||||
dst += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
while (len--) {
|
||||
*dst = dst[-4];
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
|
||||
{
|
||||
if (min_size < *size)
|
||||
return ptr;
|
||||
|
||||
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
|
||||
|
||||
ptr = av_realloc(ptr, min_size);
|
||||
/* we could set this to the unmodified min_size but this is safer
|
||||
* if the user lost the ptr and uses NULL now
|
||||
*/
|
||||
if (!ptr)
|
||||
min_size = 0;
|
||||
|
||||
*size = (unsigned int)min_size;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
|
||||
{
|
||||
ff_fast_malloc(ptr, size, min_size, 0);
|
||||
}
|
||||
|
||||
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size)
|
||||
{
|
||||
ff_fast_malloc(ptr, size, min_size, 1);
|
||||
}
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define FF_MEMORY_POISON 0x2a
|
||||
|
||||
/**
|
||||
* Allocate a block of size bytes with alignment suitable for all
|
||||
* memory accesses (including vectors if available on the CPU).
|
||||
@ -70,7 +68,6 @@ static inline void *av_malloc_array(size_t nmemb, size_t size)
|
||||
* pointers from such functions can be passed to realloc() at all.
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
* @see av_fast_realloc()
|
||||
*/
|
||||
void *av_realloc(void *ptr, size_t size);
|
||||
|
||||
@ -84,25 +81,6 @@ void *av_realloc(void *ptr, size_t size);
|
||||
*/
|
||||
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
|
||||
|
||||
/**
|
||||
* Allocate or reallocate an array.
|
||||
* If ptr is NULL and nmemb > 0, allocate a new block. If
|
||||
* nmemb is zero, free the memory block pointed to by ptr.
|
||||
* @param ptr Pointer to a memory block already allocated with
|
||||
* av_realloc() or NULL.
|
||||
* @param nmemb Number of elements
|
||||
* @param size Size of the single element
|
||||
* @return Pointer to a newly-reallocated block or NULL if the block
|
||||
* cannot be reallocated or the function is used to free the memory block.
|
||||
* @warning Pointers originating from the av_malloc() family of functions must
|
||||
* not be passed to av_realloc(). The former can be implemented using
|
||||
* memalign() (or other functions), and there is no guarantee that
|
||||
* pointers from such functions can be passed to realloc() at all.
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
*/
|
||||
void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Free a memory block which has been allocated with av_malloc(z)() or
|
||||
* av_realloc().
|
||||
@ -149,57 +127,6 @@ static inline void *av_mallocz_array(size_t nmemb, size_t size)
|
||||
*/
|
||||
void av_freep(void *ptr);
|
||||
|
||||
/**
|
||||
* Multiply two size_t values checking for overflow.
|
||||
* @return 0 if success, AVERROR(EINVAL) if overflow.
|
||||
*/
|
||||
static inline int av_size_mult(size_t a, size_t b, size_t *r)
|
||||
{
|
||||
size_t t = a * b;
|
||||
/* Hack inspired from glibc: only try the division if nelem and elsize
|
||||
* are both greater than sqrt(SIZE_MAX). */
|
||||
if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
|
||||
return AVERROR(EINVAL);
|
||||
*r = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reallocate the given block if it is not large enough, otherwise do nothing.
|
||||
*
|
||||
* @see av_realloc
|
||||
*/
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
/**
|
||||
* Allocate a buffer, reusing the given one if large enough.
|
||||
*
|
||||
* Contrary to av_fast_realloc the current buffer contents might not be
|
||||
* preserved and on error the old buffer is freed, thus no special
|
||||
* handling to avoid memleaks is necessary.
|
||||
*
|
||||
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
||||
* @param size size of the buffer *ptr points to
|
||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
||||
* *size 0 if an error occurred.
|
||||
*/
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
/**
|
||||
* Allocate a buffer, reusing the given one if large enough.
|
||||
*
|
||||
* All newly allocated space is initially cleared
|
||||
* Contrary to av_fast_realloc the current buffer contents might not be
|
||||
* preserved and on error the old buffer is freed, thus no special
|
||||
* handling to avoid memleaks is necessary.
|
||||
*
|
||||
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
||||
* @param size size of the buffer *ptr points to
|
||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
||||
* *size 0 if an error occurred.
|
||||
*/
|
||||
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user