X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Foverlaysample.C;h=a4b485d7dfa77768a7f8249a535e9ac5f598c79e;hb=163923953049a5be18026801eba4fcec8bc87c07;hp=490715951c60f537663bf563bde3e8d9c66d8b16;hpb=93d60cc0fdf746cc03b4d7a9e45744c2c424439b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/overlaysample.C b/cinelerra-5.1/cinelerra/overlaysample.C index 49071595..a4b485d7 100644 --- a/cinelerra-5.1/cinelerra/overlaysample.C +++ b/cinelerra-5.1/cinelerra/overlaysample.C @@ -26,28 +26,22 @@ 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) {