]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dxva2_h264.c
Add memory allocation failure checks to ff_iir_filter_init_coeffs().
[ffmpeg] / libavcodec / dxva2_h264.c
index b0b126a70a3b01e11423e56b50dd4782a35b4e09..bdb42df3f782c891b520ab3be426f90402bcecd3 100644 (file)
@@ -57,14 +57,14 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
     pp->UsedForReferenceFlags  = 0;
     pp->NonExistingFrameFlags  = 0;
     for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
-            const Picture *r;
-            if (j < h->short_ref_count) {
-                r = h->short_ref[j++];
-            } else {
-                r = NULL;
-                while (!r && j < h->short_ref_count + 16)
-                    r = h->long_ref[j++ - h->short_ref_count];
-            }
+        const Picture *r;
+        if (j < h->short_ref_count) {
+            r = h->short_ref[j++];
+        } else {
+            r = NULL;
+            while (!r && j < h->short_ref_count + 16)
+                r = h->long_ref[j++ - h->short_ref_count];
+        }
         if (r) {
             fill_picture_entry(&pp->RefFrameList[i],
                                ff_dxva2_get_surface_index(ctx, r),
@@ -194,7 +194,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
 
     slice->first_mb_in_slice     = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x;
     slice->NumMbsForSlice        = 0; /* XXX it is set once we have all slices */
-    slice->BitOffsetToSliceData  = get_bits_count(&s->gb) + 8;
+    slice->BitOffsetToSliceData  = get_bits_count(&s->gb);
     slice->slice_type            = ff_h264_get_slice_type(h);
     if (h->slice_type_fixed)
         slice->slice_type += 5;