see $subject

this prevents lavc to crash on one VC1 interlaced sample that I have.
the sample still does not play correctly though.
>From 2f9e3e8fbee509b2244f4820242d848b992d6d9c Mon Sep 17 00:00:00 2001
From: Vladimir Pantelic <vlado...@gmail.com>
Date: Wed, 9 Jan 2013 15:59:05 +0100
Subject: [PATCH] vc1dec: handle pred_flag parameter not given to
 get_mvdata_interlaced()

Signed-off-by: Vladimir Pantelic <vlado...@gmail.com>
---
 libavcodec/vc1dec.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d5d6884..0848919 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1133,9 +1133,13 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
         *dmv_x = get_bits(gb, v->k_x);
         *dmv_y = get_bits(gb, v->k_y);
         if (v->numref) {
-            *pred_flag = *dmv_y & 1;
-            *dmv_y     = (*dmv_y + *pred_flag) >> 1;
-        }
+            if(pred_flag) {
+	        *pred_flag = *dmv_y & 1;
+                *dmv_y     = (*dmv_y + *pred_flag) >> 1;
+            } else {
+                *dmv_y     = (*dmv_y + (*dmv_y & 1)) >> 1;
+	    }
+	}
     }
     else {
         if (extend_x)
@@ -1160,7 +1164,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
             *dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign;
         } else
             *dmv_y = 0;
-        if (v->numref)
+        if (v->numref && pred_flag)
             *pred_flag = index1 & 1;
     }
 }
-- 
1.7.6.1


_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to