[3D] Support switching to 3D resolutions

Include matching 3D flags (SBS/TAB) in the score of a resolution to switch to, to enable switching to 3d modes.
Also remove the old code that treated 3D modes differently when assigning a score.

I've also added a small weight to higher multiples of the desired framerate, so if display supports 30, 60 and 120Hz
and the video is 30fps then 30 will now be chosen rather than 120. This reduces the overhead of rendering the gui.
[confluence] Use animated gif as a cheaper working spinner
[rbp/omxplayer] Do we need discontinuity handling?

So far I've not seen what this is needed for and it does cause problems for some files.
h264_parser: Initialize the h264dsp context in the parser as well

Each AVStream struct for an H.264 elementary stream actually has two
copies of the H264DSPContext struct (and in fact all the other members
of H264Context as well):

((H264Context *) ((AVStream *)st)->codec->priv_data)->h264dsp
((H264Context *) ((AVStream *)st)->parser->priv_data)->h264dsp

but only the first of these was actually being initialised. This
prevented the addition of platform-specific implementations of
parser-related functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
h264dsp: Factorize code into a new function, h264_find_start_code_candidate

This performs the start code search which was previously part of
h264_find_frame_end() - the most CPU intensive part of the function.

By itself, this results in a performance regression:
              Before          After
              Mean   StdDev   Mean   StdDev  Change
Overall time  2925.6 26.2     3068.5 31.7    -4.7%

but this can more than be made up for by platform-optimised
implementations of the function.

Signed-off-by: Martin Storsjö <martin@martin.st>
arm: Add assembly version of h264_find_start_code_candidate

               Before          After
               Mean   StdDev   Mean   StdDev  Change
This function   508.8 23.4      185.4  9.0    +174.4%
Overall        3068.5 31.7     2752.1 29.4     +11.5%

In combination with the preceding patch:
                Before          After
                Mean   StdDev   Mean   StdDev  Change
Overall         2925.6 26.2     2752.1 29.4     +6.3%

Signed-off-by: Martin Storsjö <martin@martin.st>
[ffmpeg] Backport of h264_find_start_code_candidate optimisation
[rbp/gui] Add switch between higher and lower quality textures

To save memory we default to 16bpp textures,
but provide a GUI option to increase that to 32bpp.
[rbp/gui] Add switch to remove GUI 720p limit
[rbp/omxplayer] Add fixed latency mode for live streams
[rbp/omxplayer] Avoid marking non-monotonic timestamps as unknown

Following a single spurious timestamp that is in the future,
all subsequent timestamps will be marked unknown causing out of sync.
[rbp] Hide monitor settings added with openelec fernetmenta-fixes patch
ffmpeg demuxer: faster channel change for PVR addons without internal demuxing
Implement a window ID cache

In the course of each refresh of the visibility of controls (which is
performed every frame), there are many calls to CGUIWindowManager::GetWindow
to convert from a window's integer ID to a pointer to the corresponding
CGUIWindow pointer. This involves acquiring a lock and performing a tree walk.
Yet in practice, the same ID is looked up many times in succession, so this
benefits from a simple cache of the most recently checked ID.

I measured the effect while the Videos window of the default skin was open
(but idle) on a Raspberry Pi, and this simple change alone reduced the CPU
usage by 1.5% from 46.6% to 45.1%:

          Before          After
          Mean   StdDev   Mean   StdDev  Confidence  Change
IdleCPU%  46.6   0.9      45.1   1.2     99.8%       +3.3%
Add selective caching of infobools in list items

As noted in a TODO comment attached to CGUIInfoManager::GetBoolValue, caching
of infobools (both expression and single bools) is disabled whenever a
CGUIListItem pointer is provided. This is true whenever visibility is
evaluated for a control which is part of a list item (which is responsible
for a large portion of the controls in many windows), which obviously hurts
caceh efficiency. However, many of the bools (including the leaf nodes of
expression infobools) aren't actually dependent upon which list item they're
attached to.

This patch adds a flag to each InfoBool object to indicate whether its value
depends upon the list item; if this isn't set, then the cache is re-enabled
even if a CGUIListItem pointer is provided. The flag is calculated at parse
time because it's quite tricky to evaluate - it applies to bools in any of
the following categories:
* a statically definied boolean condition in the range LISTITEM_START to
  LISTITEM_END - for example, "ListItem.IsResumable"
* a (dynamically allocated) multi-info bool, that is to say, the result of a
  string or integer operation on a list item attribute - for example
  "substring(Listitem.mpaa,Rated R)"
* an expression that uses one or more of the above - for example
  "Window.IsVisible(Videos) + !ListItem.IsResumable"

I measured the effect while the Videos window of the default skin was open
(but idle) on a Raspberry Pi, and this reduced the CPU usage by 3.2% from
45.1% to 41.9%:

          Before          After
          Mean   StdDev   Mean   StdDev  Confidence  Change
IdleCPU%  45.1   1.2      41.9   0.5     100.0%      +7.7%
More efficient infobool expression evaluator

Expession infobools are evaluated at runtime from one or more single infobools
and a combination of boolean NOT, AND and OR operators. Previously, parsing
produced a vector of operands (leaf nodes) and operators in postfix
(reverse-Polish) form, and evaluated all leaf nodes every time the expression
was evaluated. But this ignores the fact that in many cases, once one operand
of an AND or OR operation has been evaluated, there is no need to evaluate the
other operand because its value can have no effect on the ultimate result. It
is also worth noting that AND and OR operations are associative, meaning they
can be rearranged at runtime to better suit the selected skin.

This patch rewrites the expression parsing and evaluation code. Now the
internal repreentation is in the form of a tree where leaf nodes represent a
single infobool, and branch nodes represent either an AND or an OR operation
on two or more child nodes.

Expressions are rewritten at parse time into a form which favours the
formation of groups of associative nodes. These groups are then reordered at
evaluation time such that nodes whose value renders the evaluation of the
remainder of the group unnecessary tend to be evaluated first (these are
true nodes for OR subexpressions, or false nodes for AND subexpressions).
The end effect is to minimise the number of leaf nodes that need to be
evaluated in order to determine the value of the expression. The runtime
adaptability has the advantage of not being customised for any particular skin.

The modifications to the expression at parse time fall into two groups:
1) Moving logical NOTs so that they are only applied to leaf nodes.
   For example, rewriting ![A+B]|C as !A|!B|C allows reordering such that
   any of the three leaves can be evaluated first.
2) Combining adjacent AND or OR operations such that each path from the root
   to a leaf encounters a strictly alternating pattern of AND and OR
   operations. So [A|B]|[C|D+[[E|F]|G] becomes A|B|C|[D+[E|F|G]].

I measured the effect while the Videos window of the default skin was open
(but idle) on a Raspberry Pi, and this reduced the CPU usage by 2.8% from
41.9% to 39.1%:

          Before          After
          Mean   StdDev   Mean   StdDev  Confidence  Change
IdleCPU%  41.9   0.5      39.1   0.9     100.0%      +7.0%
[rbp/omxplayer] Defer demuxer pause until buffers full
[rbp] Fix bug with CPicture::CreateTiledThumb and texture pipeline

The decode to texture pipeline results in the decoded pixels not being available to xbmc.
The pixels are required for CPicture::CreateTiledThumb, so provide an extra parameter to request that
[rbp/omxplayer] When opening a stream don't try to update gui so often

The 1ms sleep allows for up to 1000 fps gui overlay update, which when busy when opening a file is a bad idea.
Increase the sleep so it only tries to update at up to 10 times per second