From cb879ec2fb67248adf9ca4762f36836cea0a8b26 Mon Sep 17 00:00:00 2001
From: Roman Shaposhnik <roman@shaposhnik.org>
Date: Tue, 19 Aug 2008 16:00:26 +0000
Subject: [PATCH] Introducing DV_MAX_BPM macro instead of a hardcoded value for
 the highest number of blocks per macroblock

Originally committed as revision 14840 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/dv.c     | 4 ++--
 libavcodec/dvdata.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 30e0b1da551..816ccae2694 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -360,8 +360,8 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
     const uint8_t *buf_ptr;
     PutBitContext pb, vs_pb;
     GetBitContext gb;
-    BlockInfo mb_data[5 * 6], *mb, *mb1;
-    DECLARE_ALIGNED_16(DCTELEM, sblock[5*6][64]);
+    BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
+    DECLARE_ALIGNED_16(DCTELEM, sblock[5*DV_MAX_BPM][64]);
     DECLARE_ALIGNED_8(uint8_t, mb_bit_buffer[80 + 4]); /* allow some slack */
     DECLARE_ALIGNED_8(uint8_t, vs_bit_buffer[5 * 80 + 4]); /* allow some slack */
     const int log2_blocksize= 3-s->avctx->lowres;
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
index c725e1a7651..48ddfccd7a6 100644
--- a/libavcodec/dvdata.h
+++ b/libavcodec/dvdata.h
@@ -2638,6 +2638,9 @@ enum dv_pack_type {
 /* largest possible DV frame, in bytes (PAL 50Mbps) */
 #define DV_MAX_FRAME_SIZE 288000
 
+/* maximum number of blocks per macroblock in any DV format */
+#define DV_MAX_BPM 8
+
 static inline const DVprofile* dv_frame_profile(const uint8_t* frame)
 {
     if ((frame[3] & 0x80) == 0) {      /* DSF flag */
-- 
GitLab