]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/zmbv.c
Merge commit '7748dd41be3d6dd6300f14263586af4ee104ead2'
[ffmpeg] / libavcodec / zmbv.c
index 7f3b326dd1a681f5162e1caf2acaa2c70903bdeb..905c4ccbe66911e525450f23b8ca393a8b1e01f7 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "libavutil/common.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "internal.h"
@@ -493,7 +494,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
         c->bx = (c->width + c->bw - 1) / c->bw;
         c->by = (c->height+ c->bh - 1) / c->bh;
         if (!c->cur || !c->prev)
-            return -1;
+            return AVERROR(ENOMEM);
         memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
         memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
         c->decode_intra= decode_intra;
@@ -554,11 +555,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
         case ZMBV_FMT_24BPP:
 #endif
         case ZMBV_FMT_32BPP:
-            for (j = 0; j < c->height; j++) {
-                memcpy(out, src, c->stride);
-                src += c->stride;
-                out += frame->linesize[0];
-            }
+            av_image_copy_plane(out, frame->linesize[0], src, c->stride,
+                                c->stride, c->height);
             break;
         default:
             av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt);