On 2/14/12, Aneesh Dogra <[email protected]> wrote:
> ---
>  Changelog               |    1 +
>  libavcodec/Makefile     |    1 +
>  libavcodec/allcodecs.c  |    2 +-
>  libavcodec/sunrastenc.c |  246
> +++++++++++++++++++++++++++++++++++++++++++++++
>  libavformat/img2.c      |    3 +-
>  5 files changed, 251 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/sunrastenc.c
>

[...]

> +static av_cold int sunrast_encode_init(AVCodecContext *avctx)
> +{
> +    SUNRASTContext *s = avctx->priv_data;
> +    int pixels = avctx->width * avctx->height;
> +
> +    avctx->coded_frame = &s->picture;
> +
> +    s->maplength = 0;
> +    s->type      = (avctx->coder_type == FF_CODER_TYPE_RLE) ?
> +                       RT_BYTE_ENCODED : RT_STANDARD;
> +    s->maptype   = RMT_NONE;
> +
> +    switch (avctx->pix_fmt) {

This is wrong, checking for pix_fmt should not be in init().
Sane image encoders like png,pam,bmp... check pix_fmt on the fly.

[...]

> +static int sunrast_encode_frame(AVCodecContext *avctx,  AVPacket *avpkt,
> +                                const AVFrame *frame, int *got_packet_ptr)
> +{
> +    SUNRASTContext *s = avctx->priv_data;
> +    AVFrame *const p  = (AVFrame *)&s->picture;
> +    int ret;
> +
> +    if ((ret = ff_alloc_packet(avpkt, s->size *
> +                   ((s->type == RT_BYTE_ENCODED) ? 2 : 1))) < 0)

This looks wrong, RLE encoding should take less memory than uncompressed.

[...]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to