Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
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] lavfi/vf_libplacebo: support custom .cube LUTs
Date: Mon, 21 Feb 2022 12:33:19 +0100
Message-ID: <164544319979.19727.14281446130913547324@lain.red.khirnov.net> (raw)
In-Reply-To: <20220217180319.88427-1-ffmpeg@haasn.xyz>

Quoting Niklas Haas (2022-02-17 19:03:19)
> From: Niklas Haas <git@haasn.dev>
> 
> 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 <libplacebo/utils/libav.h>
>  #include <libplacebo/vulkan.h>
>  
> +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".

  reply	other threads:[~2022-02-21 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 18:03 Niklas Haas
2022-02-21 11:33 ` Anton Khirnov [this message]
2022-02-21 11:36   ` Niklas Haas
2022-02-21 11:38     ` Anton Khirnov
2022-02-21 13:48       ` Niklas Haas

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=164544319979.19727.14281446130913547324@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