| 1 | /* |
| 2 | IIRblur.c |
| 3 | |
| 4 | This Frei0r plugin implements fast IIR blurring of video |
| 5 | |
| 6 | Version 0.1 jul 2011 |
| 7 | |
| 8 | Copyright (C) 2011 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 | //compile: gcc -c -fPIC -Wall IIRblur.c -o IIRblur.o |
| 29 | //link: gcc -shared -o IIRblur.so IIRblur.o |
| 30 | |
| 31 | //stdio samo za debug izpise |
| 32 | //#include <stdio.h> |
| 33 | #include <frei0r.h>cxx . . $ `<file>/include/frei0r.h`/ |
| 34 | #include <stdlib.h> |
| 35 | #include <math.h> |
| 36 | #include <assert.h> |
| 37 | #include <inttypes.h> |
| 38 | #include <string.h> |
| 39 | |
| 40 | double PIcxx . . $ PI.=3.14159265358979; |
| 41 | |
| 42 | typedef structcxx . . $ $anonymous_type_79a4f372fae6bff1_0# |
| 43 | { |
| 44 | float rcxx . . $ $anonymous_type_79a4f372fae6bff1_0#r.; |
| 45 | float gcxx . . $ $anonymous_type_79a4f372fae6bff1_0#g.; |
| 46 | float bcxx . . $ $anonymous_type_79a4f372fae6bff1_0#b.; |
| 47 | float acxx . . $ $anonymous_type_79a4f372fae6bff1_0#a.; |
| 48 | } float_rgbacxx . . $ float_rgba#; |
| 49 | |
| 50 | #include "fibe.h"cxx . . $ `<file>/src/filter/blur/fibe.h`/ |
| 51 | |
| 52 | |
| 53 | //---------------------------------------- |
| 54 | //struktura za instanco efekta |
| 55 | typedef structcxx . . $ $anonymous_type_79a4f372fae6bff1_1# |
| 56 | { |
| 57 | //status |
| 58 | int hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h.; |
| 59 | int wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w.; |
| 60 | |
| 61 | //parameters |
| 62 | float amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.; //amount of blur |
| 63 | int tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty.; //type of blur [0..2] |
| 64 | int eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec.; //edge compensation (BOOL) |
| 65 | |
| 66 | //video buffers |
| 67 | float_rgbacxx . . $ float_rgba# *imgcxx . . $ $anonymous_type_79a4f372fae6bff1_1#img.; |
| 68 | |
| 69 | //internal variables |
| 70 | float a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1.,a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.,a3cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a3.; |
| 71 | float rd1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rd1.,rd2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rd2.,rs1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rs1.,rs2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rs2.,rc1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rc1.,rc2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rc2.; |
| 72 | |
| 73 | } instcxx . . $ inst#; |
| 74 | |
| 75 | //-------------------------------------------------------- |
| 76 | //Aitken-Neville interpolacija iz 4 tock (tretjega reda) |
| 77 | //t = stevilo tock v arrayu |
| 78 | //array xt naj bo v rastocem zaporedju, lahko neekvidistanten |
| 79 | float AitNev3cxx . . $ AitNev3(5cdedbd8584a0728).(int t, float xt[], float yt[], float x) |
| 80 | { |
| 81 | float p[10]; |
| 82 | int i,j,m; |
| 83 | |
| 84 | if ((x<xt[0])||(x>xt[t-1])) |
| 85 | { |
| 86 | // printf("\n\n x=%f je izven mej tabele!",x); |
| 87 | // Return a reasonable value instead of dividing by zero |
| 88 | if (x<xt[0]) return yt[0]; |
| 89 | else return yt[t-1]; |
| 90 | } |
| 91 | |
| 92 | //poisce, katere tocke bo uporabil |
| 93 | m=0; while (x>xt[m++]); |
| 94 | m=m-4/2-1; if (m<0) m=0; if ((m+4)>(t-1)) m=t-4; |
| 95 | |
| 96 | for (i=0;i<4;i++) |
| 97 | p[i]=yt[i+m]; |
| 98 | |
| 99 | for (j=1;j<4;j++) |
| 100 | for (i=(4-1);i>=j;i--) |
| 101 | { |
| 102 | // Check for division by zero |
| 103 | float denominator = xt[i+m]-xt[i-j+m]; |
| 104 | if (denominator == 0.0f) { |
| 105 | // If denominator is zero, skip this iteration to avoid undefined behavior |
| 106 | continue; |
| 107 | } |
| 108 | p[i]=p[i]+(x-xt[i+m])/denominator*(p[i]-p[i-1]); |
| 109 | } |
| 110 | return p[4-1]; |
| 111 | } |
| 112 | |
| 113 | |
| 114 | //----------------------------------------------------- |
| 115 | //stretch [0...1] to parameter range [min...max] linear |
| 116 | float map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(double v, float min, float max) |
| 117 | { |
| 118 | return min+(max-min)*v; |
| 119 | } |
| 120 | |
| 121 | //----------------------------------------------------- |
| 122 | //collapse from parameter range [min...max] to [0...1] linear |
| 123 | double map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(float v, float min, float max) |
| 124 | { |
| 125 | return (v-min)/(max-min); |
| 126 | } |
| 127 | |
| 128 | //----------------------------------------------------- |
| 129 | //stretch [0...1] to parameter range [min...max] logarithmic |
| 130 | //min and max must be positive! |
| 131 | float map_value_forward_logcxx . . $ map_value_forward_log(1935fda23fc189b2).(double v, float min, float max) |
| 132 | { |
| 133 | float sr,k; |
| 134 | |
| 135 | sr=sqrtf(min*max); |
| 136 | k=2.0*log(max/sr); |
| 137 | return sr*expf(k*(v-0.5)); |
| 138 | } |
| 139 | |
| 140 | //----------------------------------------------------- |
| 141 | //collapse from parameter range [min...max] to [0...1] logarithmic |
| 142 | //min and max must be positive! |
| 143 | double map_value_backward_logcxx . . $ map_value_backward_log(937b104db0ceee62).(float v, float min, float max) |
| 144 | { |
| 145 | float sr,k; |
| 146 | |
| 147 | sr=sqrtf(min*max); |
| 148 | k=2.0*log(max/sr); |
| 149 | return logf(v/sr)/k+0.5; |
| 150 | } |
| 151 | |
| 152 | //*********************************************** |
| 153 | // OBVEZNE FREI0R FUNKCIJE |
| 154 | |
| 155 | //----------------------------------------------- |
| 156 | int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).() |
| 157 | { |
| 158 | return 1; |
| 159 | } |
| 160 | |
| 161 | //------------------------------------------------ |
| 162 | void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).() |
| 163 | { |
| 164 | } |
| 165 | |
| 166 | //----------------------------------------------- |
| 167 | void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* info) |
| 168 | { |
| 169 | |
| 170 | info->namecxx . . $ f0r_plugin_info#name.="IIR blur"; |
| 171 | info->authorcxx . . $ f0r_plugin_info#author.="Marko Cebokli"; |
| 172 | info->plugin_typecxx . . $ f0r_plugin_info#plugin_type.=F0R_PLUGIN_TYPE_FILTERcxx . . $ `include/frei0r.h:247:9`!; |
| 173 | info->color_modelcxx . . $ f0r_plugin_info#color_model.=F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!; |
| 174 | info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version.=FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!; |
| 175 | info->major_versioncxx . . $ f0r_plugin_info#major_version.=0; |
| 176 | info->minor_versioncxx . . $ f0r_plugin_info#minor_version.=2; |
| 177 | info->num_paramscxx . . $ f0r_plugin_info#num_params.=3; |
| 178 | info->explanationcxx . . $ f0r_plugin_info#explanation.="Three types of fast IIR blurring"; |
| 179 | } |
| 180 | |
| 181 | //-------------------------------------------------- |
| 182 | void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index) |
| 183 | { |
| 184 | switch(param_index) |
| 185 | { |
| 186 | case 0: |
| 187 | info->namecxx . . $ f0r_param_info#name. = "Amount"; |
| 188 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 189 | info->explanationcxx . . $ f0r_param_info#explanation. = "Amount of blur"; |
| 190 | break; |
| 191 | case 1: |
| 192 | info->namecxx . . $ f0r_param_info#name. = "Type"; |
| 193 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!; |
| 194 | info->explanationcxx . . $ f0r_param_info#explanation. = "Blur type"; |
| 195 | break; |
| 196 | case 2: |
| 197 | info->namecxx . . $ f0r_param_info#name. = "Edge"; |
| 198 | info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!; |
| 199 | info->explanationcxx . . $ f0r_param_info#explanation. = "Edge compensation"; |
| 200 | break; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | //---------------------------------------------- |
| 205 | f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height) |
| 206 | { |
| 207 | instcxx . . $ inst# *in; |
| 208 | |
| 209 | in=calloccxx . . $ calloc(63a7bf2941bfcd7a).(1,sizeof(instcxx . . $ inst#)); |
| 210 | in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w.=width; |
| 211 | in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h.=height; |
| 212 | |
| 213 | in->imgcxx . . $ $anonymous_type_79a4f372fae6bff1_1#img.=calloccxx . . $ calloc(63a7bf2941bfcd7a).(width*height*4,sizeof(float)); |
| 214 | |
| 215 | in->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.=map_value_forward_logcxx . . $ map_value_forward_log(1935fda23fc189b2).(0.2, 0.5, 100.0); |
| 216 | in->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1.=-0.796093; in->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.=0.186308; |
| 217 | in->tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty.=1; |
| 218 | in->eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec.=1; |
| 219 | |
| 220 | return (f0r_instance_tcxx . . $ f0r_instance_t#)in; |
| 221 | } |
| 222 | |
| 223 | //--------------------------------------------------- |
| 224 | void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance) |
| 225 | { |
| 226 | instcxx . . $ inst# *in; |
| 227 | |
| 228 | in=(instcxx . . $ inst#*)instance; |
| 229 | |
| 230 | freecxx . . $ free(5d22bdacc48458e8).(in->imgcxx . . $ $anonymous_type_79a4f372fae6bff1_1#img.); |
| 231 | |
| 232 | freecxx . . $ free(5d22bdacc48458e8).(instance); |
| 233 | } |
| 234 | |
| 235 | //----------------------------------------------------- |
| 236 | void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# parm, int param_index) |
| 237 | { |
| 238 | instcxx . . $ inst# *p; |
| 239 | double tmpf; |
| 240 | int chg,tmpi; |
| 241 | float a0,b0,b1,b2,f,q,s; |
| 242 | |
| 243 | float am1[]={0.499999,0.7,1.0,1.5,2.0,3.0,4.0,5.0,7.0,10.0, |
| 244 | 15.0,20.0,30.0,40.0,50.0,70.0,100.0,150.0,200.00001}; |
| 245 | //float iir2f[]={0.448,0.4,0.31,0.25,0.21,0.15,0.1,0.075, |
| 246 | // 0.055,0.039,0.026,0.02,0.013,0.01,0.008,0.006, |
| 247 | // 0.0042,0.0029,0.00205}; |
| 248 | //float iir2q[]={0.53,0.53,0.54,0.54,0.54,0.55,0.6,0.7,0.7, |
| 249 | // 0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7}; |
| 250 | float iir2q[]={0.53,0.53,0.54,0.54,0.54,0.55,0.6,0.6,0.6, |
| 251 | 0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6}; |
| 252 | //float iir1a1[]={0.167,0.3,0.5,0.65,0.7,0.8,0.88,0.92,0.95, |
| 253 | // 0.96,0.97,0.98,0.985,0.988,0.99,0.992,0.993,0.9955, |
| 254 | // 0.997}; |
| 255 | |
| 256 | float iir1a1[]={0.138,0.24,0.34,0.45,0.55, 0.65,0.728,0.775,0.834,0.88, |
| 257 | 0.92,0.937,0.958,0.968,0.9745, |
| 258 | 0.98,0.986,0.991,0.9931}; //po sigmi |
| 259 | |
| 260 | float iir2f[]={0.475,0.39,0.325,0.26,0.21, |
| 261 | 0.155,0.112,0.0905,0.065,0.0458, |
| 262 | 0.031,0.0234,0.01575,0.0118,0.0093, |
| 263 | 0.00725,0.00505,0.0033,0.0025}; //po sigmi |
| 264 | |
| 265 | float iir3si[]={0.5,0.7,1.0,1.5,2.0, |
| 266 | 3.0,4.0,5.0,7.0,10.0, |
| 267 | 15.0,20.0,30.0,40.0,50.0, |
| 268 | 70.0,100.0,150.0,186.5}; |
| 269 | |
| 270 | |
| 271 | p=(instcxx . . $ inst#*)instance; |
| 272 | |
| 273 | chg=0; |
| 274 | switch(param_index) |
| 275 | { |
| 276 | case 0: |
| 277 | // tmpf=map_value_forward(*((double*)parm), 0.5, 100.0); |
| 278 | if (*((double*)parm) == 0.0) |
| 279 | tmpf = 0.0; |
| 280 | else |
| 281 | tmpf=map_value_forward_logcxx . . $ map_value_forward_log(1935fda23fc189b2).(*((double*)parm), 0.5, 100.0); |
| 282 | if (tmpf!=p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.) chg=1; |
| 283 | p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.=tmpf; |
| 284 | break; |
| 285 | case 1: |
| 286 | tmpf=*((double*)parm); |
| 287 | if (tmpf>=1.0) |
| 288 | tmpi=(int)tmpf; |
| 289 | else |
| 290 | tmpi = map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(tmpf, 0.0, 2.9999); |
| 291 | if ((tmpi<0)||(tmpi>2.0)) break; |
| 292 | if (p->tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty. != tmpi) chg=1; |
| 293 | p->tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty. = tmpi; |
| 294 | break; |
| 295 | case 2: |
| 296 | p->eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec.=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 1.0); //BOOL!! |
| 297 | break; |
| 298 | } |
| 299 | |
| 300 | if (chg==0) return; |
| 301 | |
| 302 | switch(p->tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty.) |
| 303 | { |
| 304 | case 0: //FIBE-1 |
| 305 | p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1.=AitNev3cxx . . $ AitNev3(5cdedbd8584a0728).(19, am1, iir1a1, p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.); |
| 306 | //printf("Set parm FIBE-1 a1=%f (p->am=%f)\n",p->a1,p->am); |
| 307 | break; |
| 308 | case 1: //FIBE-2 |
| 309 | f=AitNev3cxx . . $ AitNev3(5cdedbd8584a0728).(19, am1, iir2f, p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.); |
| 310 | q=AitNev3cxx . . $ AitNev3(5cdedbd8584a0728).(19, am1, iir2q, p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.); |
| 311 | calcab_lp1cxx . . $ calcab_lp1(8eec0be52e052c06).(f, q, &a0, &p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., &p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2., &b0, &b1, &b2); |
| 312 | p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1.=p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1./a0; p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.=p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2./a0; |
| 313 | repcxx . . $ rep(f94144c4c5388e).(-0.5, 0.5, 0.0, &p->rd1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rd1., &p->rd2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rd2., 256, p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.); |
| 314 | repcxx . . $ rep(f94144c4c5388e).(1.0, 1.0, 0.0, &p->rs1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rs1., &p->rs2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rs2., 256, p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.); |
| 315 | repcxx . . $ rep(f94144c4c5388e).(0.0, 0.0, 1.0, &p->rc1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rc1., &p->rc2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rc2., 256, p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.); |
| 316 | //printf("Set parm FIBE-2 a1=%f a2=%f\n",p->a1,p->a2); |
| 317 | break; |
| 318 | case 2: //FIBE-3 |
| 319 | s=AitNev3cxx . . $ AitNev3(5cdedbd8584a0728).(19, am1, iir3si, p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.); |
| 320 | young_vlietcxx . . $ young_vliet(f4c01bc3138684f3).(s, &a0, &p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., &p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2., &p->a3cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a3.); |
| 321 | p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1.=-p->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1./a0; |
| 322 | p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2.=-p->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2./a0; |
| 323 | p->a3cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a3.=-p->a3cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a3./a0; |
| 324 | //printf("Set parm FIBE-3 a1=%f a2=%f a3=%f\n",p->a1,p->a2,p->a3); |
| 325 | break; |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | //-------------------------------------------------- |
| 330 | 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) |
| 331 | { |
| 332 | instcxx . . $ inst# *p; |
| 333 | |
| 334 | p=(instcxx . . $ inst#*)instance; |
| 335 | |
| 336 | switch(param_index) |
| 337 | { |
| 338 | case 0: |
| 339 | // *((double*)param)=map_value_backward(p->am, 0.5, 100.0); |
| 340 | *((double*)param)=map_value_backward_logcxx . . $ map_value_backward_log(937b104db0ceee62).(p->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am., 0.5, 100.0); |
| 341 | break; |
| 342 | case 1: |
| 343 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty., 0.0, 2.9999); |
| 344 | break; |
| 345 | case 2: |
| 346 | *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec., 0.0, 1.0);//BOOL!! |
| 347 | break; |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | //------------------------------------------------- |
| 352 | 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) |
| 353 | { |
| 354 | instcxx . . $ inst# *in; |
| 355 | int i; |
| 356 | |
| 357 | assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance); |
| 358 | in=(instcxx . . $ inst#*)instance; |
| 359 | |
| 360 | if (in->amcxx . . $ $anonymous_type_79a4f372fae6bff1_1#am.==0.0) //zero blur, just copy and return |
| 361 | { |
| 362 | memcpycxx . . $ memcpy(cc817cb175f282d).(outframe, inframe, in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w. * in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h. * sizeof(uint32_tcxx . . $ uint32_t#)); |
| 363 | return; |
| 364 | } |
| 365 | //do the blur |
| 366 | switch(in->tycxx . . $ $anonymous_type_79a4f372fae6bff1_1#ty.) |
| 367 | { |
| 368 | case 0: |
| 369 | fibe1o_8cxx . . $ fibe1o_8(593b41a5a9743042).(inframe, outframe, in->imgcxx . . $ $anonymous_type_79a4f372fae6bff1_1#img., in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w., in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h., in->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., in->eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec.); |
| 370 | break; |
| 371 | case 1: |
| 372 | fibe2o_8cxx . . $ fibe2o_8(ceb27944aa6c51fc).(inframe, outframe, in->imgcxx . . $ $anonymous_type_79a4f372fae6bff1_1#img., in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w., in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h., in->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., in->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2., in->rd1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rd1., in->rd2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rd2., in->rs1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rs1., in->rs2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rs2., in->rc1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rc1., in->rc2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#rc2., in->eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec.); |
| 373 | break; |
| 374 | case 2: |
| 375 | fibe3_8cxx . . $ fibe3_8(e63b6d5c2cff5ded).(inframe, outframe, in->imgcxx . . $ $anonymous_type_79a4f372fae6bff1_1#img., in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w., in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h., in->a1cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a1., in->a2cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a2., in->a3cxx . . $ $anonymous_type_79a4f372fae6bff1_1#a3., in->eccxx . . $ $anonymous_type_79a4f372fae6bff1_1#ec.); |
| 376 | // The bottom 3 lines were not updated, and outframe may be initialized with garbage. |
| 377 | // Copy the 4th line from the bottom to the bottom 3 lines. |
| 378 | for (i = 0; i < 3; i++) |
| 379 | memcpycxx . . $ memcpy(cc817cb175f282d).(&outframe[in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w. * (in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h. - 3 + i)], &outframe[in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w. * (in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h. - 4)], in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w. * 4); |
| 380 | break; |
| 381 | } |
| 382 | //copy alpha |
| 383 | for (i=0;i<in->wcxx . . $ $anonymous_type_79a4f372fae6bff1_1#w.*in->hcxx . . $ $anonymous_type_79a4f372fae6bff1_1#h.;i++) |
| 384 | { |
| 385 | outframe[i]=(outframe[i]&0x00FFFFFF) | (inframe[i]&0xFF000000); |
| 386 | } |
| 387 | } |