ffmpeg: dxva drop outdated patches
authorRainer Hochecker <fernetmenta@online.de>
Tue, 28 Jan 2014 06:38:52 +0000 (07:38 +0100)
committerRainer Hochecker <fernetmenta@online.de>
Tue, 28 Jan 2014 06:38:52 +0000 (07:38 +0100)
lib/ffmpeg/libavcodec/dxva2.h
lib/ffmpeg/libavcodec/dxva2_mpeg2.c
lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch [deleted file]
lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch [deleted file]

index 881b48d..ac39e06 100644 (file)
@@ -86,7 +86,6 @@ struct dxva_context {
      * Private to the FFmpeg AVHWAccel implementation
      */
     unsigned report_id;
-    unsigned last_slice_count;
 };
 
 /**
index e967770..09e310e 100644 (file)
 
 #include "dxva2_internal.h"
 
+#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
 struct dxva2_picture_context {
     DXVA_PictureParameters pp;
     DXVA_QmatrixData       qm;
     unsigned               slice_count;
-    DXVA_SliceInfo         *slice;
-    unsigned int           slice_alloc;
-
+    DXVA_SliceInfo         slice[MAX_SLICES];
     const uint8_t          *bitstream;
     unsigned               bitstream_size;
 };
@@ -220,20 +219,9 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
     fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
 
     ctx_pic->slice_count    = 0;
-    ctx_pic->slice          = NULL;
-    ctx_pic->slice_alloc    = 0;
     ctx_pic->bitstream_size = 0;
     ctx_pic->bitstream      = NULL;
 
-    if (ctx->last_slice_count > 0)
-    {
-        ctx_pic->slice = av_fast_realloc(NULL,
-                                         &ctx_pic->slice_alloc,
-                                         ctx->last_slice_count * sizeof(DXVA_SliceInfo));
-        if (!ctx_pic->slice)
-            return -1;
-    }
-
     return 0;
 }
 
@@ -244,14 +232,9 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx,
     struct dxva2_picture_context *ctx_pic =
         s->current_picture_ptr->f.hwaccel_picture_private;
     unsigned position;
-    DXVA_SliceInfo* slice;
 
-    slice = av_fast_realloc(ctx_pic->slice,
-                            &ctx_pic->slice_alloc,
-                            (ctx_pic->slice_count + 1) * sizeof(DXVA_SliceInfo));
-    if (!slice)
+    if (ctx_pic->slice_count >= MAX_SLICES)
         return -1;
-    ctx_pic->slice = slice;
 
     if (!ctx_pic->bitstream)
         ctx_pic->bitstream = buffer;
@@ -268,7 +251,6 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
     struct MpegEncContext *s = avctx->priv_data;
     struct dxva2_picture_context *ctx_pic =
         s->current_picture_ptr->f.hwaccel_picture_private;
-    struct dxva_context *ctx = avctx->hwaccel_context;
     int ret;
 
     if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
@@ -280,7 +262,6 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
     if (!ret)
         ff_mpeg_draw_horiz_band(s, 0, avctx->height);
 
-    ctx->last_slice_count = ctx_pic->slice_count;
     return ret;
 }
 
diff --git a/lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch b/lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch
deleted file mode 100644 (file)
index 87e31c5..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-From 40f4c15370f7027dc5422edcb10e8a3b7e58e83d Mon Sep 17 00:00:00 2001
-From: CrystalP <CrystalP@xbmc.org>
-Date: Wed, 5 Oct 2011 12:38:30 -0400
-Subject: [PATCH 18/24] dxva-mpeg2 Allocate slices array dynamically - fixes
- videos with > 175 slices. They used to result in
- images with a black bottom.
-
-sample on team ftp samples/PR471/too_many_slices.ts
-
-Inspired by the vaapi code to reallocate the slices array for each new slice.
-Could be more efficient if the array could be preserved for all frames and
-freed only at the end of the video, but there doesn't seem to be anywhere
-appropriate to free the memory at the end.
-
-Alternative is to allocate the proper size straight away for a new frame,
-instead of realloc'ing for each slice.
----
- libavcodec/dxva2_mpeg2.c |   14 +++++++++++---
- 1 file changed, 11 insertions(+), 3 deletions(-)
-
-diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
-index 951305d..8ba83b6 100644
---- a/libavcodec/dxva2_mpeg2.c
-+++ b/libavcodec/dxva2_mpeg2.c
-@@ -22,12 +22,12 @@
- #include "dxva2_internal.h"
--#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
- struct dxva2_picture_context {
-     DXVA_PictureParameters pp;
-     DXVA_QmatrixData       qm;
-     unsigned               slice_count;
--    DXVA_SliceInfo         slice[MAX_SLICES];
-+    DXVA_SliceInfo         *slice;
-+    unsigned int           slice_alloc;
-     const uint8_t          *bitstream;
-     unsigned               bitstream_size;
-@@ -220,6 +220,8 @@ static int start_frame(AVCodecContext *avctx,
-     fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
-     ctx_pic->slice_count    = 0;
-+    ctx_pic->slice          = NULL;
-+    ctx_pic->slice_alloc    = 0;
-     ctx_pic->bitstream_size = 0;
-     ctx_pic->bitstream      = NULL;
-     return 0;
-@@ -232,9 +234,14 @@ static int decode_slice(AVCodecContext *avctx,
-     struct dxva2_picture_context *ctx_pic =
-         s->current_picture_ptr->f.hwaccel_picture_private;
-     unsigned position;
-+    DXVA_SliceInfo* slice;
--    if (ctx_pic->slice_count >= MAX_SLICES)
-+    slice = av_fast_realloc(ctx_pic->slice,
-+                            &ctx_pic->slice_alloc,
-+                            (ctx_pic->slice_count + 1) * sizeof(DXVA_SliceInfo));
-+    if (!slice)
-         return -1;
-+    ctx_pic->slice = slice;
-     if (!ctx_pic->bitstream)
-         ctx_pic->bitstream = buffer;
-@@ -258,6 +265,7 @@ static int end_frame(AVCodecContext *avctx)
-                                      &ctx_pic->pp, sizeof(ctx_pic->pp),
-                                      &ctx_pic->qm, sizeof(ctx_pic->qm),
-                                      commit_bitstream_and_slice_buffer);
-+    av_freep(ctx_pic->slice);
- }
- AVHWAccel ff_mpeg2_dxva2_hwaccel = {
--- 
-1.7.9.4
-
diff --git a/lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch b/lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch
deleted file mode 100644 (file)
index 4336c31..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-From 681f74b224e16a4df7f8c4e31a9be56975d57e10 Mon Sep 17 00:00:00 2001
-From: CrystalP <CrystalP@xbmc.org>
-Date: Mon, 10 Oct 2011 19:42:50 -0400
-Subject: [PATCH 19/24] dxva-mpeg2 speed up slice allocation
-
-The number of slices is not very likely to change from frame to frame, so
-at the beginning of a new frame, allocate memory for the amount of slices of
-the previous frame. Saves a lot of reallocation, for some TV capture samples
-there are over 200 slices.
-
-There wasn't anywhere really appropriate to store last_slice_count (needs to
-live from first frame to last frame), so this is likely to cause discussion to
-merge upstream.
-Adding members to dxva_context breaks ABI, which we don't care too much about
-since on Windows we don't support external ffmpeg.
-dxva mpeg2 code also has access to MpegEncContext, but adding there would
-likely break ABI as well.
----
- libavcodec/dxva2.h       |    1 +
- libavcodec/dxva2_mpeg2.c |   12 ++++++++++++
- 2 files changed, 13 insertions(+)
-
-diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
-index fc99560..16a6994 100644
---- a/libavcodec/dxva2.h
-+++ b/libavcodec/dxva2.h
-@@ -66,6 +66,7 @@ struct dxva_context {
-      * Private to the FFmpeg AVHWAccel implementation
-      */
-     unsigned report_id;
-+    unsigned last_slice_count;
- };
- #endif /* AVCODEC_DXVA_H */
-diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
-index 8ba83b6..90507f9 100644
---- a/libavcodec/dxva2_mpeg2.c
-+++ b/libavcodec/dxva2_mpeg2.c
-@@ -222,6 +222,16 @@
-     ctx_pic->slice_count    = 0;
-     ctx_pic->bitstream_size = 0;
-     ctx_pic->bitstream      = NULL;
-+
-+    if (ctx->last_slice_count > 0)
-+    {
-+        ctx_pic->slice = av_fast_realloc(NULL,
-+                                         &ctx_pic->slice_alloc,
-+                                         ctx->last_slice_count * sizeof(DXVA_SliceInfo));
-+        if (!ctx_pic->slice)
-+            return -1;
-+    }
-+
-     return 0;
- }
-
-@@ -251,6 +261,7 @@
-     struct MpegEncContext *s = avctx->priv_data;
-     struct dxva2_picture_context *ctx_pic =
-         s->current_picture_ptr->f.hwaccel_picture_private;
-+    struct dxva_context *ctx = avctx->hwaccel_context;
-     int ret;
-
-     if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
-@@ -261,6 +272,8 @@
-                                     commit_bitstream_and_slice_buffer);
-     if (!ret)
-         ff_mpeg_draw_horiz_band(s, 0, avctx->height);
-+
-+    ctx->last_slice_count = ctx_pic->slice_count;
-     return ret;
- }
-
--- 
-1.7.9.4
-