From: Thomas Siedel <thomas.ff@spin-digital.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v5 04/10] avcodec: add MP4 to annexb support for H266/VVC Date: Fri, 10 Feb 2023 19:40:41 +0100 Message-ID: <CAD25kL45w89oH_8CBSeLQz5LOG2CyewtfOCZXkfzF-SVuZt2fg@mail.gmail.com> (raw) In-Reply-To: <tencent_663D2723B8E9961A4D322073CDBD4FFED507@qq.com> On Wed, 1 Feb 2023 at 16:34, zhilizhao(赵志立) <quinkblack@foxmail.com> wrote: > > > > On Jan 3, 2023, at 21:40, Thomas Siedel <thomas.ff@spin-digital.com> > wrote: > > > > Add parser for VVC MP4 to Annex B byte stream format. > > > > Co-authored-by: Nuo Mi <nuomi2021@gmail.com> > > --- > > configure | 1 + > > libavcodec/Makefile | 2 + > > libavcodec/bitstream_filters.c | 2 + > > libavcodec/h266_metadata_bsf.c | 146 ++++++++++++++ > > libavcodec/vvc_mp4toannexb_bsf.c | 329 +++++++++++++++++++++++++++++++ > > Please add these bsfs in separate patches. > Thank you for your feedback. I separated them now in the new patch set version 6. > > 5 files changed, 480 insertions(+) > > create mode 100644 libavcodec/h266_metadata_bsf.c > > create mode 100644 libavcodec/vvc_mp4toannexb_bsf.c > > I don’t know the reason behind h265_metadata_bsf/hevc_mp4toannexb_bsf, > but I prefer use the same prefix unless there are technical reasons. > Such alias is annoying when browsing and searching the source code. > I took the naming of the HEVC implementation as an orientation. But yes, I agree that this kind of mix might be problematic. In the new patch set, I now decided on the ITU syntax and renamed all the files and functions from vvc to h266 prefix. With this, they are now also alphabetically close to h264 and hevc. However, I did not rename the VVC_* enum types, because this would change a lot of code, and I am worried that this makes things more complicated when comparing different versions of the code, e.g., for review. What do you, and the other developers, think about this? Which naming pattern would you prefer? Should the enums also be renamed? > > --- a/libavcodec/bitstream_filters.c > > +++ b/libavcodec/bitstream_filters.c > > @@ -64,6 +64,8 @@ extern const FFBitStreamFilter ff_vp9_metadata_bsf; > > extern const FFBitStreamFilter ff_vp9_raw_reorder_bsf; > > extern const FFBitStreamFilter ff_vp9_superframe_bsf; > > extern const FFBitStreamFilter ff_vp9_superframe_split_bsf; > > +extern const FFBitStreamFilter ff_vvc_mp4toannexb_bsf; > > +extern const FFBitStreamFilter ff_vvc_metadata_bsf; > > Please sort by alphabetical order. > OK, this is done now in the new patch set version. > > > > > #include "libavcodec/bsf_list.c" > > > > diff --git a/libavcodec/h266_metadata_bsf.c > b/libavcodec/h266_metadata_bsf.c > > new file mode 100644 > > index 0000000000..f2bd2f31f3 > > --- /dev/null > > +++ b/libavcodec/h266_metadata_bsf.c > > @@ -0,0 +1,146 @@ > > +/* > > + * 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 "libavutil/common.h" > > +#include "libavutil/opt.h" > > + > > +#include "bsf.h" > > +#include "bsf_internal.h" > > +#include "cbs.h" > > +#include "cbs_bsf.h" > > +#include "cbs_h266.h" > > +#include "vvc.h" > > + > > +#define IS_SLICE(nut) (nut <= VVC_RASL_NUT || (nut >= VVC_IDR_W_RADL && > nut <= VVC_GDR_NUT)) > > +#define IS_PH(nut) (nut == VVC_PH_NUT) > > They are duplicated inside vvc_parser.c. How about add a prefix and share > these macros? > Thank you for the suggestion. I did it now in the new patch set version. > > > + > > +typedef struct VVCMetadataContext { > > + CBSBSFContext common; > > + > > + H266RawAUD aud_nal; > > + > > + int aud; > > +} VVCMetadataContext; > > + > > +static int h266_metadata_update_fragment(AVBSFContext *bsf, AVPacket > *pkt, > > + CodedBitstreamFragment *pu) > > +{ > > + VVCMetadataContext *ctx = bsf->priv_data; > > + int err, i; > > + > > + // If an AUD is present, it must be the first NAL unit. > > + if (pu->units[0].type == VVC_AUD_NUT) { > > + if (ctx->aud == BSF_ELEMENT_REMOVE) > > + ff_cbs_delete_unit(pu, 0); > > + } else { > > + if (ctx->aud == BSF_ELEMENT_INSERT) { > > Should check pkt != NULL here. > > `else if` can save one level of indentation. > OK, this is done now in the new patch set version. > > + > > +const FFBitStreamFilter ff_vvc_metadata_bsf = { > > + .p.name = "vvc_metadata", > > + .p.codec_ids = vvc_metadata_codec_ids, > > + .p.priv_class = &vvc_metadata_class, > > + .priv_data_size = sizeof(VVCMetadataContext), > > + .init = &vvc_metadata_init, > > + .close = &ff_cbs_bsf_generic_close, > > + .filter = &ff_cbs_bsf_generic_filter, > > +}; > > The function of vvc_metadata is very limited, I’d like to suggest > add more features with v2. It can be done after other patches. > > Indeed (currently only aud is implemented). More metadata should be implemented after the first version is merged. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-02-10 18:41 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-03 13:40 [FFmpeg-devel] [PATCH v5 00/10] Add " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 01/10] avcodec: add enum types " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 02/10] avcodec: add cbs " Thomas Siedel 2023-02-01 8:20 ` "zhilizhao(赵志立)" 2023-02-10 18:06 ` Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 03/10] avcodec: add bitstream parser " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 04/10] avcodec: add MP4 to annexb support " Thomas Siedel 2023-02-01 15:34 ` zhilizhao(赵志立) 2023-02-10 18:40 ` Thomas Siedel [this message] 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 05/10] avformat: add demuxer and probe " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 06/10] avformat: add muxer " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 07/10] avcodec: add external decoder libvvdec " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 08/10] avcodec: add external encoder libvvenc " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 09/10] avformat: add ts stream types " Thomas Siedel 2023-01-03 13:40 ` [FFmpeg-devel] [PATCH v5 10/10] avcodec: increase minor version " Thomas Siedel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAD25kL45w89oH_8CBSeLQz5LOG2CyewtfOCZXkfzF-SVuZt2fg@mail.gmail.com \ --to=thomas.ff@spin-digital.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git