Loading ...
Sorry, an error occurred while loading the content.

258marf-cvs Digest, Vol 22, Issue 2

Expand Messages
  • marf-cvs-bounces@lists.sourceforge.net
    Nov 27, 2011
    • 0 Attachment
      Send marf-cvs mailing list submissions to
      marf-cvs@...

      To subscribe or unsubscribe via the World Wide Web, visit
      https://lists.sourceforge.net/lists/listinfo/marf-cvs
      or, via email, send a message with subject or body 'help' to
      marf-cvs-request@...

      You can reach the person managing the list at
      marf-cvs-owner@...

      When replying, please edit your Subject line so it is more specific
      than "Re: Contents of marf-cvs digest..."


      The MARF CVS Commit Log Digest
      Dispatched daily or when the size reaches 40k
      ----------------------------------------------

      Today's Topics:

      1. marf/src/marf/math ComplexMatrix.java,1.13,1.14
      (Serguei A. Mokhov)
      2. marf/src/marf/Preprocessing/WaveletFilters - New directory
      (Serguei A. Mokhov)
      3. marf/src/marf/math Algorithms.java,1.12,1.13 (Serguei A. Mokhov)
      4. marf/src/marf/Preprocessing PreprocessingFactory.java, 1.4,
      1.5 (Serguei A. Mokhov)
      5. marf/src/marf MARF.java,1.115,1.116 (Serguei A. Mokhov)
      6. marf/src/marf/Preprocessing/WaveletFilters
      DualTreeComplexWaveletFilter.java, NONE, 1.1
      DyadicWaveletFilter.java, NONE, 1.1 WaveletFilter.java, NONE, 1.1
      (Serguei A. Mokhov)
      7. marf/src/marf/Preprocessing/WaveletFilters
      WaveletFilter.java, 1.1, 1.2 (Serguei A. Mokhov)
      8. marf/src/marf MARF.java,1.116,1.117 (Serguei A. Mokhov)


      ----------------------------------------------------------------------

      Message: 1
      Date: Mon, 21 Nov 2011 20:51:22 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/math ComplexMatrix.java,1.13,1.14
      To: marf-cvs@...
      Message-ID:
      <mailman.55116.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv18288

      Modified Files:
      ComplexMatrix.java
      Log Message:
      Assign serialVersionUID; massage comments.

      Index: ComplexMatrix.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/math/ComplexMatrix.java,v
      retrieving revision 1.13
      retrieving revision 1.14
      diff -C2 -d -r1.13 -r1.14
      *** ComplexMatrix.java 18 Jul 2010 20:30:42 -0000 1.13
      --- ComplexMatrix.java 21 Nov 2011 20:51:20 -0000 1.14
      ***************
      *** 1,9 ****
      - /**
      - *
      - */
      package marf.math;

      - import java.util.Date;
      -
      import marf.util.Arrays;
      import marf.util.Debug;
      --- 1,4 ----
      ***************
      *** 14,21 ****
      * but for operations on matrices with complex numbers.</p>
      *
      - * $Id$
      - *
      * @author Serguei Mokhov
      ! * @version $Revision$
      * @since 0.3.0.6
      * @see Matrix
      --- 9,14 ----
      * but for operations on matrices with complex numbers.</p>
      *
      * @author Serguei Mokhov
      ! * @version $Id$
      * @since 0.3.0.6
      * @see Matrix
      ***************
      *** 25,28 ****
      --- 18,26 ----
      {
      /**
      + * For serialization versioning.
      + */
      + private static final long serialVersionUID = -6416567531639737308L;
      +
      + /**
      * The corresponding imaginary data to the real data array.
      */
      ***************
      *** 30,34 ****

      /**
      ! *
      */
      public ComplexMatrix()
      --- 28,35 ----

      /**
      ! * Default matrix.
      ! * @see #ComplexMatrix(int, int)
      ! * @see Matrix#DEFAULT_ROWS
      ! * @see Matrix#DEFAULT_COLS
      */
      public ComplexMatrix()
      ***************
      *** 38,43 ****

      /**
      ! * @param piRows
      ! * @param piCols
      */
      public ComplexMatrix(int piRows, int piCols)
      --- 39,46 ----

      /**
      ! * Matrix with specified rows and columns count.
      ! * @param piRows number of rows
      ! * @param piCols number of columns
      ! * @see #ComplexMatrix(int, int, double)
      */
      public ComplexMatrix(int piRows, int piCols)




      ------------------------------

      Message: 2
      Date: Mon, 21 Nov 2011 20:55:49 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Preprocessing/WaveletFilters - New
      directory
      To: marf-cvs@...
      Message-ID:
      <mailman.55117.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters
      In directory vz-cvs-4.sog:/tmp/cvs-serv19669/WaveletFilters

      Log Message:
      Directory /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters added to the repository





      ------------------------------

      Message: 3
      Date: Mon, 21 Nov 2011 20:59:35 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/math Algorithms.java,1.12,1.13
      To: marf-cvs@...
      Message-ID:
      <mailman.55118.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/math
      In directory vz-cvs-4.sog:/tmp/cvs-serv19963/math

      Modified Files:
      Algorithms.java
      Log Message:
      Implement basic/crude discreete wavelet transform support. Most of it comes
      as a translation of the MATLAB code referenced from:
      http://eeweb.poly.edu/iselesni/WaveletSoftware
      and C++ code from:
      http://code.google.com/p/upfirdn/source/browse/upfirdn/Resampler.h
      A lot more clean up is needed and testing. This is inly a 1D version. 2D and
      3D are next when 1D is stable. In part prompted by the MARFCAT and
      OCTMARF projects.

      Index: Algorithms.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/math/Algorithms.java,v
      retrieving revision 1.12
      retrieving revision 1.13
      diff -C2 -d -r1.12 -r1.13
      *** Algorithms.java 17 Nov 2011 18:02:32 -0000 1.12
      --- Algorithms.java 21 Nov 2011 20:59:33 -0000 1.13
      ***************
      *** 1,4 ****
      --- 1,6 ----
      package marf.math;

      + import marf.util.Arrays;
      +
      /**
      * <p>Collection of algorithms to be used by the modules.
      ***************
      *** 6,13 ****
      * used by different types of modules.</p>
      *
      - * $Id$
      - *
      * @author Serguei Mokhov
      ! * @version $Revision$
      * @since 0.3.0.2
      */
      --- 8,13 ----
      * used by different types of modules.</p>
      *
      * @author Serguei Mokhov
      ! * @version $Id$
      * @since 0.3.0.2
      */
      ***************
      *** 252,261 ****

      /**
      ! * Performs a normal FFT, taking a real input (supposedly an audio sample) and returns
      * the frequency analysis in terms of "magnitude" and "phase angle".
      *
      * @param padSample must be an array of size (2^k)
      * @param padMagnitude must be half the size of "sample"
      ! * @param padPhaseAngle must be half the size of "sample"
      * @throws MathException
      */
      --- 252,261 ----

      /**
      ! * Performs a normal FFT, taking a real input (e.g. an audio sample) and returns
      * the frequency analysis in terms of "magnitude" and "phase angle".
      *
      * @param padSample must be an array of size (2^k)
      * @param padMagnitude must be half the size of "sample"
      ! * @param padPhaseAngle must be half the size of "sample"; may be null
      * @throws MathException
      */
      ***************
      *** 290,294 ****

      /**
      ! * Performs a normal FFT, taking a real input (supposedly an audio sample) and returns
      * the frequency analysis in terms of "magnitude".
      *
      --- 290,294 ----

      /**
      ! * Performs a normal FFT, taking a real input (e.g. an audio sample) and returns
      * the frequency analysis in terms of "magnitude".
      *
      ***************
      *** 405,408 ****
      --- 405,804 ----

      /**
      + * <p>A collection of Wavelet-transform-related algorithms.</p>
      + * @author Serguei Mokhov
      + * @since 0.3.0.6, November 2011
      + */
      + public static final class Wavelet
      + {
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/farras.m
      + public static double[][] af =
      + {
      + {
      + 0,
      + 0,
      + -0.08838834764832,
      + 0.08838834764832,
      + 0.69587998903400,
      + 0.69587998903400,
      + 0.08838834764832,
      + -0.08838834764832,
      + 0.01122679215254,
      + 0.01122679215254
      + },
      + {
      + -0.01122679215254,
      + 0.01122679215254,
      + 0.08838834764832,
      + 0.08838834764832,
      + -0.69587998903400,
      + 0.69587998903400,
      + -0.08838834764832,
      + -0.08838834764832,
      + 0,
      + 0
      + }
      + };
      +
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/farras.m
      + public static double[][] sf =
      + {
      + {
      + 0,
      + 0,
      + -0.08838834764832,
      + 0.08838834764832,
      + 0.69587998903400,
      + 0.69587998903400,
      + 0.08838834764832,
      + -0.08838834764832,
      + 0.01122679215254,
      + 0.01122679215254
      + },
      + {
      + -0.01122679215254,
      + 0.01122679215254,
      + 0.08838834764832,
      + 0.08838834764832,
      + -0.69587998903400,
      + 0.69587998903400,
      + -0.08838834764832,
      + -0.08838834764832,
      + 0,
      + 0
      + }
      + };
      +
      + public static final void applyWaveletTransform
      + (
      + final double[] padInputReal,
      + final double[] padInputImag,
      + double[] padOutputReal,
      + double[] padOutputImag,
      + int piDirection
      + )
      + throws MathException
      + {
      + throw new MathException("Not implemented.");
      + }
      +
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/afb.m
      + public static double[][] afb(double[] x, double[][] af)
      + throws MathException
      + {
      + int N = x.length;
      + int L = af.length / 2;
      + x = cshift(x, -L);
      +
      + // lowpass filter
      + double[] lo = upfirdn(x, af[0], 1, 2);
      + // lo(1:L) = lo(N/2+[1:L]) + lo(1:L);
      + for(int l = 0; l < L; l++)
      + {
      + lo[l] = lo[N/2+l] + lo[l];
      + }
      +
      + //lo = lo(1:N/2);
      + double[] loHalf = new double[N/2];
      + Arrays.copy(loHalf, lo, N/2);
      +
      +
      + // highpass filter
      + double[] hi = upfirdn(x, af[1], 1, 2);
      + //hi(1:L) = hi(N/2+[1:L]) + hi(1:L);
      + for(int h = 0; h < L; h++)
      + {
      + hi[h] = hi[N/2+h] + hi[h];
      + }
      + //hi = hi(1:N/2);
      + double[] hiHalf = new double[N/2];
      + Arrays.copy(hiHalf, hi, N/2);
      +
      + return new double[][] {loHalf, hiHalf};
      + }
      +
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/sfb.m
      + public static final double[] sfb(double[] lo, double[] hi, double[][] sf)
      + throws MathException
      + {
      + int N = 2*lo.length;
      + //int L = sf.length;
      + int L = sf[0].length;
      + lo = upfirdn(lo, sf[0], 2, 1);
      + hi = upfirdn(hi, sf[1], 2, 1);
      + double[] y = add(lo, hi);
      + //y(1:L-2) = y(1:L-2) + y(N+[1:L-2]);
      + for(int l = 0; l < L-2; l++)
      + {
      + y[l] += y[N+l];
      + }
      + //y = y(1:N);
      + y = cshift(y, 1-L/2);
      + return y;
      + }
      +
      + public static final double[][] farras()
      + {
      + return new double[][]
      + {
      + af[0],
      + af[1],
      + sf[0],
      + sf[1]
      + };
      + }
      +
      + // XXX: use our Vector?
      + public static final double[] add(double[] x, double[] y)
      + {
      + double[] z = new double[x.length];
      +
      + for(int i = 0; i < x.length; i++)
      + {
      + z[i] = x[i] + y[i];
      + }
      +
      + return z;
      + }
      +
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/cshift.m
      + public static final double[] cshift(double[] x, int m)
      + {
      + int N = x.length;
      + double[] y = new double[N];
      +
      + for(int n = 0; n < N-1; n++)
      + {
      + n = (n - m) % N;
      + y[n] = x[n+1];
      + }
      +
      + return y;
      + }
      +
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/dwt.m
      + public static final double[][] dwt(double[] x, int J, double[][] af)
      + throws MathException
      + {
      + double w[][] = new double[J+1][];
      +
      + for(int k = 0; k < J; k++)
      + {
      + x = afb(x, af)[0];
      + w[k] = afb(x, af)[1];
      + }
      +
      + w[J] = x;
      +
      + return w;
      + }
      +
      + // http://eeweb.poly.edu/iselesni/WaveletSoftware/allcode/idwt.m
      + public static final double[] idwt(double[][] w, int J, double[][] sf)
      + throws MathException
      + {
      + double y[] = w[J];
      +
      + for(int k = J-1; k >= 0; k--)
      + {
      + y = sfb(y, w[k], sf);
      + }
      +
      + return y;
      + }
      +
      + // http://code.google.com/p/upfirdn/source/browse/upfirdn/Resampler.h
      + public static final class Resampler
      + {
      + private int _upRate;
      + private int _downRate;
      +
      + private double[] _transposedCoefs;
      + private double[] _state;
      + //private double[] _stateEnd;
      + private int _stateEnd;
      +
      + private int _paddedCoefCount; // ceil(len(coefs)/upRate)*upRate
      + private int _coefsPerPhase; // _paddedCoefCount / upRate
      +
      + private int _t; // "time" (modulo upRate)
      + private int _xOffset;
      +
      + Resampler(int upRate, int downRate, double[] coefs, int coefCount)
      + {
      + this._upRate = upRate;
      + this._downRate = downRate;
      + _t = 0;
      + _xOffset = 0;
      +
      + _paddedCoefCount = coefCount;
      + while (_paddedCoefCount % _upRate != 0) {
      + _paddedCoefCount++;
      + }
      + _coefsPerPhase = _paddedCoefCount / _upRate;
      +
      + _transposedCoefs = new double[_paddedCoefCount];
      + //fill(_transposedCoefs, _transposedCoefs.length + _paddedCoefCount, 0.);
      + Arrays.fill(_transposedCoefs, 0);
      +
      + _state = new double[_coefsPerPhase - 1];
      + //_stateEnd = _state + _coefsPerPhase - 1;
      + //fill(_state, _stateEnd, 0.);
      + Arrays.fill(_state, 0);
      +
      +
      + /* This both transposes, and "flips" each phase, while
      + * copying the defined coefficients into local storage.
      + * There is probably a faster way to do this
      + */
      + for (int i=0; i<_upRate; ++i) {
      + for (int j=0; j<_coefsPerPhase; ++j) {
      + if (j*_upRate + i < coefCount)
      + _transposedCoefs[(_coefsPerPhase-1-j) + i*_coefsPerPhase] =
      + coefs[j*_upRate + i];
      + }
      + }
      + }
      +
      + int apply(double[] in, int inCount, double[] out, int outCount)
      + throws MathException
      + {
      + if (outCount < neededOutCount(inCount))
      + throw new MathException("Not enough output samples");
      +
      + // x points to the latest processed input sample
      + //inputType *x = in + _xOffset;
      + int x = _xOffset;
      + //outputType *y = out;
      + int y = 0;
      +
      + // inputType *end = in + inCount;
      + int end = inCount;
      + while (x < end) {
      + //outputType acc = 0.;
      + double acc = 0.;
      + //coefType *h = _transposedCoefs + _t*_coefsPerPhase;
      + int h = _t*_coefsPerPhase;
      + //inputType *xPtr = x - _coefsPerPhase + 1;
      + int xPtr = x - _coefsPerPhase + 1;
      + //int offset = in - xPtr;
      + int offset = _xOffset - xPtr;
      + if (offset > 0) {
      + // need to draw from the _state buffer
      + //inputType *statePtr = _stateEnd - offset;
      + int statePtr = _stateEnd - offset;
      + while (statePtr < _stateEnd) {
      + //acc += *statePtr++ * *h++;
      + acc += in[statePtr++] * in[h++];
      + }
      + xPtr += offset;
      + }
      + while (xPtr <= x) {
      + //acc += *xPtr++ * *h++;
      + acc += in[xPtr++] * in[h++];
      + }
      + //*y++ = acc;
      + out[y++] = acc;
      + _t += _downRate;
      +
      + int advanceAmount = _t / _upRate;
      +
      + x += advanceAmount;
      + // which phase of the filter to use
      + _t %= _upRate;
      + }
      + _xOffset = x - end;
      +
      + // manage _state buffer
      + // find number of samples retained in buffer:
      + int retain = (_coefsPerPhase - 1) - inCount;
      + if (retain > 0) {
      + // for inCount smaller than state buffer, copy end of buffer
      + // to beginning:
      + //copy(_stateEnd - retain, _stateEnd, _state);
      + Arrays.copy(_state, _stateEnd - retain, _state, _stateEnd);
      + // Then, copy the entire (short) input to end of buffer
      + //copy(in, end, _stateEnd - inCount);
      + Arrays.copy(_state, end, in, _stateEnd - inCount);
      + } else {
      + // just copy last input samples into state buffer
      + //copy(end - (_coefsPerPhase - 1), end, _state);
      + Arrays.copy(_state, end - (_coefsPerPhase - 1), _state, end);
      + }
      + // number of samples computed
      + //return y - out;
      + return y - out.length;
      + }
      +
      + int neededOutCount(int inCount)
      + {
      + int np = inCount * _upRate;
      + int need = np / _downRate;
      + if ((_t + _upRate * _xOffset) < (np % _downRate))
      + need++;
      + return need;
      + }
      +
      + int coefsPerPhase() { return _coefsPerPhase; }
      +
      + }
      +
      + static double[] upfirdn
      + (
      + int upRate,
      + int downRate,
      + double[] input,
      + int inLength,
      + double[] filter,
      + int filterLength
      + )
      + throws MathException
      + {
      + // Create the Resampler
      + //Resampler<S1, S2, C> theResampler(upRate, downRate, filter, filterLength);
      + Resampler theResampler = new Resampler(upRate, downRate, filter, filterLength);
      +
      + // pad input by length of one polyphase of filter to flush all values out
      + int padding = theResampler.coefsPerPhase() - 1;
      + double[] inputPadded = new double[inLength + padding];
      +
      + for (int i = 0; i < inLength + padding; i++) {
      + if (i < inLength)
      + inputPadded[i] = input[i];
      + else
      + inputPadded[i] = 0;
      + }
      +
      + // calc size of output
      + int resultsCount = theResampler.neededOutCount(inLength + padding);
      +
      + // results.resize(resultsCount);
      + double[] results = new double[resultsCount];
      +
      + // run filtering
      + int numSamplesComputed = theResampler.apply(inputPadded,
      + inLength + padding, results, resultsCount);
      + //delete[] inputPadded;
      + inputPadded = null;
      +
      + return results;
      + }
      +
      + static double[] upfirdn(int upRate, int downRate,
      + double[] input, double[] filter) throws MathException
      + {
      + return upfirdn(upRate, downRate, input, input.length, filter,
      + filter.length);
      + }
      +
      + static double[] upfirdn(double[] input, double[] filter, int upRate, int downRate)
      + throws MathException
      + {
      + return upfirdn(upRate, downRate, input, input.length, filter,
      + filter.length);
      + }
      +
      + } // Wavelet
      +
      + /**
      * Returns source code revision information.
      * @return revision string




      ------------------------------

      Message: 4
      Date: Mon, 21 Nov 2011 20:59:35 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Preprocessing
      PreprocessingFactory.java, 1.4, 1.5
      To: marf-cvs@...
      Message-ID:
      <mailman.55119.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Preprocessing
      In directory vz-cvs-4.sog:/tmp/cvs-serv19963/Preprocessing

      Modified Files:
      PreprocessingFactory.java
      Log Message:
      Implement basic/crude discreete wavelet transform support. Most of it comes
      as a translation of the MATLAB code referenced from:
      http://eeweb.poly.edu/iselesni/WaveletSoftware
      and C++ code from:
      http://code.google.com/p/upfirdn/source/browse/upfirdn/Resampler.h
      A lot more clean up is needed and testing. This is inly a 1D version. 2D and
      3D are next when 1D is stable. In part prompted by the MARFCAT and
      OCTMARF projects.

      Index: PreprocessingFactory.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/Preprocessing/PreprocessingFactory.java,v
      retrieving revision 1.4
      retrieving revision 1.5
      diff -C2 -d -r1.4 -r1.5
      *** PreprocessingFactory.java 16 Dec 2007 07:14:52 -0000 1.4
      --- PreprocessingFactory.java 21 Nov 2011 20:59:33 -0000 1.5
      ***************
      *** 10,14 ****
      import marf.Preprocessing.FFTFilter.LowPassFilter;
      import marf.Storage.Sample;
      - import marf.util.Debug;


      --- 10,13 ----
      ***************
      *** 16,23 ****
      * <p>Provides a factory to instantiate requested preprocessing module(s).</p>
      *
      - * $Id$
      - *
      * @author Serguei Mokhov
      ! * @version $Revision$
      * @since 0.3.0.5
      */
      --- 15,20 ----
      * <p>Provides a factory to instantiate requested preprocessing module(s).</p>
      *
      * @author Serguei Mokhov
      ! * @version $Id$
      * @since 0.3.0.5
      */
      ***************
      *** 199,202 ****
      --- 196,217 ----
      }

      + case MARF.SEPARABLE_DWT_FILTER:
      + {
      + oPreprocessing = new marf.Preprocessing.WaveletFilters.WaveletFilter(poSample);
      + break;
      + }
      +
      + case MARF.DUAL_DTREE_DWT_FILTER:
      + {
      + oPreprocessing = new marf.Preprocessing.WaveletFilters.DualTreeComplexWaveletFilter(poSample);
      + break;
      + }
      +
      + case MARF.DYADIC_DWT_FILTER:
      + {
      + oPreprocessing = new marf.Preprocessing.WaveletFilters.DyadicWaveletFilter(poSample);
      + break;
      + }
      +
      default:
      {




      ------------------------------

      Message: 5
      Date: Mon, 21 Nov 2011 20:59:35 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf MARF.java,1.115,1.116
      To: marf-cvs@...
      Message-ID:
      <mailman.55120.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf
      In directory vz-cvs-4.sog:/tmp/cvs-serv19963

      Modified Files:
      MARF.java
      Log Message:
      Implement basic/crude discreete wavelet transform support. Most of it comes
      as a translation of the MATLAB code referenced from:
      http://eeweb.poly.edu/iselesni/WaveletSoftware
      and C++ code from:
      http://code.google.com/p/upfirdn/source/browse/upfirdn/Resampler.h
      A lot more clean up is needed and testing. This is inly a 1D version. 2D and
      3D are next when 1D is stable. In part prompted by the MARFCAT and
      OCTMARF projects.

      Index: MARF.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/MARF.java,v
      retrieving revision 1.115
      retrieving revision 1.116
      diff -C2 -d -r1.115 -r1.116
      *** MARF.java 27 Sep 2010 23:55:21 -0000 1.115
      --- MARF.java 21 Nov 2011 20:59:33 -0000 1.116
      ***************
      *** 142,145 ****
      --- 142,163 ----

      /**
      + * Indicates to use separable discreet wavelet transform filter.
      + * @since 0.3.0.6, November 2011
      + */
      + public static final int SEPARABLE_DWT_FILTER = 114;
      +
      + /**
      + * Indicates to use dual-tree discreet wavelet transform filter.
      + * @since 0.3.0.6, November 2011
      + */
      + public static final int DUAL_DTREE_DWT_FILTER = 115;
      +
      + /**
      + * Indicates to use dyadic discreet wavelet transform filter.
      + * @since 0.3.0.6, November 2011
      + */
      + public static final int DYADIC_DWT_FILTER = 116;
      +
      + /**
      * Upper boundary for preprocessing methods enumeration.
      * Used in error checks.




      ------------------------------

      Message: 6
      Date: Mon, 21 Nov 2011 20:59:35 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Preprocessing/WaveletFilters
      DualTreeComplexWaveletFilter.java, NONE, 1.1 DyadicWaveletFilter.java,
      NONE, 1.1 WaveletFilter.java, NONE, 1.1
      To: marf-cvs@...
      Message-ID:
      <mailman.55121.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters
      In directory vz-cvs-4.sog:/tmp/cvs-serv19963/Preprocessing/WaveletFilters

      Added Files:
      DualTreeComplexWaveletFilter.java DyadicWaveletFilter.java
      WaveletFilter.java
      Log Message:
      Implement basic/crude discreete wavelet transform support. Most of it comes
      as a translation of the MATLAB code referenced from:
      http://eeweb.poly.edu/iselesni/WaveletSoftware
      and C++ code from:
      http://code.google.com/p/upfirdn/source/browse/upfirdn/Resampler.h
      A lot more clean up is needed and testing. This is inly a 1D version. 2D and
      3D are next when 1D is stable. In part prompted by the MARFCAT and
      OCTMARF projects.

      --- NEW FILE: DyadicWaveletFilter.java ---
      package marf.Preprocessing.WaveletFilters;

      import marf.Preprocessing.IPreprocessing;
      import marf.Preprocessing.PreprocessingException;
      import marf.Storage.Sample;

      /**
      * @author serguei
      *
      */
      public class DyadicWaveletFilter extends WaveletFilter {

      /**
      *
      */
      private static final long serialVersionUID = -3729208239407325876L;

      /**
      *
      */
      public DyadicWaveletFilter() {
      // TODO Auto-generated constructor stub
      }

      /**
      * @param poPreprocessing
      * @throws PreprocessingException
      */
      public DyadicWaveletFilter(IPreprocessing poPreprocessing)
      throws PreprocessingException {
      super(poPreprocessing);
      // TODO Auto-generated constructor stub
      }

      /**
      * @param poSample
      * @throws PreprocessingException
      */
      public DyadicWaveletFilter(Sample poSample) throws PreprocessingException {
      super(poSample);
      // TODO Auto-generated constructor stub
      }

      }

      --- NEW FILE: WaveletFilter.java ---
      package marf.Preprocessing.WaveletFilters;

      import sun.reflect.generics.reflectiveObjects.NotImplementedException;
      import marf.Preprocessing.Filter;
      import marf.Preprocessing.IPreprocessing;
      import marf.Preprocessing.PreprocessingException;
      import marf.Storage.Sample;
      import marf.math.Algorithms;
      import marf.math.MathException;
      import marf.util.Arrays;
      import marf.util.Debug;

      /**
      * @author Serguei Mokhov
      * @version $Id: WaveletFilter.java,v 1.1 2011/11/21 20:59:33 mokhov Exp $
      */
      public class WaveletFilter
      extends Filter
      {
      /**
      * For serialization versioning.
      */
      private static final long serialVersionUID = -2327003693081462142L;

      /**
      *
      */
      public WaveletFilter()
      {
      super();
      }

      /**
      * @param poPreprocessing
      * @throws PreprocessingException
      */
      public WaveletFilter(IPreprocessing poPreprocessing)
      throws PreprocessingException
      {
      super(poPreprocessing);
      }

      /**
      * @param poSample
      * @throws PreprocessingException
      */
      public WaveletFilter(Sample poSample)
      throws PreprocessingException
      {
      super(poSample);
      }

      /* (non-Javadoc)
      * @see marf.Preprocessing.IFilter#filter(double[], double[])
      */
      public boolean filter(double[] padSample, double[] padFiltered)
      throws PreprocessingException
      {
      try
      {
      //int iResponseSize = this.adFreqResponse.length;
      /*
      double[] adBuffer = new double[iResponseSize];
      double[] adBufferImag = new double[iResponseSize];
      double[] adOutputReal = new double[iResponseSize];
      double[] adOutputImag = new double[iResponseSize];
      */
      if(padFiltered.length < padSample.length)
      {
      throw new PreprocessingException
      (
      "WaveletFilter: Output buffer not long enough (" +
      padFiltered.length + " < " + padSample.length + ")."
      );
      }

      int i;

      //int iPosition = -iResponseSize / 2;
      int iPosition = 0;

      Debug.debug
      (
      getClass(),
      new StringBuffer("position prior entry to while(): ").append(iPosition)
      .append(", sample length: ").append(padSample.length)
      );

      while(iPosition < padSample.length)
      {
      /*
      for(i = 0; i < iResponseSize; i++)
      {
      if(((iPosition + i) < padSample.length) && ((iPosition + i) >= 0))
      {
      adBuffer[i] = padSample[iPosition + i] * Algorithms.Hamming.sqrtHamming(i, iResponseSize);
      }
      else
      {
      adBuffer[i] = 0;
      }

      adBufferImag[i] = 0;
      }
      */

      //Algorithms.FFT.doFFT(adBuffer, adBufferImag, adOutputReal, adOutputImag, 1);
      double[][] adDWTCoeffs = Algorithms.Wavelet.dwt(padSample, 6, Algorithms.Wavelet.af);

      /*
      for(i = 0; i < iResponseSize; i++)
      {
      adOutputReal[i] *= this.adFreqResponse[i];
      adOutputImag[i] *= this.adFreqResponse[i];
      }
      */

      //Algorithms.FFT.doFFT(adOutputReal, adOutputImag, adBuffer, adBufferImag, -1);
      double[] adFiltered = Algorithms.Wavelet.idwt(adDWTCoeffs, 6, Algorithms.Wavelet.sf);

      Arrays.copy(padFiltered, 0, adFiltered);


      // Copy & normalize
      /*
      for(i = 0; (i < iResponseSize) && ((iPosition + i) < padSample.length); i++)
      {
      if((iPosition + i) >= 0)
      {
      padFiltered[iPosition + i] +=
      adBuffer[i] * Algorithms.Hamming.sqrtHamming(i, iResponseSize) / iResponseSize;
      }
      }
      */

      //iPosition += iResponseSize / 2;
      iPosition++;

      //Debug.debug(getClass(), "position prior next iteration of while(): " + iPosition);
      }

      Debug.debug(getClass(), "done");

      return true;
      }
      catch(NullPointerException e)
      {
      e.printStackTrace(System.err);
      throw new PreprocessingException("FFTFilter: frequency response hasn't been set.");
      }
      catch(MathException e)
      {
      e.printStackTrace(System.err);
      throw new PreprocessingException("FFTFilter: " + e.getMessage());
      }
      }

      /* (non-Javadoc)
      * @see marf.Preprocessing.IFilter#filter(double[][], double[][])
      */
      public boolean filter(double[][] padSample, double[][] padFiltered)
      throws PreprocessingException {
      // TODO Auto-generated method stub
      throw new NotImplementedException();
      //return false;
      }

      /* (non-Javadoc)
      * @see marf.Preprocessing.IFilter#filter(double[][][], double[][][])
      */
      public boolean filter(double[][][] padSample, double[][][] padFiltered)
      throws PreprocessingException {
      // TODO Auto-generated method stub
      throw new NotImplementedException();
      //return false;
      }
      }

      // EOF

      --- NEW FILE: DualTreeComplexWaveletFilter.java ---
      /**
      *
      */
      package marf.Preprocessing.WaveletFilters;

      import marf.Preprocessing.IPreprocessing;
      import marf.Preprocessing.PreprocessingException;
      import marf.Storage.Sample;

      /**
      * @author serguei
      *
      */
      public class DualTreeComplexWaveletFilter extends WaveletFilter {

      /**
      *
      */
      private static final long serialVersionUID = -814393911837606095L;

      /**
      *
      */
      public DualTreeComplexWaveletFilter() {
      // TODO Auto-generated constructor stub
      }

      /**
      * @param poPreprocessing
      * @throws PreprocessingException
      */
      public DualTreeComplexWaveletFilter(IPreprocessing poPreprocessing)
      throws PreprocessingException {
      super(poPreprocessing);
      // TODO Auto-generated constructor stub
      }

      /**
      * @param poSample
      * @throws PreprocessingException
      */
      public DualTreeComplexWaveletFilter(Sample poSample)
      throws PreprocessingException {
      super(poSample);
      // TODO Auto-generated constructor stub
      }

      }




      ------------------------------

      Message: 7
      Date: Mon, 21 Nov 2011 21:14:27 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf/Preprocessing/WaveletFilters
      WaveletFilter.java, 1.1, 1.2
      To: marf-cvs@...
      Message-ID:
      <mailman.55122.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters
      In directory vz-cvs-4.sog:/tmp/cvs-serv22130

      Modified Files:
      WaveletFilter.java
      Log Message:
      It was meant to be our NotImplementedException and not Sun's. Not sure
      how the latter got in there.

      Index: WaveletFilter.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/Preprocessing/WaveletFilters/WaveletFilter.java,v
      retrieving revision 1.1
      retrieving revision 1.2
      diff -C2 -d -r1.1 -r1.2
      *** WaveletFilter.java 21 Nov 2011 20:59:33 -0000 1.1
      --- WaveletFilter.java 21 Nov 2011 21:14:24 -0000 1.2
      ***************
      *** 1,5 ****
      package marf.Preprocessing.WaveletFilters;

      - import sun.reflect.generics.reflectiveObjects.NotImplementedException;
      import marf.Preprocessing.Filter;
      import marf.Preprocessing.IPreprocessing;
      --- 1,4 ----
      ***************
      *** 10,13 ****
      --- 9,13 ----
      import marf.util.Arrays;
      import marf.util.Debug;
      + import marf.util.NotImplementedException;

      /**




      ------------------------------

      Message: 8
      Date: Sun, 27 Nov 2011 15:17:09 +0000
      From: "Serguei A. Mokhov" <mokhov@...>
      Subject: [marf-cvs] marf/src/marf MARF.java,1.116,1.117
      To: marf-cvs@...
      Message-ID:
      <mailman.55123.1322407030.26619.marf-cvs@...>

      Update of /cvsroot/marf/marf/src/marf
      In directory vz-cvs-4.sog:/tmp/cvs-serv19869

      Modified Files:
      MARF.java
      Log Message:
      Make sure MAX_PREPROCESSING_METHOD is properly updated.

      Index: MARF.java
      ===================================================================
      RCS file: /cvsroot/marf/marf/src/marf/MARF.java,v
      retrieving revision 1.116
      retrieving revision 1.117
      diff -C2 -d -r1.116 -r1.117
      *** MARF.java 21 Nov 2011 20:59:33 -0000 1.116
      --- MARF.java 27 Nov 2011 15:17:07 -0000 1.117
      ***************
      *** 163,171 ****
      * Used in error checks.
      *
      ! * *Update it when add more methods.*
      *
      * @since 0.3.0.1
      */
      ! public static final int MAX_PREPROCESSING_METHOD = BAND_STOP_FFT_FILTER;

      /**
      --- 163,171 ----
      * Used in error checks.
      *
      ! * *Update it when add more algorithm constants.*
      *
      * @since 0.3.0.1
      */
      ! public static final int MAX_PREPROCESSING_METHOD = DYADIC_DWT_FILTER;

      /**




      ------------------------------

      ------------------------------------------------------------------------------
      All the data continuously generated in your IT infrastructure
      contains a definitive record of customers, application performance,
      security threats, fraudulent activity, and more. Splunk takes this
      data and makes sense of it. IT sense. And common sense.
      http://p.sf.net/sfu/splunk-novd2d

      ------------------------------

      _______________________________________________
      marf-cvs mailing list
      marf-cvs@...
      https://lists.sourceforge.net/lists/listinfo/marf-cvs


      End of marf-cvs Digest, Vol 22, Issue 2
      ***************************************