mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-08-01 08:49:59 +02:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: configure: Group math functions into a separate variable avutil/mem: K&R formatting cosmetics avutil/lzo: K&R formatting cosmetics Conflicts: configure libavutil/mem.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
6912e7a008
55
configure
vendored
55
configure
vendored
@ -1263,6 +1263,25 @@ HAVE_LIST_PUB='
|
|||||||
incompatible_fork_abi
|
incompatible_fork_abi
|
||||||
'
|
'
|
||||||
|
|
||||||
|
MATH_FUNCS="
|
||||||
|
cbrtf
|
||||||
|
exp2
|
||||||
|
exp2f
|
||||||
|
isinf
|
||||||
|
isnan
|
||||||
|
llrint
|
||||||
|
llrintf
|
||||||
|
log2
|
||||||
|
log2f
|
||||||
|
lrint
|
||||||
|
lrintf
|
||||||
|
rint
|
||||||
|
round
|
||||||
|
roundf
|
||||||
|
trunc
|
||||||
|
truncf
|
||||||
|
"
|
||||||
|
|
||||||
HAVE_LIST="
|
HAVE_LIST="
|
||||||
$ARCH_EXT_LIST
|
$ARCH_EXT_LIST
|
||||||
$(add_suffix _external $ARCH_EXT_LIST)
|
$(add_suffix _external $ARCH_EXT_LIST)
|
||||||
@ -1270,6 +1289,7 @@ HAVE_LIST="
|
|||||||
$HAVE_LIST_CMDLINE
|
$HAVE_LIST_CMDLINE
|
||||||
$HAVE_LIST_PUB
|
$HAVE_LIST_PUB
|
||||||
$THREADS_LIST
|
$THREADS_LIST
|
||||||
|
$MATH_FUNCS
|
||||||
aligned_malloc
|
aligned_malloc
|
||||||
aligned_stack
|
aligned_stack
|
||||||
alsa_asoundlib_h
|
alsa_asoundlib_h
|
||||||
@ -1280,7 +1300,6 @@ HAVE_LIST="
|
|||||||
asm_types_h
|
asm_types_h
|
||||||
attribute_may_alias
|
attribute_may_alias
|
||||||
attribute_packed
|
attribute_packed
|
||||||
cbrtf
|
|
||||||
clock_gettime
|
clock_gettime
|
||||||
closesocket
|
closesocket
|
||||||
cmov
|
cmov
|
||||||
@ -1299,8 +1318,6 @@ HAVE_LIST="
|
|||||||
dxva_h
|
dxva_h
|
||||||
ebp_available
|
ebp_available
|
||||||
ebx_available
|
ebx_available
|
||||||
exp2
|
|
||||||
exp2f
|
|
||||||
fast_64bit
|
fast_64bit
|
||||||
fast_clz
|
fast_clz
|
||||||
fast_cmov
|
fast_cmov
|
||||||
@ -1321,23 +1338,15 @@ HAVE_LIST="
|
|||||||
inet_aton
|
inet_aton
|
||||||
io_h
|
io_h
|
||||||
isatty
|
isatty
|
||||||
isinf
|
|
||||||
isnan
|
|
||||||
jack_port_get_latency_range
|
jack_port_get_latency_range
|
||||||
kbhit
|
kbhit
|
||||||
ldbrx
|
ldbrx
|
||||||
libdc1394_1
|
libdc1394_1
|
||||||
libdc1394_2
|
libdc1394_2
|
||||||
llrint
|
|
||||||
llrintf
|
|
||||||
local_aligned_16
|
local_aligned_16
|
||||||
local_aligned_8
|
local_aligned_8
|
||||||
localtime_r
|
localtime_r
|
||||||
log2
|
|
||||||
log2f
|
|
||||||
loongson
|
loongson
|
||||||
lrint
|
|
||||||
lrintf
|
|
||||||
lzo1x_999_compress
|
lzo1x_999_compress
|
||||||
machine_ioctl_bt848_h
|
machine_ioctl_bt848_h
|
||||||
machine_ioctl_meteor_h
|
machine_ioctl_meteor_h
|
||||||
@ -1358,9 +1367,6 @@ HAVE_LIST="
|
|||||||
posix_memalign
|
posix_memalign
|
||||||
pthread_cancel
|
pthread_cancel
|
||||||
rdtsc
|
rdtsc
|
||||||
rint
|
|
||||||
round
|
|
||||||
roundf
|
|
||||||
sched_getaffinity
|
sched_getaffinity
|
||||||
sdl
|
sdl
|
||||||
sdl_video_size
|
sdl_video_size
|
||||||
@ -1396,8 +1402,6 @@ HAVE_LIST="
|
|||||||
termios_h
|
termios_h
|
||||||
texi2html
|
texi2html
|
||||||
threads
|
threads
|
||||||
trunc
|
|
||||||
truncf
|
|
||||||
unistd_h
|
unistd_h
|
||||||
usleep
|
usleep
|
||||||
vfp_args
|
vfp_args
|
||||||
@ -3615,22 +3619,9 @@ check_lib math.h sin -lm && LIBM="-lm"
|
|||||||
disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
|
disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
|
||||||
enabled vaapi && require vaapi va/va.h vaInitialize -lva
|
enabled vaapi && require vaapi va/va.h vaInitialize -lva
|
||||||
|
|
||||||
check_mathfunc cbrtf
|
for func in $MATH_FUNCS; do
|
||||||
check_mathfunc exp2
|
check_mathfunc $func
|
||||||
check_mathfunc exp2f
|
done
|
||||||
check_mathfunc isinf
|
|
||||||
check_mathfunc isnan
|
|
||||||
check_mathfunc llrint
|
|
||||||
check_mathfunc llrintf
|
|
||||||
check_mathfunc log2
|
|
||||||
check_mathfunc log2f
|
|
||||||
check_mathfunc lrint
|
|
||||||
check_mathfunc lrintf
|
|
||||||
check_mathfunc rint
|
|
||||||
check_mathfunc round
|
|
||||||
check_mathfunc roundf
|
|
||||||
check_mathfunc trunc
|
|
||||||
check_mathfunc truncf
|
|
||||||
|
|
||||||
# these are off by default, so fail if requested and not available
|
# these are off by default, so fail if requested and not available
|
||||||
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
|
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#define OUTBUF_PADDED 1
|
#define OUTBUF_PADDED 1
|
||||||
/// Define if we may read up to 8 bytes beyond the input buffer.
|
/// Define if we may read up to 8 bytes beyond the input buffer.
|
||||||
#define INBUF_PADDED 1
|
#define INBUF_PADDED 1
|
||||||
|
|
||||||
typedef struct LZOContext {
|
typedef struct LZOContext {
|
||||||
const uint8_t *in, *in_end;
|
const uint8_t *in, *in_end;
|
||||||
uint8_t *out_start, *out, *out_end;
|
uint8_t *out_start, *out, *out_end;
|
||||||
@ -39,7 +40,8 @@ typedef struct LZOContext {
|
|||||||
* @brief Reads one byte from the input buffer, avoiding an overrun.
|
* @brief Reads one byte from the input buffer, avoiding an overrun.
|
||||||
* @return byte read
|
* @return byte read
|
||||||
*/
|
*/
|
||||||
static inline int get_byte(LZOContext *c) {
|
static inline int get_byte(LZOContext *c)
|
||||||
|
{
|
||||||
if (c->in < c->in_end)
|
if (c->in < c->in_end)
|
||||||
return *c->in++;
|
return *c->in++;
|
||||||
c->error |= AV_LZO_INPUT_DEPLETED;
|
c->error |= AV_LZO_INPUT_DEPLETED;
|
||||||
@ -58,10 +60,12 @@ static inline int get_byte(LZOContext *c) {
|
|||||||
* @param mask bits used from x
|
* @param mask bits used from x
|
||||||
* @return decoded length value
|
* @return decoded length value
|
||||||
*/
|
*/
|
||||||
static inline int get_len(LZOContext *c, int x, int mask) {
|
static inline int get_len(LZOContext *c, int x, int mask)
|
||||||
|
{
|
||||||
int cnt = x & mask;
|
int cnt = x & mask;
|
||||||
if (!cnt) {
|
if (!cnt) {
|
||||||
while (!(x = get_byte(c))) cnt += 255;
|
while (!(x = get_byte(c)))
|
||||||
|
cnt += 255;
|
||||||
cnt += mask + x;
|
cnt += mask + x;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -84,7 +88,8 @@ static inline int get_len(LZOContext *c, int x, int mask) {
|
|||||||
* @brief Copies bytes from input to output buffer with checking.
|
* @brief Copies bytes from input to output buffer with checking.
|
||||||
* @param cnt number of bytes to copy, must be >= 0
|
* @param cnt number of bytes to copy, must be >= 0
|
||||||
*/
|
*/
|
||||||
static inline void copy(LZOContext *c, int cnt) {
|
static inline void copy(LZOContext *c, int cnt)
|
||||||
|
{
|
||||||
register const uint8_t *src = c->in;
|
register const uint8_t *src = c->in;
|
||||||
register uint8_t *dst = c->out;
|
register uint8_t *dst = c->out;
|
||||||
if (cnt > c->in_end - src) {
|
if (cnt > c->in_end - src) {
|
||||||
@ -117,7 +122,8 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
|
|||||||
* cnt > back is valid, this will copy the bytes we just copied,
|
* cnt > back is valid, this will copy the bytes we just copied,
|
||||||
* thus creating a repeating pattern with a period length of back.
|
* thus creating a repeating pattern with a period length of back.
|
||||||
*/
|
*/
|
||||||
static inline void copy_backptr(LZOContext *c, int back, int cnt) {
|
static inline void copy_backptr(LZOContext *c, int back, int cnt)
|
||||||
|
{
|
||||||
register const uint8_t *src = &c->out[-back];
|
register const uint8_t *src = &c->out[-back];
|
||||||
register uint8_t *dst = c->out;
|
register uint8_t *dst = c->out;
|
||||||
if (src < c->out_start || src > dst) {
|
if (src < c->out_start || src > dst) {
|
||||||
@ -132,7 +138,8 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) {
|
|||||||
c->out = dst + cnt;
|
c->out = dst + cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void memcpy_backptr(uint8_t *dst, int back, int cnt) {
|
static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
|
||||||
|
{
|
||||||
const uint8_t *src = &dst[-back];
|
const uint8_t *src = &dst[-back];
|
||||||
if (back <= 1) {
|
if (back <= 1) {
|
||||||
memset(dst, *src, cnt);
|
memset(dst, *src, cnt);
|
||||||
@ -166,11 +173,13 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_memcpy_backptr(uint8_t *dst, int back, int cnt) {
|
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
|
||||||
|
{
|
||||||
memcpy_backptr(dst, back, cnt);
|
memcpy_backptr(dst, back, cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
|
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
|
||||||
|
{
|
||||||
int state = 0;
|
int state = 0;
|
||||||
int x;
|
int x;
|
||||||
LZOContext c;
|
LZOContext c;
|
||||||
@ -191,7 +200,8 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
|
|||||||
if (x > 17) {
|
if (x > 17) {
|
||||||
copy(&c, x - 17);
|
copy(&c, x - 17);
|
||||||
x = GETB(c);
|
x = GETB(c);
|
||||||
if (x < 16) c.error |= AV_LZO_ERROR;
|
if (x < 16)
|
||||||
|
c.error |= AV_LZO_ERROR;
|
||||||
}
|
}
|
||||||
if (c.in > c.in_end)
|
if (c.in > c.in_end)
|
||||||
c.error |= AV_LZO_INPUT_DEPLETED;
|
c.error |= AV_LZO_INPUT_DEPLETED;
|
||||||
|
@ -99,28 +99,28 @@ void *av_malloc(size_t size)
|
|||||||
#elif HAVE_MEMALIGN
|
#elif HAVE_MEMALIGN
|
||||||
ptr = memalign(ALIGN, size);
|
ptr = memalign(ALIGN, size);
|
||||||
/* Why 64?
|
/* Why 64?
|
||||||
Indeed, we should align it:
|
* Indeed, we should align it:
|
||||||
on 4 for 386
|
* on 4 for 386
|
||||||
on 16 for 486
|
* on 16 for 486
|
||||||
on 32 for 586, PPro - K6-III
|
* on 32 for 586, PPro - K6-III
|
||||||
on 64 for K7 (maybe for P3 too).
|
* on 64 for K7 (maybe for P3 too).
|
||||||
Because L1 and L2 caches are aligned on those values.
|
* Because L1 and L2 caches are aligned on those values.
|
||||||
But I don't want to code such logic here!
|
* But I don't want to code such logic here!
|
||||||
*/
|
*/
|
||||||
/* Why 32?
|
/* Why 32?
|
||||||
For AVX ASM. SSE / NEON needs only 16.
|
* For AVX ASM. SSE / NEON needs only 16.
|
||||||
Why not larger? Because I did not see a difference in benchmarks ...
|
* Why not larger? Because I did not see a difference in benchmarks ...
|
||||||
*/
|
*/
|
||||||
/* benchmarks with P3
|
/* benchmarks with P3
|
||||||
memalign(64)+1 3071,3051,3032
|
* memalign(64) + 1 3071, 3051, 3032
|
||||||
memalign(64)+2 3051,3032,3041
|
* memalign(64) + 2 3051, 3032, 3041
|
||||||
memalign(64)+4 2911,2896,2915
|
* memalign(64) + 4 2911, 2896, 2915
|
||||||
memalign(64)+8 2545,2554,2550
|
* memalign(64) + 8 2545, 2554, 2550
|
||||||
memalign(64)+16 2543,2572,2563
|
* memalign(64) + 16 2543, 2572, 2563
|
||||||
memalign(64)+32 2546,2545,2571
|
* memalign(64) + 32 2546, 2545, 2571
|
||||||
memalign(64)+64 2570,2533,2558
|
* memalign(64) + 64 2570, 2533, 2558
|
||||||
|
*
|
||||||
BTW, malloc seems to do 8-byte alignment by default here.
|
* BTW, malloc seems to do 8-byte alignment by default here.
|
||||||
*/
|
*/
|
||||||
#else
|
#else
|
||||||
ptr = malloc(size);
|
ptr = malloc(size);
|
||||||
@ -148,10 +148,12 @@ void *av_realloc(void *ptr, size_t size)
|
|||||||
|
|
||||||
#if CONFIG_MEMALIGN_HACK
|
#if CONFIG_MEMALIGN_HACK
|
||||||
//FIXME this isn't aligned correctly, though it probably isn't needed
|
//FIXME this isn't aligned correctly, though it probably isn't needed
|
||||||
if(!ptr) return av_malloc(size);
|
if (!ptr)
|
||||||
|
return av_malloc(size);
|
||||||
diff = ((char *)ptr)[-1];
|
diff = ((char *)ptr)[-1];
|
||||||
ptr = realloc((char *)ptr - diff, size + diff);
|
ptr = realloc((char *)ptr - diff, size + diff);
|
||||||
if(ptr) ptr = (char*)ptr + diff;
|
if (ptr)
|
||||||
|
ptr = (char *)ptr + diff;
|
||||||
return ptr;
|
return ptr;
|
||||||
#elif HAVE_ALIGNED_MALLOC
|
#elif HAVE_ALIGNED_MALLOC
|
||||||
return _aligned_realloc(ptr, size + !size, ALIGN);
|
return _aligned_realloc(ptr, size + !size, ALIGN);
|
||||||
|
Loading…
Reference in New Issue
Block a user