remove / from shift drop filter, corrent alpha calculation in overlaysample
authorGood Guy <good1.2guy@gmail.com>
Mon, 17 Sep 2018 19:57:28 +0000 (13:57 -0600)
committerGood Guy <good1.2guy@gmail.com>
Mon, 17 Sep 2018 19:57:28 +0000 (13:57 -0600)
cinelerra-5.1/cinelerra/binfolder.C
cinelerra-5.1/cinelerra/overlaysample.C

index ffe5a12f9484548a3a2aabcfab901e3236f0dde9..b5d4b9f8147d003c9c4dec8ecce7a0c09453fd8a 100644 (file)
@@ -354,7 +354,7 @@ int BinFolder::add_patterns(ArrayList<Indexable*> *drag_idxbls, int use_basename
                if( use_basename && idxbl->is_asset ) {
                        const char *cp = strrchr(tp, '/');
                        if( cp ) tp = cp + 1;
-                       len += 2;  // "*/" + fn
+                       len += 1;  // "*" + fn
                }
                len += strlen(tp) + 1;
        }
@@ -370,7 +370,7 @@ int BinFolder::add_patterns(ArrayList<Indexable*> *drag_idxbls, int use_basename
                if( use_basename && idxbl->is_asset ) {
                        const char *cp = strrchr(tp, '/');
                        if( cp ) tp = cp + 1;
-                       *bp++ = '*';  *bp++ = '/';
+                       *bp++ = '*';
                }
                while( *tp ) *bp++ = *tp++;
        }
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) {