[FFmpeg-devel] [PATCH]Support SOLID_GRAY lagarith frames

Paul B Mahol onemda at gmail.com
Tue Jan 22 12:02:24 CET 2013


On 1/22/13, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Hi!
>
> Attached patch fixes bug 431 for me.
>
> Please comment, Carl Eugen
>

Sure I will enjoy :/


> diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
> index 486e326..b87ce71 100644
> --- a/libavcodec/lagarith.c
> +++ b/libavcodec/lagarith.c
> @@ -535,6 +535,14 @@ static int lag_decode_frame(AVCodecContext *avctx,
>      switch (frametype) {
>      case FRAME_SOLID_RGBA:
>          avctx->pix_fmt = AV_PIX_FMT_RGB32;
> +    case FRAME_SOLID_GRAY:
> +        if (frametype == FRAME_SOLID_GRAY)
> +            if (avctx->bits_per_coded_sample == 24) {
> +                avctx->pix_fmt = AV_PIX_FMT_RGB24;
> +            } else {
> +                avctx->pix_fmt = AV_PIX_FMT_0RGB32;
> +                planes = 4;

Is this last line actaully needed?

> +            }
>
>          if (ff_thread_get_buffer(avctx, p) < 0) {
>              av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> @@ -543,8 +551,12 @@ static int lag_decode_frame(AVCodecContext *avctx,
>
>          dst = p->data[0];
>          for (j = 0; j < avctx->height; j++) {
> +            if (frametype == FRAME_SOLID_RGBA) {

if/else in loop when it is not needed/pointless.

>              for (i = 0; i < avctx->width; i++)
>                  AV_WN32(dst + i * 4, offset_gu);
> +            } else {
> +                memset(dst, buf[1], avctx->width * planes);

Are you sure that out of array write is not possible?

> +            }
>              dst += p->linesize[0];
>          }
>          break;


More information about the ffmpeg-devel mailing list