/** * Find the appropriate filter for the given up/down compbination. * * @param upFactor up sampling factor * @param downFactor down sampling factor * @return filter */ private static Filters.FIRFilter createFilter(final int upFactor, final int downFactor) { final int gcd = greatestCommonDivisor(upFactor, downFactor); return Filters.createFir1_16thOrderLowpass(Math.max(upFactor / gcd, downFactor / gcd)); }
/** * Creates a decimator using a simple fir1 16th order low pass filter. * * @param factor nth frame to keep (factor) * @throws IllegalArgumentException if the decimation factor is not supported * @see Filters#createFir1_16thOrderLowpass(int) */ public Decimator(final int factor) throws IllegalArgumentException { super(Filters.createFir1_16thOrderLowpass(factor).getCoefficients()); this.factor = factor; }
/** * Creates an interpolator using a simple fir1 16th order low pass filter. * * @param factor upsample factor * @throws IllegalArgumentException if the upsample factor is not supported * @see Filters#createFir1_16thOrderLowpass(int) */ public Interpolator(final int factor) { this(Filters.createFir1_16thOrderLowpass(factor).getCoefficients(), factor); }