lavu: add support for atomic operations.

These could be used for reference counting, or for keeping track of
decoding progress in references in multithreaded decoders.

Support is provided by gcc/msvc/suncc intrinsics, with a fallback using
pthread mutexes.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
lavu: add a new API for reference-counted data buffers.
AVBuffer: add a new API for buffer pools
avpacket: use AVBuffer to allow refcounting the packets.

This will allow us to avoid copying the packets in many cases.

This breaks ABI.
pthread: avoid copying input packets when possible.
lavc: move AVFrame.hwaccel_picture_private to Picture.

This field is private and should not be present in a public struct. It
is only used in DXVA with mpegvideo-based decoders currently.
Move AVFrame from lavc to lavu.

Add AVBuffer-based reference counting API to it.
AVFrame: add side data.
lavfi: switch to AVFrame.

Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it
and use AVFrame instead.
mpegvideo_enc: drop support for reusing the input motion vectors.

This misfeature is most likely completely useless and conflicts with
removing the mpegvideo-specific fields from AVFrame. In the improbable
case it is actually useful, it should be reimplemented in a better way.
lavc decoders: work with refcounted frames.
lavc decoders: properly initialize AVFrame.
lavc: allow decoders to override frame parameters.
lavc: limit maximum number of channels to 63

This is the most that can be represented with the current channel layout
system. This limit should be raised/removed when a better system is
implemented.
lavc: make up a fake frame channel layout when there is no real one.

This should ensure that a valid channel layout is always set on a frame,
until a better solution is implemented.
mpegvideo: drop vismv code

It has been broken for over a year without anyone complaining or
noticing, thus proving that nobody ever uses it.
avconv: convert to new refcounted AVFrame API
avplay: switch to new refcounted frames API

Remove now unused cmdutils get_buffer() implementation.
avserver: don't set deprecated options.
lavc: stop setting AVFrame.motion_subsample_log2

It is not used inside lavc anywhere and now it makes no sense to export
it.