Patent ID: 8724709

Claim:
Method for encoding an integer, said method comprises: determining a threshold value, dividing the integer by a predetermined number and determining a quotient being an integer part of the divided integer, determining a remainder being the integer diminished by the quotient multiplied by the predetermined number comparing said quotient with the threshold value, when said quotient is smaller than or equal to said threshold value, encoding said quotient using unary representation, and, when said quotient is larger than said threshold value, determining a difference between said quotient increased by 1 and said threshold value, determining a first adjuvant integer as the integer part of the logarithm, to the base of 2, of the determined difference plus said threshold value, encoding said first adjuvant integer using unary representation, determining a second adjuvant integer as difference between the determined difference and 2 raised to the power of said first adjuvant integer minus said threshold, and encoding the second adjuvant integer using binary representation, and binary encoding the remainder in the predetermined number of bits, wherein the threshold is determined as the integer part of a further quotient obtained by dividing a maximum value for the integer plus 1 by said predetermined number, wherein the maximum value is determined as, either, a maximum among a set of exemplary test data, or, an estimated maximum determined using an occurrence probability threshold and the predetermined number.