rsencoder.java

来自「用java写的RS算法的交织器」· Java 代码 · 共 46 行

JAVA
46
字号
package cmmb.dsp.common;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class RSEncoder {
	public RSEncoder() {
		System.loadLibrary("RSEncodeDLL"); // 载入系统动态库
	}

	public native byte[] encodeRS(byte[] data);

	public static void main(String[] args) throws IOException

	{
		int INFORROWSNUM = 207;
		int FECROWSNUM = 48;
		int LINESNUM = 3;
		FileInputStream fileInput = new FileInputStream(
				"E:\\data.txt");
		byte[] data = new byte[INFORROWSNUM * LINESNUM];
		fileInput.read(data);

		Interlacer interlacer = new Interlacer(data, LINESNUM);
		byte[] inforRegionData = new byte[INFORROWSNUM * LINESNUM];
		inforRegionData = interlacer.inforRegionCreater();
		byte[][] fecRegion = new byte[LINESNUM][FECROWSNUM];
		byte[] inData = new byte[INFORROWSNUM];
		byte[] outData = new byte[FECROWSNUM];
		RSEncoder encoder = new RSEncoder();
		for (int i = 0; i < LINESNUM; i++) {
			for (int j = 0; j < INFORROWSNUM; j++) {
				inData[j] = inforRegionData[i * INFORROWSNUM + j];
			}
			outData = encoder.encodeRS(inData);
			for (int index = 0; index < FECROWSNUM; index++) {
				fecRegion[i][index] = outData[index];
			}
		}
		FileOutputStream fileOut5 = new FileOutputStream("E:\\fec.txt");
		fileOut5.write(interlacer.fecRegionCreater(fecRegion));

	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?