/** * Apply a bit-shuffling filter into the input float array. * * @param input * @return bit-shuffled byte array * @throws IOException */ public static byte[] shuffle(float[] input) throws IOException { byte[] output = new byte[input.length * 4]; int numProcessed = impl.shuffle(input, 0, 4, input.length * 4, output, 0); assert(numProcessed == input.length * 4); return output; }
/** * Convert the input bit-shuffled byte array into an original long array. * * @param input * @return a long array * @throws IOException */ public static long[] unshuffleLongArray(byte[] input) throws IOException { long[] output = new long[input.length / 8]; int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0); assert(numProcessed == input.length); return output; }
static synchronized BitShuffleNative loadBitShuffleApi() { if (bitshuffleApi != null) { return bitshuffleApi; } loadNativeLibrary(); bitshuffleApi = new BitShuffleNative(); return bitshuffleApi; }
throw new IllegalArgumentException("not enough space for output"); int numProcessed = impl.unshuffleDirectBuffer(shuffled, uPos, typeSize, uLen, output, shuffled.position()); assert(numProcessed == uLen);
throw new IllegalArgumentException("not enough space for output"); int numProcessed = impl.shuffleDirectBuffer(input, uPos, typeSize, uLen, shuffled, shuffled.position()); assert(numProcessed == uLen);
/** * Apply a bit-shuffling filter into the input int array. * * @param input * @return bit-shuffled byte array * @throws IOException */ public static byte[] shuffle(int[] input) throws IOException { byte[] output = new byte[input.length * 4]; int numProcessed = impl.shuffle(input, 0, 4, input.length * 4, output, 0); assert(numProcessed == input.length * 4); return output; }
/** * Convert the input bit-shuffled byte array into an original int array. * * @param input * @return an int array * @throws IOException */ public static int[] unshuffleIntArray(byte[] input) throws IOException { int[] output = new int[input.length / 4]; int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0); assert(numProcessed == input.length); return output; }
/** * Apply a bit-shuffling filter into the input long array. * * @param input * @return bit-shuffled byte array * @throws IOException */ public static byte[] shuffle(long[] input) throws IOException { byte[] output = new byte[input.length * 8]; int numProcessed = impl.shuffle(input, 0, 8, input.length * 8, output, 0); assert(numProcessed == input.length * 8); return output; }
/** * Convert the input bit-shuffled byte array into an original float array. * * @param input * @return an float array * @throws IOException */ public static float[] unshuffleFloatArray(byte[] input) throws IOException { float[] output = new float[input.length / 4]; int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0); assert(numProcessed == input.length); return output; }
/** * Apply a bit-shuffling filter into the input double array. * * @param input * @return bit-shuffled byte array * @throws IOException */ public static byte[] shuffle(double[] input) throws IOException { byte[] output = new byte[input.length * 8]; int numProcessed = impl.shuffle(input, 0, 8, input.length * 8, output, 0); assert(numProcessed == input.length * 8); return output; }
/** * Convert the input bit-shuffled byte array into an original short array. * * @param input * @return a short array * @throws IOException */ public static short[] unshuffleShortArray(byte[] input) throws IOException { short[] output = new short[input.length / 2]; int numProcessed = impl.unshuffle(input, 0, 2, input.length, output, 0); assert(numProcessed == input.length); return output; }
/** * Apply a bit-shuffling filter into the input short array. * * @param input * @return bit-shuffled byte array * @throws IOException */ public static byte[] shuffle(short[] input) throws IOException { byte[] output = new byte[input.length * 2]; int numProcessed = impl.shuffle(input, 0, 2, input.length * 2, output, 0); assert(numProcessed == input.length * 2); return output; }
/** * Convert the input bit-shuffled byte array into an original double array. * * @param input * @return a double array * @throws IOException */ public static double[] unshuffleDoubleArray(byte[] input) throws IOException { double[] output = new double[input.length / 8]; int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0); assert(numProcessed == input.length); return output; } }