diff options
Diffstat (limited to 'libavcodec/lagarith.c')
-rw-r--r-- | libavcodec/lagarith.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 757873ead3..c72de2dcfa 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -2,20 +2,20 @@ * Lagarith lossless decoder * Copyright (c) 2009 Nathan Caldwell <saintdev (at) gmail.com> * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -247,14 +247,15 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf, { int L, TL; - /* Left pixel is actually prev_row[width] */ - L = buf[width - stride - 1]; if (!line) { /* Left prediction only for first line */ L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width - 1, buf[0]); return; - } else if (line == 1) { + } + /* Left pixel is actually prev_row[width] */ + L = buf[width - stride - 1]; + if (line == 1) { /* Second line, left predict first pixel, the rest of the line is median predicted * NOTE: In the case of RGB this pixel is top predicted */ TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L; @@ -498,7 +499,7 @@ static int lag_decode_frame(AVCodecContext *avctx, if (!l->rgb_planes) { l->rgb_stride = FFALIGN(avctx->width, 16); - l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes); + l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes + 16); if (!l->rgb_planes) { av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); |