1 %% extends "common.c.t"
3 %% macro filter_include()
4 #include "core/GP_Context.h"
5 #include "core/GP_Pixel.h"
6 #include "core/GP_GetPutPixel.h"
7 #include "core/GP_Debug.h"
12 * Value clamping macro
14 %% macro filter_clamp_val(var, size)
18 if ({{ var }} > {{ 2 ** size - 1}})
19 {{ var }} = {{ 2 ** size - 1}};
23 * Load parameters from params structure into variables
25 %% macro filter_params(pt, params, c_type, suffix, id)
26 GP_ASSERT(GP_FilterParamCheckPixelType({{ params }}, GP_PIXEL_{{ pt.name }}) == 0,
27 "Invalid params channels for context pixel type");
29 %% for chann in pt.chanslist
30 {{ c_type }}{{ chann[0] }}{{ suffix }} = (GP_FilterParamChannel({{ params }}, "{{ chann[0] }}"))->val.{{ id }};
34 %% macro filter_params_raw(pt, params, suffix)
35 GP_ASSERT(GP_FilterParamCheckPixelType({{ params }}, GP_PIXEL_{{ pt.name }}) == 0,
36 "Invalid params channels for context pixel type");
38 %% for chann in pt.chanslist
39 GP_FilterParam *{{ chann[0] }}{{ suffix }} = GP_FilterParamChannel({{ params }}, "{{ chann[0] }}");
44 * Load parameters from params structure into variable
46 %% macro filter_param(ps, params, c_type, suffix, id)
47 GP_ASSERT(GP_FilterParamChannels({{ params }}) != 1,
48 "Expected only one channel");
50 {{ c_type }}pix{{ suffix }} = {{ params }}[0].val.{{ id }};
53 %% macro filter_param_raw(ps, params, suffix)
54 GP_ASSERT(GP_FilterParamChannels({{ params }}) != 1,
55 "Expected only one channel");
57 GP_FilterParam *pix{{ suffix }} = &{{ params }}[0];