| 1 | /* |
| 2 | test_pat_I |
| 3 | This frei0r plugin generates test patterns for measurement of |
| 4 | spatial impulse and step responses |
| 5 | |
| 6 | Version 0.1 may 2010 |
| 7 | |
| 8 | Copyright (C) 2010 Marko Cebokli http://lea.hamradio.si/~s57uuu |
| 9 | |
| 10 | |
| 11 | This program is free software; you can redistribute it and/or modify |
| 12 | it under the terms of the GNU General Public License as published by |
| 13 | the Free Software Foundation; either version 2 of the License, or |
| 14 | (at your option) any later version. |
| 15 | |
| 16 | This program is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | GNU General Public License for more details. |
| 20 | |
| 21 | You should have received a copy of the GNU General Public License |
| 22 | along with this program; if not, write to the Free Software |
| 23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | |
| 25 | */ |
| 26 | |
| 27 | /*********************************************************** |
| 28 | Test patterns: spatial impulse and step response |
| 29 | |
| 30 | The patterns are drawn into a temporary float array, for two reasons: |
| 31 | 1. drawing routines are color model independent, |
| 32 | 2. drawing is done only when a parameter changes. |
| 33 | |
| 34 | only the function float2color() |
| 35 | needs to care about color models, endianness, DV legality etc. |
| 36 | |
| 37 | *************************************************************/ |
| 38 | |
| 39 | //compile: gcc -Wall -c -fPIC test_pat_I.c -o test_pat_I.o |
| 40 | |
| 41 | //link: gcc -lm -shared -o test_pat_I.so test_pat_I.o |
| 42 | |
| 43 | #include <stdlib.h> |
| 44 | #include <assert.h> |
| 45 | #include <math.h> |
| 46 | |
| 47 | #include "frei0r.h"cxx . . $ `<file>/include/frei0r.h`/ |
| 48 | |
| 49 | |
| 50 | |
| 51 | double PIcxx . . $ PI.=3.14159265358979; |
| 52 | |
| 53 | typedef structcxx . . $ $anonymous_type_572f6910ba6084e9_0# |
| 54 | { |
| 55 | float rcxx . . $ $anonymous_type_572f6910ba6084e9_0#r.; |
| 56 | float gcxx . . $ $anonymous_type_572f6910ba6084e9_0#g.; |
| 57 | float bcxx . . $ $anonymous_type_572f6910ba6084e9_0#b.; |
| 58 | float acxx . . $ $anonymous_type_572f6910ba6084e9_0#a.; |
| 59 | } float_rgbacxx . . $ float_rgba#; |
| 60 | |
| 61 | |
| 62 | //---------------------------------------------------------- |
| 63 | void draw_rectanglecxx . . $ draw_rectangle(1c8176280125e6a).(float *sl, int w, int h, int x, int y, int wr, int hr, float gray) |
| 64 | { |
| 65 | int i,j; |
| 66 | int zx,kx,zy,ky; |
| 67 | |
| 68 | zx=x; if (zx<0) zx=0; |
| 69 | zy=y; if (zy<0) zy=0; |
| 70 | kx=x+wr; if (kx>w) kx=w; |
| 71 | ky=y+hr; if (ky>h) ky=h; |
| 72 | for (i=zy;i<ky;i++) |
| 73 | for (j=zx;j<kx;j++) |
| 74 | sl[w*i+j]=gray; |
| 75 | |
| 76 | } |
| 77 | |
| 78 | //---------------------------------------------------- |
| 79 | //pravokotna pika |
| 80 | void pika_pcxx . . $ pika_p(f75bf12e7728a7b1).(float *sl, int w, int h, float size, float amp) |
| 81 | { |
| 82 | int i; |
| 83 | |
| 84 | for (i=0;i<w*h;i++) sl[i]=0.5-amp/2.0; //background |
| 85 | draw_rectanglecxx . . $ draw_rectangle(1c8176280125e6a).(sl, w, h, w/2-size/2, h/2-size/2, size, size, 0.5+amp/2.0); |
| 86 | |
| 87 | } |
| 88 | |
| 89 | //---------------------------------------------------- |
| 90 | //okrogla pika (raised cos) |
| 91 | void pika_ocxx . . $ pika_o(f75bf12e7728a7b1).(float *sl, int w, int h, float size, float amp) |
| 92 | { |
| 93 | int i,j; |
| 94 | float x,y,r,g; |
| 95 | |
| 96 | for (i=0;i<w*h;i++) sl[i]=0.5-amp/2.0; //background |
| 97 | |
| 98 | for (i=0;i<size;i++) |
| 99 | for (j=0;j<size;j++) |
| 100 | { |
| 101 | x=(float)j-size/2.0+0.5; |
| 102 | y=(float)i-size/2.0+0.5; |
| 103 | r=sqrtfcxx . . $ sqrtf(fbcf3211dfe1bfd1).(x*x+y*y); |
| 104 | if (r>size/2.0) r=size/2.0; |
| 105 | g=0.5+amp/2.0*cosfcxx . . $ cosf(fbcf3211dfe1bfd1).(r/size*2.0*PIcxx . . $ PI.); |
| 106 | sl[(i+h/2-(int)size/2)*w+j+w/2-(int)size/2]=g; |
| 107 | } |
| 108 | |
| 109 | } |
| 110 | |
| 111 | //---------------------------------------------------- |
| 112 | //crta pravokotna |
| 113 | void crta_pcxx . . $ crta_p(ecd8a3d5fb48347c).(float *sl, int w, int h, float size, float amp, float tilt) |
| 114 | { |
| 115 | int i,j; |
| 116 | float d,st,ct; |
| 117 | |
| 118 | st=sinfcxx . . $ sinf(fbcf3211dfe1bfd1).(tilt); |
| 119 | ct=cosfcxx . . $ cosf(fbcf3211dfe1bfd1).(tilt); |
| 120 | for (i=0;i<h;i++) |
| 121 | for (j=0;j<w;j++) |
| 122 | { |
| 123 | d=(i-h/2)*ct+(j-w/2)*st; |
| 124 | if (fabsfcxx . . $ fabsf(fbcf3211dfe1bfd1).(d)>size/2.0) |
| 125 | { |
| 126 | sl[i*w+j]=0.5-amp/2.0; |
| 127 | } |
| 128 | else |
| 129 | { |
| 130 | sl[i*w+j]=0.5+amp/2.0; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | } |
| 135 | |
| 136 | //---------------------------------------------------- |
| 137 | //crta raised cos |
| 138 | void crtacxx . . $ crta(ecd8a3d5fb48347c).(float *sl, int w, int h, float size, float amp, float tilt) |
| 139 | { |
| 140 | int i,j; |
| 141 | float d,st,ct,g; |
| 142 | |
| 143 | if (size==0.0) return; |
| 144 | st=sinfcxx . . $ sinf(fbcf3211dfe1bfd1).(tilt); |
| 145 | ct=cosfcxx . . $ cosf(fbcf3211dfe1bfd1).(tilt); |
| 146 | for (i=0;i<h;i++) |
| 147 | for (j=0;j<w;j++) |
| 148 | { |
| 149 | d=(i-h/2)*ct+(j-w/2)*st; |
| 150 | if (fabsfcxx . . $ fabsf(fbcf3211dfe1bfd1).(d)>size/2.0) |
| 151 | { |
| 152 | sl[i*w+j]=0.5-amp/2.0; |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | if (d>size/2.0) d=size/2.0; |
| 157 | g=0.5+amp/2.0*cosfcxx . . $ cosf(fbcf3211dfe1bfd1).(d/size*2.0*PIcxx . . $ PI.); |
| 158 | sl[i*w+j]=g; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | } |
| 163 | |
| 164 | //---------------------------------------------------- |
| 165 | //crta step raised cos, oz. pravokotna, ce das size=1 |
| 166 | void crta_scxx . . $ crta_s(ecd8a3d5fb48347c).(float *sl, int w, int h, float size, float amp, float tilt) |
| 167 | { |
| 168 | int i,j; |
| 169 | float d,st,ct,g; |
| 170 | |
| 171 | if (size==0.0) return; |
| 172 | st=sinfcxx . . $ sinf(fbcf3211dfe1bfd1).(tilt); |
| 173 | ct=cosfcxx . . $ cosf(fbcf3211dfe1bfd1).(tilt); |
| 174 | for (i=0;i<h;i++) |
| 175 | for (j=0;j<w;j++) |
| 176 | { |
| 177 | d=(i-h/2)*ct+(j-w/2)*st; |
| 178 | if (fabsfcxx . . $ fabsf(fbcf3211dfe1bfd1).(d)>size/2.0) |
| 179 | { |
| 180 | if (d>0.0) |
| 181 | sl[i*w+j]=0.5-amp/2.0; |
| 182 | else |
| 183 | sl[i*w+j]=0.5+amp/2.0; |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | if (d>size/2.0) d=size/2.0; |
| 188 | g=0.5-amp/2.0*sinfcxx . . $ sinf(fbcf3211dfe1bfd1).(d/size*PIcxx . . $ PI.); |
| 189 | sl[i*w+j]=g; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | } |
| 194 | |
| 195 | //---------------------------------------------------- |
| 196 | //crta step linear ramp, oz. pravokotna, ce das size=1 |
| 197 | void crta_rcxx . . $ crta_r(ecd8a3d5fb48347c).(float *sl, int w, int h, float size, float amp, float tilt) |
| 198 | { |
| 199 | int i,j; |
| 200 | float d,st,ct,g; |
| 201 | |
| 202 | if (size==0.0) return; |
| 203 | st=sinfcxx . . $ sinf(fbcf3211dfe1bfd1).(tilt); |
| 204 | ct=cosfcxx . . $ cosf(fbcf3211dfe1bfd1).(tilt); |
| 205 | for (i=0;i<h;i++) |
| 206 | for (j=0;j<w;j++) |
| 207 | { |
| 208 | d=(i-h/2)*ct+(j-w/2)*st; |
| 209 | if (fabsfcxx . . $ fabsf(fbcf3211dfe1bfd1).(d)>size/2.0) |
| 210 | { |
| 211 | if (d>0.0) |
| 212 | sl[i*w+j]=0.5-amp/2.0; |
| 213 | else |
| 214 | sl[i*w+j]=0.5+amp/2.0; |
| 215 | } |
| 216 | else |
| 217 | { |
| 218 | if (d>size/2.0) d=size/2.0; |
| 219 | g = 0.5-amp*(d/size); |
| 220 | sl[i*w+j]=g; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | } |
| 225 | |
| 226 | //----------------------------------------------------- |
| 227 | //converts the internal monochrome float image into |
| 228 | //Frei0r rgba8888 color |
| 229 | //ch selects the channel 0=all 1=R 2=G 3=B |
| 230 | //sets alpha to opaque |
| 231 | void float2colorcxx . . $ float2color(861aee960bd7d064).(float *sl, uint32_tcxx . . $ uint32_t#* outframe, int w , int h, int ch) |
| 232 | { |
| 233 | int i,ri,gi,bi; |
| 234 | uint32_tcxx . . $ uint32_t# p; |
| 235 | float r,g,b; |
| 236 | |
| 237 | switch (ch) |
| 238 | { |
| 239 | case 0: //all (gray) |
| 240 | for (i=0;i<w*h;i++) |
| 241 | { |
| 242 | p=(uint32_tcxx . . $ uint32_t#)(255.0*sl[i]) & 0xFF; |
| 243 | outframe[i] = (p<<16)+(p<<8)+p+0xFF000000; |
| 244 | } |
| 245 | break; |
| 246 | case 1: //R |
| 247 | for (i=0;i<w*h;i++) |
| 248 | { |
| 249 | p=(uint32_tcxx . . $ uint32_t#)(255.0*sl[i]) & 0xFF; |
| 250 | outframe[i] = p+0xFF000000; |
| 251 | } |
| 252 | break; |
| 253 | case 2: //G |
| 254 | for (i=0;i<w*h;i++) |
| 255 | { |
| 256 | p=(uint32_tcxx . . $ uint32_t#)(255.0*sl[i]) & 0xFF; |
| 257 | outframe[i] = (p<<8)+0xFF000000; |
| 258 | } |
| 259 | break; |
| 260 | case 3: //B |
| 261 | for (i=0;i<w*h;i++) |
| 262 | { |
| 263 | p=(uint32_tcxx . . $ uint32_t#)(255.0*sl[i]) & 0xFF; |
| 264 | outframe[i] = (p<<16)+0xFF000000; |
| 265 | } |
| 266 | break; |
| 267 | case 4: //ccir rec 601 R-Y on 50 gray |
| 268 | for (i=0;i<w*h;i++) |
| 269 | { |
| 270 | r=sl[i]; |
| 271 | b=0.5; |
| 272 | g=(0.5-0.299*r-0.114*b)/0.587; |
| 273 | ri=(int)(255.0*r); |
| 274 | gi=(int)(255.0*g); |
| 275 | bi=(int)(255.0*b); |
| 276 | outframe[i] = (bi<<16)+(gi<<8)+ri+0xFF000000; |
| 277 | } |
| 278 | break; |
| 279 | case 5: //ccir rec 601 B-Y on 50% gray |
| 280 | for (i=0;i<w*h;i++) |
| 281 | { |
| 282 | b=sl[i]; |
| 283 | r=0.5; |
| 284 | g=(0.5-0.299*r-0.114*b)/0.587; |
| 285 | ri=(int)(255.0*r); |
| 286 | gi=(int)(255.0*g); |
| 287 | bi=(int)(255.0*b); |
| 288 | outframe[i] = (bi<<16)+(gi<<8)+ri+0xFF000000; |
| 289 | } |
| 290 | break; |
| 291 | case 6: //ccir rec 709 R-Y on 50 gray |
| 292 | for (i=0;i<w*h;i++) |
| 293 | { |
| 294 | r=sl[i]; |
| 295 | b=0.5; |
| 296 | g=(0.5-0.2126*r-0.0722*b)/0.7152; |
| 297 | ri=(int)(255.0*r); |
| 298 | gi=(int)(255.0*g); |
| 299 | bi=(int)(255.0*b); |
| 300 | outframe[i] = (bi<<16)+(gi<<8)+ri+0xFF000000; |
| 301 | } |
| 302 | break; |
| 303 | case 7: //ccir rec 709 B-Y on 50% gray |
| 304 | for (i=0;i<w*h;i++) |
| 305 | { |
| 306 | b=sl[i]; |
| 307 | r=0.5; |
| 308 | g=(0.5-0.2126*r-0.0722*b)/0.7152; |
| 309 | ri=(int)(255.0*r); |
| 310 | gi=(int)(255.0*g); |
| 311 | bi=(int)(255.0*b); |
| 312 | outframe[i] = (bi<<16)+(gi<<8)+ri+0xFF000000; |
| 313 | } |
| 314 | break; |
| 315 | default: |
| 316 | break; |
| 317 | } |
| 318 | |
| 319 | } |
| 320 | |
| 321 | //----------------------------------------------------- |
| 322 | //stretch [0...1] to parameter range [min...max] linear |
| 323 | float map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(double v, float min, float max) |
| 324 | { |
| 325 | return min+(max-min)*v; |
| 326 | } |
| 327 | |
| 328 | //----------------------------------------------------- |
| 329 | //collapse from parameter range [min...max] to [0...1] linear |
| 330 | double map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(float v, float min, float max) |
| 331 | { |
| 332 | return (v-min)/(max-min); |
| 333 | } |
| 334 | |
| 335 | //----------------------------------------------------- |
| 336 | //stretch [0...1] to parameter range [min...max] logarithmic |
| 337 | //min and max must be positive! |
| 338 | float map_value_forward_logcxx . . $ map_value_forward_log(1935fda23fc189b2).(double v, float min, float max) |
| 339 | { |
| 340 | float sr,k; |
| 341 | |
| 342 | sr=sqrtfcxx . . $ sqrtf(fbcf3211dfe1bfd1).(min*max); |
| 343 | k=2.0*log(max/sr); |
| 344 | return sr*expfcxx . . $ expf(fbcf3211dfe1bfd1).(k*(v-0.5)); |
| 345 | } |
| 346 | |
| 347 | //----------------------------------------------------- |
| 348 | //collapse from parameter range [min...max] to [0...1] logarithmic |
| 349 | //min and max must be positive! |
| 350 | double map_value_backward_logcxx . . $ map_value_backward_log(937b104db0ceee62).(float v, float min, float max) |
| 351 | { |
| 352 | float sr,k; |
| 353 | |
| 354 | sr=sqrtfcxx . . $ sqrtf(fbcf3211dfe1bfd1).(min*max); |
| 355 | k=2.0*log(max/sr); |
| 356 | return logfcxx . . $ logf(fbcf3211dfe1bfd1).(v/sr)/k+0.5; |
| 357 | } |
| 358 | |
| 359 | //************************************************** |
| 360 | //obligatory frei0r stuff follows |
| 361 | |
| 362 | //------------------------------------------------ |
| 363 | //this structure holds an instance of the test_pat_I plugin |
| 364 | typedef structcxx . . $ $anonymous_type_572f6910ba6084e9_1# |
| 365 | { |
| 366 | unsigned int wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w.; |
| 367 | unsigned int hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h.; |
| 368 | |
| 369 | int typecxx . . $ $anonymous_type_572f6910ba6084e9_1#type.; |
| 370 | int chancxx . . $ $anonymous_type_572f6910ba6084e9_1#chan.; |
| 371 | float ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp.; |
| 372 | float pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw.; |
| 373 | float tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt.; |
| 374 | int negcxx . . $ $anonymous_type_572f6910ba6084e9_1#neg.; |
| 375 | |
| 376 | float *slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl.; |
| 377 | |
| 378 | } tp_inst_tcxx . . $ tp_inst_t#; |
| 379 | |
| 380 | //---------------------------------------------------- |
| 381 | int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).() |
| 382 | { |
| 383 | return 1; |
| 384 | } |
| 385 | |
| 386 | //-------------------------------------------------- |
| 387 | void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).() |
| 388 | { /* no initialization required */ } |
| 389 | |
| 390 | //-------------------------------------------------- |
| 391 | void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* tp_info) |
| 392 | { |
| 393 | tp_info->namecxx . . $ f0r_plugin_info#name. = "test_pat_I"; |
| 394 | tp_info->authorcxx . . $ f0r_plugin_info#author. = "Marko Cebokli"; |
| 395 | tp_info->plugin_typecxx . . $ f0r_plugin_info#plugin_type. = F0R_PLUGIN_TYPE_SOURCEcxx . . $ `include/frei0r.h:249:9`!; |
| 396 | // tp_info->plugin_type = F0R_PLUGIN_TYPE_FILTER; |
| 397 | tp_info->color_modelcxx . . $ f0r_plugin_info#color_model. = F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!; |
| 398 | tp_info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version. = FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!; |
| 399 | tp_info->major_versioncxx . . $ f0r_plugin_info#major_version. = 0; |
| 400 | tp_info->minor_versioncxx . . $ f0r_plugin_info#minor_version. = 2; |
| 401 | tp_info->num_paramscxx . . $ f0r_plugin_info#num_params. = 6; |
| 402 | tp_info->explanationcxx . . $ f0r_plugin_info#explanation. = "Generates spatial impulse and step test patterns"; |
| 403 | } |
| 404 | |
| 405 | //-------------------------------------------------- |
| 406 | void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index) |
| 407 | { |
| 408 | switch (param_index) |
| 409 | { |
| 410 | case 0: |
| 411 | info->namecxx . . $ f0r_param_info#name. = "Type"; |
| 412 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 413 | info->explanationcxx . . $ f0r_param_info#explanation. = "Type of test pattern"; break; |
| 414 | case 1: |
| 415 | info->namecxx . . $ f0r_param_info#name. ="Channel"; |
| 416 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 417 | info->explanationcxx . . $ f0r_param_info#explanation. = "Into which color channel to draw"; |
| 418 | break; |
| 419 | case 2: |
| 420 | info->namecxx . . $ f0r_param_info#name. = "Amplitude"; |
| 421 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 422 | info->explanationcxx . . $ f0r_param_info#explanation. = "Amplitude (contrast) of the pattern"; |
| 423 | break; |
| 424 | case 3: |
| 425 | info->namecxx . . $ f0r_param_info#name. = "Width"; |
| 426 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 427 | info->explanationcxx . . $ f0r_param_info#explanation. = "Width of impulse"; |
| 428 | break; |
| 429 | case 4: |
| 430 | info->namecxx . . $ f0r_param_info#name. = "Tilt"; |
| 431 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 432 | info->explanationcxx . . $ f0r_param_info#explanation. = "Angle of step function"; |
| 433 | break; |
| 434 | case 5: |
| 435 | info->namecxx . . $ f0r_param_info#name. = "Negative"; |
| 436 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!; |
| 437 | info->explanationcxx . . $ f0r_param_info#explanation. = "Change polarity of impulse/step"; |
| 438 | break; |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | //-------------------------------------------------- |
| 443 | f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height) |
| 444 | { |
| 445 | tp_inst_tcxx . . $ tp_inst_t#* inst = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*inst)); |
| 446 | inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w. = width; |
| 447 | inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h. = height; |
| 448 | |
| 449 | inst->typecxx . . $ $anonymous_type_572f6910ba6084e9_1#type.=0; |
| 450 | inst->chancxx . . $ $anonymous_type_572f6910ba6084e9_1#chan.=0; |
| 451 | inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp.=0.8; |
| 452 | inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw.=5.0; |
| 453 | inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt.=0.0; |
| 454 | inst->negcxx . . $ $anonymous_type_572f6910ba6084e9_1#neg.=0; |
| 455 | |
| 456 | inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl.=(float*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(width*height,sizeof(float)); |
| 457 | |
| 458 | pika_pcxx . . $ pika_p(f75bf12e7728a7b1).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp.); |
| 459 | |
| 460 | return (f0r_instance_tcxx . . $ f0r_instance_t#)inst; |
| 461 | } |
| 462 | |
| 463 | //-------------------------------------------------- |
| 464 | void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance) |
| 465 | { |
| 466 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 467 | |
| 468 | freecxx . . $ free(5d22bdacc48458e8).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl.); |
| 469 | freecxx . . $ free(5d22bdacc48458e8).(inst); |
| 470 | } |
| 471 | |
| 472 | //-------------------------------------------------- |
| 473 | 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) |
| 474 | { |
| 475 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 476 | |
| 477 | f0r_param_doublecxx . . $ f0r_param_double#* p = (f0r_param_doublecxx . . $ f0r_param_double#*) param; |
| 478 | |
| 479 | int chg,tmpi; |
| 480 | float tmpf; |
| 481 | |
| 482 | chg=0; |
| 483 | switch (param_index) |
| 484 | { |
| 485 | case 0: //type |
| 486 | tmpf=*((double*)p); |
| 487 | if (tmpf>=1.0) |
| 488 | tmpi=(int)tmpf; |
| 489 | else |
| 490 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(tmpf, 0.0, 5.9999); |
| 491 | if ((tmpi<0)||(tmpi>5.0)) break; |
| 492 | if (inst->typecxx . . $ $anonymous_type_572f6910ba6084e9_1#type. != tmpi) chg=1; |
| 493 | inst->typecxx . . $ $anonymous_type_572f6910ba6084e9_1#type. = tmpi; |
| 494 | break; |
| 495 | case 1: //channel |
| 496 | tmpf=*((double*)p); |
| 497 | if (tmpf>=1.0) |
| 498 | tmpi=(int)tmpf; |
| 499 | else |
| 500 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(tmpf, 0.0, 7.9999); |
| 501 | if ((tmpi<0)||(tmpi>7.0)) break; |
| 502 | if (inst->chancxx . . $ $anonymous_type_572f6910ba6084e9_1#chan. != tmpi) chg=1; |
| 503 | inst->chancxx . . $ $anonymous_type_572f6910ba6084e9_1#chan. = tmpi; |
| 504 | case 2: //amplitude |
| 505 | tmpf = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 0.0, 1.0); |
| 506 | if (inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp. != tmpf) chg=1; |
| 507 | inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp. = tmpf; |
| 508 | break; |
| 509 | case 3: //width |
| 510 | tmpf = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 1.0, 100.0); |
| 511 | if (inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw. != tmpf) chg=1; |
| 512 | inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw. = tmpf; |
| 513 | break; |
| 514 | case 4: //tilt |
| 515 | tmpf = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), -PIcxx . . $ PI./2.0, PIcxx . . $ PI./2.0); |
| 516 | if (inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt. != tmpf) chg=1; |
| 517 | inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt. = tmpf; |
| 518 | break; |
| 519 | case 5: //negative |
| 520 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)p), 0.0, 1.0); |
| 521 | if (inst->negcxx . . $ $anonymous_type_572f6910ba6084e9_1#neg. != tmpi) chg=1; |
| 522 | inst->negcxx . . $ $anonymous_type_572f6910ba6084e9_1#neg. = tmpi; |
| 523 | break; |
| 524 | } |
| 525 | |
| 526 | if (chg==0) return; |
| 527 | |
| 528 | switch (inst->typecxx . . $ $anonymous_type_572f6910ba6084e9_1#type.) |
| 529 | { |
| 530 | case 0: // |
| 531 | pika_pcxx . . $ pika_p(f75bf12e7728a7b1).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp.); |
| 532 | break; |
| 533 | case 1: // |
| 534 | pika_ocxx . . $ pika_o(f75bf12e7728a7b1).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp.); |
| 535 | break; |
| 536 | case 2: // |
| 537 | crta_pcxx . . $ crta_p(ecd8a3d5fb48347c).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp., inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt.); |
| 538 | break; |
| 539 | case 3: // |
| 540 | crtacxx . . $ crta(ecd8a3d5fb48347c).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp., inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt.); |
| 541 | break; |
| 542 | case 4: // |
| 543 | crta_scxx . . $ crta_s(ecd8a3d5fb48347c).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp., inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt.); |
| 544 | break; |
| 545 | case 5: // |
| 546 | crta_rcxx . . $ crta_r(ecd8a3d5fb48347c).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w., inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp., inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt.); |
| 547 | break; |
| 548 | default: |
| 549 | break; |
| 550 | } |
| 551 | |
| 552 | } |
| 553 | |
| 554 | //------------------------------------------------- |
| 555 | 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) |
| 556 | { |
| 557 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 558 | |
| 559 | f0r_param_doublecxx . . $ f0r_param_double#* p = (f0r_param_doublecxx . . $ f0r_param_double#*) param; |
| 560 | |
| 561 | switch (param_index) |
| 562 | { |
| 563 | case 0: //type |
| 564 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->typecxx . . $ $anonymous_type_572f6910ba6084e9_1#type., 0.0, 5.9999); |
| 565 | break; |
| 566 | case 1: //channel |
| 567 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->chancxx . . $ $anonymous_type_572f6910ba6084e9_1#chan., 0.0, 7.9999); |
| 568 | break; |
| 569 | case 2: //amplitude |
| 570 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->ampcxx . . $ $anonymous_type_572f6910ba6084e9_1#amp., 0.0, 1.0); |
| 571 | break; |
| 572 | case 3: //width |
| 573 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->pwcxx . . $ $anonymous_type_572f6910ba6084e9_1#pw., 1.0, 100.0); |
| 574 | break; |
| 575 | case 4: //tilt |
| 576 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->tiltcxx . . $ $anonymous_type_572f6910ba6084e9_1#tilt., -PIcxx . . $ PI./2.0, PIcxx . . $ PI./2.0); |
| 577 | break; |
| 578 | case 5: //negative |
| 579 | *p = map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(inst->negcxx . . $ $anonymous_type_572f6910ba6084e9_1#neg., 0.0, 1.0); |
| 580 | break; |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | //--------------------------------------------------- |
| 585 | void f0r_updatecxx . . $ f0r_update(96cd7b27f2fca8a7).(f0r_instance_tcxx . . $ f0r_instance_t# instance, double time, const uint32_tcxx . . $ uint32_t#* inframe, uint32_tcxx . . $ uint32_t#* outframe) |
| 586 | { |
| 587 | |
| 588 | assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance); |
| 589 | tp_inst_tcxx . . $ tp_inst_t#* inst = (tp_inst_tcxx . . $ tp_inst_t#*)instance; |
| 590 | |
| 591 | float2colorcxx . . $ float2color(861aee960bd7d064).(inst->slcxx . . $ $anonymous_type_572f6910ba6084e9_1#sl., outframe, inst->wcxx . . $ $anonymous_type_572f6910ba6084e9_1#w. , inst->hcxx . . $ $anonymous_type_572f6910ba6084e9_1#h., inst->chancxx . . $ $anonymous_type_572f6910ba6084e9_1#chan.); |
| 592 | |
| 593 | } |