[FFmpeg-cvslog] VP3: fix decoding of videos with stride > 2048

Jason Garrett-Glaser git
Sun Feb 20 19:28:24 CET 2011


ffmpeg | branch: master | Jason Garrett-Glaser <jason at x264.com> | Thu Feb 17 20:24:05 2011 -0800| [d14723861b271cfb53c42006ce7fc6832461db38] | committer: Michael Niedermayer

VP3: fix decoding of videos with stride > 2048

Also remove qscale_table code; this didn't make sense anyways as VP3 doesn't
use an MPEG-like quantizer scale.
(cherry picked from commit 902685b8abf4e2089802528a32a50f3c68033fda)

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

 libavcodec/vp3.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index ee41846..97051f7 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -237,8 +237,7 @@ typedef struct Vp3DecodeContext {
      * is coded. */
     unsigned char *macroblock_coding;
 
-    uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc
-    int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
+    uint8_t *edge_emu_buffer;
 
     /* Huffman decode */
     int hti;
@@ -325,8 +324,6 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi)
             s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0];
         }
     }
-
-    memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune
 }
 
 /*
@@ -1409,10 +1406,6 @@ static void render_slice(Vp3DecodeContext *s, int slice)
         if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY))
             continue;
 
-
-        if(FFABS(stride) > 2048)
-            return; //various tables are fixed size
-
         /* for each superblock row in the slice (both of them)... */
         for (; sb_y < slice_height; sb_y++) {
 
@@ -1817,10 +1810,8 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
             }
         }
 
-        if (s->qps[0] != s1->qps[0]) {
-            memcpy(&s->qscale_table, &s1->qscale_table, sizeof(s->qscale_table));
+        if (s->qps[0] != s1->qps[0])
             memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array));
-        }
 
         if (qps_changed)
             copy_fields(s, s1, qps, superblock_count);
@@ -1892,6 +1883,9 @@ static int vp3_decode_frame(AVCodecContext *avctx,
         goto error;
     }
 
+    if (!s->edge_emu_buffer)
+        s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0]));
+
     if (s->keyframe) {
         if (!s->theora)
         {
@@ -1925,9 +1919,6 @@ static int vp3_decode_frame(AVCodecContext *avctx,
         }
     }
 
-    s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
-    s->current_frame.qstride= 0;
-
     memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
     ff_thread_finish_setup(avctx);
 
@@ -2007,6 +1998,7 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
     av_free(s->macroblock_coding);
     av_free(s->motion_val[0]);
     av_free(s->motion_val[1]);
+    av_free(s->edge_emu_buffer);
 
     if (avctx->is_copy) return 0;
 




More information about the ffmpeg-cvslog mailing list