]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/motionpixels.c
msmpeg4: Add ff_ prefix to nonstatic symbols
[ffmpeg] / libavcodec / motionpixels.c
index 70b499eabe99558a8870f4ee5305eaf3e6ed58cd..37c108f1f29a6520209a4c4f6e8de72fcef37958 100644 (file)
@@ -52,14 +52,16 @@ typedef struct MotionPixelsContext {
 static av_cold int mp_decode_init(AVCodecContext *avctx)
 {
     MotionPixelsContext *mp = avctx->priv_data;
+    int w4 = (avctx->width  + 3) & ~3;
+    int h4 = (avctx->height + 3) & ~3;
 
     motionpixels_tableinit();
     mp->avctx = avctx;
-    dsputil_init(&mp->dsp, avctx);
-    mp->changes_map = av_mallocz(avctx->width * avctx->height);
+    ff_dsputil_init(&mp->dsp, avctx);
+    mp->changes_map = av_mallocz(avctx->width * h4);
     mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
     mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
-    mp->hpt = av_mallocz(avctx->height * avctx->width / 16 * sizeof(YuvPixel));
+    mp->hpt = av_mallocz(h4 * w4 / 16 * sizeof(YuvPixel));
     avctx->pix_fmt = PIX_FMT_RGB555;
     return 0;
 }
@@ -279,10 +281,12 @@ static int mp_decode_frame(AVCodecContext *avctx,
     if (sz == 0)
         goto end;
 
+    if (mp->max_codes_bits <= 0)
+        goto end;
     if (init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0))
         goto end;
     mp_decode_frame_helper(mp, &gb);
-    free_vlc(&mp->vlc);
+    ff_free_vlc(&mp->vlc);
 
 end:
     *data_size = sizeof(AVFrame);