**comp.graphics.algorithms**

## Subject: **Re: 2D convolution performance expectation**

François wrote:

> Dear all,

>

>

> I just begin to implment a 2d spatial convolution of an image with 7*7

> float kernel using C++.

> I was wondering what kind of performance I should expect when processing

> 1000*1000 images

>

> For the moment, in release mode, it takes around 1.5sec for the whole

> process. Does it sound ok or some optimization still have to be taken?

>

> thanks in advance

>

>

> François

Why are you using floating point ?

You also did not say wether the image is color or Grayscale

the usual manner for a kernel convolution is to use integers

For Instance with a 7 x 7 kernel there would 49 Multiplies and additions

and 1 divide for nearly every point in the 1000 x 1000 image array

If you neglect the edges then the image convolution takes place over

951 x 951

this is 43277 multiples and adds

On a modern Pentium 4 with 4 MB LII cache this can all take place in the

cache for a grayscale image which can take 2 cycles for each multiply

and 1 cycle for each add and I think it is 10 cycles for a divide

which works out to 692432 clock cycles which on a 2 GHz machine should

only take about 339 Milliseconds for color the math is very similar

Reply

View All Messages in

**comp.graphics.algorithms**

path:

2D convolution performance expectation =>

Replies:

Re: 2D convolution performance expectation

Copyright © 2006 WatermarkFactory.com. All Rights Reserved.