x86: vc1: fix and enable optimised loop filter

The problem is that the ssse3 psign instruction does the wrong
thing here.  Commit ea60dfe incorrectly removed a macro emulating
this instruction for pre-ssse3 code.  However, the emulation is
incorrect, and the code relies on the behaviour of the macro.
Specifically, the psign sets destination elements to zero where
the corresponding source element is zero, whereas the emulation
only negates destination elements where the source is negative.

Furthermore, the PSIGNW_MMX macro in x86util.asm is totally bogus,
which is why the original VC-1 code had an additional right shift
when using it.  Since the psign instruction cannot be used here,
skip all the macro hell and use the working instruction sequence
directly.

None of this was noticed due a stray return statement in
ff_vc1dsp_init_mmx() which meant that only the mmx version of the
loop filter was ever used (before being removed in ea60dfe).

Signed-off-by: Mans Rullgard <mans@mansr.com>
os_support: Include all the necessary headers for the win32 open function

io.h is required for open and _wopen, and fcntl.h is required for
the O_CREAT flag. On mingw, fcntl.h is included by os_support.h (and
the mingw fcntl.h includes io.h), but include it explicitly here
since this implementation requires it.

Also move the #undef open up. open must not be defined to ff_win32_open
while including the headers that declare the open function. On mingw,
this happened in os_support.h before open was redirected.

Signed-off-by: Martin Storsjö <martin@martin.st>
os_support: Don't compare a negative number against socket descriptors

The fds are unsigned integers in the windows definition of struct
sockfds. Due to this, the comparison if (fds[i].fd > n) was always
false.

Signed-off-by: Martin Storsjö <martin@martin.st>
network: Check for struct pollfd

We need to include winsock2.h here, to make sure we have the
real pollfd struct definition, if one exists, before defining the
fallback poll function.

Signed-off-by: Martin Storsjö <martin@martin.st>
os_support: Rename the poll fallback function to ff_poll

The fallback function is a non-static function, we shouldn't be
defining non-static functions outside of the proper ff/av prefix
namespaces.

This is especially important for a function like poll, which
other parties (other libraries, or executables linking these
libraries) also might provide similar but incompatible fallbacks for.

Signed-off-by: Martin Storsjö <martin@martin.st>
os_support: Add fallback definitions for stat flags

Mingw headers provide similar defines already (unconditional #defines,
without any #undef or #ifdef around it), while MSVC doesn't have
them.

Signed-off-by: Martin Storsjö <martin@martin.st>
cmdutils: Pass the actual chosen encoder to filter_codec_opts

This allows passing the right options to encoders when there's more
than one encoder for a certain codec id.

Signed-off-by: Martin Storsjö <martin@martin.st>
attributes: Add a definition of av_always_inline for MSVC

Signed-off-by: Martin Storsjö <martin@martin.st>
ffplay: only configure video filters after we got the first frame

Otherwise the codec width, height and pixel format values may not be set.

Signed-off-by: Marton Balint <cus@passwd.hu>
x86: fmtconvert: add special asm for float_to_int16_interleave_misc_*

This gets rid of a variable-length array and a for loop in C code.

Signed-off-by: Martin Storsjö <martin@martin.st>
dnxhdenc: add space between function argument type and comment.

Signed-off-by: Martin Storsjö <martin@martin.st>
dsputilenc_mmx: split assignment of ff_sse16_sse2 to SSE2 section.
ffmpeg: re-set frame_size after filter graph reset.

The filter contexts are completely cleared,
so the frame size can not be kept.
Merge remote-tracking branch 'qatar/master'

* qatar/master:
  dsputilenc_mmx: split assignment of ff_sse16_sse2 to SSE2 section.
  dnxhdenc: add space between function argument type and comment.
  x86: fmtconvert: add special asm for float_to_int16_interleave_misc_*
  attributes: Add a definition of av_always_inline for MSVC
  cmdutils: Pass the actual chosen encoder to filter_codec_opts
  os_support: Add fallback definitions for stat flags
  os_support: Rename the poll fallback function to ff_poll
  network: Check for struct pollfd
  os_support: Don't compare a negative number against socket descriptors
  os_support: Include all the necessary headers for the win32 open function
  x86: vc1: fix and enable optimised loop filter

Conflicts:
	cmdutils.c
	cmdutils.h
	ffmpeg.c
	ffplay.c
	libavformat/os_support.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge remote-tracking branch 'cus/stable'

* cus/stable:
  ffplay: only configure video filters after we got the first frame

Merged-by: Michael Niedermayer <michaelni@gmx.at>