performance questions

  • Thread starter Thread starter Jeroen CEuppens
  • Start date Start date
J

Jeroen CEuppens

Hi,

I need to make conclusions for a thesis.

I work with WinCE .NET 4.2 and write the program in C# with a Advantech
board wit 64MBRAM and 300Mhz

The calculations for image processing seems to be very poor

here code that takes about 2500 millisenconds
output=new double[H,W];

double[,] doublepixeldata=new doublepixeldata[320,480];

//code to fill doublepixeldata





double [,] filter=new double[FR,FK]; //FR= filter rij FK = filter kolom

//[320,480];

double term=Convert.ToDouble(this.Parameter[4].SName);

//double term=(double)0.04;


for (int i=0;i<FR;i++)

{

for(int j=0;j<FK;j++)

{

filter[i,j]=filterdata[i*FR+j];

}

}

double NewVal;

int a,b,c,r;

int r0,r1,c0,c1;

for(r=FK/2;r<H-FK/2;r++)

{

r0=r-FK/2;

r1=r0+FK;

for(c=FR/2;c<W-FR/2;c++)

{

c0=c-FR/2;

c1=c0+FR;

NewVal = 0;

for(a=r0;a<r1;a++)

{

for(b=c0;b<c1;b++)

NewVal+=doublepixeldata[a,b] *
filter[b-c0,a-r0];//NewVal+=input[b,a] * filter[b-c0,a-r0];

}

output[r,c]=NewVal;//output[r,c]=Math.Abs(NewVal);

}

}

}


Other question, what about the graphics performance, is it possible to view
smooth video with the standard drivers?


Greetz Jeroen
 
Some general observations on the performance of the code below:

1) Most embedded devices have fairly poor floating-point performance
because they lack an FPU. If your application has the flexibility, a
fixed-point algorithm based on 32-bit ints would give the best performance.

2) Multi-dimensional arrays are not the most efficient construct in the
Compact Framework. Since your code belows relies quite heavily on array
accesses, you could probably get a noticeable performance improvement by
using a one-dimensional array and only logically dividing it into rows and
columns afterwards. An array of arrays (double[][]) would also have better
performance than a multi-dimensional array (double[,]) in most
circumstances, though perhaps not as good as a one-dimensional array.

--------------------
From: "Jeroen CEuppens" <[email protected]>
Subject: performance questions
Date: Thu, 22 Apr 2004 13:27:47 +0100

Hi,

I need to make conclusions for a thesis.

I work with WinCE .NET 4.2 and write the program in C# with a Advantech
board wit 64MBRAM and 300Mhz

The calculations for image processing seems to be very poor

here code that takes about 2500 millisenconds
output=new double[H,W];

double[,] doublepixeldata=new doublepixeldata[320,480];

//code to fill doublepixeldata





double [,] filter=new double[FR,FK]; //FR= filter rij FK = filter kolom

//[320,480];

double term=Convert.ToDouble(this.Parameter[4].SName);

//double term=(double)0.04;


for (int i=0;i<FR;i++)

{

for(int j=0;j<FK;j++)

{

filter[i,j]=filterdata[i*FR+j];

}

}

double NewVal;

int a,b,c,r;

int r0,r1,c0,c1;

for(r=FK/2;r<H-FK/2;r++)

{

r0=r-FK/2;

r1=r0+FK;

for(c=FR/2;c<W-FR/2;c++)

{

c0=c-FR/2;

c1=c0+FR;

NewVal = 0;

for(a=r0;a<r1;a++)

{

for(b=c0;b<c1;b++)

NewVal+=doublepixeldata[a,b] *
filter[b-c0,a-r0];//NewVal+=input[b,a] * filter[b-c0,a-r0];

}

output[r,c]=NewVal;//output[r,c]=Math.Abs(NewVal);

}

}

}


Other question, what about the graphics performance, is it possible to view
smooth video with the standard drivers?


Greetz Jeroen

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top