Add color HW space conversion support for grab

Create Images of proper color space from the start and try to Get surface content to them. Fall back to YUV if
failure occurs at some point in the more accelerated version.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Make sure to only touch VA-API OSD areas softhddevice has memory access to

This should fix crashes when using certain skins (e.g. skinFlatPlus) that for some reason want to
outside the OSD provided by softhddevice.

Signed-off-by: Antti Seppälä <a.sepala@gmail.com>
Implement better putsurface synchronization

This patch should work "in theory" better than the code there was. Earlier code may have been working better in
practice because of buggy vaapi library. Since then extensive GPU hang fixes have been implemented on library
level.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Rudimentary VA-API VPP support to softhddevice v3

This is a second version of VA-API VPP patch for softhddevice. Some changes over the previous version:
 * Implemented dynamic temporal reference handling
 * Picture controls (brightness, contrast etc.) now implemented
 * Fixes deinterlacing when playing bottom-field-first material
 * Still more simplifications to postprocessing setup code

This patchs adds support for Intel VA-API VPP filters to softhddevice. It is expected that many things that used to work are
now broken (progressive images, different frame rates, etc.) or that the entire patch does not work well enough for
production use.

The patch currently forces hardware accelerated Motion Compensated deinterlace algorithm and video denoise filters on. In
addition there is support for changing picture controls from the plugin menu.

Unfortunately the current stable libva-intel-driver has buggy implementation of va-api postprocessing surface handling.
There is a staging version of the driver where the most of the bugs have been fixed
(https://github.com/gbeauchesne/libva-intel-driver/tree/17.vpp.vebox).
This patch was developed against the staging driver. If used against stable libva-intel-driver the image stutters or may get
stuck and green surfaces are occasionally rendered as postprocessing result producing flickering video.

Some additional TODO items for the patch:
 * Dynamic adjusting of deinterlace mode (bob, weave, MotionComp, MotionAdaptive) via softhddevice menu
 * Adjusting of denoise strength via softhddevice menu
 * Providing the picture control limits to the plugin menu (e.g. hue range from -180 to 180)
 * Error handling in case certain vaapi features are not available
 * Testing / fixing progressive input
 * Testing / fixing various framerate and display refreshrate combinations
 * Stricter video pipeline capability checking with filter combinations

The patch was/is tested and developed on:
 * ffmpeg 1.2.6
 * libva 1.3.1
 * libva-intel-driver 1.3.3.pre1 (17.vpp.vebox-r1-8-gad3f8b5)
 + Intel D54250WYK NUC kit (Haswell i5)

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Fix postprocessing of 720p material

Do not run postprocessing filters twice for non-interlaced content
Some further fixes to deinterlacing flags for 720p
Fix playback getting stuck when no forward references exist
Remove mistakenly left debug print
Fix embarrassing mistake where two deinterlaces (MoComp & Bob) were run simultaneously

Bobbing was done by putsurface flags even though the surface was already deinterlaced
Cleanup Vpp surfaces, context and config on cleanup-call.

Also zero/initialize the respective id's
Lock cleanup call to protect it from video postprocessing queueing

This might hopefully fix running into the abort() assertation with surface queue

Also adding some debug logging before abort() call.
Sync surface after postprocessing
Add more elaborate deinterlace flag handling to postprocessing function

This should be correct "on paper"
Try to lock the surface queue but exit if lock is taken for cleanup purposes

Hoping this will fix some abort() calls in the cleanup
Lift number of postprocessing surfaces into its own define

Makes it easier to experiment with different values.
Enable dynamically the "best" (last) deinterlace algorithm.

Also reduce amount of noisereduction
Initialize rest of the Postprocessing pipeline buffer

LIBVA_TRACE=dump.txt shows that these were in uninitialized memory
Clarify surface ordering after postprocessing

Lift surface ordering problematic up one abstraction level.
This allows for better control and clearer code.
Skip deinterlace filter if material is non-interlaced

Slightly hacky change to analyze the filter chain and skip deinterlace
filter if material is not interlaced.

Other filters are currently left unaffected but could be also analyzed
for suitability based on input material parameters.
Fix filter chain if no deinterlace filter is available.