Initial commit: video effects processing system

Add S-expression based video effects pipeline with modular effect
definitions, constructs, and recipe files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-19 12:34:45 +00:00
commit 406cc7c0c7
171 changed files with 13406 additions and 0 deletions

52
effects/contrast.py Normal file
View File

@@ -0,0 +1,52 @@
# /// script
# requires-python = ">=3.10"
# dependencies = ["numpy"]
# ///
"""
@effect contrast
@version 1.0.0
@author artdag
@description
Adjusts contrast by scaling pixel values around the midpoint (128).
Higher values increase contrast, lower values flatten the image.
@param factor float
@range 0 3
@default 1.0
Contrast multiplier. 0.5 = low contrast, 1 = unchanged, 2 = high contrast.
@example
(effect contrast :factor 1.5)
@example
;; Dramatic contrast on energy peaks
(effect contrast :factor (bind energy :range [1.0 2.0]))
"""
import numpy as np
def process_frame(frame: np.ndarray, params: dict, state: dict) -> tuple:
"""
Adjust contrast of a video frame.
Args:
frame: Input frame as numpy array (H, W, 3) RGB uint8
params: Effect parameters
- factor: contrast multiplier (default 1.0)
state: Persistent state dict (unused)
Returns:
Tuple of (processed_frame, new_state)
"""
factor = params.get("factor", 1.0)
if factor == 1.0:
return frame, state
# Adjust contrast around midpoint (128)
img_float = frame.astype(np.float32)
result = 128 + factor * (img_float - 128)
return np.clip(result, 0, 255).astype(np.uint8), state