Re: Image Library effects through Performer calls

New Message Reply Date view Thread view Subject view Author view

Rob Jenkins (robj++at++barney.reading.sgi.com)
Wed, 20 Sep 1995 09:44:01 +0100


Timothy

There is a discussion on the subject of image processing effects in the monthly
archives. You can get the archives by anonymous ftp from:

sgigate.sgi.com:~ftp/Performer/monthly-archives

the attached posting from Ran Yakir is on the subject of convolve and is in
perf-95-05.

Cheers
Rob

-- 
________________________________________________________________
Rob Jenkins, Software Support Group, Silicon Graphics UK Ltd.       
1530 Arlington Business Park, Theale, Reading, UK, RG7 4SB. 
tel 01734 257736, fax 01734 257553, email robj++at++reading.sgi.com,

Kathy,

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               |

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:53 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.