[FFmpeg-devel] [PATCH]Support 1bpp and 4bpp palettized sunrast images
Paul B Mahol
onemda at gmail.com
Mon Jan 9 21:11:28 CET 2012
On 1/9/12, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Hi!
>
> Attached patch fixes tickets #864 and #897 for me.
> get_buffer() fails for PIX_FMT_NONE, so I did not add an additional check,
> and
> I assumed av_image_check_size() avoids that (w+15)*h overflows.
>
> Please review, Carl Eugen
>
>
> diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
> index f621cbe..23999a0 100644
> --- a/libavcodec/sunrast.c
> +++ b/libavcodec/sunrast.c
> @@ -51,7 +51,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
> AVFrame *picture = data;
> AVFrame * const p = &s->picture;
> unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
> - uint8_t *ptr;
> + uint8_t *ptr, *ptr2 = NULL;
> const uint8_t *bufstart = buf;
>
> if (avpkt->size < 32)
> @@ -90,7 +90,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
>
> switch (depth) {
> case 1:
> - avctx->pix_fmt = PIX_FMT_MONOWHITE;
> + avctx->pix_fmt = maplength ? PIX_FMT_PAL8 : PIX_FMT_MONOWHITE;
> + break;
> + case 4:
> + avctx->pix_fmt = maplength ? PIX_FMT_PAL8 : PIX_FMT_NONE;
Hmm, if maplength is 0 then pix_fmt is not-implemented PIX_FMT_GRAY4 ?
> break;
> case 8:
> avctx->pix_fmt = maplength ? PIX_FMT_PAL8 : PIX_FMT_GRAY8;
lgtm
More information about the ffmpeg-devel
mailing list