Rev 335 | Rev 500 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 335 | Rev 343 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | } |
53 | } |
54 | } |
54 | } |
55 | 55 | ||
56 | // full setup for evaluation, called when formulae have changed. |
56 | // full setup for evaluation, called when formulae have changed. |
57 | Boolean setup(FilterRecordPtr pb){ |
57 | Boolean setup(FilterRecordPtr pb){ |
- | 58 | int srcrad; |
|
58 | int i; |
59 | int i; |
59 | 60 | ||
60 | // Attention: If you introduce new variables, please define them also in lexer.l |
61 | // Attention: If you introduce new variables, please define them also in lexer.l |
61 | if (HAS_BIG_DOC(pb)) { |
62 | if (HAS_BIG_DOC(pb)) { |
62 | var['X'] = BIGDOC_FILTER_RECT(pb).right - BIGDOC_FILTER_RECT(pb).left; |
63 | var['X'] = BIGDOC_FILTER_RECT(pb).right - BIGDOC_FILTER_RECT(pb).left; |
Line 75... | Line 76... | ||
75 | var['V'] = val_V; |
76 | var['V'] = val_V; |
76 | 77 | ||
77 | /* initialise flags for tracking special variable usage */ |
78 | /* initialise flags for tracking special variable usage */ |
78 | for(i = 0; i < 0x100; i++) |
79 | for(i = 0; i < 0x100; i++) |
79 | varused[i] = 0; |
80 | varused[i] = 0; |
80 | needall = cnvused = state_changing_funcs_used = 0; |
81 | needall = srcrad = cnvused = state_changing_funcs_used = 0; |
81 | for(i = 0; i < nplanes; ++i){ |
82 | for(i = 0; i < nplanes; ++i){ |
82 | //char s[100];sprintf(s,"expr[%d]=%#x",i,expr[i]);dbg(s); |
83 | //char s[100];sprintf(s,"expr[%d]=%#x",i,expr[i]);dbg(s); |
83 | if( tree[i] || (tree[i] = parseexpr(expr[i])) ) |
84 | if( tree[i] || (tree[i] = parseexpr(expr[i])) ) |
84 | // if src() and rad() is used => needall=1, since we need arbitary access to all pixels |
85 | // if src() and rad() is used => needall=1, since we need arbitary access to all pixels |
85 | checkvars(tree[i],varused,&cnvused,/*srcrad=*/&needall,&state_changing_funcs_used); |
86 | checkvars(tree[i],varused,&cnvused,&srcrad,&state_changing_funcs_used); |
86 | else |
87 | else |
87 | break; |
88 | break; |
88 | } |
89 | } |
- | 90 | needall = srcrad; |
|
89 | needinput = ( cnvused || needall |
91 | needinput = ( cnvused || needall |
90 | || varused['r'] || varused['g'] || varused['b'] || varused['a'] |
92 | || varused['r'] || varused['g'] || varused['b'] || varused['a'] |
91 | || varused['i'] || varused['u'] || varused['v'] || varused['c'] ); |
93 | || varused['i'] || varused['u'] || varused['v'] || varused['c'] ); |
92 | 94 | ||
93 | /* |
95 | /* |
Line 102... | Line 104... | ||
102 | 104 | ||
103 | // If we want accurate rnd(a,b) results (i.e. FilterFoundry and FilterFactory output |
105 | // If we want accurate rnd(a,b) results (i.e. FilterFoundry and FilterFactory output |
104 | // exactly the same picture), we must not use chunked processing. |
106 | // exactly the same picture), we must not use chunked processing. |
105 | if (state_changing_funcs_used) needall = true; |
107 | if (state_changing_funcs_used) needall = true; |
106 | 108 | ||
- | 109 | // DM 09 Sep 2021: Added, because otherwise, some filters are very, very, very slow! |
|
- | 110 | // e.g. BlowOut by Greg Schorno: |
|
- | 111 | // R = put(sin(d*ctl(0)/4+ctl(2)*4)/(val(1,256,16)*256/M),0),src(x+get(0),y+get(0),z) |
|
- | 112 | // G = src(x+get(0),y+get(0),z) |
|
- | 113 | // B = src(x+get(0),y+get(0),z) |
|
- | 114 | state_changing_funcs_used = 0; |
|
- | 115 | ||
107 | evalinit(); |
116 | evalinit(); |
108 | return i==nplanes; /* all required expressions parse OK */ |
117 | return i==nplanes; /* all required expressions parse OK */ |
109 | } |
118 | } |
110 | 119 | ||
111 | void evalpixel(unsigned char *outp,unsigned char *inp){ |
120 | void evalpixel(unsigned char *outp,unsigned char *inp){ |