summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdutils.c11
-rw-r--r--cmdutils.h6
-rwxr-xr-xconfigure3
-rw-r--r--ffmpeg.c4
-rw-r--r--ffplay.c2
-rw-r--r--libavcodec/dnxhdenc.h2
-rw-r--r--libavcodec/x86/dsputilenc_mmx.c9
-rw-r--r--libavcodec/x86/fmtconvert.asm78
-rw-r--r--libavcodec/x86/fmtconvert_mmx.c12
-rw-r--r--libavcodec/x86/vc1dsp_mmx.c2
-rw-r--r--libavcodec/x86/vc1dsp_yasm.asm5
-rw-r--r--libavformat/os_support.c18
-rw-r--r--libavformat/os_support.h17
-rw-r--r--libavutil/attributes.h2
14 files changed, 141 insertions, 30 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 557e1a601f..36f82c94bf 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1135,8 +1135,8 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
return AVERROR(EINVAL);
}
-AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
- AVFormatContext *s, AVStream *st)
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id,
+ AVFormatContext *s, AVStream *st, AVCodec *codec)
{
AVDictionary *ret = NULL;
AVDictionaryEntry *t = NULL;
@@ -1146,6 +1146,9 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
const AVClass *cc = avcodec_get_class();
if (!codec)
+ codec = s->oformat ? avcodec_find_encoder(codec_id)
+ : avcodec_find_decoder(codec_id);
+ if (!codec)
return NULL;
switch (codec->type) {
@@ -1205,8 +1208,8 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
return NULL;
}
for (i = 0; i < s->nb_streams; i++)
- opts[i] = filter_codec_opts(codec_opts, avcodec_find_decoder(s->streams[i]->codec->codec_id),
- s, s->streams[i]);
+ opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id,
+ s, s->streams[i], NULL);
return opts;
}
diff --git a/cmdutils.h b/cmdutils.h
index d99037cfb2..d26089cca4 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -232,10 +232,12 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
*
* @param s Corresponding format context.
* @param st A stream from s for which the options should be filtered.
+ * @param codec The particular codec for which the options should be filtered.
+ * If null, the default one is looked up according to the codec id.
* @return a pointer to the created dictionary
*/
-AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec,
- AVFormatContext *s, AVStream *st);
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id,
+ AVFormatContext *s, AVStream *st, AVCodec *codec);
/**
* Setup AVCodecContext options for avformat_find_stream_info().
diff --git a/configure b/configure
index f30998b37c..956e3a147f 100755
--- a/configure
+++ b/configure
@@ -1265,6 +1265,7 @@ HAVE_LIST="
struct_group_source_req
struct_ip_mreq_source
struct_ipv6_mreq
+ struct_pollfd
struct_rusage_ru_maxrss
struct_sockaddr_in6
struct_sockaddr_sa_len
@@ -3125,6 +3126,7 @@ if enabled network; then
check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
check_type netinet/in.h "struct sockaddr_in6"
+ check_type poll.h "struct pollfd"
check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
check_header netinet/sctp.h
@@ -3141,6 +3143,7 @@ if enabled network; then
check_type ws2tcpip.h "struct group_source_req"
check_type ws2tcpip.h "struct ip_mreq_source"
check_type ws2tcpip.h "struct ipv6_mreq"
+ check_type winsock2.h "struct pollfd"
check_type ws2tcpip.h "struct sockaddr_in6"
check_type ws2tcpip.h "struct sockaddr_storage"
check_struct winsock2.h "struct sockaddr" sa_len
diff --git a/ffmpeg.c b/ffmpeg.c
index df8de11f16..25112d3e2c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4149,7 +4149,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
ist->file_index = nb_input_files;
ist->discard = 1;
st->discard = AVDISCARD_ALL;
- ist->opts = filter_codec_opts(codec_opts, choose_decoder(o, ic, st), ic, st);
+ ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st, choose_decoder(o, ic, st));
ist->ts_scale = 1.0;
MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
@@ -4505,7 +4505,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
st->codec->codec_type = type;
choose_encoder(o, oc, ost);
if (ost->enc) {
- ost->opts = filter_codec_opts(codec_opts, ost->enc, oc, st);
+ ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st, ost->enc);
}
avcodec_get_context_defaults3(st->codec, ost->enc);
diff --git a/ffplay.c b/ffplay.c
index c01740a682..9f46759696 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2161,7 +2161,7 @@ static int stream_component_open(VideoState *is, int stream_index)
avctx = ic->streams[stream_index]->codec;
codec = avcodec_find_decoder(avctx->codec_id);
- opts = filter_codec_opts(codec_opts, codec, ic, ic->streams[stream_index]);
+ opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index], codec);
switch(avctx->codec_type){
case AVMEDIA_TYPE_AUDIO : is->last_audio_stream = stream_index; if(audio_codec_name ) codec= avcodec_find_decoder_by_name( audio_codec_name); break;
diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h
index 279a978cd3..640bbd3995 100644
--- a/libavcodec/dnxhdenc.h
+++ b/libavcodec/dnxhdenc.h
@@ -90,7 +90,7 @@ typedef struct DNXHDEncContext {
RCCMPEntry *mb_cmp;
RCEntry (*mb_rc)[8160];
- void (*get_pixels_8x4_sym)(DCTELEM */*align 16*/, const uint8_t *, int);
+ void (*get_pixels_8x4_sym)(DCTELEM * /*align 16*/, const uint8_t *, int);
} DNXHDEncContext;
void ff_dnxhd_init_mmx(DNXHDEncContext *ctx);
diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
index bf439ca5df..00e0a3fc37 100644
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ b/libavcodec/x86/dsputilenc_mmx.c
@@ -1128,8 +1128,8 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
#endif
c->pix_norm1 = pix_norm1_mmx;
- c->sse[0] = (HAVE_YASM && mm_flags & AV_CPU_FLAG_SSE2) ? ff_sse16_sse2 : sse16_mmx;
- c->sse[1] = sse8_mmx;
+ c->sse[0] = sse16_mmx;
+ c->sse[1] = sse8_mmx;
c->vsad[4]= vsad_intra16_mmx;
c->nsse[0] = nsse16_mmx;
@@ -1165,10 +1165,13 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
if (bit_depth <= 8)
c->get_pixels = get_pixels_sse2;
c->sum_abs_dctelem= sum_abs_dctelem_sse2;
-#if HAVE_YASM && HAVE_ALIGNED_STACK
+#if HAVE_YASM
+ c->sse[0] = ff_sse16_sse2;
+#if HAVE_ALIGNED_STACK
c->hadamard8_diff[0]= ff_hadamard8_diff16_sse2;
c->hadamard8_diff[1]= ff_hadamard8_diff_sse2;
#endif
+#endif
}
#if HAVE_SSSE3
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index 72bee55669..9499a9e3a7 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -115,6 +115,84 @@ FLOAT_TO_INT16 sse, 0
FLOAT_TO_INT16 3dnow, 0
%undef cvtps2pi
+;------------------------------------------------------------------------------
+; void ff_float_to_int16_step(int16_t *dst, const float *src, long len, long step);
+;------------------------------------------------------------------------------
+%macro FLOAT_TO_INT16_STEP 2
+cglobal float_to_int16_step_%1, 4,7,%2, dst, src, len, step, step3, v1, v2
+ add lenq, lenq
+ lea srcq, [srcq+2*lenq]
+ lea step3q, [stepq*3]
+ neg lenq
+.loop:
+%ifidn %1, sse2
+ cvtps2dq m0, [srcq+2*lenq ]
+ cvtps2dq m1, [srcq+2*lenq+16]
+ packssdw m0, m1
+ movd v1d, m0
+ psrldq m0, 4
+ movd v2d, m0
+ psrldq m0, 4
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+ movd v1d, m0
+ psrldq m0, 4
+ movd v2d, m0
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+%else
+ cvtps2pi m0, [srcq+2*lenq ]
+ cvtps2pi m1, [srcq+2*lenq+ 8]
+ cvtps2pi m2, [srcq+2*lenq+16]
+ cvtps2pi m3, [srcq+2*lenq+24]
+ packssdw m0, m1
+ packssdw m2, m3
+ movd v1d, m0
+ psrlq m0, 32
+ movd v2d, m0
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+ movd v1d, m2
+ psrlq m2, 32
+ movd v2d, m2
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+%endif
+ add lenq, 16
+ js .loop
+%ifnidn %1, sse2
+ emms
+%endif
+ REP_RET
+%endmacro
+
+INIT_XMM
+FLOAT_TO_INT16_STEP sse2, 2
+INIT_MMX
+FLOAT_TO_INT16_STEP sse, 0
+%define cvtps2pi pf2id
+FLOAT_TO_INT16_STEP 3dnow, 0
+%undef cvtps2pi
;-------------------------------------------------------------------------------
; void ff_float_to_int16_interleave2(int16_t *dst, const float **src, long len);
diff --git a/libavcodec/x86/fmtconvert_mmx.c b/libavcodec/x86/fmtconvert_mmx.c
index ca0b29344a..8c9c43f662 100644
--- a/libavcodec/x86/fmtconvert_mmx.c
+++ b/libavcodec/x86/fmtconvert_mmx.c
@@ -25,6 +25,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86_cpu.h"
#include "libavcodec/fmtconvert.h"
+#include "libavcodec/dsputil.h"
#if HAVE_YASM
@@ -35,6 +36,10 @@ void ff_float_to_int16_3dnow(int16_t *dst, const float *src, long len);
void ff_float_to_int16_sse (int16_t *dst, const float *src, long len);
void ff_float_to_int16_sse2 (int16_t *dst, const float *src, long len);
+void ff_float_to_int16_step_3dnow(int16_t *dst, const float *src, long len, long step);
+void ff_float_to_int16_step_sse (int16_t *dst, const float *src, long len, long step);
+void ff_float_to_int16_step_sse2 (int16_t *dst, const float *src, long len, long step);
+
void ff_float_to_int16_interleave2_3dnow(int16_t *dst, const float **src, long len);
void ff_float_to_int16_interleave2_sse (int16_t *dst, const float **src, long len);
void ff_float_to_int16_interleave2_sse2 (int16_t *dst, const float **src, long len);
@@ -48,12 +53,9 @@ void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len
#define FLOAT_TO_INT16_INTERLEAVE(cpu) \
/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\
static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\
- DECLARE_ALIGNED(16, int16_t, tmp)[len];\
- int i,j,c;\
+ int c;\
for(c=0; c<channels; c++){\
- ff_float_to_int16_##cpu(tmp, src[c], len);\
- for(i=0, j=c; i<len; i++, j+=channels)\
- dst[j] = tmp[i];\
+ ff_float_to_int16_step_##cpu(dst+c, src[c], len, channels);\
}\
}\
\
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index 4adeabca3b..bddac5ec77 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -809,7 +809,7 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
#if HAVE_YASM
if (mm_flags & AV_CPU_FLAG_MMX) {
}
- return;
+
if (mm_flags & AV_CPU_FLAG_MMX2) {
ASSIGN_LF(mmx2);
}
diff --git a/libavcodec/x86/vc1dsp_yasm.asm b/libavcodec/x86/vc1dsp_yasm.asm
index b897580b76..590aa509a7 100644
--- a/libavcodec/x86/vc1dsp_yasm.asm
+++ b/libavcodec/x86/vc1dsp_yasm.asm
@@ -119,7 +119,9 @@ section .text
pand m2, m6
pand m3, m2 ; d final
- PSIGNW m3, m7
+ psraw m7, 15
+ pxor m3, m7
+ psubw m3, m7
psubw m0, m3
paddw m1, m3
packuswb m0, m0
@@ -284,7 +286,6 @@ cglobal vc1_h_loop_filter8_sse2, 3,6,8
RET
%define PABSW PABSW_SSSE3
-%define PSIGNW PSIGNW_SSSE3
INIT_MMX
; void ff_vc1_v_loop_filter4_ssse3(uint8_t *src, int stride, int pq)
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index fd3836d574..a5f51e5845 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -28,10 +28,12 @@
#include "os_support.h"
#if defined(_WIN32) && !defined(__MINGW32CE__)
+#undef open
+#include <fcntl.h>
+#include <io.h>
#include <windows.h>
#include <share.h>
-#undef open
int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
{
int fd;
@@ -265,7 +267,7 @@ int ff_socket_nonblock(int socket, int enable)
}
#if !HAVE_POLL_H
-int poll(struct pollfd *fds, nfds_t numfds, int timeout)
+int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout)
{
fd_set read_set;
fd_set write_set;
@@ -285,7 +287,7 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
FD_ZERO(&write_set);
FD_ZERO(&exception_set);
- n = -1;
+ n = 0;
for(i = 0; i < numfds; i++) {
if (fds[i].fd < 0)
continue;
@@ -300,22 +302,22 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set);
if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set);
- if (fds[i].fd > n)
- n = fds[i].fd;
+ if (fds[i].fd >= n)
+ n = fds[i].fd + 1;
};
- if (n == -1)
+ if (n == 0)
/* Hey!? Nothing to poll, in fact!!! */
return 0;
if (timeout < 0)
- rc = select(n+1, &read_set, &write_set, &exception_set, NULL);
+ rc = select(n, &read_set, &write_set, &exception_set, NULL);
else {
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = 1000 * (timeout % 1000);
- rc = select(n+1, &read_set, &write_set, &exception_set, &tv);
+ rc = select(n, &read_set, &write_set, &exception_set, &tv);
};
if (rc < 0)
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index bf2698405b..6110a334d1 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -29,6 +29,8 @@
#include "config.h"
+#include <sys/stat.h>
+
#if defined(__MINGW32__) && !defined(__MINGW32CE__)
# include <fcntl.h>
# ifdef lseek
@@ -58,6 +60,13 @@ static inline int is_dos_path(const char *path)
#define SHUT_RD SD_RECEIVE
#define SHUT_WR SD_SEND
#define SHUT_RDWR SD_BOTH
+
+#ifndef S_IRUSR
+#define S_IRUSR S_IREAD
+#endif
+#ifndef S_IWUSR
+#define S_IWUSR S_IWRITE
+#endif
#endif
#if defined(_WIN32) && !defined(__MINGW32CE__)
@@ -78,6 +87,10 @@ typedef int socklen_t;
#if !HAVE_POLL_H
typedef unsigned long nfds_t;
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#if !HAVE_STRUCT_POLLFD
struct pollfd {
int fd;
short events; /* events to look for */
@@ -97,9 +110,11 @@ struct pollfd {
#define POLLERR 0x0004 /* errors pending */
#define POLLHUP 0x0080 /* disconnected */
#define POLLNVAL 0x1000 /* invalid file descriptor */
+#endif
-int poll(struct pollfd *fds, nfds_t numfds, int timeout);
+int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout);
+#define poll ff_poll
#endif /* HAVE_POLL_H */
#endif /* CONFIG_NETWORK */
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 75d0cec8f1..9a837a7d15 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -35,6 +35,8 @@
#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_always_inline __attribute__((always_inline)) inline
+#elif defined(_MSC_VER)
+# define av_always_inline __forceinline
#else
# define av_always_inline inline
#endif