raseonsi/vcn: fix a h264 decoding issue

reason:
   some h264 streams have some strange pictures, from
   vaapi input these pictures don't have a reference frame,
   however, they are not intra only pictures, in MB layer
   these pictures are looking for some references, if they
   cannot find it. It could cause PF.

   when reference pictures exist, it will need to set used_for
   reference_flags, therefore if that is set, however the
   number of reference frames is zero, which is odd, it
   should be avoided.

solution:
   In the above case,  to scan the ref list so that it will
   make at least one reference available to avoid crash, since
   this is not accurate enough, it could cause some artifacts.
   And in that case, it will need to be checked individually
   for another solution.

closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1462
closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8401
Cc: mesa-stable

Tested-by: llyyr <llyyr.public@gmail.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21732>
(cherry picked from commit 0f3370eede23284c09abdaa46714d7c4c795ecd4)
2 files changed