[FFmpeg-devel] [libav-devel] [PATCH] Cineform HD Decoder:
Vittorio Giovara
vittorio.giovara at gmail.com
Mon Jan 4 16:36:23 CET 2016
On Mon, Jan 4, 2016 at 1:04 AM, Kieran Kunhya <kieran at kunhya.com> wrote:
> Decodes YUV422P10 samples in AVI and MOV (Gopro Studio)
> Older files with more subbands, skips, Bayer not supported
> ---
> +static av_cold int cfhd_init_decoder(AVCodecContext *avctx)
> +{
> + CFHDContext *s = avctx->priv_data;
> +
> + ff_cfhd_init_vlcs(s);
> +
> + avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
> + avctx->bits_per_raw_sample = 16;
> + s->avctx = avctx;
> +
> + return 0;
here could be return ff_cfhd_init_vlcs(s); (see below)
> +static av_cold int cfhd_close_decoder(AVCodecContext *avctx)
> +{
> + CFHDContext *s = avctx->priv_data;
> +
> + ff_free_vlc(&s->vlc_9);
> + ff_free_vlc(&s->vlc_18);
> +
> + return 0;
> +}
<snip>
> +AVCodec ff_cfhd_decoder = {
> + .name = "cfhdvideo",
> + .long_name = NULL_IF_CONFIG_SMALL("cfhd video"),
> + .type = AVMEDIA_TYPE_VIDEO,
> + .id = AV_CODEC_ID_CFHD,
> + .priv_data_size = sizeof(CFHDContext),
> + .init = cfhd_init_decoder,
> + .close = cfhd_close_decoder,
> + .decode = cfhd_decode,
> + .capabilities = AV_CODEC_CAP_EXPERIMENTAL,
also DR1 I believe
> +};
<snip>
> +av_cold int ff_cfhd_init_vlcs(CFHDContext *s)
> +{
> + init_vlc(&s->vlc_9, VLC_BITS, j, new_cfhd_vlc_len,
> + 1, 1, new_cfhd_vlc_bits, 4, 4, 0);
<snip>
> + init_vlc(&s->vlc_18, VLC_BITS, j, new_cfhd_vlc_len,
> + 1, 1, new_cfhd_vlc_bits, 4, 4, 0);
> + assert(s->vlc_18.table_size == 4572);
my only suggestion here is that since this isn't using static vars you
should add FF_CODEC_CAP_INIT_THREADSAFE to the internal capabilities,
and since allocating memory you should check the init_vlc return
value, return it and add the proper FF_CODEC_CAP_INIT_CLEANUP to do
the cleanup work for you
if you feel like it you could use avpriv_report_missing_feature
instead of av_log where you return AVERROR_PATCHWELCOME
--
Vittorio
More information about the ffmpeg-devel
mailing list