On Sat, Apr 15, 2017 at 6:31 AM, Diego Biurrun <[email protected]> wrote:
> From: Kostya Shishkov <[email protected]>
>
> Only I-frames are decoded for now.
>
> Signed-off-by: Diego Biurrun <[email protected]>
> ---
> Changelog | 1 +
> doc/general.texi | 1 +
> libavcodec/Makefile | 1 +
> libavcodec/allcodecs.c | 1 +
> libavcodec/avcodec.h | 1 +
> libavcodec/clearvideo.c | 385
> ++++++++++++++++++++++++++++++++++++++++++++++++
> libavcodec/codec_desc.c | 7 +
> libavcodec/version.h | 2 +-
> libavformat/riff.c | 2 +
> libavformat/rm.c | 1 +
> 10 files changed, 401 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/clearvideo.c
>
> diff --git a/Changelog b/Changelog
> index dccf173..ebf094a 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -14,6 +14,7 @@ version <next>:
> - Cineform HD decoder
> - VP9 superframe split/merge bitstream filters
> - FM Screen Capture Codec decoder
> +- incomplete ClearVideo decoder
IMO `incomplete` is not descriptive, I'd suggest
- ClearVideo decoder (I-frames only)
> diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
> new file mode 100644
> index 0000000..88af1a7
> --- /dev/null
> +++ b/libavcodec/clearvideo.c
> @@ -0,0 +1,385 @@
> +/*
> + * ClearVideo decoder
> + * Copyright (c) 2012 Konstantin Shishkov
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +/**
> + * @file
> + * ClearVideo decoder
> + */
> +
> +#include "avcodec.h"
> +#include "bytestream.h"
> +#include "get_bits.h"
shouldn't new code be converted to the new bitstream reader?
> +
> + if (frame_type & 0x2) {
> + bytestream2_get_be32(&gb); // frame size;
> + c->ac_quant = bytestream2_get_byte(&gb);
> + c->luma_dc_quant = 32;
> + c->chroma_dc_quant = 32;
> +
> + if ((ret = init_get_bits8(&c->gb, buf + bytestream2_tell(&gb),
> + buf_size - bytestream2_tell(&gb))) < 0)
> + return ret;
> +
> + for (i = 0; i < 3; i++)
> + c->top_dc[i] = 32;
> + for (i = 0; i < 4; i++)
> + c->left_dc[i] = 32;
> +
> + for (j = 0; j < c->mb_height; j++) {
> + for (i = 0; i < c->mb_width; i++) {
> + ret |= decode_mb(c, i, j);
> + }
> + }
> + } else {
> + }
empty else? probably missing a patchwelcome message
> + if ((ret = av_frame_ref(data, c->pic)) < 0)
> + return ret;
> +
> + *got_frame = 1;
> +
> + return ret < 0 ? ret : buf_size;
> +}
> +
> +AVCodec ff_clearvideo_decoder = {
> + .name = "clearvideo",
> + .long_name = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"),
> + .type = AVMEDIA_TYPE_VIDEO,
> + .id = AV_CODEC_ID_CLEARVIDEO,
> + .priv_data_size = sizeof(CLVContext),
> + .init = clv_decode_init,
> + .close = clv_decode_end,
> + .decode = clv_decode_frame,
> + .capabilities = AV_CODEC_CAP_DR1,
> +};
this should have the safe open and init cleanup internal capabilities
set I think
--
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel