Debian Codegraph @

src/mixer2/sleid0r/sleid0r_push-left.c

raw symbols SCIP
1 /*
2 Copyright (C) 2013 Vadim Druzhin <[email protected]>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <stdlib.h>
19 #include <stdint.h>
20 #include <string.h>
21 #include <frei0r.h>cxx . . $ `<file>/include/frei0r.h`/
22
23 typedef struct instance_scxx . . $ instance_s#
24 {
25 unsigned wcxx . . $ instance_s#w.;
26 unsigned hcxx . . $ instance_s#h.;
27 double poscxx . . $ instance_s#pos.;
28 } instance_tcxx . . $ instance_t#;
29
30 int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).(void)
31 {
32 return 1;
33 }
34
35 void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).(void) {}
36
37 void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t# *info)
38 {
39 info->namecxx . . $ f0r_plugin_info#name. = "push-left";
40 info->authorcxx . . $ f0r_plugin_info#author. = "Vadim Druzhin";
41 info->plugin_typecxx . . $ f0r_plugin_info#plugin_type. = F0R_PLUGIN_TYPE_MIXER2cxx . . $ `include/frei0r.h:251:9`!;
42 info->color_modelcxx . . $ f0r_plugin_info#color_model. = F0R_COLOR_MODEL_PACKED32cxx . . $ `include/frei0r.h:322:9`!;
43 info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version. = FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!;
44 info->major_versioncxx . . $ f0r_plugin_info#major_version. = 0;
45 info->minor_versioncxx . . $ f0r_plugin_info#minor_version. = 1;
46 info->num_paramscxx . . $ f0r_plugin_info#num_params. = 1;
47 info->explanationcxx . . $ f0r_plugin_info#explanation. = "Push from right to left";
48 }
49
50 void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t# *info, int index)
51 {
52 if(0 == index)
53 {
54 info->namecxx . . $ f0r_param_info#name. = "position";
55 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
56 info->explanationcxx . . $ f0r_param_info#explanation. = "Push position";
57 }
58 }
59
60 f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned width, unsigned height)
61 {
62 instance_tcxx . . $ instance_t# *inst;
63
64 inst = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*inst));
65 if(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! == inst)
66 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
67
68 inst->wcxx . . $ instance_s#w. = width;
69 inst->hcxx . . $ instance_s#h. = height;
70 inst->poscxx . . $ instance_s#pos. = 0.0;
71
72 return inst;
73 }
74
75 void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# inst)
76 {
77 freecxx . . $ free(5d22bdacc48458e8).(inst);
78 }
79
80 void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# param, int param_index)
81 {
82 instance_tcxx . . $ instance_t# *inst = instance;
83
84 if(0 == param_index)
85 inst->poscxx . . $ instance_s#pos. = *(f0r_param_doublecxx . . $ f0r_param_double# *)param;
86 }
87
88 void f0r_get_param_valuecxx . . $ f0r_get_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# param, int param_index)
89 {
90 instance_tcxx . . $ instance_t# *inst = instance;
91
92 if(0 == param_index)
93 *(f0r_param_doublecxx . . $ f0r_param_double# *)param = inst->poscxx . . $ instance_s#pos.;
94 }
95
96 void f0r_update2cxx . . $ f0r_update2(1b234bc88d3943d5).(
97 f0r_instance_tcxx . . $ f0r_instance_t# instance,
98 double time,
99 const uint32_tcxx . . $ uint32_t#* inframe1,
100 const uint32_tcxx . . $ uint32_t#* inframe2,
101 const uint32_tcxx . . $ uint32_t#* inframe3,
102 uint32_tcxx . . $ uint32_t#* outframe
103 )
104 {
105 instance_tcxx . . $ instance_t# *inst = instance;
106 unsigned y, off;
107 double t;
108
109 (void)time; /* Unused */
110 (void)inframe3; /* Unused */
111
112 if(inst->poscxx . . $ instance_s#pos. < 0.5)
113 {
114 t = inst->poscxx . . $ instance_s#pos.;
115 t = t * t * 2.0;
116 }
117 else
118 {
119 t = 1.0 - inst->poscxx . . $ instance_s#pos.;
120 t = 1.0 - t * t * 2.0;
121 }
122 off = (unsigned)(inst->wcxx . . $ instance_s#w. * t + 0.5);
123
124 for(y = 0; y < inst->hcxx . . $ instance_s#h.; ++y)
125 {
126 memcpycxx . . $ memcpy(cc817cb175f282d).(outframe + inst->wcxx . . $ instance_s#w. * y, inframe1 + inst->wcxx . . $ instance_s#w. * y + off,
127 (inst->wcxx . . $ instance_s#w. - off) * sizeof(*outframe));
128 memcpycxx . . $ memcpy(cc817cb175f282d).(outframe + inst->wcxx . . $ instance_s#w. * y + inst->wcxx . . $ instance_s#w. - off, inframe2 + inst->wcxx . . $ instance_s#w. * y,
129 off * sizeof(*outframe));
130 }
131 }
132
133
134