From: Michael Niedermayer Date: Sun, 17 Nov 2013 00:36:26 +0000 (+0100) Subject: Merge commit '2e09096da912f563c4dd889a8f25c314529bbaa6' X-Git-Tag: android-x86-6.0-r1~8957 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9f890a165666a73376c73b3c2bd920345b5c3b79;p=android-x86%2Fexternal-ffmpeg.git Merge commit '2e09096da912f563c4dd889a8f25c314529bbaa6' * commit '2e09096da912f563c4dd889a8f25c314529bbaa6': kgv1: use the AVFrame API properly. indeo2: use the AVFrame API properly. iff: use the AVFrame API properly. msrle: use the AVFrame API properly. Conflicts: libavcodec/iff.c libavcodec/indeo2.c libavcodec/kgv1dec.c libavcodec/msrle.c See: 451b2ca1b4349f9b60416cc057eaf5518d81025c See: 80e9e63c946660304fc65fa8141ccfdbe4d196d1 See: 057dce5f21cd70db1ef6e3b67644a39f0d51aba5 Merged-by: Michael Niedermayer --- 9f890a165666a73376c73b3c2bd920345b5c3b79 diff --cc libavcodec/iff.c index a4b90fa4a3,7ac78b0e5c..5d69539171 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@@ -318,6 -144,14 +318,16 @@@ static int extract_header(AVCodecContex return 0; } + static av_cold int decode_end(AVCodecContext *avctx) + { + IffContext *s = avctx->priv_data; + av_frame_free(&s->frame); + av_freep(&s->planebuf); ++ av_freep(&s->ham_buf); ++ av_freep(&s->ham_palbuf); + return 0; + } + static av_cold int decode_init(AVCodecContext *avctx) { IffContext *s = avctx->priv_data; @@@ -358,14 -174,12 +368,16 @@@ if (!s->planebuf) return AVERROR(ENOMEM); + s->bpp = avctx->bits_per_coded_sample; s->frame = av_frame_alloc(); - if (!s->frame) + if (!s->frame) { + decode_end(avctx); return AVERROR(ENOMEM); + } + if ((err = extract_header(avctx, NULL)) < 0) + return err; + return 0; } @@@ -858,20 -371,9 +870,10 @@@ static int decode_frame(AVCodecContext return buf_size; } - static av_cold int decode_end(AVCodecContext *avctx) - { - IffContext *s = avctx->priv_data; - av_frame_free(&s->frame); - av_freep(&s->planebuf); - av_freep(&s->ham_buf); - av_freep(&s->ham_palbuf); - return 0; - } - +#if CONFIG_IFF_ILBM_DECODER AVCodec ff_iff_ilbm_decoder = { - .name = "iff_ilbm", - .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"), + .name = "iff", + .long_name = NULL_IF_CONFIG_SMALL("IFF"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_IFF_ILBM, .priv_data_size = sizeof(IffContext), diff --cc libavcodec/kgv1dec.c index 328a555b62,1436ccbaea..5528c6f361 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@@ -162,6 -169,10 +159,9 @@@ static av_cold int decode_init(AVCodecC if (!c->prev) return AVERROR(ENOMEM); - c->avctx = avctx; + avctx->pix_fmt = AV_PIX_FMT_RGB555; + avctx->flags |= CODEC_FLAG_EMU_EDGE; + return 0; } diff --cc libavcodec/msrle.c index 2b4ab1a6a5,4b39c92061..2836fec2fd --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@@ -70,12 -66,10 +70,14 @@@ static av_cold int msrle_decode_init(AV return AVERROR_INVALIDDATA; } - avcodec_get_frame_defaults(&s->frame); + s->frame = av_frame_alloc(); + if (!s->frame) + return AVERROR(ENOMEM); + if (avctx->extradata_size >= 4) + for (i = 0; i < FFMIN(avctx->extradata_size, AVPALETTE_SIZE)/4; i++) + s->pal[i] = 0xFFU<<24 | AV_RL32(avctx->extradata+4*i); + return 0; } @@@ -92,24 -86,27 +94,24 @@@ static int msrle_decode_frame(AVCodecCo s->buf = buf; s->size = buf_size; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) - if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); ++ if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } - if (avctx->bits_per_coded_sample <= 8) { + if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { - s->frame.palette_has_changed = 1; + s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } - /* make the palette available */ - memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); + memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } /* FIXME how to correctly detect RLE ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ - int linesize = avctx->width * avctx->bits_per_coded_sample / 8; + int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; - uint8_t *ptr = s->frame.data[0]; + uint8_t *ptr = s->frame->data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j;