E
E. Naubauer
Hello everybody
I want to manipulate an image which is stored as an int array.
The array is as big as the image , 704 * 576 elements.
What I need to do is to read the data from the input array,
do some integer arithmetic and write it to an output array
from the same size.
it looks somewhat like this:
int input[];
int output[];
......
int temp;
for(int i = 0;i < array.length;i++)
{
temp = input;
<do some integer arithmetic with temp and write it to output>
output = temp;
}
However, this small loop causes running times from about ~80 ms.
Since I need to do more operations to the image before drawing and
the images need to be processed in real-time (10 frames per second)
this is a little slow for my purposes.
For testing I removed the last line and the processing time went down.
Then I used the new for-loop from Java 1.5 spec.
for(int i : array)
{
temp = i;
<do some integer arithmetic with temp and write it to output>
}
and again I got a speed boost.
I think this is due to optimized array access in the native
implementation (less bounds checking etc. ).
Does anyone have an idea of methods or new language constructs for
accessing array elements very fast?
Thanks in advance
I want to manipulate an image which is stored as an int array.
The array is as big as the image , 704 * 576 elements.
What I need to do is to read the data from the input array,
do some integer arithmetic and write it to an output array
from the same size.
it looks somewhat like this:
int input[];
int output[];
......
int temp;
for(int i = 0;i < array.length;i++)
{
temp = input;
<do some integer arithmetic with temp and write it to output>
output = temp;
}
However, this small loop causes running times from about ~80 ms.
Since I need to do more operations to the image before drawing and
the images need to be processed in real-time (10 frames per second)
this is a little slow for my purposes.
For testing I removed the last line and the processing time went down.
Then I used the new for-loop from Java 1.5 spec.
for(int i : array)
{
temp = i;
<do some integer arithmetic with temp and write it to output>
}
and again I got a speed boost.
I think this is due to optimized array access in the native
implementation (less bounds checking etc. ).
Does anyone have an idea of methods or new language constructs for
accessing array elements very fast?
Thanks in advance