decoder: h264: slightly optimize the process to detect new pictures.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 30 Jun 2014 09:06:29 +0000 (11:06 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 30 Jun 2014 09:51:59 +0000 (11:51 +0200)
Optimize the process to detect new pictures or start of new access
units by checking if the previous NAL unit was the end of a picture,
or the end of the previous access unit.

gst-libs/gst/vaapi/gstvaapidecoder_h264.c

index 2dbe8f1..a51595b 100644 (file)
@@ -4040,7 +4040,12 @@ gst_vaapi_decoder_h264_parse(GstVaapiDecoder *base_decoder,
     case GST_H264_NAL_SLICE_IDR:
     case GST_H264_NAL_SLICE:
         flags |= GST_VAAPI_DECODER_UNIT_FLAG_SLICE;
-        if (is_new_picture(pi, priv->prev_slice_pi)) {
+        if (priv->prev_pi &&
+            (priv->prev_pi->flags & GST_VAAPI_DECODER_UNIT_FLAG_AU_END)) {
+            flags |= GST_VAAPI_DECODER_UNIT_FLAG_AU_START |
+                GST_VAAPI_DECODER_UNIT_FLAG_FRAME_START;
+        }
+        else if (is_new_picture(pi, priv->prev_slice_pi)) {
             flags |= GST_VAAPI_DECODER_UNIT_FLAG_FRAME_START;
             if (is_new_access_unit(pi, priv->prev_slice_pi))
                 flags |= GST_VAAPI_DECODER_UNIT_FLAG_AU_START;