Commit 2dbc9345 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '80521c19'

* commit '80521c19':
  build: allow targets to specify extra objects to link with executables
  swscale: avoid pointless use of compound literals
  libm: add fallbacks for various single-precision functions
  network: use getservbyport() only if available
  network: add fallbacks for INADDR_LOOPBACK and INET_ADDRSTRLEN
  Include sys/time.h before sys/resource.h

Conflicts:
	Makefile
	configure
	libavutil/libm.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents cccb4575 80521c19
......@@ -17,7 +17,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver
PROGS := $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
OBJS = cmdutils.o
OBJS = cmdutils.o $(EXEOBJS)
OBJS-ffmpeg = ffmpeg_opt.o ffmpeg_filter.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
......@@ -56,8 +56,8 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF)
$(CP) $< $@
$(STRIP) $@
$(TOOLS): %$(EXESUF): %.o
$(LD) $(LDFLAGS) $(LD_O) $< $(ELIBS)
$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
$(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
......@@ -91,7 +91,7 @@ endef
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
define DOPROG
OBJS-$(1) += $(1).o cmdutils.o
OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS)
$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
$(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
......
......@@ -54,6 +54,7 @@
#include "libavformat/network.h"
#endif
#if HAVE_SYS_RESOURCE_H
#include <sys/time.h>
#include <sys/resource.h>
#endif
......
......@@ -1264,20 +1264,28 @@ HAVE_LIST_PUB='
'
MATH_FUNCS="
atanf
atan2f
cbrtf
cosf
exp2
exp2f
expf
isinf
isnan
ldexpf
llrint
llrintf
log2
log2f
log10f
lrint
lrintf
powf
rint
round
roundf
sinf
trunc
truncf
"
......@@ -1331,6 +1339,7 @@ HAVE_LIST="
GetProcessTimes
GetSystemTimeAsFileTime
getrusage
getservbyport
gettimeofday
glob
gnu_as
......@@ -3484,6 +3493,7 @@ if enabled network; then
check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
check_type netinet/sctp.h "struct sctp_event_subscribe"
check_func getaddrinfo $network_extralibs
check_func getservbyport $network_extralibs
# Prefer arpa/inet.h over winsock2
if check_header arpa/inet.h ; then
check_func closesocket
......@@ -4206,6 +4216,7 @@ ZLIB=$($ldflags_filter -lz)
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
EXTRALIBS=$extralibs
COMPAT_OBJS=$compat_objs
EXEOBJS=$exeobjs
INSTALL=$install
LIBTARGET=${LIBTARGET}
SLIBNAME=${SLIBNAME}
......
......@@ -69,6 +69,7 @@
# include "libavfilter/buffersink.h"
#if HAVE_SYS_RESOURCE_H
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
#elif HAVE_GETPROCESSTIMES
......
......@@ -31,6 +31,7 @@
#include "libavcodec/aacps_tables.h"
#else
#include "libavutil/common.h"
#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#define NR_ALLPASS_BANDS20 30
......
......@@ -201,6 +201,14 @@ const char *ff_gai_strerror(int ecode);
#define gai_strerror ff_gai_strerror
#endif
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001
#endif
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN INET_ADDRSTRLEN
#endif
......
......@@ -236,8 +236,10 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen,
if (serv && servlen > 0) {
struct servent *ent = NULL;
#if HAVE_GETSERVBYPORT
if (!(flags & NI_NUMERICSERV))
ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : "tcp");
#endif
if (ent)
snprintf(serv, servlen, "%s", ent->s_name);
......
......@@ -33,6 +33,21 @@
#include "libavutil/mips/libm_mips.h"
#endif /* HAVE_MIPSFPU && HAVE_INLINE_ASM*/
#if !HAVE_ATANF
#undef atanf
#define atanf(x) ((float)atan(x))
#endif
#if !HAVE_ATAN2F
#undef atan2f
#define atan2f(y, x) ((float)atan2(y, x))
#endif
#if !HAVE_POWF
#undef powf
#define powf(x, y) ((float)pow(x, y))
#endif
#if !HAVE_CBRTF
static av_always_inline float cbrtf(float x)
{
......@@ -40,6 +55,16 @@ static av_always_inline float cbrtf(float x)
}
#endif
#if !HAVE_COSF
#undef cosf
#define cosf(x) ((float)cos(x))
#endif
#if !HAVE_EXPF
#undef expf
#define expf(x) ((float)exp(x))
#endif
#if !HAVE_EXP2
#undef exp2
#define exp2(x) exp((x) * 0.693147180559945)
......@@ -70,6 +95,11 @@ static av_always_inline av_const int isnan(float x)
}
#endif /* HAVE_ISNAN */
#if !HAVE_LDEXPF
#undef ldexpf
#define ldexpf(x, exp) ((float)ldexp(x, exp))
#endif
#if !HAVE_LLRINT
#undef llrint
#define llrint(x) ((long long)rint(x))
......@@ -90,6 +120,16 @@ static av_always_inline av_const int isnan(float x)
#define log2f(x) ((float)log2(x))
#endif /* HAVE_LOG2F */
#if !HAVE_LOG10F
#undef log10f
#define log10f(x) ((float)log10(x))
#endif
#if !HAVE_SINF
#undef sinf
#define sinf(x) ((float)sin(x))
#endif
#if !HAVE_RINT
static inline double rint(double x)
{
......
......@@ -36,7 +36,7 @@ define RULES
$(EXAMPLES) $(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
$$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
......
......@@ -451,6 +451,11 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
uint8_t *dst[], int dstStride[])
{
int alpha_first = 0;
const uint8_t *src102[] = { src[1], src[0], src[2] };
const uint8_t *src201[] = { src[2], src[0], src[1] };
int stride102[] = { srcStride[1], srcStride[0], srcStride[2] };
int stride201[] = { srcStride[2], srcStride[0], srcStride[1] };
if (c->srcFormat != AV_PIX_FMT_GBRP) {
av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",
av_get_pix_fmt_name(c->srcFormat),
......@@ -460,15 +465,13 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
switch (c->dstFormat) {
case AV_PIX_FMT_BGR24:
gbr24ptopacked24((const uint8_t *[]) { src[1], src[0], src[2] },
(int []) { srcStride[1], srcStride[0], srcStride[2] },
gbr24ptopacked24(src102, stride102,
dst[0] + srcSliceY * dstStride[0], dstStride[0],
srcSliceH, c->srcW);
break;
case AV_PIX_FMT_RGB24:
gbr24ptopacked24((const uint8_t *[]) { src[2], src[0], src[1] },
(int []) { srcStride[2], srcStride[0], srcStride[1] },
gbr24ptopacked24(src201, stride201,
dst[0] + srcSliceY * dstStride[0], dstStride[0],
srcSliceH, c->srcW);
break;
......@@ -476,8 +479,7 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
case AV_PIX_FMT_ARGB:
alpha_first = 1;
case AV_PIX_FMT_RGBA:
gbr24ptopacked32((const uint8_t *[]) { src[2], src[0], src[1] },
(int []) { srcStride[2], srcStride[0], srcStride[1] },
gbr24ptopacked32(src201, stride201,
dst[0] + srcSliceY * dstStride[0], dstStride[0],
srcSliceH, alpha_first, c->srcW);
break;
......@@ -485,8 +487,7 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
case AV_PIX_FMT_ABGR:
alpha_first = 1;
case AV_PIX_FMT_BGRA:
gbr24ptopacked32((const uint8_t *[]) { src[1], src[0], src[2] },
(int []) { srcStride[1], srcStride[0], srcStride[2] },
gbr24ptopacked32(src102, stride102,
dst[0] + srcSliceY * dstStride[0], dstStride[0],
srcSliceH, alpha_first, c->srcW);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment