diff options
Diffstat (limited to 'libavcodec/mimic.c')
-rw-r--r-- | libavcodec/mimic.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index d7723a8ef7..0cc30ab0ed 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -2,20 +2,20 @@ * Copyright (C) 2005 Ole André Vadla Ravnås <oleavr@gmail.com> * Copyright (C) 2008 Ramiro Polla * - * 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 */ @@ -119,7 +119,8 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx) MimicContext *ctx = avctx->priv_data; int i; - av_free(ctx->swap_buf); + av_freep(&ctx->swap_buf); + ctx->swap_buf_size = 0; for (i = 0; i < FF_ARRAY_ELEMS(ctx->frames); i++) { if (ctx->frames[i].f) @@ -165,6 +166,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) return 0; } +#if HAVE_THREADS static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from) { MimicContext *dst = avctx->priv_data, *src = avctx_from->priv_data; @@ -178,7 +180,7 @@ static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCod for (i = 0; i < FF_ARRAY_ELEMS(dst->frames); i++) { ff_thread_release_buffer(avctx, &dst->frames[i]); - if (src->frames[i].f->data[0]) { + if (i != src->next_cur_index && src->frames[i].f->data[0]) { ret = ff_thread_ref_frame(&dst->frames[i], &src->frames[i]); if (ret < 0) return ret; @@ -187,6 +189,7 @@ static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCod return 0; } +#endif static const int8_t vlcdec_lookup[9][64] = { { 0, }, @@ -254,7 +257,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale) value = get_bits(&ctx->gb, num_bits); - /* Libav's IDCT behaves somewhat different from the original code, so + /* FFmpeg's IDCT behaves somewhat different from the original code, so * a factor of 4 was added to the input */ coeff = vlcdec_lookup[num_bits][value]; @@ -409,10 +412,8 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ctx->frames[ctx->cur_index].f->pict_type = is_pframe ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if ((res = ff_thread_get_buffer(avctx, &ctx->frames[ctx->cur_index], - AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + AV_GET_BUFFER_FLAG_REF)) < 0) return res; - } ctx->next_prev_index = ctx->cur_index; ctx->next_cur_index = (ctx->cur_index - 1) & 15; @@ -448,6 +449,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, return buf_size; } +#if HAVE_THREADS static av_cold int mimic_init_thread_copy(AVCodecContext *avctx) { MimicContext *ctx = avctx->priv_data; @@ -463,6 +465,7 @@ static av_cold int mimic_init_thread_copy(AVCodecContext *avctx) return 0; } +#endif AVCodec ff_mimic_decoder = { .name = "mimic", |