diff --git a/configure b/configure index 09f7714299..31c13d1004 100755 --- a/configure +++ b/configure @@ -631,27 +631,35 @@ prepend(){ } add_cppflags(){ - append CPPFLAGS $($filter_cppflags "$@") + append CPPFLAGS "$@" } add_cflags(){ - append CFLAGS $($filter_cflags "$@") + append CFLAGS $($cflags_filter "$@") } add_cxxflags(){ - append CXXFLAGS $($filter_cflags "$@") + append CXXFLAGS $($cflags_filter "$@") } add_asflags(){ - append ASFLAGS $($filter_asflags "$@") + append ASFLAGS $($asflags_filter "$@") } add_ldflags(){ - append LDFLAGS "$@" + append LDFLAGS $($ldflags_filter "$@") } add_extralibs(){ - prepend extralibs "$@" + prepend extralibs $($ldflags_filter "$@") +} + +add_host_cflags(){ + append host_cflags $($host_cflags_filter "$@") +} + +add_host_ldflags(){ + append host_ldflags $($host_ldflags_filter "$@") } check_cmd(){ @@ -715,7 +723,9 @@ check_ld(){ for f; do test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f" done - check_$type $($filter_cflags $flags) || return + check_$type $($cflags_filter $flags) || return + flags=$($ldflags_filter $flags) + libs=$($ldflags_filter $libs) check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs } @@ -735,7 +745,6 @@ check_code(){ check_cppflags(){ log check_cppflags "$@" - set -- $($filter_cppflags "$@") check_cc "$@" < #if !($condition) #error "unsatisfied condition: $condition" @@ -983,6 +992,7 @@ check_host_cc(){ check_host_cflags(){ log check_host_cflags "$@" + set -- $($host_cflags_filter "$@") check_host_cc "$@" <&1 | grep -q '^gcc.*LLVM'; then cc_type=llvm_gcc gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver" CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' - speed_cflags='-O3' - size_cflags='-Os' + cflags_speed='-O3' + cflags_size='-Os' elif $cc -v 2>&1 | grep -qi ^gcc; then cc_type=gcc gcc_version=$($cc --version | head -n1) @@ -2247,30 +2257,29 @@ elif $cc -v 2>&1 | grep -qi ^gcc; then CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' fi - speed_cflags='-O3' - size_cflags='-Os' + cflags_speed='-O3' + cflags_size='-Os' elif $cc --version 2>/dev/null | grep -q Intel; then cc_type=icc cc_ident=$($cc --version | head -n1) - icc_version=$($cc -dumpversion) CC_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD' - speed_cflags='-O3' - size_cflags='-Os' - noopt_cflags='-O1' + cflags_speed='-O3' + cflags_size='-Os' + cflags_noopt='-O1' elif $cc -v 2>&1 | grep -q xlc; then cc_type=xlc cc_ident=$($cc -qversion 2>/dev/null | head -n1) - speed_cflags='-O5' - size_cflags='-O5 -qcompact' + cflags_speed='-O5' + cflags_size='-O5 -qcompact' elif $cc -V 2>/dev/null | grep -q Compaq; then cc_type=ccc cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3) DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M' debuglevel=3 add_ldflags -Wl,-z,now # calls to libots crash without this - speed_cflags='-fast' - size_cflags='-O1' + cflags_speed='-fast' + cflags_size='-O1' elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then test -d "$sysroot" || die "No valid sysroot specified." cc_type=armcc @@ -2286,9 +2295,9 @@ elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then as_default="${cross_prefix}gcc" CC_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD' - speed_cflags='-O3' - size_cflags='-Os' - filter_asflags="filter_out -W${armcc_opt}*" + cflags_speed='-O3' + cflags_size='-Os' + asflags_filter="filter_out -W${armcc_opt}*" elif $cc -version 2>/dev/null | grep -q TMS470; then cc_type=tms470 cc_ident=$($cc -version | head -n1 | tr -s ' ') @@ -2301,9 +2310,9 @@ elif $cc -version 2>/dev/null | grep -q TMS470; then add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__= CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)' AS_DEPFLAGS='-MMD' - speed_cflags='-O3 -mf=5' - size_cflags='-O3 -mf=2' - filter_cflags=tms470_flags + cflags_speed='-O3 -mf=5' + cflags_size='-O3 -mf=2' + cflags_filter=tms470_flags tms470_flags(){ for flag; do case $flag in @@ -2333,17 +2342,17 @@ elif $cc -v 2>&1 | grep -q clang; then cc_ident=$($cc --version | head -n1) CC_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD' - speed_cflags='-O3' - size_cflags='-Os' + cflags_speed='-O3' + cflags_size='-Os' elif $cc -V 2>&1 | grep -q Sun; then cc_type=suncc cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)' DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1' add_ldflags -xc99 - speed_cflags='-O5' - size_cflags='-O5 -xspace' - filter_cflags=suncc_flags + cflags_speed='-O5' + cflags_size='-O5 -xspace' + cflags_filter=suncc_flags suncc_flags(){ for flag; do case $flag in @@ -2382,25 +2391,25 @@ elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' - speed_cflags='-O2' - size_cflags='-Os' - filter_cflags='filter_out -Wdisabled-optimization' + cflags_speed='-O2' + cflags_size='-Os' + cflags_filter='filter_out -Wdisabled-optimization' elif $cc -v 2>&1 | grep -q Open64; then cc_type=open64 cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' - speed_cflags='-O2' - size_cflags='-Os' - filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros' + cflags_speed='-O2' + cflags_size='-Os' + cflags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros' elif $cc -V 2>&1 | grep -q Portland; then cc_type=pgi cc_ident="PGI $($cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')" opt_common='-alias=ansi -Mlre -Mpre' - speed_cflags="-O3 -Mautoinline -Munroll=c:4 $opt_common" - size_cflags="-O2 -Munroll=c:1 $opt_common" - noopt_cflags="-O1" - filter_cflags=pgi_flags + cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common" + cflags_size="-O2 -Munroll=c:1 $opt_common" + cflags_noopt="-O1" + cflags_filter=pgi_flags pgi_flags(){ for flag; do case $flag in @@ -3509,11 +3518,11 @@ fi if [ -n "$optflags" ]; then add_cflags $optflags elif enabled small; then - add_cflags $size_cflags + add_cflags $cflags_size elif enabled optimizations; then - add_cflags $speed_cflags + add_cflags $cflags_speed else - add_cflags $noopt_cflags + add_cflags $cflags_noopt fi check_cflags -fno-math-errno check_cflags -fno-signed-zeros @@ -3541,6 +3550,7 @@ if enabled icc; then # icc 11.0 and 11.1 work with ebp_available, but don't pass the test enable ebp_available if enabled x86_32; then + icc_version=$($cc -dumpversion) test ${icc_version%%.*} -ge 11 && check_cflags -falign-stack=maintain-16-byte || disable aligned_stack diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bc46cb7dd0..9560529aef 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -52,7 +52,7 @@ static const AVOption options[] = { { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags) + FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags), { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 1e119be10b..d07a0471bf 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -379,14 +379,6 @@ static int mpeg_mux_init(AVFormatContext *ctx) av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default } -#if 0 - /* see VCD standard, p. IV-7*/ - stream->max_buffer_size = 46 * 1024; - else - /* This value HAS to be used for SVCD (see SVCD standard, p. 26 V.2.3.2). - Right now it is also used for everything else.*/ - stream->max_buffer_size = 230 * 1024; -#endif s->video_bound++; break; case AVMEDIA_TYPE_SUBTITLE: @@ -534,92 +526,6 @@ static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts) } -#if 0 /* unused, remove? */ -/* return the exact available payload size for the next packet for - stream 'stream_index'. 'pts' and 'dts' are only used to know if - timestamps are needed in the packet header. */ -static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, - int64_t pts, int64_t dts) -{ - MpegMuxContext *s = ctx->priv_data; - int buf_index; - StreamInfo *stream; - - stream = ctx->streams[stream_index]->priv_data; - - buf_index = 0; - if (((s->packet_number % s->pack_header_freq) == 0)) { - /* pack header size */ - if (s->is_mpeg2) - buf_index += 14; - else - buf_index += 12; - - if (s->is_vcd) { - /* there is exactly one system header for each stream in a VCD MPEG, - One in the very first video packet and one in the very first - audio packet (see VCD standard p. IV-7 and IV-8).*/ - - if (stream->packet_number==0) - /* The system headers refer only to the stream they occur in, - so they have a constant size.*/ - buf_index += 15; - - } else { - if ((s->packet_number % s->system_header_freq) == 0) - buf_index += s->system_header_size; - } - } - - if ((s->is_vcd && stream->packet_number==0) - || (s->is_svcd && s->packet_number==0)) - /* the first pack of each stream contains only the pack header, - the system header and some padding (see VCD standard p. IV-6) - Add the padding size, so that the actual payload becomes 0.*/ - buf_index += s->packet_size - buf_index; - else { - /* packet header size */ - buf_index += 6; - if (s->is_mpeg2) { - buf_index += 3; - if (stream->packet_number==0) - buf_index += 3; /* PES extension */ - buf_index += 1; /* obligatory stuffing byte */ - } - if (pts != AV_NOPTS_VALUE) { - if (dts != pts) - buf_index += 5 + 5; - else - buf_index += 5; - - } else { - if (!s->is_mpeg2) - buf_index++; - } - - if (stream->id < 0xc0) { - /* AC-3/LPCM private data header */ - buf_index += 4; - if (stream->id >= 0xa0) { - int n; - buf_index += 3; - /* NOTE: we round the payload size to an integer number of - LPCM samples */ - n = (s->packet_size - buf_index) % stream->lpcm_align; - if (n) - buf_index += (stream->lpcm_align - n); - } - } - - if (s->is_vcd && (stream->id & 0xe0) == AUDIO_ID) - /* The VCD standard demands that 20 zero bytes follow - each audio packet (see standard p. IV-8).*/ - buf_index+=20; - } - return s->packet_size - buf_index; -} -#endif - /* Write an MPEG padding packet header. */ static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes) { @@ -985,28 +891,6 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) s->packet_number++; } -#if 0 /* unused, remove? */ -static int64_t get_vcd_scr(AVFormatContext *ctx,int stream_index,int64_t pts) -{ - MpegMuxContext *s = ctx->priv_data; - int64_t scr; - - /* Since the data delivery rate is constant, SCR is computed - using the formula C + i * 1200 where C is the start constant - and i is the pack index. - It is recommended that SCR 0 is at the beginning of the VCD front - margin (a sequence of empty Form 2 sectors on the CD). - It is recommended that the front margin is 30 sectors long, so - we use C = 30*1200 = 36000 - (Note that even if the front margin is not 30 sectors the file - will still be correct according to the standard. It just won't have - the "recommended" value).*/ - scr = 36000 + s->packet_number * 1200; - - return scr; -} -#endif - static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){ // MpegMuxContext *s = ctx->priv_data; int i; diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index f7e2cf0630..0a3071d190 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -31,7 +31,7 @@ //#define DEBUG static const AVOption options[] = { - FF_RTP_FLAG_OPTS(RTPMuxContext, flags) + FF_RTP_FLAG_OPTS(RTPMuxContext, flags), { "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM }, { "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { NULL }, diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h index 8827cb3254..de2b3a6e60 100644 --- a/libavformat/rtpenc.h +++ b/libavformat/rtpenc.h @@ -73,7 +73,7 @@ typedef struct RTPMuxContext RTPMuxContext; { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ { "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ { "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ - { "h264_mode0", "Use mode 0 for H264 in RTP", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_H264_MODE0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ + { "h264_mode0", "Use mode 0 for H264 in RTP", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_H264_MODE0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index abfdca80db..c00ff99686 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -74,7 +74,7 @@ const AVOption ff_rtsp_options[] = { { "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {0}, 0, 1, DEC }, - FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags) + FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags), { "rtsp_transport", "RTSP transport protocols", OFFSET(lower_transport_mask), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC|ENC, "rtsp_transport" }, \ { "udp", "UDP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP}, 0, 0, DEC|ENC, "rtsp_transport" }, \ { "tcp", "TCP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_TCP}, 0, 0, DEC|ENC, "rtsp_transport" }, \ diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c index 9359f0b1f3..92deda2f5f 100644 --- a/libswscale/x86/rgb2rgb.c +++ b/libswscale/x86/rgb2rgb.c @@ -33,6 +33,8 @@ #include "libswscale/swscale.h" #include "libswscale/swscale_internal.h" +#if HAVE_INLINE_ASM + DECLARE_ASM_CONST(8, uint64_t, mmx_ff) = 0x00000000000000FFULL; DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL; @@ -126,8 +128,11 @@ DECLARE_ASM_CONST(8, uint64_t, mul16_mid) = 0x2080208020802080ULL; 32-bit C version, and and&add trick by Michael Niedermayer */ +#endif /* HAVE_INLINE_ASM */ + void rgb2rgb_init_x86(void) { +#if HAVE_INLINE_ASM int cpu_flags = av_get_cpu_flags(); if (cpu_flags & AV_CPU_FLAG_MMX) @@ -138,4 +143,5 @@ void rgb2rgb_init_x86(void) rgb2rgb_init_MMX2(); if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) rgb2rgb_init_SSE2(); +#endif /* HAVE_INLINE_ASM */ } diff --git a/libswscale/x86/swscale_mmx.c b/libswscale/x86/swscale_mmx.c index 86576bd6ec..48d1a8e9c7 100644 --- a/libswscale/x86/swscale_mmx.c +++ b/libswscale/x86/swscale_mmx.c @@ -28,6 +28,8 @@ #include "libavutil/cpu.h" #include "libavutil/pixdesc.h" +#if HAVE_INLINE_ASM + #define DITHER1XBPP DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL; @@ -262,6 +264,8 @@ static void yuv2yuvX_sse3(const int16_t *filter, int filterSize, } #endif +#endif /* HAVE_INLINE_ASM */ + #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ SwsContext *c, int16_t *data, \ @@ -367,6 +371,7 @@ void ff_sws_init_swScale_mmx(SwsContext *c) { int cpu_flags = av_get_cpu_flags(); +#if HAVE_INLINE_ASM if (cpu_flags & AV_CPU_FLAG_MMX) sws_init_swScale_MMX(c); #if HAVE_MMX2 @@ -377,6 +382,7 @@ void ff_sws_init_swScale_mmx(SwsContext *c) c->yuv2planeX = yuv2yuvX_sse3; } #endif +#endif /* HAVE_INLINE_ASM */ #if HAVE_YASM #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ diff --git a/libswscale/x86/yuv2rgb_mmx.c b/libswscale/x86/yuv2rgb_mmx.c index fd184eb71d..2107dd1ca4 100644 --- a/libswscale/x86/yuv2rgb_mmx.c +++ b/libswscale/x86/yuv2rgb_mmx.c @@ -36,6 +36,8 @@ #include "libavutil/x86_cpu.h" #include "libavutil/cpu.h" +#if HAVE_INLINE_ASM + #define DITHER1XBPP // only for MMX /* hope these constant values are cache line aligned */ @@ -64,8 +66,11 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL; #include "yuv2rgb_template.c" #endif /* HAVE_MMX2 */ +#endif /* HAVE_INLINE_ASM */ + SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) { +#if HAVE_INLINE_ASM int cpu_flags = av_get_cpu_flags(); #if HAVE_MMX2 @@ -99,6 +104,7 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c) case PIX_FMT_RGB555: return yuv420_rgb15_MMX; } } +#endif /* HAVE_INLINE_ASM */ return NULL; }