Callers always use a frame and cast it to AVPicture, change ff_msrle_decode() to accept an AVFrame directly instead. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>tags/n3.0
| @@ -85,7 +85,7 @@ static int aasc_decode_frame(AVCodecContext *avctx, | |||||
| break; | break; | ||||
| case 1: | case 1: | ||||
| bytestream2_init(&s->gb, buf, buf_size); | bytestream2_init(&s->gb, buf, buf_size); | ||||
| ff_msrle_decode(avctx, (AVPicture*)s->frame, 8, &s->gb); | |||||
| ff_msrle_decode(avctx, s->frame, 8, &s->gb); | |||||
| break; | break; | ||||
| default: | default: | ||||
| av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr); | av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr); | ||||
| @@ -264,7 +264,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, | |||||
| p->linesize[0] = -p->linesize[0]; | p->linesize[0] = -p->linesize[0]; | ||||
| } | } | ||||
| bytestream2_init(&gb, buf, dsize); | bytestream2_init(&gb, buf, dsize); | ||||
| ff_msrle_decode(avctx, (AVPicture*)p, depth, &gb); | |||||
| ff_msrle_decode(avctx, p, depth, &gb); | |||||
| if (height < 0) { | if (height < 0) { | ||||
| p->data[0] += p->linesize[0] * (avctx->height - 1); | p->data[0] += p->linesize[0] * (avctx->height - 1); | ||||
| p->linesize[0] = -p->linesize[0]; | p->linesize[0] = -p->linesize[0]; | ||||
| @@ -126,7 +126,7 @@ static int msrle_decode_frame(AVCodecContext *avctx, | |||||
| } | } | ||||
| } else { | } else { | ||||
| bytestream2_init(&s->gb, buf, buf_size); | bytestream2_init(&s->gb, buf, buf_size); | ||||
| ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb); | |||||
| ff_msrle_decode(avctx, s->frame, avctx->bits_per_coded_sample, &s->gb); | |||||
| } | } | ||||
| if ((ret = av_frame_ref(data, s->frame)) < 0) | if ((ret = av_frame_ref(data, s->frame)) < 0) | ||||
| @@ -30,7 +30,7 @@ | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "msrledec.h" | #include "msrledec.h" | ||||
| static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic, | |||||
| static int msrle_decode_pal4(AVCodecContext *avctx, AVFrame *pic, | |||||
| GetByteContext *gb) | GetByteContext *gb) | ||||
| { | { | ||||
| unsigned char rle_code; | unsigned char rle_code; | ||||
| @@ -128,7 +128,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic, | |||||
| } | } | ||||
| static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, | |||||
| static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVFrame *pic, | |||||
| int depth, GetByteContext *gb) | int depth, GetByteContext *gb) | ||||
| { | { | ||||
| uint8_t *output, *output_end; | uint8_t *output, *output_end; | ||||
| @@ -243,7 +243,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, | |||||
| } | } | ||||
| int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, | |||||
| int ff_msrle_decode(AVCodecContext *avctx, AVFrame *pic, | |||||
| int depth, GetByteContext *gb) | int depth, GetByteContext *gb) | ||||
| { | { | ||||
| switch(depth){ | switch(depth){ | ||||
| @@ -33,7 +33,7 @@ | |||||
| * @param depth bit depth | * @param depth bit depth | ||||
| * @param gb input bytestream context | * @param gb input bytestream context | ||||
| */ | */ | ||||
| int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, | |||||
| int ff_msrle_decode(AVCodecContext *avctx, AVFrame *pic, | |||||
| int depth, GetByteContext *gb); | int depth, GetByteContext *gb); | ||||
| #endif /* AVCODEC_MSRLEDEC_H */ | #endif /* AVCODEC_MSRLEDEC_H */ | ||||
| @@ -95,7 +95,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, | |||||
| if (ret != Z_DATA_ERROR) { | if (ret != Z_DATA_ERROR) { | ||||
| bytestream2_init(&c->gb, c->decomp_buf, | bytestream2_init(&c->gb, c->decomp_buf, | ||||
| c->decomp_size - c->zstream.avail_out); | c->decomp_size - c->zstream.avail_out); | ||||
| ff_msrle_decode(avctx, (AVPicture*)frame, c->bpp, &c->gb); | |||||
| ff_msrle_decode(avctx, frame, c->bpp, &c->gb); | |||||
| } | } | ||||
| /* make the palette available on the way out */ | /* make the palette available on the way out */ | ||||