an advanced signal processing toolkit for java applications

6 downloads 320499 Views 264KB Size Report
programming language for web-based applications. ... the problems of developing new applications as well as improving ... In this paper, an advanced signal.
AN ADVANCED SIGNAL PROCESSING TOOLKIT FOR JAVA APPLICATIONS V. P. Shah and N. H. Younan

T. Alford and A. skjellum

Department of Electrical and Computer Engineering Mississippi State University Mississippi State, MS 39762 1 (662) 325-3912

MPI Software Technolgy, Inc. 101 S. Lafayette St., Suite 33 Starkville, MS 39759 1 (662) 320-4300 [email protected], [email protected]

[email protected], [email protected]

ABSTRACT This paper examines the capability, performance, and relevance of a signal processing toolkit in Java, a programming language for Web-based applications. Due to the simplicity, ease and application use of the toolkit and with the advanced Internet technologies such as Remote Method Invocation (RMI), a spectral estimation applet has been created in the Java environment. This toolkit also provides an interactive and visual approach in understanding the various theoretical concepts of spectral estimation and shows the need to create more application applets to better understand the various concepts of signal and image processing.

Categories and Subject Descriptors D.1.3 [Concurrent Programming]: Distributed programming G.4 [Mathematical Software]: Algorithm design and analysis, Efficiency Reliability and robustness

General Terms Algorithms, Performance, Design, Standardization, Languages.

Keywords Java, Algorithms, VSIPL, Signal Processing.

1. INTRODUCTION The introduction of Java by Sun Microsystems has brought revolution into the computing world. Java is the most effective programming language for web-based applications. Java technology is not limited to the workstations and servers, but it also targets a wide range of platforms such as pagers, hand-held devices, cellular phones, screen phones, digital set-top boxes, and car navigation systems as well. Standard signal processing libraries, such as Vector Signal and Image processing library (VSIPL) in C [1], Signal Processing in C++ (SPUC) [2], IEEE DSP program (McMaster) in Fortran [3] are available. With these libraries, why should a toolkit be developed for Java? Although Java is considered to be relatively

slow for computational type applications, it has several advantages such as simplicity, object-oriented programming, portability, robustness, security, exception handling capability, Internet-application language, simplifying the multiprocessing tasks of a signal processing system using Remote Method Interface (RMI), and last but not least its usefulness in developing a teaching toolkit for signal processing applications. Current available packages in Java are customized, distinct, and do not allow an easy creation of specific new applications for signal processing [4]. Having a standard Java toolkit simplifies the problems of developing new applications as well as improving the current applications. In this paper, an advanced signal processing toolkit in the Java environment has been developed. This toolkit provides an interactive and visual approach in understanding the various theoretical concepts of spectral estimation and shows the need to create more application applets to better understand the various concepts of signal and image processing. A performance comparison of the Java package with other standard packages using other high-level languages is also made.

2. Java 2.1 Java Native Interface Java Layer Java Layer

C Layer

Exceptions Functions JNI

Classes

Libraries VM

Figure 1. JNI Layout The Java Native Interface (JNI) provides the standard interface to integrate native code (written using C, C++, or assembly) into a Java code [5]. JNI acts as the “glue” between native and Java applications. JNI saves the time of rewriting high performance applications that already exist in native language. Figure 1 shows the JNI layout. The native implementations are compiled into a dynamic link library (known shared objects (.so) in Solaris and dynamic link

libraries (.dll) in Win32). The operating system loads and links this library into the process that is running the Java Virtual Machine.

2.2 Remote Method Invocation Application

RMI System

Client

Server

Stubs

Skeletons

3.2 Data Manipulation in Library Sample, Block, and View are the base classes for storage and operation of the user data. Sample and its subclass provide the support for storing and retrieving the real and complex values of different primitive data types, including double, float, integer, and Boolean. Block is the basic unit of the inAspect package and the concept of allocating continuous memory similar to a “block” of VSIPL. The data type specific classes ComplexBlock and RealBlock extend the Block class. These classes are extended according to the available primitive data types, double and float. Currently Java does not support complex data types. Hence, the ComplexBlock is formed by interleaved format or split format ways of storing complex values in arrays of primitives.

Remote Reference Layer (RRL) Transport

Network

Transport

Figure 2. RMI Architecture Overview

For an example consider a real block of size = 25 0 1 2 3 4 5

……………

20 21 22 23 24

Let us form a Vector View with The Remote Method Invocation facilitates writing an application to distribute computing across the networking environment. RMI takes a step further in object-oriented design by selecting the appropriate machine for performing a specific task [6]. The RMI architecture consists of three layers: the stubs/skeleton layer, the remote reference layer (RRL), and the transport layer. Figure 2 shows the relationships among these layers [7]. The stubs/skeletons layer maintains a connection between the objects of client-servers. The remote reference layer (RRL) provides the data stream to stubs and skeletons, and it deals with the transport layer. It thus manages the “liveliness” and communication between the client/server. The transport layer is the layer that creates and maintains the actual connection between client and server, sending information over wire.

3. inAspect LIBRARY 3.1 inApsect’s Programming Model Application, Applet, Servlet, Bean Java Platform

Advanced Signal Processing Toolkit (inAspect)

Java Virtual Machnine

JNI VSIPL/VSI-PRO

Operating System

Figure 3. Programming Model inAspect has been designed to provide a portable, highperformance library for signal processing in Java. Considering the fact that Java is computationally slow, inAspect uses native libraries on supported platforms. Currently, it provides the interface to the native library developed by VSIPL and VSI/PRO [1, 8]. The programming model of inAspect using JNI is shown in Figure 3, which also shows the utility and importance of the VSIPL-VSI/PRO native library in the Aspect package.

offset = 3 ( 4th element of the block) length = 6 (number of elements it can access froma given block) stride = 3 ( space between consecutive element in vector view (3, 6, 9, ...)) The Resultant view is :

3 6 9 12 15 18

Figure 4. Example for Creating a Specific View from a Block View is the base class for the manipulation of data in the inAspect package. VectorView, MatrixView, and TensorView extend View to represent a form that is more specific. VectorView, MatrixView, and TensorView represent the block in 1-D, 2-D, and 3-D forms respectively. A User can attach more than one view to a single block and can manipulate either part of or the whole block using the Views attached to that block or by rebinding the whole set of data to the block. Figure 4 shows an example of creating a different type of view from a real block of size 25.

4. SPECTRAL ESTIMATION APPLICATION One topic of interest in signal processing applications is spectral analysis, a process that involves the estimation of the spectral content, i.e. the distribution of power over frequency, of a time series data from a finite set of measurements. Traditional methods, based solely on Fourier transforms, are mainly used for relating the time domain representation of a signal to its frequency domain. In addition, since most signals have noisy or random components, statistics play a major role in characterizing these signals. Accordingly, robust and reliable signal processing algorithms are needed to improve the overall performance, such as better frequency or spectral resolution and higher signal detection ability. The Spectral Estimation package layout is shown in Figure 5. The estimation algorithms, identified for this task, are grouped as Classical, Parametric, and Statistical estimation [9-10].

WindowData SpectralEstimation

EquationSolver

Box, Hanning, Hamming, Bartlett, Black.

Base Class

Method : Gen Levinson and Solver of Cubic Equation. uses

AR Estimation

MA Estimation

Classical Estimation

ARMA Estimation

Statistical Estimation

Method : Autocorrelation, Covariance, Modified Covariance, Burg

Method : Durbin

Method : Periodogram, Correlogram, Average Periodogram

Method : Yule-Walker Levinson, Least Square.

Method : RLME, Minimum Variance

Figure 5. Layout of the Spectral Estimation

Create Blocks, Views, Process Queue and other object required For PSD estimation.

Create Object of Spectral Estimation Method

Call Method Function used for estimating PSD queued.

Process Queue

P er sis Estimate New PSD

No

Non Persistent

ten t

Yes

Queue Type

Bind New Data

Destroy Object Figure 6. General Function Block Diagram

4.1 General Functional Block Diagram The JNI introduces the overhead of transferring data from the native side to Java. This overhead may be large enough to reduce the high performance obtained using the native approach. With this issue in mind, inAspect uses the concept of queuing. All the operations to be performed on data are queued in the

queue object, eliminating the need for switching between C and Java for each operation. Thus, all operations are performed using the single native call [11]. Figure 6 illustrates the concept of Queuing, used in implementing the Spectral Estimation Package.

swing graph JDialog

armaParameters

Jpanel

inaspectSignalPanel

JApplet

inaspectInputPanel

inaspectS pectrumAnalysis

inApsect

S pectralEstimation

spectEstImp

spectServ spectEst

Figure 7. Main Applet Structure

4.2 Spectral Estimation Applet Design The class inaspectSpectrumAnalysis extends the JApplet class and uses spectImp to call library functions that are bundled in the SpectralEstimation package. Class inaspectSpectrumAnalysis is the main applet class and is also the client application. Class inaspectInputPanel provides functions to obtain inputs from the user. Class inaspectSignalPanel displays the input and output results. Class armaParameters provides a dialog box for entering various parameters required by the AR, MA, ARMA and Statistical Methods. Figure 7 shows the class relationships for the main applet. The RMI structure for the applet is shown in Figure 8. Class spectEst provides the interface for calculating the power spectral density, depending upon the selected method. Class spectEstImp provides the implementation of the interface defined in spectEst. Classes spectEstImp_Stub and spectEstImp_Skel help in maintaining the connection between the objects of client applet and server. Class spectServ is the server application and helps binding the server name to the object spectEstImp.

4.3 Screen Shot of the JAVA Applet The main JAVA applet is divided into three modules; userinput, computational, and display modules. A brief description of each module follows:

4.3.1 User Input Module The user-input module is divided into menus and it lets the user select different methods, signal type, and window type from the Method menu, Signal menu, and Window menu, respectively. The user can draw or clear the spectrum plot from the Spectrum menu. Furthermore, the user is able to input the various parameters of a signal, such as sampling frequency, number of samples, FFT length, window size, and overlap length for the Average Periodogram. A separate dialog box is provided to enter the model orders for the AR, MA, and ARMA methods.

Figure 8. RMI Model Structure

4.3.2 Computational Module This module is used to compute an estimate of the power spectral density (PSD) of a time series data according to a certain set of parameters as defined in the User Input Module. These parameters are then passed to the server (spectServ) to obtain the corresponding PSD. The results are then returned to the client.

4.3.3 Display Module This module displays the input signal and outputs the corresponding PSD in dB. Figure 9 shows the actual screenshots of the display module. The output results are obtained for a set of 1500 data samples that consists of a 50 Hz sinusoid with a unit amplitude in additive white noise of unit variance (SNR = -3 dB), sampled at 800 Hz, using a rectangular window, and taking a 1024 point FFT.

User Input

Display Module

140

80 60

6. 84 8

0. 64

0

25 .7 7

Time (ms)

100

40

44 4. 29

10

52

96 11

20

2. 91

.9 6

30

52

40

24 .5 1

Time (ms)

50

Periodogram

120

70 60

Correlogram

20

2. 06 4

Periodogram

12 .7 36

Correlogram

41 .6 4

80

160

44

90

94 .3 7

100

15 2. 08

Figure 9. Screen Shot of the Java Applet.

0

Pure Java

Non-Persistent Queue Implementation

Persistent Queue

Figure 10. Timing under Window 2000

Pure Java

Non-Persistent Queue Implementation

Persistent Queue

Figure 11. Timing under SunOS 5.8

4.4 Performance Comparison The inAspect package provides two types of queuing; persistent and non-persistent. If the queue is declared as persistent, all the required operations are queued and they remain in the queue until the queue is destroyed or a specific command is given to remove it. Queuing is processed using a specific function. The same set of operations can be performed on new data by processing the same queue. While in the non-persistent queue, each operation is processed immediately and a specific operation is removed from the queue. In order to perform the same set of operations on new data, all the operations are required to be enqueued. Figures 10 and 11 show the timing of two Classical Estimation methods, Periodogram and Correlogram, under Windows 2000 Professional (Hardware: Intel Pentium III ~500 MHz, 256 MB RAM), SunOS 5.8 (Hardware: Sun Ultra 5/10 UPA/PCI (UltraSPAR, C-IIi 333MHz), System clock frequency: 83 MHz, Memory size: 256 Megabytes) operating systems respectively and Sun Microsystems’s J2SE 1.4.1 SDK. A comparison is also made between the algorithms implemented in pure Java, using the Nonpersistent queue and persistent queue of the inAspect package. In order to thoroughly test the performance of each implementation, random data is generated, a 1024 point FFT is taken, and an average time for 1250 cycles is calculated. These figures clearly show the advantage of using the inAspect package with the persistent queue and native libraries (if available for that platform). It can be seen that the implementation using non-persistent queuing is slower due to the extra overhead involved in transferring data from the C layer to the Java layer for each operation. Furthermore, the pure Java version is even much slower due to the overhead and extra checking which Java performs during execution. For this reason, the design of such algorithms is essential, to maintain an acceptable level of performance.

5. CONCLUSION Various independent and customized signal processing packages in Java are available, but developing a new application from these packages is limited. Hence, the development of a signal processing toolkit provides more usability and better performance. inAspectTM provides the high performance Signal Processing and Image Processing toolkit in Java. A performance comparison shows the advantage of the queuing function for specific applications and also the advantage of using the JNI

compared to pure Java. Furthermore, the creation of a spectrum analysis applet using the inAspect package shows the ease of using this toolkit for the development of various signal processing applications.

6. ACKNOWLEDGMENT The authors would like to first acknowledge the National Science Foundation for their funding under NSF Phase II SBIR Grant 0078563. Also special thanks go to Dr. Anthony Skjellum and Mr. Torey Alford of MPI software Technology, Inc. for their help in developing the application toolkit.

7. REFERENCES [1] VSIPL Forum http://www.vsipl.org.

[2] SPUC C++ Library http://spuc.sourceforge.net/.

[3] MCMaster Signal Processing Library in Fortran ftp://nimios.eng.mcmaster.ca/pub/IEEE/software/dsp.zip.

[4] Douglas A. Lyon and Hayagriva V. Rao, “ Java DSP”, M & T Books, 1998.

[5] Java Native Interface http://java.sun.com/docs/books/tutorial/native1.1/concepts/in dex.html.

[6] Sun Microsystems website http://java.sun.com/

[7] RMI Concept http://www.edm2.com/0601/rmi1.html.

[8] VSI-PRO product http://dri.mpi-softtech.com/servlet/MPI/products/vsi-pro

[9] S.L. Marple, Jr., Digital Spectral Analysis with Applications, Prentice Hall, Inc., Englewood Cliffs, NJ, 1987.

[10] S.M. Kay, Modern Spectral Estimation Theory and Application, Prentice Hall Englewood Cliffs, NJ, 1988.

Signal

Processing

Series,

[11] T. Alford, V. Shah, D. Whitcomb, A. Skjellum, N. Younan, A. Watkins, “inAspect™ – Interfacing Java and VSIPL”, Proceedings of the 2002 joint ACM-ISCOPE conference on Java Grande, ACM Press, pp 148-155, 2002.

Suggest Documents