]> git.sesse.net Git - ffmpeg/commitdiff
h264: move direct mode inits out of h264_slice_header_parse()
authorAnton Khirnov <anton@khirnov.net>
Thu, 14 Apr 2016 18:53:59 +0000 (20:53 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 12 Jun 2016 18:27:52 +0000 (20:27 +0200)
This code does not do any bitstream parsing, it just initializes some
internal state.

libavcodec/h264_slice.c

index 404e333c94c83dc3bbeb5ebf2578445b42324ab8..aefb37507c3cacc659275565e5c4a22b2028c457 100644 (file)
@@ -1387,10 +1387,6 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
         }
     }
 
-    if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
-        ff_h264_direct_dist_scale_factor(h, sl);
-    ff_h264_direct_ref_list_init(h, sl);
-
     if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) {
         tmp = get_ue_golomb_31(&sl->gb);
         if (tmp > 2) {
@@ -1464,6 +1460,10 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
     if (ret < 0)
         return ret;
 
+    if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
+        ff_h264_direct_dist_scale_factor(h, sl);
+    ff_h264_direct_ref_list_init(h, sl);
+
     if (h->avctx->skip_loop_filter >= AVDISCARD_ALL ||
         (h->avctx->skip_loop_filter >= AVDISCARD_NONKEY &&
          sl->slice_type_nos != AV_PICTURE_TYPE_I) ||