From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Cc: "Kacper Michajłow" <kasper93@gmail.com>
Subject: Re: [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: allow linking to shared library with dllimport
Date: Sun, 21 May 2023 13:16:44 +0200
Message-ID: <20230521131644.GB102437@haasn.xyz> (raw)
In-Reply-To: <20230517194503.1659-1-kasper93@gmail.com>
On Wed, 17 May 2023 21:45:03 +0200 Kacper Michajłow <kasper93@gmail.com> wrote:
> Address of dll imported variables can't be used for constant
> initialization in C language modes.
> ---
> libavfilter/vf_libplacebo.c | 39 ++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 18 deletions(-)
>
> diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
> index 94e49aa465..f26d0126be 100644
> --- a/libavfilter/vf_libplacebo.c
> +++ b/libavfilter/vf_libplacebo.c
> @@ -56,23 +56,6 @@ enum {
> TONE_MAP_COUNT,
> };
>
> -static const struct pl_tone_map_function * const tonemapping_funcs[TONE_MAP_COUNT] = {
> - [TONE_MAP_AUTO] = &pl_tone_map_auto,
> - [TONE_MAP_CLIP] = &pl_tone_map_clip,
> -#if PL_API_VER >= 246
> - [TONE_MAP_ST2094_40] = &pl_tone_map_st2094_40,
> - [TONE_MAP_ST2094_10] = &pl_tone_map_st2094_10,
> -#endif
> - [TONE_MAP_BT2390] = &pl_tone_map_bt2390,
> - [TONE_MAP_BT2446A] = &pl_tone_map_bt2446a,
> - [TONE_MAP_SPLINE] = &pl_tone_map_spline,
> - [TONE_MAP_REINHARD] = &pl_tone_map_reinhard,
> - [TONE_MAP_MOBIUS] = &pl_tone_map_mobius,
> - [TONE_MAP_HABLE] = &pl_tone_map_hable,
> - [TONE_MAP_GAMMA] = &pl_tone_map_gamma,
> - [TONE_MAP_LINEAR] = &pl_tone_map_linear,
> -};
> -
> static const char *const var_names[] = {
> "in_w", "iw", ///< width of the input video frame
> "in_h", "ih", ///< height of the input video frame
> @@ -269,6 +252,26 @@ static void pl_av_log(void *log_ctx, enum pl_log_level level, const char *msg)
> av_log(log_ctx, av_lev, "%s\n", msg);
> }
>
> +static const struct pl_tone_map_function *pl_get_tonemapping_func(int tm) {
> + switch (tm) {
> + case TONE_MAP_AUTO: return &pl_tone_map_auto;
> + case TONE_MAP_CLIP: return &pl_tone_map_clip;
> +#if PL_API_VER >= 246
> + case TONE_MAP_ST2094_40: return &pl_tone_map_st2094_40;
> + case TONE_MAP_ST2094_10: return &pl_tone_map_st2094_10;
> +#endif
> + case TONE_MAP_BT2390: return &pl_tone_map_bt2390;
> + case TONE_MAP_BT2446A: return &pl_tone_map_bt2446a;
> + case TONE_MAP_SPLINE: return &pl_tone_map_spline;
> + case TONE_MAP_REINHARD: return &pl_tone_map_reinhard;
> + case TONE_MAP_MOBIUS: return &pl_tone_map_mobius;
> + case TONE_MAP_HABLE: return &pl_tone_map_hable;
> + case TONE_MAP_GAMMA: return &pl_tone_map_gamma;
> + case TONE_MAP_LINEAR: return &pl_tone_map_linear;
> + default: av_assert0(0);
> + }
> +}
> +
> static int parse_shader(AVFilterContext *avctx, const void *shader, size_t len)
> {
> LibplaceboContext *s = avctx->priv;
> @@ -365,7 +368,7 @@ static int update_settings(AVFilterContext *ctx)
> s->color_map_params = *pl_color_map_params(
> .intent = s->intent,
> .gamut_mode = gamut_mode,
> - .tone_mapping_function = tonemapping_funcs[s->tonemapping],
> + .tone_mapping_function = pl_get_tonemapping_func(s->tonemapping),
> .tone_mapping_param = s->tonemapping_param,
> .tone_mapping_mode = tonemapping_mode,
> .inverse_tone_mapping = s->inverse_tonemapping,
> --
> 2.34.1
>
> _______________________________________________
> 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".
Merged as 1aeefc4c06de5408c24bc3f5db4d10fdfd9c27c0
_______________________________________________
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".
prev parent reply other threads:[~2023-05-21 11:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 19:45 Kacper Michajłow
2023-05-18 19:48 ` Niklas Haas
2023-05-21 11:16 ` Niklas Haas [this message]
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=20230521131644.GB102437@haasn.xyz \
--to=ffmpeg@haasn.xyz \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=kasper93@gmail.com \
/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