ExCubecl.Filter (ExCubecl v0.4.0)

Copy Markdown View Source

GPU-accelerated filters for video and audio.

Supports single-filter application and chainable filter pipelines.

Video filters

filtered = ExCubecl.Filter.apply(frame, :gaussian_blur, radius: 5)
filtered = ExCubecl.Filter.apply(frame, :sharpen, strength: 1.2)
filtered = ExCubecl.Filter.apply(frame, :lut, file: "cinematic.cube")
filtered = ExCubecl.Filter.apply(frame, :chroma_key, color: {0, 177, 64}, threshold: 0.3)
filtered = ExCubecl.Filter.apply(frame, :brightness_contrast, brightness: 0.1, contrast: 1.2)
filtered = ExCubecl.Filter.apply(frame, :denoise, strength: 0.5)

Audio filters

filtered = ExCubecl.Filter.apply(samples, :eq, bands: [{:high_pass, 80}, {:shelf_high, 8000, 3.0}])
filtered = ExCubecl.Filter.apply(samples, :compressor, threshold: -18, ratio: 4.0)
filtered = ExCubecl.Filter.apply(samples, :reverb, room_size: 0.5, wet: 0.2)
filtered = ExCubecl.Filter.apply(samples, :normalize)

Filter chains via pipeline

ExCubecl.pipeline()
|> ExCubecl.pipeline_add(%{op: :filter, kernel: :gaussian_blur, input: frame, params: %{radius: 3}})
|> ExCubecl.pipeline_add(%{op: :filter, kernel: :lut, input: :prev, params: %{file: "warm.cube"}})
|> ExCubecl.pipeline_run()

Summary

Functions

Applies a named GPU filter to a frame or audio buffer.

Applies a chain of filters in sequence using a pipeline.

Types

frame_or_samples()

@type frame_or_samples() :: ExCubecl.VideoFrame.t() | ExCubecl.AudioSamples.t()

Functions

apply(input, kernel, params \\ [])

@spec apply(frame_or_samples(), atom(), keyword()) ::
  {:ok, frame_or_samples()} | {:error, term()}

Applies a named GPU filter to a frame or audio buffer.

Returns the filtered result (same type as input).

chain(input, filters)

@spec chain(frame_or_samples(), [{atom(), keyword()}]) ::
  {:ok, frame_or_samples()} | {:error, term()}

Applies a chain of filters in sequence using a pipeline.

Each filter is a {kernel_name, params} tuple.

Examples

ExCubecl.Filter.chain(frame, [
  {:gaussian_blur, [radius: 3]},
  {:lut, [file: "warm.cube"]}
])