CA2244380C

Z-coder: a fast adaptive binary arithmetic coder

Abstract

A binary arithmetic coder and decoder providesimproved coding accuracy due to improved probabilityestimation and adaptation. They also provide improveddecoding speed through a "fast path" design whereindecoding of a most probable symbol requires fewcomputational steps. Coded data represents data that ispopulated by more probable symbols ("MPS") and lessprobable symbols ("LPS"). In an embodiment, a decoderreceives a segment of the coded data as a binaryfraction C. It defines a coding interval of possiblevalues of C, the interval extending from a variablelower bound A to a constant upper bound 1. For eachposition in the decoded symbol string, the decodercomputes a test value Z that subdivides the codinginterval into sub-intervals according to the relativeprobabilities that an MPS or an LPS occurs in theposition. A first sub-interval extends from the lowerbound A to the test value Z; the second sub-intervalextending from the test value Z to 1. If C is greaterthan Z, the decoder emits an MPS for the currentposition in the decoded symbol string and sets the lowerbound A to the test variable Z for use during decodingof the next position in the decoded symbol string. If Cis less than Z, the decoder emits an LPS and computes anew lower bound A and a new binary fraction C for useduring decoding of the next position in the decodedsymbol string. The encoder operates according toanalogous techniques to compose coded data from originaldata.

CA2244380C, drawing sheet 1
Sheet 1 of 6

Term

Term ended

Expired 27 July 2018, 8.2 years ago.

  1. Priority
  2. Filed
  3. Granted
  4. Expired
  5. Today

94 claims: 30 independent, 64 dependent

  1. 1
    CA 02244380 2001-07-11 CLAIMS :1. A method for encoding data, the data represented by a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS), the method comprising the steps of : initializing a code accumulator S;defining a coding interval extending from a variable lower bound A to a constant upper bound 1;for each position in the symbol string: computing a test value Z subdividing the coding interval into sub - intervals in accordance with the relative probabilities of an MPS and an LPS occurrence in the position, a first sub-interval extending from the lower bound A to the test value Z, the second subinterval extending from the test value Z to 1;if the symbol located at the current position in the symbol string is an MPS, setting the lower bound A to the test variable Z for use in encoding of a next position in the decoded symbol string;if the symbol located at the current position in the symbol string is an LPS, adding the length of the second sub-interval to the accumulator S, and computing a new lower bound A for use in encoding of a next position in the decoded symbol string;and when a predefined criterion is met, outputting a segment of coded data and computing new values for both the accumulator S and the lower bound A. CA 02244380 2001-07-11
  2. 4
    The method of claim 3, wherein k is 1/2.
  3. 5
    The method of claim 3, wherein k is 1/4.
  4. 6
    The method of claim 1, wherein the computation of the test value Z depends on the value of a parameter P approximating a probability of the occurrence of LPS symbols in the decoded symbol string, said method comprising the additional steps of :if the decoded symbol is an LPS, setting the parameter P to a value representing an increased estimated probability for the LPS symbol;and if the decoded symbol is an MPS;comparing the lower bound A with a threshold value M depending on P, and CA 02244380 2001-07-11 if the lower bound A is greater than the threshold value M, setting the parameter P to a value representing a decreased estimated probability for the LPS symbol.
  5. 10
    A method for decoding coded data into a decoded symbol string populated by more probable symbols (MPS) and less probable symbols (LPS), the method comprising the steps of :receiving a segment of coded data interpreted as a binary fraction C;defining a coding interval of possible values of C, the interval extending from a variable lower bound A to a constant upper bound 1;for each position in the decoded symbol string: computing a test value Z subdividing the coding interval in sub-intervals in accordance with the relative probabilities that an MPS and an LPS occurrence in the position, a first sub-interval extending from the lower bound A to the test value Z, the second sub-interval extending from the test value Z to 1, the computing step comprising : computing a first test value Z1 derived from the lower bound A and from a current estimate P of the probability of the LPS symbol, computing a second test value Z2 derived from the lower bound A and from the current estimate P of the probability of the LPS symbol, and CA 02244380 2001-07-11 setting the test value Z to the lesser of Z1 and Z2;if C is greater than Z: placing an MPS at the current position in the decoded symbol string, and setting the lower bound A to the test variable Z for use in decoding of a next position in the symbol string;and if C is less than Z: placing an LPS at the current position in the decoded symbol string, and computing a new lower bound A and a new binary fraction C for use in decoding of the next position in the decoded symbol string.
  6. 26
    A method of decoding coded data into a decoded symbol string, the decoded data represented by a symbol string of more probable symbols (MPS”) and less probable symbols (LPS), the method comprising:receiving a segment of coded data interpreted as a binary fraction, for a position in the decoded symbol string: defining an interval of possible values of the coded data, the interval bounded by 1 and a lower bound, computing a test variable that divides the interval into two sub-intervals according to relative probabilities that the symbol should be occupied by the MPS or the LPS, a first sub-interval extending from 1 to the test variable and associated with the MPS, a second sub-interval extending from the test variable to the lower bound and associated with the LPS, the computing step comprising: computing a first test value Z1 derived from the lower bound A and from a current estimate P of the probability of the LPS symbol, computing a second test value Z2 derived from the lower bound A and from the current estimate P of the probability of the LPS symbol, and setting the test value Z to the lesser of Z1 and Z2;when the coded data segment occupies the first subinterval, placing an MPS in the position, and CA 02244380 2001-07-11 when the coded data segment occupies the second subinterval, placing an LPS in the position.
  7. 27
    A method of decoding coded data into decoded data, the decoded data represented by a symbol string of more probable symbols (MPS) and less probable symbols (LPS), the method comprising:receiving a segment of coded data interpreted as a binary fraction, for a position in the decoded symbol string, defining an interval of possible values of the coded data, the interval bounded by 1 and a lower bound, computing a test variable that divides the interval into two sub-intervals according to relative probabilities that the symbol should be occupied by the MPS or the LPS, a first sub-interval extending from 1 to the test variable and associated with the MPS, a second sub-interval extending from the test variable to the lower bound and associated with the LPS, computing a fence variable to be the lesser of the coded data segment and 1/2, and when the test variable is less than the fence variable, placing an MPS in the position.
  8. 32
    A method of decoding coded data into decoded data, comprising the steps of:receiving a segment of coded data interpreted as a binary fraction, for a position in the decoded symbol string, defining an interval of possible values of the coded data, the interval bounded by 1 and a lower bound, computing a test variable that divides the interval into two sub-intervals according to relative probabilities that the symbol should be occupied by the MPS or the LPS, a first sub-interval extending from 1 to the test variable and associated with the MPS, a second CA 02244380 2001-07-11 3 5 sub-interval extending from the test variable to the lower bound and associated with the LPS, computing a fence variable to be the lesser of the coded data segment and 1/2, decoding an MPS for the position when either of the following conditions occur: the test variable is less than the fence variable, and when the test variable is less than the segment of coded data, and decoding an LPS for the position and performing LPS adaptation when neither of the conditions occur.
  9. 34
    A method of decoding coded data, the coded data representing a sequence of symbols including a most probable symbol (MPS) and a least probable symbol (LPS), the method comprising:receiving a segment of the coded data as a fractional value;initializing a variable representing a lower limit on possible values of the segment of coded data to equal zero;and iteratively, calculating a test variable that divides an interval from the lower limit to one according to relative probabilities that a next symbol to be decoded is an LPS or an MPS, CA 02244380 2001-07-11 calculâting a fence variable representing the lesser of one half and the value of segment of coded data, decoding the next symbol to be an MPS when the test variable is less than the fence variable, otherwise, decoding the next symbol to be an MPS when the test variable is less than the value of segment of coded data, otherwise, decoding the next symbol to be an LPS, when an MPS is decoded, setting the lower limit for a next iteration equal to the test variable, and when an LPS is decoded, setting the lower limit and the segment of coded data equal to their respective values for the instant iteration added by an amount equal to the difference between the test variable and 1.
  10. 37
    A decoder adapted to perform the following functions :receive a segment of the coded data as a fractional value ;initialize a variable representing a lower limit on possible values of the segment of coded data to equal zero;and iteratively, CA 02244380 2001-07-11 calculate a test variable that divides an interval from the lower limit to one according to relative probabilities that a next symbol to be decoded is an LPS or an MPS, calculate a fence variable representing the lesser of one half and the value of segment of coded data, decode the next symbol to be an MPS when the test variable is less than the fence variable, otherwise, decode the next symbol to be an MPS when the test variable is less than the value of segment of coded data, otherwise, decode the next symbol to be an LPS, when an MPS is decoded, set the lower limit for a next iteration equal to the test variable, and when an LPS is decoded, set the lower limit and the segment of coded data equal to their respective values for the instant iteration added by an amount equal to the difference between the test variable and 1.
  11. 40
    A method for simultaneously decoding coded data into a decoded symbol string populated with symbols of a CA 02244380 2001-07-11 first and second kind, and for adapting a plurality of integer states whose values are representative of a probability distribution of the symbols , comprising the steps of :receiving a segment of coded data interpreted as a binary fraction C;for each position in the decoded symbol string: determining which integer state is representative of the probability distribution of the symbol located at said position in the decoded symbol string;defining a coding interval of possible values of C, the interval extending from a variable lower bound A to a constant upper bound 1 ;retrieving a parameter P L ps from a table indexed by the integer state, said parameter P L ps approximating a probability of occurrence of the LPS at the position in the decoded symbol string;computing a test value Z subdividing the coding interval in sub-intervals in accordance with the value of Plps, a first sub-interval extending from the lower bound A to the test value Z, the second sub-interval extending from the test value Z to 1;if C is less than Z: placing the LPS at the current position in the decoded symbol string, computing a new lower bound A and a new binary fraction C for use in decoding of the next position in the decoded symbol string, and CA 02244380 2001-07-11 modifying the value of said integer state to a new integer representing an increased estimated probability of the LPS;if C is greater than Z: placing the MPS at the current position in the decoded symbol string, setting the lower bound A to the test variable Z for use in decoding of the next position in the symbol string, retrieving a threshold parameter M from a table indexed by the integer state, said table containing different threshold values for different integer states, if A is greater than M, modifying the value of said integer state to a new integer representing a decreased estimated probability of the LPS.
  12. 41
    A method for simultaneously decoding coded data into a decoded symbol string populated with symbols of a first and second kind, and for adapting a plurality of integer states whose values are representative of the probability distribution of the symbols, comprising the steps of :receiving a segment of coded data interpreted as a binary fraction C;for each position in the decoded symbol string: determining which integer state is representative of the probability distribution of the symbol located at said position in the decoded symbol string;CA 02244380 2001-07-11 determining one of the symbol kinds to be a most probable symbol (MPS), the other to be a least probable symbol (LPS), defining a coding interval of possible values of C, the interval extending from a variable lower bound A to a constant upper bound 1 ;retrieving a parameter P IjPS from a table indexed by the integer state, said parameter P LPS approximating the estimated probability of occurrence of the LPS at said position in the decoded symbol string;computing a test value Z subdividing the coding interval in sub-intervals in accordance with the value of parameter P LPS , a first sub-interval extending from the lower bound A to the test value Z, the second sub- interval extending from the test value Z to 1, if C is less than Z : placing the LPS at the current position in the decoded symbol string, and computing a new lower bound A and a new binary fraction C for use in decoding of the next position in the decoded symbol string, and modifying the value of said integer state to a new integer representing an increased estimated probability of the LPS;and if C is greater than Z: placing the MPS at the current position in the decoded symbol string, setting the lower bound A to the test variable Z for use in decoding of the next position in the symbol string, and CA 02244380 2001-07-11 retrieving a threshold parameter M from a table indexed by the integer state, said table containing different threshold values for integer state, and if Z is greater than M, modifying the value of said integer state to a new integer representing a decreased estimated probability of the LPS.
  13. 42
    A method for decoding coded data into a decoded symbol string populated by more probable symbols (MPS) and less probable symbols (LPS), the method comprising the steps of :receiving a segment of coded data interpreted as a binary fraction C;defining a coding interval of possible values of C, the interval extending from a variable lower bound A to a constant upper bound 1;retrieving, from an index table, a parameter (Plps) approximating a probability of an LPS occurrence in the decoded symbol string and an increment parameter p representing an optimal increment of P LPS when an LPS symbol occurs in the symbol stream, for each position in the decoded symbol string: computing a test value Z subdividing the coding interval in sub-intervals in accordance with relative probabilities of an MPS and an LPS occurrence in the position, a first sub-interval extending from the lower bound A to the test value Z, the second sub-interval extending from the test value Z to 1, if C is less than Z: CA 02244380 2001-07-11 placing an LPS at the current position in the decoded symbol string, and computing a new lower bound A and a new binary fraction C for use in decoding of the next position in the decoded symbol string, and incrementing P LPS by p for a subsequent iteration;and if C is greater than Z: placing an MPS at the current position in the decoded symbol string, and setting the lower bound A to the test variable Z for use in decoding of a next position in the symbol string, and comparing the lower bound A with a threshold value m in [1/2-p, 1/2] and, if A m, reducing p for a subsequent iteration to a value representing a decreased estimated probability of an LPS occurrence.
  14. 43
    A method for decoding coded data into a decoded symbol string populated by more probable symbols (MPS) and less probable symbols (LPS), the method comprising the steps of :receiving a segment of coded data interpreted as a binary fraction C;defining a coding interval of possible values of C, the interval extending from a variable lower bound A to a constant upper bound 1;retrieving, from an index table, a parameter (Plps) approximating a probability of an LPS occurrence in the decoded symbol string and an increment parameter p CA 02244380 2001-07-11 representing an optimal increment of P LPS when an LPS symbol occurs in the symbol stream, for each position in the decoded symbol string: computing a test value Z subdividing the coding interval in sub-intervals in accordance with relative probabilities of an MPS and an LPS occurrence in the position, a first sub-interval extending from the lower bound A to the test value Z, the second sub-interval extending from the test value Z to 1, if C is less than Z: placing an LPS at the current position in the decoded symbol string, and computing a new lower bound A and a new binary fraction C for use in decoding of the next position in the decoded symbol string, and incrementing P ]jPS by p for a subsequent iteration;and if C is greater than Z: placing an MPS at the current position in the decoded symbol string, and setting the lower bound A to the test variable Z for use in decoding of a next position in the symbol string, and comparing the test value Z with a threshold value m in [1/2-p, 1/2] and, if Z m, reducing p for a subsequent iteration to a value representing a decreased estimated probability of an LPS occurrence.
  15. 44
    A method for decoding a coded string into a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS), comprising:CA 02244380 2001-07-11 interpreting the;coded string as a binaryfraction;creating a coding interval defined by a variable lower bound value and 1 ;calculating a test value;dividing the coding interval into lower subinterval and an upper subinterval, the lower subinterval extending from the lower bound value to the test value and the upper subinterval extending from the test value to 1;placing an LPS into the symbol string and incrementing the lower bound value and coded string by a lies within predetermined amount when the coded string the lower subinterval, the predetermined amount being equal to the quantity 1 minus the test value;and placing an MPS into the symbol string and setting the lower bound value equal to the test value when the coded string lies within the upper subinterval.
  16. 50
    The method of claim 49, wherein k = 1/4.
  17. 52
    The method of claim 49, further comprising :of calculating a fence value to be the lesser the code string or 1/2;and CA 02244380 2001-07-11 placing an MPS into the symbol string and setting the lower bound value equal to the test value if the first intermediate test value is less than the fence value .
  18. 56
    A method for encoding a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS) into a coded string, comprising:calculating a test value ;incrementing a variable lower bound value and an accumulator value by a predetermined amount when the symbol to be coded is an LPS, the predetermined amount being equal to the quantity 1 minus the test value;setting the lower bound value equal to the test value when the symbol to be coded is an MPS;calculating an accumulator difference value as the quantity 1 minus the accumulator value;and placing the most significant bit of the accumulator difference value into the coded string and shifting the CA 02244380 2001-07-11 bits of the lower bound value and the accumulator value one bit position to the left when the lower bound value is less than 1/2.
  19. 60
    The method of claim 59, wherein k = 1/4.
  20. 62
    An apparatus for decoding a coded string into a symbol string populated by more probable symbols (MPS) CA 02244380 2001-07-11 and less probable symbols (LPS), comprising a processor adapted to:interpret a coded string as a binary fraction;create a coding interval defined by a variable lower bound value and 1;calculate a test value;divide the coding interval into a lower subinterval and an upper subinterval, the lower subinterval extending from the lower bound value to the test value and the upper subinterval extending from the test value to 1 ;place an LPS into the symbol string and increment the lower bound value and coded string by a predetermined amount when the coded string lies within the lower subinterval, the predetermined amount being equal to the quantity 1 minus the test value;and place an MPS into the symbol string and set the lower bound value equal to the test value when the coded string lies within the upper subinterval.
  21. 63
    The apparatus of claim 62, wherein said processor is further adapted to :re-normalize the lower bound value and the coded string when the most significant bit positions of the lower bound value and the coded string are equal to 1;and consume the most significant bit positions of the lower bound value and the coded string. CA 02244380 2001-07-11
  22. 72
    An apparatus for encoding a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS) into a coded string, comprising a processor adapted to:calculate a test value;increment the lower bound value and the accumulator value by a predetermined amount when the symbol to be coded is an LPS, the predetermined amount being equal to the quantity 1 minus the test value;set the lower bound value equal to the test value when the symbol to be coded is an MPS ;calculate an accumulator difference value as the quantity 1 minus the accumulator value;and place the most significant bit of the accumulator difference value into the coded string and shift the bits of the lower bound value and the accumulator value one CA 02244380 2001-07-11 bit position to the left when the lower bound value is less than 1/2.
  23. 77
    An encoded data signal representing a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS) generated according to the process of :calculating a test value;incrementing a variable lower bound value and an accumulator value by a predetermined amount when the CA 02244380 2001-07-11 symbol to be coded is an LPS, the predetermined amount being equal to the quantity 1 minus the test value;setting the lower bound value equal to the test value when the symbol to be coded is an MPS ;calculating an accumulator difference value as the quantity 1 minus the accumulator value;and placing the most significant bit of the accumulator difference value into the coded string and shifting the bits of the lower bound value and the accumulator value one bit position to the left when the lower bound value is less than 1/2.
  24. 80
    The data signal of claim 79, wherein k = 1/4. CA 02244380 2001-07-11
  25. 82
    A computer-readable medium having stored thereon a plurality of instructions for decoding a coded string into a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS), which, when executed by a processor, cause the processor to:interpret a coded string as a binary fraction;create a coding interval defined by a variable lower bound value and 1;calculate a test value;divide the coding interval into a lower subinterval upper subinterval, the lower subinterval extending from the lower bound value to the test value and the upper subinterval extending from the test value to 1;place an LPS into the symbol string and increment the lower bound value and coded string by a predetermined amount when the coded string lies within the lower subinterval, the predetermined amount being equal to the quantity 1 minus the test value;and place an MPS into the symbol string and set the lower bound value equal to the test value when the coded string lies within the upper subinterval.
  26. 84
    The computer readable medium of claim 83, wherein the decoding is completed when all the bits in the coded string are consumed.
  27. 85
    The computer readable medium of claim 83, further comprising instructions that cause the processor to :shift the bits of the coded string one position to the left;and add a new coded bit to the least significant bit position of the coded string.
  28. 88
    The computer readable medium of claim 87, wherein k = 1/4
  29. 89
    8 9. The computer readable medium of claim 82, further comprising instructions that cause the processor to :calculate a fence value to be the lesser of the code string or 1/2;and place an MPS into the symbol string and set the lower bound value equal to the test value if the first intermediate test value is less than the fence value.
  30. 92
    A computer-readable medium having stored thereon a plurality of instructions for encoding a symbol string populated by more probable symbols (MPS) and less probable symbols (LPS) into a coded string, which, when executed by a processor, cause the processor to:CA 02244380 2001-07-11 calculate a test value;increment the lower bound value and the accumulator value by a predetermined amount when the symbol to be coded is an LPS, the predetermined amount being equal to the quantity 1 minus the test value;set the lower bound value equal to the test value when the symbol to be coded is an MPS;calculate an accumulator difference value as the quantity 1 minus the accumulator value;and place the most significant bit of the accumulator difference value into the coded string and shift the bits of the lower bound value and the accumulator value one bit position to the left when the lower bound value is less than 1/2.
Independent claims30