Ran Yakir (rany++at++amcor.bvr.co.il)
Wed, 10 May 1995 09:25:38 +0000
I'm afraid that doing image processing with the host CPU, will get you nowhere.
As you said, only the lrectread() and lrectwrite() is bad enough. That is,
ofcourse, for a resolution of 640 X 480. If you are willing to render the image
at a lower resolution when the defocus is on, you might be able to do this.
Using the convolve() function of the RE will have better results. I've tried
bluring an OTW image with convolve() and those are the results :
kernel size resolution time (milisec)
----------- ---------- ----
3X3 seperable 640X480 10
5X5 seperable 640X480 12
7X7 seperable 640X480 15
If your application is drawing the scene in less than 15 milisec, you might
have 30 Hz with 7X7 convlution.
Note that I've used the CV_SEPERABLE convolution which is less accurate, but
faster. I can measure the CV_GENERAL convolution if you like.
A substantial performance gain is achieved by using 8 bit pixel operations
instead of 24 bit. This is possible in your case since you use monochrome
image.
The following code does the job :
...
static float kernel3[] =
{
1/6, 1/6, 1/6,
1/6, 1/6, 1/6
};
static float kernel5[] =
{
1/10, 1/10, 1/10, 1/10, 1/10,
1/10, 1/10, 1/10, 1/10, 1/10
};
static float kernel7[] =
{
1/14, 1/14, 1/14, 1/14, 1/14, 1/14, 1/14,
1/14, 1/14, 1/14, 1/14, 1/14, 1/14, 1/14
};
float *kernel;
/*
* select the appropriate kernel
*/
switch (shared->blur_kernel_size)
{
case 3 :
kernel = kernel3;
break;
case 5 :
kernel = kernel3;
break;
case 7 :
kernel = kernel3;
break;
default :
return;
}
/*
* set up the convolution params
*/
convolve (CV_SEPARABLE, CV_REDUCE,
shared->blur_kernel_size, shared->blur_kernel_size, kernel,
0.0f);
/*
* set up pixel op. mode to monochrome (input - I, output - RGB)
*/
pixmode (PM_SIZE, 8);
pixmode (PM_INPUT_TYPE, PM_UNSIGNED_BYTE);
pixmode (PM_INPUT_FORMAT, PM_LUMINANCE);
pixmode (PM_OUTPUT_FORMAT, PM_BGR);
/*
* copy the original image to another part of the screen
*/
rectcopy (mx0, my0, mx1, my1, to_x, to_y);
/*
* restore everithing to normal
*/
pixmode (PM_SIZE, 32);
pixmode (PM_INPUT_FORMAT, PM_ABGR);
pixmode (PM_OUTPUT_FORMAT, PM_ABGR);
convolve (CV_OFF, CV_REDUCE, 3, 3, kernel, 0.0f);
}
As for the accumulation buffer, anything you do with it requires multiple
rendering. You can have realtime performance only if you scene is drawn _very_
fast.
Regards,
Ran
--
__ | Ran Yakir
/_) _ __ \ / _ / o __ | Graphics App. Chief Engineer
/ )_ (_(_) ) \/ (_(_/<_(_)( | BVR Technologies Ltd.
_/ |
-------------------------------------+--------------------------------
Phone : | E-mail : rany++at++bvr.co.il
Work : 972-3-5715671 |
Res. : 972-9-989974 |
Fax : 972-3-5715668 |
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:29 PDT