[FFmpeg-devel] [PATCH v3 03/14] vvcdec: add parameter parser for sps, pps, ph, sh

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Oct 15 11:54:54 EEST 2023


Nuo Mi:
> ---
>  libavcodec/vvc/Makefile |    3 +-
>  libavcodec/vvc/vvc_ps.c | 1325 +++++++++++++++++++++++++++++++++++++++
>  libavcodec/vvc/vvc_ps.h |  274 ++++++++
>  libavcodec/vvc/vvcdec.h |    4 +
>  4 files changed, 1605 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/vvc/vvc_ps.c
>  create mode 100644 libavcodec/vvc/vvc_ps.h
> 
> diff --git a/libavcodec/vvc/Makefile b/libavcodec/vvc/Makefile
> index 104b17db29..3ea430f61a 100644
> --- a/libavcodec/vvc/Makefile
> +++ b/libavcodec/vvc/Makefile
> @@ -2,4 +2,5 @@ clean::
>  	$(RM) $(CLEANSUFFIXES:%=libavcodec/vvc/%)
>  
>  OBJS-$(CONFIG_VVC_DECODER)          +=  vvc/vvcdec.o            \
> -                                        vvc/vvc_data.o
> +                                        vvc/vvc_data.o          \
> +                                        vvc/vvc_ps.o
> diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
> new file mode 100644
> index 0000000000..c180a401f0
> --- /dev/null
> +++ b/libavcodec/vvc/vvc_ps.c
> @@ -0,0 +1,1325 @@
> +/*
> + * VVC parameter set parser
> + *
> + * Copyright (C) 2023 Nuo Mi
> + * Copyright (C) 2022 Xu Mu
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg 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.
> + *
> + * FFmpeg 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 FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#include "libavcodec/cbs_h266.h"
> +#include "libavutil/imgutils.h"
> +#include "vvc_data.h"
> +#include "vvc_ps.h"
> +#include "vvcdec.h"
> +
> +
> +typedef void (*free_fn)(uint8_t *data);
> +
> +static void ps_free(void *opaque, uint8_t *data)
> +{
> +    free_fn free = (free_fn)opaque;
> +
> +    free(data);
> +    av_freep(&data);
> +}
> +
> +static AVBufferRef* ps_alloc(size_t size, free_fn free)
> +{
> +    AVBufferRef *buf;
> +    uint8_t *data = av_mallocz(size);
> +
> +    if (!data)
> +        return NULL;
> +
> +    buf = av_buffer_create(data, size, ps_free, free, 0);
> +    if (!buf)
> +        av_freep(&data);
> +
> +    return buf;
> +}

All this should be replaced by RefStruct. You will have to partially
replace it anyway, because CBS has been ported to RefStruct.

- Andreas



More information about the ffmpeg-devel mailing list