[FFmpeg-devel] MxPEG decoder

Stefano Sabatini stefano.sabatini-lala
Mon Feb 14 13:37:44 CET 2011


On date Monday 2011-02-14 14:46:28 +0300, Anatoly Nenashev encoded:
> Hi!
> The previous version of this patch got lost in all the noise. Also
> it needs some changes to new API. Here is the last version of MxPEG
> decoder patch.
> 
> Regards,
> Anatoly.

> From 502f988b95f6f721613da6ab4b1de5c3ae9ce4bf Mon Sep 17 00:00:00 2001
> From: anatoly <anatoly.nenashev at ovsoft.ru>
> Date: Mon, 14 Feb 2011 14:40:44 +0300
> Subject: [PATCH] Add MxPEG video decoder
> 
> ---
>  libavcodec/Makefile    |    1 +
>  libavcodec/allcodecs.c |    1 +
>  libavcodec/mjpegdec.c  |  275 +++++++++++++++++++++++++++++++++++++++++++-----
>  libavcodec/mjpegdec.h  |   13 +++
>  4 files changed, 264 insertions(+), 26 deletions(-)
[...]
> +static int mxpeg_allocate_picture(MXpegDecodeContext *mxctx, MJpegDecodeContext* s)
> +{
> +    AVFrame *picture_ptr, *reference_ptr;
> +    if (s->first_picture) {
> +        av_log(s->avctx, AV_LOG_WARNING, "First picture has no SOF, skipping\n");
> +        return -1;
> +    }
> +    if (!mxctx->got_sof_data) {
> +        av_log(s->avctx, AV_LOG_WARNING, "Can not process SOS after broken SOF, skipping\n");
> +        return -1;
> +    }
> +    if (!mxctx->mxm_bitmask) {
> +        av_log(s->avctx, AV_LOG_WARNING, "Non-key frame has no MXM, skipping\n");
> +        return -1;
> +    }

Please return meaningful error codes, here and below.

[...]
> @@ -859,6 +947,14 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int s
>      int linesize = s->linesize[c];
>      int last_scan = 0;
>      int16_t *quant_matrix = s->quant_matrixes[ s->quant_index[c] ];
> +    MXpegDecodeContext *mxctx = (s->avctx->codec_id == CODEC_ID_MXPEG) ? s->avctx->priv_data : 0;
> +
> +    if (mxctx) {
> +        //FIXME implement progressive mode for MxPEG if needed (no samples available now)
> +        av_log(s->avctx, AV_LOG_ERROR,

> +               "Progressive mode doesn't implemented in MxPEG decoder\n");

Grammar: "Progressive mode is not implemented in MxPEG decoder\n"

> +        return -1;

AVERROR_PATCHWELCOME?

[...]
> @@ -1565,3 +1773,18 @@ AVCodec ff_thp_decoder = {
>      .max_lowres = 3,
>      .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
>  };
> +
> +AVCodec ff_mxpeg_decoder = {
> +    "mxpeg",
> +    AVMEDIA_TYPE_VIDEO,
> +    CODEC_ID_MXPEG,
> +    sizeof(MXpegDecodeContext),
> +    ff_mjpeg_decode_init,
> +    NULL,
> +    ff_mjpeg_decode_end,
> +    ff_mjpeg_decode_frame,
> +    CODEC_CAP_DR1,
> +    NULL,
> +    .max_lowres = 3,
> +    .long_name = NULL_IF_CONFIG_SMALL("Mobotix MxPEG video"),
> +};

Please use always designated field init (.foo = "bar"), more readable
and more robust.
-- 
FFmpeg = Forgiving and Fiendish Muttering Philosofic EniGma



More information about the ffmpeg-devel mailing list