dxva2: Increase maximum number of slices for mpeg2
authorRainer Hochecker <fernetmenta@online.de>
Thu, 6 Mar 2014 13:40:43 +0000 (14:40 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Thu, 6 Mar 2014 18:28:20 +0000 (19:28 +0100)
Some content requires an higher number of slices in order to
render properly.

Rise the number to 1024 and warn if ever it exceeds.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/dxva2_mpeg2.c

index 049fa48..e0b2efa 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/log.h"
 #include "dxva2_internal.h"
 
-#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
+#define MAX_SLICES 1024
 struct dxva2_picture_context {
     DXVA_PictureParameters pp;
     DXVA_QmatrixData       qm;
@@ -233,9 +234,11 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx,
         s->current_picture_ptr->hwaccel_picture_private;
     unsigned position;
 
-    if (ctx_pic->slice_count >= MAX_SLICES)
+    if (ctx_pic->slice_count >= MAX_SLICES) {
+        avpriv_request_sample(avctx, "%d slices in dxva2",
+                              ctx_pic->slice_count);
         return -1;
-
+    }
     if (!ctx_pic->bitstream)
         ctx_pic->bitstream = buffer;
     ctx_pic->bitstream_size += size;