1

I am a bit of a newbie to Java (prior experience with C on embedded platforms), so please forgive me if this question is very trivial.

I need to implement some signal processing algorithms in Java. I know Java is probably not the best language to do this [1], but the Java requirement has come in primarily because the rest of my team is not comfortable with C at all.

What we need to do at a high level is to read some files containing video frames, process them (gather some statistics about them) and then write them back to disk. The processing will involve reading in a few kB of data and parsing them somehow, possibly with some kind of transforms. i.e. I expect we will need to do a lot of byte-addressed random memory accesses. And I'll need to do about 30 frames per second and a few tens of thousands of such operations every frame (so possibly 100s of 1000s of ops per second)

I do not know the 'internals' of Java very well, but from what I read I believe the memory that Java sees is far abstracted from the actual virtual memory that the OS itself provides [2].

What buffer management libraries should I use so that I can get the best possible performance? I've seen a few (NIO [3], Java 2d [4], etc) but I am not able to find which is faster, or if there are any other options that I am missing. Do you guys have any suggestions or pointers [5] for me?

I will also be doing lots of arithmetic, so are there any libraries that do 'faster' arithmetic? I come from a world where I could accelerate almost everything on the hardware but now I need to run this on a PC so I am not sure if there are any such options available.

Any other suggestions or help you guys could provide will be much appreciated!

Community
  • 1
  • 1
hide0
  • 394
  • 1
  • 2
  • 13
  • 3
    The thing is, most signal processing in Java will look almost identical to C, because it will almost inevitably be implemented in a procedural style. I don't know why your coworkers would be so scared of this. Take away objects and Java starts to look a lot like C. – Mark Peters Nov 03 '11 at 04:05
  • [2] This is correct. The JVM maintains its own memory and has some quite high performance garbage collection algorithms. It also does a lot of dynamic optimisation, so I would recommend writing up your algorithm and profiling it to evaluate your performance bottlenecks. –  Nov 03 '11 at 04:39
  • @MarkPeters yes, that is true - I guess it's more inertia than anything else. – hide0 Nov 03 '11 at 16:21
  • I found a link that explains some bits of NIO in greater detail - I thought it might help : http://www.cs.brown.edu/courses/cs161/papers/j-nio-ltr.pdf – hide0 Nov 03 '11 at 18:35
  • To be completely fair, if your group, as a whole, is not comfortable with the C programming language, then what business does the group have implementing signal processing algorithms? It would be worth it for the group to learn C while developing this project. – Zéychin Nov 03 '11 at 18:43

1 Answers1

0

I hope following link might helpful to you

Community
  • 1
  • 1
Jitendra Vispute
  • 709
  • 8
  • 18
  • OK, most of these links seem to indicate that the MappedByteBuffer from NIO is the way to go, so I guess I'll give that a try. – hide0 Nov 03 '11 at 16:20