]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/svq1enc.c
avcodec/dsddec: use av_malloc_array()
[ffmpeg] / libavcodec / svq1enc.c
index 9e320403be41871a3bf358cf9435b4118fd09b15..93a1cc16266492e979e467905d1cf6fb4521849d 100644 (file)
@@ -295,11 +295,11 @@ static int svq1_encode_plane(SVQ1Context *s, int plane,
         s->m.avctx                         = s->avctx;
         s->m.current_picture_ptr           = &s->m.current_picture;
         s->m.last_picture_ptr              = &s->m.last_picture;
-        s->m.last_picture.f.data[0]        = ref_plane;
+        s->m.last_picture.f->data[0]        = ref_plane;
         s->m.linesize                      =
-        s->m.last_picture.f.linesize[0]    =
-        s->m.new_picture.f.linesize[0]     =
-        s->m.current_picture.f.linesize[0] = stride;
+        s->m.last_picture.f->linesize[0]    =
+        s->m.new_picture.f->linesize[0]     =
+        s->m.current_picture.f->linesize[0] = stride;
         s->m.width                         = width;
         s->m.height                        = height;
         s->m.mb_width                      = block_width;
@@ -347,7 +347,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane,
         s->m.me.dia_size      = s->avctx->dia_size;
         s->m.first_slice_line = 1;
         for (y = 0; y < block_height; y++) {
-            s->m.new_picture.f.data[0] = src - y * 16 * stride; // ugly
+            s->m.new_picture.f->data[0] = src - y * 16 * stride; // ugly
             s->m.mb_y                  = y;
 
             for (i = 0; i < 16 && i + 16 * y < height; i++) {
@@ -515,6 +515,9 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
            s->rd_total / (double)(avctx->width * avctx->height *
                                   avctx->frame_number));
 
+    s->m.mb_type = NULL;
+    ff_MPV_common_end(&s->m);
+
     av_freep(&s->m.me.scratchpad);
     av_freep(&s->m.me.map);
     av_freep(&s->m.me.score_map);
@@ -537,6 +540,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
 static av_cold int svq1_encode_init(AVCodecContext *avctx)
 {
     SVQ1Context *const s = avctx->priv_data;
+    int ret;
 
     ff_dsputil_init(&s->dsp, avctx);
     ff_hpeldsp_init(&s->hdsp, avctx->flags);
@@ -560,6 +564,12 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
 
     s->avctx               = avctx;
     s->m.avctx             = avctx;
+
+    if ((ret = ff_MPV_common_init(&s->m)) < 0) {
+        svq1_encode_end(avctx);
+        return ret;
+    }
+
     s->m.picture_structure = PICT_FRAME;
     s->m.me.temp           =
     s->m.me.scratchpad     = av_mallocz((avctx->width + 64) *