Dala.Media.Filter (dala v0.3.0)

Copy Markdown View Source

GPU compute filters for realtime video processing.

Runs compute shaders on GPU textures for effects like blur, sharpen, LUT color grading, beauty filter, denoise, etc.

All filters operate on GPU textures directly — no CPU roundtrip.

Example

# Apply gaussian blur
Dala.Media.Filter.apply(surface, :blur, %{radius: 5.0})

# Apply LUT color grading
Dala.Media.Filter.apply(surface, :lut, %{lut_path: "path/to/lut.png"})

# Chain multiple filters
Dala.Media.Filter.chain(surface, [
  [:blur, %{radius: 2.0}],
  [:sharpen, %{amount: 0.5}],
  [:lut, %{lut_path: "film.emulation.png"}]
])

Summary

Functions

Apply a single filter to a GPU surface.

Chain multiple filters in sequence.

Get the shader source for a filter type.

Types

filter_type()

@type filter_type() :: :blur | :sharpen | :lut | :beauty | :denoise | :edge_detect

params()

@type params() :: map()

surface()

@type surface() :: pid()

Functions

apply_filter(surface_or_nil, filter_type, params \\ %{})

@spec apply_filter(surface() | nil, filter_type(), params()) ::
  binary() | :ok | {:error, term()}

Apply a single filter to a GPU surface.

chain(surface, filters)

@spec chain(surface(), [{filter_type(), params()}]) :: :ok | {:error, term()}

Chain multiple filters in sequence.

shader_source(atom)

@spec shader_source(filter_type()) :: String.t()

Get the shader source for a filter type.