On Mon, Mar 19, 2012 at 01:58:31AM +0000, Paul B Mahol wrote:
> Variants: ANIM v1, ANIM v2 & SANM.
>
> Signed-off-by: Paul B Mahol <[email protected]>
> ---
> doc/general.texi | 2 +
> libavcodec/Makefile | 1 +
> libavcodec/allcodecs.c | 1 +
> libavcodec/avcodec.h | 1 +
> libavcodec/sanm.c | 1245
> ++++++++++++++++++++++++++++++++++++++++++++++++
> libavcodec/sanm_data.h | 249 ++++++++++
> libavcodec/version.h | 2 +-
> 7 files changed, 1500 insertions(+), 1 deletions(-)
> create mode 100644 libavcodec/sanm.c
> create mode 100644 libavcodec/sanm_data.h
>
> diff --git a/doc/general.texi b/doc/general.texi
> index 14040db..74db79c 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -516,6 +516,8 @@ following image formats are supported:
> @item LCL (LossLess Codec Library) MSZH @tab @tab X
> @item LCL (LossLess Codec Library) ZLIB @tab E @tab E
> @item LOCO @tab @tab X
> +@item LucasArts Smush @tab @tab X
> + @ Used in LucasArts games
> @item lossless MJPEG @tab X @tab X
> @item Microsoft RLE @tab @tab X
> @item Microsoft Video 1 @tab @tab X
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 05db041..5e8dd0d 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -339,6 +339,7 @@ OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o
> rv30dsp.o rv34dsp.o \
> OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv34dsp.o rv40dsp.o \
> mpegvideo.o error_resilience.o
> OBJS-$(CONFIG_S302M_DECODER) += s302m.o
> +OBJS-$(CONFIG_SANM_DECODER) += sanm.o
> OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
> OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
> OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 03eec03..39f3a67 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -184,6 +184,7 @@ void avcodec_register_all(void)
> REGISTER_DECODER (RV30, rv30);
> REGISTER_DECODER (RV40, rv40);
> REGISTER_DECODER (S302M, s302m);
> + REGISTER_DECODER (SANM, sanm);
> REGISTER_ENCDEC (SGI, sgi);
> REGISTER_DECODER (SMACKER, smacker);
> REGISTER_DECODER (SMC, smc);
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 9219f84..d4a3b1f 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -246,6 +246,7 @@ enum CodecID {
> CODEC_ID_XWD,
> CODEC_ID_CDXL,
> CODEC_ID_XBM,
> + CODEC_ID_SANM,
>
> /* various PCM "codecs" */
> CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the
> start of audio codecs
> diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
> new file mode 100644
> index 0000000..926623c
> --- /dev/null
> +++ b/libavcodec/sanm.c
> @@ -0,0 +1,1245 @@
> +/*
> + * LucasArts Smush decoder
> + * Copyright (c) 2006 Cyril Zorin
> + * Copyright (c) 2011 Konstantin Shishkov
huh? I'd say it was late 2008-early 2009 instead.
[...]
> +
> +static int process_frame_obj(SANMVideoContext *ctx)
> +{
> + uint16_t codec, top, left, w, h;
> +
> + codec = bytestream2_get_le16u(&ctx->gb);
> + left = bytestream2_get_le16u(&ctx->gb);
> + top = bytestream2_get_le16u(&ctx->gb);
> + w = bytestream2_get_le16u(&ctx->gb);
> + h = bytestream2_get_le16u(&ctx->gb);
> +
> + if (ctx->width < left + w || ctx->height < top + h) {
> + ctx->avctx->width = FFMAX(left + w, ctx->width);
> + ctx->avctx->height = FFMAX(top + h, ctx->height);
> + init_sizes(ctx, left + w, top + h);
> + if (init_buffers(ctx)) {
> + av_log(ctx->avctx, AV_LOG_ERROR, "error resizing buffers\n");
> + return AVERROR(ENOMEM);
> + }
> + }
> + bytestream2_skip(&ctx->gb, 4);
> +
> + av_dlog(ctx->avctx, "subcodec %d\n", codec);
nit: I've seen in the binaries that codec_id is only one byte.
(so they simply have table with 256 pointers to decoder functions, on init
they set some of them and on decode they call corresponding function - kinda
prehistoric LAbvcodec).
In general looks nice.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel