类 GolombEncoder
- java.lang.Object
-
- com.github.myibu.algorithm.endode.GolombEncoder
-
- 所有已实现的接口:
Encoder
public class GolombEncoder extends java.lang.Object implements Encoder
Golomb code see https://en.wikipedia.org/wiki/Golomb_coding#Simple_algorithm
-
-
构造器概要
构造器 构造器 说明 GolombEncoder()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 intdecode(Bits bits, int m)decode binary bits to nstatic intdecodeTruncatedBinary(Bits bits, int m)Bitsencode(int n, int m)encode n to binary bits based on argument mstatic BitsencodeToBinary(int x, int len)static intencodeToBinary(Bits bits)static BitsencodeToTruncatedBinary(int x, int n)
-
-
-
方法详细资料
-
encode
public Bits encode(int n, int m)
encode n to binary bits based on argument m- 参数:
n- the value to encodem- m, like 5- 返回:
- the length of encoded bits
-
encodeToTruncatedBinary
public static Bits encodeToTruncatedBinary(int x, int n)
-
encodeToBinary
public static Bits encodeToBinary(int x, int len)
-
decode
public int decode(Bits bits, int m)
decode binary bits to n- 参数:
bits- encoded binary bitsm- m, like 5- 返回:
- decoded value
-
decodeTruncatedBinary
public static int decodeTruncatedBinary(Bits bits, int m)
-
encodeToBinary
public static int encodeToBinary(Bits bits)
-
-