History

lavfi/vf_libplacebo: allow linking to shared library with dllimport

Address of dll imported variables can't be used for constant initialization in C language modes.

Kacper Michajłow committed 3 years ago

Commit 1aeefc41 parent 65fe1801 file · +21 −18Browse files

Unified · Split

libavfilter/vf_libplacebo.c+21−18
@@ -56,23 +56,6 @@ enum { · 55 unmodified lines
5656 TONE_MAP_COUNT,
5757 };
5858
59−static const struct pl_tone_map_function * const tonemapping_funcs[TONE_MAP_COUNT] = {
60− [TONE_MAP_AUTO] = &pl_tone_map_auto,
61− [TONE_MAP_CLIP] = &pl_tone_map_clip,
62−#if PL_API_VER >= 246
63− [TONE_MAP_ST2094_40] = &pl_tone_map_st2094_40,
64− [TONE_MAP_ST2094_10] = &pl_tone_map_st2094_10,
65−#endif
66− [TONE_MAP_BT2390] = &pl_tone_map_bt2390,
67− [TONE_MAP_BT2446A] = &pl_tone_map_bt2446a,
68− [TONE_MAP_SPLINE] = &pl_tone_map_spline,
69− [TONE_MAP_REINHARD] = &pl_tone_map_reinhard,
70− [TONE_MAP_MOBIUS] = &pl_tone_map_mobius,
71− [TONE_MAP_HABLE] = &pl_tone_map_hable,
72− [TONE_MAP_GAMMA] = &pl_tone_map_gamma,
73− [TONE_MAP_LINEAR] = &pl_tone_map_linear,
74−};
75−
7659 static const char *const var_names[] = {
7760 "in_w", "iw", ///< width of the input video frame
7861 "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) · 190 unmodified lines
269252 av_log(log_ctx, av_lev, "%s\n", msg);
270253 }
271254
255+static const struct pl_tone_map_function *pl_get_tonemapping_func(int tm) {
256+ switch (tm) {
257+ case TONE_MAP_AUTO: return &pl_tone_map_auto;
258+ case TONE_MAP_CLIP: return &pl_tone_map_clip;
259+#if PL_API_VER >= 246
260+ case TONE_MAP_ST2094_40: return &pl_tone_map_st2094_40;
261+ case TONE_MAP_ST2094_10: return &pl_tone_map_st2094_10;
262+#endif
263+ case TONE_MAP_BT2390: return &pl_tone_map_bt2390;
264+ case TONE_MAP_BT2446A: return &pl_tone_map_bt2446a;
265+ case TONE_MAP_SPLINE: return &pl_tone_map_spline;
266+ case TONE_MAP_REINHARD: return &pl_tone_map_reinhard;
267+ case TONE_MAP_MOBIUS: return &pl_tone_map_mobius;
268+ case TONE_MAP_HABLE: return &pl_tone_map_hable;
269+ case TONE_MAP_GAMMA: return &pl_tone_map_gamma;
270+ case TONE_MAP_LINEAR: return &pl_tone_map_linear;
271+ default: av_assert0(0);
272+ }
273+}
274+
272275 static int parse_shader(AVFilterContext *avctx, const void *shader, size_t len)
273276 {
274277 LibplaceboContext *s = avctx->priv;
@@ -365,7 +368,7 @@ static int update_settings(AVFilterContext *ctx) · 90 unmodified lines
365368 s->color_map_params = *pl_color_map_params(
366369 .intent = s->intent,
367370 .gamut_mode = gamut_mode,
368− .tone_mapping_function = tonemapping_funcs[s->tonemapping],
371+ .tone_mapping_function = pl_get_tonemapping_func(s->tonemapping),
369372 .tone_mapping_param = s->tonemapping_param,
370373 .tone_mapping_mode = tonemapping_mode,
371374 .inverse_tone_mapping = s->inverse_tonemapping,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t