mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
decoder: h264: factor out DPB pruning for MVC.
Factor out the removal process of unused inter-view only reference pictures from the DPB, prior to the possible insertion of the current picture. Ideally, the compiler could still opt for generating two loops. But at least, the code is now clearer for maintenance.
This commit is contained in:
parent
63fde28dfd
commit
c65aec1aa6
1 changed files with 12 additions and 22 deletions
|
@ -873,31 +873,21 @@ static void
|
||||||
dpb_prune_mvc(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
|
dpb_prune_mvc(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
|
||||||
{
|
{
|
||||||
GstVaapiDecoderH264Private * const priv = &decoder->priv;
|
GstVaapiDecoderH264Private * const priv = &decoder->priv;
|
||||||
|
const gboolean is_last_picture = /* in the access unit */
|
||||||
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_AU_END);
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
// Remove all unused inter-view only reference components of the current AU
|
// Remove all unused inter-view only reference components of the current AU
|
||||||
if (GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_AU_END)) {
|
i = 0;
|
||||||
i = 0;
|
while (i < priv->dpb_count) {
|
||||||
while (i < priv->dpb_count) {
|
GstVaapiFrameStore * const fs = priv->dpb[i];
|
||||||
GstVaapiFrameStore * const fs = priv->dpb[i];
|
if (fs->view_id != picture->base.view_id &&
|
||||||
if (fs->view_id != picture->base.view_id &&
|
!fs->output_needed && !gst_vaapi_frame_store_has_reference(fs) &&
|
||||||
!fs->output_needed && !gst_vaapi_frame_store_has_reference(fs))
|
(is_last_picture ||
|
||||||
dpb_remove_index(decoder, i);
|
!is_inter_view_reference_for_next_frames(decoder, fs)))
|
||||||
else
|
dpb_remove_index(decoder, i);
|
||||||
i++;
|
else
|
||||||
}
|
i++;
|
||||||
}
|
|
||||||
else {
|
|
||||||
i = 0;
|
|
||||||
while (i < priv->dpb_count) {
|
|
||||||
GstVaapiFrameStore * const fs = priv->dpb[i];
|
|
||||||
if (fs->view_id != picture->base.view_id &&
|
|
||||||
!fs->output_needed && !gst_vaapi_frame_store_has_reference(fs) &&
|
|
||||||
!is_inter_view_reference_for_next_frames(decoder, fs))
|
|
||||||
dpb_remove_index(decoder, i);
|
|
||||||
else
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue