Revision as of 04:58, 23 November 2010 by Han84 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
/**
 * Interleave for FEC.
 * @param data
 * @param size
 * @return
 */
public static byte[] fecInterleave(byte[] data, int size) {
	byte[] inter = new byte[data.length];
	int cycle = (int) Math.ceil(data.length / (double) size);
	for (int i = 0; i < cycle; i++) {
		for (int j = 0; j < size; j++) {
			inter[j * cycle + i] = data[i * size + j];
		}
	}
	return inter;
}
 
/**
 * Reverse interleave for FEC.
 * @param data
 * @param size
 * @return
 */
public static byte[] fecDeinterleave(byte[] data, int size) {
	return Ts.fecInterleave(data, (int) Math.ceil(data.length / (double) size));
}


Back to JavaHowTo

Alumni Liaison

ECE462 Survivor

Seraj Dosenbach