Re: [FFmpeg-devel] [PATCH v3 01/14] vvcdec: add vvc decoder stub
On Sun, Oct 15, 2023 at 5:35 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > Nuo Mi: > > --- > > configure | 1 + > > libavcodec/Makefile | 1 + > > libavcodec/allcodecs.c | 1 + > > libavcodec/vvc/Makefile | 4 + > > libavcodec/vvc/vvcdec.c | 84 +++ > > libavcodec/vvc/vvcdec.h | 307 > > 6 files changed, 398 insertions(+) > > create mode 100644 libavcodec/vvc/Makefile > > create mode 100644 libavcodec/vvc/vvcdec.c > > create mode 100644 libavcodec/vvc/vvcdec.h > > > > diff --git a/configure b/configure > > index 8a1902810a..442c439c3e 100755 > > --- a/configure > > +++ b/configure > > @@ -3025,6 +3025,7 @@ vp6f_decoder_select="vp6_decoder" > > vp7_decoder_select="h264pred videodsp vp8dsp" > > vp8_decoder_select="h264pred videodsp vp8dsp" > > vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf" > > +vvc_decoder_select="cabac golomb videodsp" > > wcmv_decoder_select="inflate_wrapper" > > webp_decoder_select="vp8_decoder exif" > > wmalossless_decoder_select="llauddsp" > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > > index 08fd151619..fb2738d8eb 100644 > > --- a/libavcodec/Makefile > > +++ b/libavcodec/Makefile > > @@ -62,6 +62,7 @@ OBJS = ac3_parser.o > \ > > xiph.o > \ > > > > # subsystems > > +include $(SRC_PATH)/libavcodec/vvc/Makefile > > I don't see why vvc should have a subfolder of its own. > This is a suggestion from JB. There are 1700+ files in libavcodec, Even https://github.com/FFmpeg/FFmpeg/tree/master/libavcodec can't not list them all. > > OBJS-$(CONFIG_AANDCTTABLES)+= aandcttab.o > > OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o > > OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o > mpeg4audio_sample_rates.o > > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > > index 6e95ca5636..c16d80cb85 100644 > > --- a/libavcodec/allcodecs.c > > +++ b/libavcodec/allcodecs.c > > @@ -388,6 +388,7 @@ extern const FFCodec ff_vp9_rkmpp_decoder; > > extern const FFCodec ff_vp9_v4l2m2m_decoder; > > extern const FFCodec ff_vqa_decoder; > > extern const FFCodec ff_vqc_decoder; > > +extern const FFCodec ff_vvc_decoder; > > extern const FFCodec ff_wbmp_decoder; > > extern const FFCodec ff_wbmp_encoder; > > extern const FFCodec ff_webp_decoder; > > diff --git a/libavcodec/vvc/Makefile b/libavcodec/vvc/Makefile > > new file mode 100644 > > index 00..bd14dbc1df > > --- /dev/null > > +++ b/libavcodec/vvc/Makefile > > @@ -0,0 +1,4 @@ > > +clean:: > > + $(RM) $(CLEANSUFFIXES:%=libavcodec/vvc/%) > > + > > +OBJS-$(CONFIG_VVC_DECODER) += vvc/vvcdec.o\ > > diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c > > new file mode 100644 > > index 00..8d027af0b9 > > --- /dev/null > > +++ b/libavcodec/vvc/vvcdec.c > > @@ -0,0 +1,84 @@ > > +/* > > + * VVC video decoder > > + * > > + * Copyright (C) 2021 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 "config_components.h" > > What do you need this for? > > > + > > +#include "libavcodec/codec_internal.h" > > +#include "libavcodec/decode.h" > > +#include "libavcodec/golomb.h" > > +#include "libavcodec/profiles.h" > > +#include "libavcodec/vvc.h" > > + > > +#include "libavutil/cpu.h" > > Why would you ever need cpu.h in the decoder? > Even if a later patch needs it, it should be added in the later patch. > > > + > > +#include "vvcdec.h" > > + > > +static int vvc_decode_frame(AVCodecContext *avctx, AVFrame *output, > > +int *got_output, AVPacket *avpkt) > > +{ > > +return avpkt->size; > > +} > > + > > +static void vvc_decode_flush(AVCodecContext *avctx) > > +{ > > +} > > + > > +static av_cold int vvc_decode_free(AVCodecContext *avctx) > > +{ > > +return 0; > > +} > > + > > +static av_cold int vvc_decode_init(AVCodecContext *avctx) > > +{ > > +return 0; > > +} > > + > > +#define OFFSET(x) offsetof(VVCContext, x) > > +#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) > > + > > +static const AVOption options[] = { > > +{ NULL }, > > +}; > > +
Re: [FFmpeg-devel] [PATCH v3 01/14] vvcdec: add vvc decoder stub
Nuo Mi: > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/vvc/Makefile | 4 + > libavcodec/vvc/vvcdec.c | 84 +++ > libavcodec/vvc/vvcdec.h | 307 > 6 files changed, 398 insertions(+) > create mode 100644 libavcodec/vvc/Makefile > create mode 100644 libavcodec/vvc/vvcdec.c > create mode 100644 libavcodec/vvc/vvcdec.h > > diff --git a/configure b/configure > index 8a1902810a..442c439c3e 100755 > --- a/configure > +++ b/configure > @@ -3025,6 +3025,7 @@ vp6f_decoder_select="vp6_decoder" > vp7_decoder_select="h264pred videodsp vp8dsp" > vp8_decoder_select="h264pred videodsp vp8dsp" > vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf" > +vvc_decoder_select="cabac golomb videodsp" > wcmv_decoder_select="inflate_wrapper" > webp_decoder_select="vp8_decoder exif" > wmalossless_decoder_select="llauddsp" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 08fd151619..fb2738d8eb 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -62,6 +62,7 @@ OBJS = ac3_parser.o > \ > xiph.o \ > > # subsystems > +include $(SRC_PATH)/libavcodec/vvc/Makefile I don't see why vvc should have a subfolder of its own. > OBJS-$(CONFIG_AANDCTTABLES)+= aandcttab.o > OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o > OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o > mpeg4audio_sample_rates.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index 6e95ca5636..c16d80cb85 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -388,6 +388,7 @@ extern const FFCodec ff_vp9_rkmpp_decoder; > extern const FFCodec ff_vp9_v4l2m2m_decoder; > extern const FFCodec ff_vqa_decoder; > extern const FFCodec ff_vqc_decoder; > +extern const FFCodec ff_vvc_decoder; > extern const FFCodec ff_wbmp_decoder; > extern const FFCodec ff_wbmp_encoder; > extern const FFCodec ff_webp_decoder; > diff --git a/libavcodec/vvc/Makefile b/libavcodec/vvc/Makefile > new file mode 100644 > index 00..bd14dbc1df > --- /dev/null > +++ b/libavcodec/vvc/Makefile > @@ -0,0 +1,4 @@ > +clean:: > + $(RM) $(CLEANSUFFIXES:%=libavcodec/vvc/%) > + > +OBJS-$(CONFIG_VVC_DECODER) += vvc/vvcdec.o\ > diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c > new file mode 100644 > index 00..8d027af0b9 > --- /dev/null > +++ b/libavcodec/vvc/vvcdec.c > @@ -0,0 +1,84 @@ > +/* > + * VVC video decoder > + * > + * Copyright (C) 2021 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 "config_components.h" What do you need this for? > + > +#include "libavcodec/codec_internal.h" > +#include "libavcodec/decode.h" > +#include "libavcodec/golomb.h" > +#include "libavcodec/profiles.h" > +#include "libavcodec/vvc.h" > + > +#include "libavutil/cpu.h" Why would you ever need cpu.h in the decoder? Even if a later patch needs it, it should be added in the later patch. > + > +#include "vvcdec.h" > + > +static int vvc_decode_frame(AVCodecContext *avctx, AVFrame *output, > +int *got_output, AVPacket *avpkt) > +{ > +return avpkt->size; > +} > + > +static void vvc_decode_flush(AVCodecContext *avctx) > +{ > +} > + > +static av_cold int vvc_decode_free(AVCodecContext *avctx) > +{ > +return 0; > +} > + > +static av_cold int vvc_decode_init(AVCodecContext *avctx) > +{ > +return 0; > +} > + > +#define OFFSET(x) offsetof(VVCContext, x) > +#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) > + > +static const AVOption options[] = { > +{ NULL }, > +}; > + > +static const AVClass vvc_decoder_class = { > +.class_name = "vvc decoder", > +.item_name = av_default_item_name, > +.option = options, > +.version= LIBAVUTIL_VERSION_INT, > +}; This seems to be based upon H.264, but the H.264 decoder has options, whereas this decoder doesn't, so this AVClass and the options are unnecessary. > + > +const FFCodec ff_vvc_decoder = { > +.p.name
[FFmpeg-devel] [PATCH v3 01/14] vvcdec: add vvc decoder stub
--- configure | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/vvc/Makefile | 4 + libavcodec/vvc/vvcdec.c | 84 +++ libavcodec/vvc/vvcdec.h | 307 6 files changed, 398 insertions(+) create mode 100644 libavcodec/vvc/Makefile create mode 100644 libavcodec/vvc/vvcdec.c create mode 100644 libavcodec/vvc/vvcdec.h diff --git a/configure b/configure index 8a1902810a..442c439c3e 100755 --- a/configure +++ b/configure @@ -3025,6 +3025,7 @@ vp6f_decoder_select="vp6_decoder" vp7_decoder_select="h264pred videodsp vp8dsp" vp8_decoder_select="h264pred videodsp vp8dsp" vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf" +vvc_decoder_select="cabac golomb videodsp" wcmv_decoder_select="inflate_wrapper" webp_decoder_select="vp8_decoder exif" wmalossless_decoder_select="llauddsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 08fd151619..fb2738d8eb 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -62,6 +62,7 @@ OBJS = ac3_parser.o \ xiph.o \ # subsystems +include $(SRC_PATH)/libavcodec/vvc/Makefile OBJS-$(CONFIG_AANDCTTABLES)+= aandcttab.o OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio_sample_rates.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6e95ca5636..c16d80cb85 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -388,6 +388,7 @@ extern const FFCodec ff_vp9_rkmpp_decoder; extern const FFCodec ff_vp9_v4l2m2m_decoder; extern const FFCodec ff_vqa_decoder; extern const FFCodec ff_vqc_decoder; +extern const FFCodec ff_vvc_decoder; extern const FFCodec ff_wbmp_decoder; extern const FFCodec ff_wbmp_encoder; extern const FFCodec ff_webp_decoder; diff --git a/libavcodec/vvc/Makefile b/libavcodec/vvc/Makefile new file mode 100644 index 00..bd14dbc1df --- /dev/null +++ b/libavcodec/vvc/Makefile @@ -0,0 +1,4 @@ +clean:: + $(RM) $(CLEANSUFFIXES:%=libavcodec/vvc/%) + +OBJS-$(CONFIG_VVC_DECODER) += vvc/vvcdec.o\ diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c new file mode 100644 index 00..8d027af0b9 --- /dev/null +++ b/libavcodec/vvc/vvcdec.c @@ -0,0 +1,84 @@ +/* + * VVC video decoder + * + * Copyright (C) 2021 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 "config_components.h" + +#include "libavcodec/codec_internal.h" +#include "libavcodec/decode.h" +#include "libavcodec/golomb.h" +#include "libavcodec/profiles.h" +#include "libavcodec/vvc.h" + +#include "libavutil/cpu.h" + +#include "vvcdec.h" + +static int vvc_decode_frame(AVCodecContext *avctx, AVFrame *output, +int *got_output, AVPacket *avpkt) +{ +return avpkt->size; +} + +static void vvc_decode_flush(AVCodecContext *avctx) +{ +} + +static av_cold int vvc_decode_free(AVCodecContext *avctx) +{ +return 0; +} + +static av_cold int vvc_decode_init(AVCodecContext *avctx) +{ +return 0; +} + +#define OFFSET(x) offsetof(VVCContext, x) +#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) + +static const AVOption options[] = { +{ NULL }, +}; + +static const AVClass vvc_decoder_class = { +.class_name = "vvc decoder", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + +const FFCodec ff_vvc_decoder = { +.p.name = "vvc", +.p.long_name = NULL_IF_CONFIG_SMALL("VVC (Versatile Video Coding)"), +.p.type = AVMEDIA_TYPE_VIDEO, +.p.id= AV_CODEC_ID_VVC, +.priv_data_size = sizeof(VVCContext), +.p.priv_class= &vvc_decoder_class, +.init= vvc_decode_init, +.close = vvc_decode_free, +FF_CODEC_DECODE_CB(vvc_decode_frame), +.flush = vvc_decode_flush, +.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, +.caps_internal = FF_