From: Anton Khirnov <anton@khirnov.net> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Niklas Haas <git@haasn.dev> Subject: Re: [FFmpeg-devel] [PATCH v5 4/6] lavc: Implement Dolby Vision RPU parsing Date: Mon, 20 Dec 2021 11:13:15 +0100 Message-ID: <163999519548.13029.13385878156195650068@lain.red.khirnov.net> (raw) In-Reply-To: <20211212115546.119662-4-ffmpeg@haasn.xyz> Quoting Niklas Haas (2021-12-12 12:55:44) > +void ff_dovi_ctx_unref(DOVIContext *s) > +{ > + for (int i = 0; i < DOVI_MAX_DM_ID; i++) nit: FF_ARRAY_ELEMS(s->vdr_ref) is considered better > + av_buffer_unref(&s->vdr_ref[i]); > + > + /* Preserve the user-provided fields explicitly, reset everything else */ > + *s = (DOVIContext) { > + .avctx = s->avctx, > + .config = s->config, > + }; > +} > + > +int ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0) > +{ > + int ret; > + s->avctx = s0->avctx; > + s->config = s0->config; > + s->mapping = s0->mapping; > + s->color = s0->color; > + for (int i = 0; i < DOVI_MAX_DM_ID; i++) { > + if ((ret = av_buffer_replace(&s->vdr_ref[i], s0->vdr_ref[i])) < 0) > + goto fail; > + } > + > + return 0; > + > +fail: > + /* clean up any potentially invalid pointers */ Would not calling ff_dovi_ctx_unref() be safer here? > + s->mapping = NULL; > + s->color = NULL; > + return ret; > +} > [...] > diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h > new file mode 100644 > index 0000000000..8cabff2718 > --- /dev/null > +++ b/libavcodec/dovi_rpu.h > @@ -0,0 +1,71 @@ > +/* > + * Dolby Vision RPU decoder > + * > + * Copyright (C) 2021 Jan Ekström > + * Copyright (C) 2021 Niklas Haas > + * > + * 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 > + */ > + > +#ifndef AVCODEC_DOVI_RPU_H > +#define AVCODEC_DOVI_RPU_H > + > +#include "libavutil/dovi_meta.h" > +#include "avcodec.h" > + > +#define DOVI_MAX_DM_ID 15 > +typedef struct DOVIContext { > + AVCodecContext *avctx; This is only used for logging (as it should be), so you can make this void *logctx and drop the avcodec.h #include. -- Anton Khirnov _______________________________________________ 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:[~2021-12-20 10:13 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20211212115546.119662-1-ffmpeg@haasn.xyz> [not found] ` <CA+anqdwT+O2B2859vqyT3Or92bYHGXEQp9NgaC0C4b3Pb6m1bw@mail.gmail.com> 2021-12-15 14:19 ` [FFmpeg-devel] [PATCH v5 1/6] lavu/frame: Add Dolby Vision metadata side data type Derek Buitenhuis 2021-12-18 18:34 ` Hendrik Leppkes 2021-12-20 9:53 ` Anton Khirnov 2021-12-20 10:02 ` Anton Khirnov [not found] ` <20211212115546.119662-4-ffmpeg@haasn.xyz> 2021-12-20 10:13 ` Anton Khirnov [this message] 2021-12-20 14:47 ` [FFmpeg-devel] [PATCH v5 4/6] lavc: Implement Dolby Vision RPU parsing Niklas Haas 2021-12-20 14:55 ` Anton Khirnov
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=163999519548.13029.13385878156195650068@lain.red.khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=git@haasn.dev \ /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