decoder: h264: allocate reference frames earlier, if needed.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 6 May 2014 12:07:30 +0000 (14:07 +0200)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 16 Jun 2014 03:53:35 +0000 (11:53 +0800)
commita35d3c2d8f006d4b019881a23ad57819eeb7d62e
treee893489ca3f97b87905fde38d18700e6fe689fc3
parent99075c5cc755a767e8904777d3a98bd8c222a03b
decoder: h264: allocate reference frames earlier, if needed.

Sometimes, a dummy frame comes from the codec layer and it is used
as a reference, per the comment in the existing code. Even though
this looks suspicious, keep this criterion but make sure to try
allocating the VA surface, if needed, earlier in the function that
sanity checks the parameters for decoding the current frame.

This makes it possible to fail at a much earlier time, and actually
make it possible to return a sensible error code to the upper layer.

Also fix the reference_objects[] array elements to be an exact 1:1
match for ReferenceFrames[] array elements, including possible but
unlikely holes in it. The former array holds object_surface structs
corresponding to the VA surfaces present in the ReferenceFrames[]
array and identified by VAPictureH264.picture_id.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 5a12ccda3f77d03b6ffa8249d607c03e4dc8161f)
src/i965_decoder_utils.c