rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt
[goodguy/history.git] / cinelerra-5.1 / cinelerra / overlaysample.C
index 490715951c60f537663bf563bde3e8d9c66d8b16..a4b485d7dfa77768a7f8249a535e9ac5f598c79e 100644 (file)
                                float racc=0.f, gacc=0.f, bacc=0.f, aacc=0.f; \
                                int ki = lookup_sk[j], x = lookup_sx0[j]; \
                                type *ip = input + x * components; \
-                               float wacc = 0, awacc = 0; \
-                               while(x++ < lookup_sx1[j]) { \
+                               while(x < lookup_sx1[j]) { \
                                        float kv = k[abs(ki >> INDEX_FRACTION)]; \
                                        /* handle fractional pixels on edges of input */ \
                                        if(x == i1i) kv *= i1f; \
-                                       if(x + 1 == i2i) kv *= i2f; \
-                                       if( components == 4 ) { awacc += kv;  kv *= ip[3]; } \
-                                       wacc += kv; \
+                                       if(++x == i2i) kv *= i2f; \
                                        racc += kv * *ip++; \
                                        gacc += kv * (*ip++ - ofs); \
                                        bacc += kv * (*ip++ - ofs); \
-                                       if( components == 4 ) { aacc += kv;  ++ip; } \
+                                       if( components == 4 ) { aacc += kv * *ip++; } \
                                        ki += kd; \
                                } \
-                               if(wacc > 0.) wacc = 1. / wacc; \
+                               float wacc = lookup_wacc[j]; \
                                *tempp++ = racc * wacc; \
                                *tempp++ = gacc * wacc; \
                                *tempp++ = bacc * wacc; \
-                               if( components == 4 ) { \
-                                       if(awacc > 0.) awacc = 1. / awacc; \
-                                       *tempp++ = aacc * awacc; \
-                               } \
+                               if( components == 4 ) { *tempp++ = aacc * wacc; } \
                        } \
                } \
  \
@@ -147,7 +141,7 @@ void SampleUnit::process_package(LoadPackage *package)
        int *lookup_sx0 = engine->lookup_sx0;
        int *lookup_sx1 = engine->lookup_sx1;
        int *lookup_sk = engine->lookup_sk;
-       //float *lookup_wacc = engine->lookup_wacc;
+       float *lookup_wacc = engine->lookup_wacc;
 
        BLEND_SWITCH(XBLEND_SAMPLE);
 }
@@ -243,12 +237,8 @@ void SampleEngine::init_packages()
                                 * the contribution of the first and last input pixel (if
                                 * fractional) are linearly weighted by the fraction
                                 */
-                               if(j == i1i)
-                                       wacc += k[abs(kv)] * i1f;
-                               else if(j + 1 == i2i)
-                                       wacc += k[abs(kv)] * i2f;
-                               else
-                                       wacc += k[abs(kv)];
+                               float fk = k[abs(kv)];
+                               wacc += j == i1i ? fk * i1f : j+1 == i2i ? fk * i2f : fk;
 
                                /* this is where we clip the kernel convolution to the source plane */
                                if(j >= 0 && j < iw) {