[FFmpeg-cvslog] er: replace VLA with malloc/free

Mans Rullgard git at videolan.org
Sat Oct 22 20:47:46 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sun Jul  4 01:57:47 2010 +0100| [39b0165f9e11c7f66ae563864e2738cf9efa477f] | committer: Michael Niedermayer

er: replace VLA with malloc/free
(cherry picked from commit 5c2d016a85453f121285d125ed049a8cf492855a)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39b0165f9e11c7f66ae563864e2738cf9efa477f
---

 libavcodec/error_resilience.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index cf967bf..8a2a7ae 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -358,7 +358,7 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
 }
 
 static void guess_mv(MpegEncContext *s){
-    uint8_t fixed[s->mb_stride * s->mb_height];
+    uint8_t *fixed = av_malloc(s->mb_stride * s->mb_height);
 #define MV_FROZEN    3
 #define MV_CHANGED   2
 #define MV_UNCHANGED 1
@@ -414,7 +414,7 @@ static void guess_mv(MpegEncContext *s){
                 decode_mb(s, 0);
             }
         }
-        return;
+        goto end;
     }
 
     for(depth=0;; depth++){
@@ -634,7 +634,7 @@ score_sum+= best_score;
         }
 
         if(none_left)
-            return;
+            goto end;
 
         for(i=0; i<s->mb_num; i++){
             int mb_xy= s->mb_index2xy[i];
@@ -643,6 +643,8 @@ score_sum+= best_score;
         }
 //        printf(":"); fflush(stdout);
     }
+end:
+    av_free(fixed);
 }
 
 static int is_intra_more_likely(MpegEncContext *s){



More information about the ffmpeg-cvslog mailing list