diff options
Diffstat (limited to 'libavcodec/eacmv.c')
-rw-r--r-- | libavcodec/eacmv.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 085e2d8..20ec0a2 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -2,20 +2,20 @@ * Electronic Arts CMV Video Decoder * Copyright (c) 2007-2008 Peter Ross * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -43,6 +43,10 @@ typedef struct CmvContext { static av_cold int cmv_decode_init(AVCodecContext *avctx){ CmvContext *s = avctx->priv_data; + avcodec_get_frame_defaults(&s->frame); + avcodec_get_frame_defaults(&s->last_frame); + avcodec_get_frame_defaults(&s->last2_frame); + s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; return 0; @@ -106,9 +110,10 @@ static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t * }else{ /* inter using last frame as reference */ int xoffset = (buf[i] & 0xF) - 7; int yoffset = ((buf[i] >> 4)) - 7; - cmv_motcomp(s->frame.data[0], s->frame.linesize[0], - s->last_frame.data[0], s->last_frame.linesize[0], - x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height); + if (s->last_frame.data[0]) + cmv_motcomp(s->frame.data[0], s->frame.linesize[0], + s->last_frame.data[0], s->last_frame.linesize[0], + x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height); } i++; } |