From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BF96D4035E for ; Mon, 21 Feb 2022 11:33:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1DC3968B148; Mon, 21 Feb 2022 13:33:27 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D42B768AE4E for ; Mon, 21 Feb 2022 13:33:20 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4E66B240179; Mon, 21 Feb 2022 12:33:20 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ig7V_icpu326; Mon, 21 Feb 2022 12:33:19 +0100 (CET) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id B9387240175; Mon, 21 Feb 2022 12:33:19 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id C7F631601AD; Mon, 21 Feb 2022 12:33:19 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20220217180319.88427-1-ffmpeg@haasn.xyz> References: <20220217180319.88427-1-ffmpeg@haasn.xyz> Mail-Followup-To: FFmpeg development discussions and patches , Niklas Haas Date: Mon, 21 Feb 2022 12:33:19 +0100 Message-ID: <164544319979.19727.14281446130913547324@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: support custom .cube LUTs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Niklas Haas (2022-02-17 19:03:19) > From: Niklas Haas > > Option boilerplate. Very soon we shall definitely need to add some sort > of generic forward-proof option parsing mechanism to libplacebo.. > --- > libavfilter/vf_libplacebo.c | 78 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 78 insertions(+) > > diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c > index 31ae28ac38..0ee2db80ed 100644 > --- a/libavfilter/vf_libplacebo.c > +++ b/libavfilter/vf_libplacebo.c > @@ -26,6 +26,14 @@ > #include > #include > > +struct custom_lut { > + const struct pl_custom_lut *lut; > + char *path; > + void *bin; > + int bin_len; > + int type; > +}; > + > typedef struct LibplaceboContext { > /* lavfi vulkan*/ > FFVulkanContext vkctx; > @@ -115,6 +123,11 @@ typedef struct LibplaceboContext { > int shader_bin_len; > const struct pl_hook *hooks[2]; > int num_hooks; > + > + /* custom LUTs */ > + struct custom_lut lut; > + struct custom_lut input_lut; > + struct custom_lut output_lut; > } LibplaceboContext; > > static inline enum pl_log_level get_log_level(void) > @@ -202,6 +215,37 @@ static int libplacebo_init(AVFilterContext *avctx) > return 0; > } > > +static int load_custom_lut(AVFilterContext *avctx, struct custom_lut *lut) > +{ > + LibplaceboContext *s = avctx->priv; > + uint8_t *buf = NULL; > + size_t buf_len; > + int err; > + > + if (lut->bin_len) { > + // Binary specified > + buf = lut->bin; > + buf_len = lut->bin_len; > + } else if (lut->path) { > + // File path specified > + if ((err = av_file_map(lut->path, &buf, &buf_len, 0, s))) Non-overridable IO in random places is evil. -- 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".