View Single Post
Old 4th December 2008, 10:48   #59  |  Link
PeaceAnt
also known as GrassHoppeR
 
Join Date: Mar 2006
Location: Poland
Posts: 30
Quote:
Originally Posted by Didée
The interesting idea is to vary the radius on a per-pixel level, i.e. the control clip tells which radius to use for processing each pixel of the source clip.
Which is impossible to construct through a script, it requires plugin support.
Quote:
Originally Posted by Mug Funky
hmm... interesting. you feed it an alpha channel and it blurs according to it's brightness.
here's my plugin that averages number of pixels according to value of alpha channel with 1/16 pixel precision.
http://members.lycos.co.uk/grasshopper/dof/ <-example and files
http://members.lycos.co.uk/grasshopper/dof/ghrchb.dll <-GHRCompoundHBlur plugin
http://members.lycos.co.uk/grasshopp...poundHBlur.cpp <-source code

it works only in x-axis and needs some optimalization (or maybe ass and mmx code? ) but it WORKS!

what you think?

below is the main loop code. maybe someone has an issue how to improve its speed, blurring near the edge and so, that you can find it useful too. but first of all it must not crash! i'm not experienced cpp writer so please check my source code.

Code:
		for (i=0; i < (src_height-32); i++) {
			for (w=64; w<(src_width-64); w+=4) {

			v = *(srcp + w + 3);
			a = (v & 15);
			b = (v & 240)>>2;

			ub = a*(*(srcp + w - b - 4)+*(srcp + w + b + 4));
			ug = a*(*(srcp + w - b - 3)+*(srcp + w + b + 5));
			ur = a*(*(srcp + w - b - 2)+*(srcp + w + b + 6));

lb=lg=lr = 0;
for (j=-b; j<=b; j+=4){
lb+=*(srcp + w+j);
lg+=*(srcp + w+j+1);
lr+=*(srcp + w+j+2);
}
n = 16+v+v;
*(dstp + w) = (lb*16+ub)/n;
*(dstp + w+1) = (lg*16+ug)/n;
*(dstp + w+2) = (lr*16+ur)/n;
*(dstp + w+3) = v;
		}
srcp+=src_pitch;
dstp += dst_pitch;
	}
pozdrawiam
PeaceAnt is offline   Reply With Quote