decoder: h264: fix frame store logic for MVC.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 5 Jun 2014 19:36:33 +0000 (21:36 +0200)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 16 Jun 2014 03:53:35 +0000 (11:53 +0800)
commit143c53900943c660390122f7fa4a1c5705798fdd
treeb6af55d593976e900b46d57c7bdeaaed2fa143bc
parentd2262e37a4737d0d03004c0b34165180ddb1d956
decoder: h264: fix frame store logic for MVC.

In strict MVC decoding mode, when only the necessary set of inter-view
reference pictures are passed to the ReferenceFrames array for decoding
the current picture, we should not re-use a frame store id that might
be needed for decoding another view component in the same access unit.

One way to solve this problem is to track when the VA surface in a
specified frame store id was last referenced. So, a "ref_age" field
is introduced to the GenFrameStore struct and is updated whenever
the surface is being referenced.

Additionally, the list of retired refs candidates (free_refs) is kept
ordered by increasing ref_age. That way, we can immediately know what
is the oldest frame store id to recycle.

Let deltaAge = CurrAge - RefAge:
If deltaAge > 1, we know for sure that the VA surface is gone ;
If deltaAge = 1, the surface could be re-used for inter prediction ;
If deltaAge = 0, the surface could be re-used for inter-view prediction.

The ref_age in each Frame Store entry is always current, i.e. it is
the same for all reference frames that intervened in the decoding
process of all inter view components of the previous access unit. The
age tracks access units.

v2: used a more correct representation of age, instead of POC [Yakui]
v3: minor optimization for detecting changes of access unit [Haihao]

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 3b5eb0522fbfe1220dcd0c0bb093a93cfc25e22c)
12 files changed:
src/gen6_mfd.c
src/gen6_mfd.h
src/gen75_mfd.c
src/gen7_mfd.c
src/gen7_mfd.h
src/gen8_mfd.c
src/i965_avc_bsd.c
src/i965_decoder.h
src/i965_decoder_utils.c
src/i965_decoder_utils.h
src/i965_media_h264.h
src/intel_media.h