truemotion2: convert packet header reading to bytestream2.

Also use correct buffer sizes in calls to tm2_read_stream(). Together,
this prevents overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
h264: fix cabac-on-stack after safe cabac reader.
WMAL: Remove inaccurate and unnecessary doxy

A call to decode_packet() does not always decode a complete WMA packet.
Moreover, this is not the correct place to document calls that are part
of the public API.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
lzw: prevent buffer overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
id3v2: add another mimetype for JPEG image
mp3dec: perform I/S and M/S only when frame mode is joint stereo.

Looks like some LAME versions produce dual stereo mode MP3s with
flags for intensity and middle stereo set. In this mode those flags
should be ignored like the reference decoder and derived ones do.
configure: Check for a different SDL function

This one is available both in SDL 1.2 and in 1.3 (which is the current
version available e.g. in macports), while 1.3 doesn't contain
SDL_Linked_Version().

The current check for SDL_Linked_Version() (available since SDL 1.2.13)
was added in 8f1b06c8, because including the headers for SDL_Init()
redirects the main() function, requiring the main function signature
to match the one of SDL_main (including argc/argv).

Signed-off-by: Martin Storsjö <martin@martin.st>
truemotion2: handle out-of-frame motion vectors through edge extension.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
truemotion: forbid invalid VLC bitsizes and token values.

SHOW_UBITS() is only defined up to n_bits is 25, therefore forbid
values larger than this in get_vlc2() (max_bits). tokens[][] can be
used as an index in deltas[], which has a size of 64, so ensure the
values are smaller than that.

This prevents crashes on corrupt bitstreams.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
lzw: fix potential integer overflow.
mov: don't overwrite existing indexes.

Prevents all kind of badness if files contain multiple
indexes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
rv40dsp: implement prescaled versions for biweight.

The check of whether the fastpath can be used only needs to be done once per
frame.
rv40dsp x86: use only one register, for both increment and loop counter

Around 10 cycles faster for luma.
rv40dsp x86: MMX/MMX2/3DNow/SSE2/SSSE3 implementations of MC

Code mostly inspired by vp8's MC, however:
- its MMX2 horizontal filter is worse because it can't take advantage of
  the coefficient redundancy
- that same coefficient redundancy allows better code for non-SSSE3 versions

Benchmark (rounded to tens of unit):
        V8x8  H8x8  2D8x8  V16x16  H16x16  2D16x16
C       445    358   985    1785    1559    3280
MMX*    219    271   478     714     929    1443
SSE2    131    158   294     425     515     892
SSSE3   120    122   248     387     390     763

End result is overall around a 15% speedup for SSSE3 version (on 6 sequences);
all loop filter functions now take around 55% of decoding time, while luma MC
dsp functions are around 6%, chroma ones are 1.3% and biweight around 2.3%.
mirror in ssse3
dsputil x86: revert a test back to its previous value

Commit 356ee8d caused the initial inversion.
rv40dsp x86: shorten opcodes

Benchmark (rounded to tens of unit):
SSSE3   118    121   246     379     387     744
Fix win32 compile.
rv34dsp x86: implement MMX2 inverse transform

141 cycles down to 56.
53 cycles.