Concurrent detection of errors in arithmetic data compression coding

Abstract: Method and means are disclosed for detecting any single errors introduced into an arithmetic data compression code string as a result of coding, transmission, or decoding through testing according to a modulo-n function, n being an odd number not equal to +1 or -1, an arithmetic compression coded data stream C′(s) generated by n-scaling an arithmetically recursive function that produces a non-scaled arithmetically data compressed code stream C(s) as a number in the semi-open coding range [0,1).

Description: The present invention is directed at the problem of discovering error as quickly as possible anywhere in the total process of handling messages compressed arithmetically by a preferably parallel uniform operation. We have discovered a solution to the above for a binary basis of notation which is believed to generalise to any other basis of notation. The total process of handling arithmetic compression can be regarded as a recursive compression process, followed by a simplex transmission and/or storage and retrieval process, followed by a recursive decompression process. According to the invention, by scaling each number generated during the encoding recursions by n, where n is prime relative to the basis of notation, i.e., by an odd number equal to or greater than 3 or equal to or less than -3 for binary logic and transmission where the basis of notation is 2, but ±2, ± 4, ± 5, ±7... for ternary, where the basis of notation is 3, the application of a modulo n operation anywhere in the total process after the scaling point will register most immediate errors at that point at the end of any recursion and during transmission and/or storage and retrieval, if the result of the modulo n operation is non-standard. It is pointed out that, as usual, some multiple errors cancel and will not be detected. In practical terms, the basis of notation is 2 and the standard result is "all zero's", the former being custom and the latter being sensibly the easiest to test for. Such a checking process can be applied in parallel to the message handling and, as far as compression and decompression recursions are concerned makes its result available there and then, rather than at the end of the total recursive process. The basis of arithmetic compression is that, if all possible messages, and in this context, a message is not restricted to text, of a given length are given appropriate subintervals of the interval [0 to 1), identifying the subinterval identifies the message and adding to the message, implies the further subdividing of one and only one existing subinterval, usually, by altering only one boundary thereof. Thus errors in encoding and decoding are intermittently cumulative and their discovery, as it were, at source by simply extending the interval from [0 to 1) to [0 to a selected n) by scaling at each recursion is both unexpected and distinctly advantageous and the more so as it applies equally to the handling of the compressed message between compression and decompression. Apart from two generalised claims, the remainder of this specification is couched in terms of a binary basis of notation. In terms of a binary basis of notation, the invention relates to detecting at least single-bit errors occurring in an arithmetic data compression code string C(s), embodied as a number in the semi-open coding range [0,1), the code stream C(s) being computed according to an arithmetically recursive function. The extends to detection of single-bit errors produced by an arithmetic encoder, introduced into the code channel, or produced by an arithmetic decoder as enabled by n-scaling of the recursive function conventionally used to produce a compressed binary representation C′(s) in the semi-open coding range [0,1) and testing C′(s) by a modulo-n function for a non-standard, usually a non-zero, residue. Arithmetic compression codes are established in the prior art and may be understood for the binary source case by reference to Langdon and Rissanen, "A Simple General Binary Source Code," IEEE Transactions On Information Theory, Volume IT-29, No. 5, September 1982. The following issued United States patents trace the development of arithmetic data compression coding, and are incorporated herein by reference: U.S. Patent No. 4,122,440, of Langdon, Jr. et al.; U.S. Patent No. 4,286,256, of Langdon, Jr. et al.; U.S. Patent No. 4,295,125, of Langdon, Jr.; and U.S. Patent No. 4,467,317, of Langdon, Jr. et al. These references generally relate to the theory of arithmetic compression coding and offer a number of encoder embodiments useful for operating on unencoded data streams drawn from binary alphabets. As taught in U.S. Patent No. US-A-4,467,317, high-speed arithmetic data compression coding is a sequential process that recursively adds augends to the significant end of a so-far generated code string C(s) in response to an unencoded data string s. As stated in the referenced patent, the coding process depends upon coding parameters provided by a statistical model of the string. (As in the past, the inventors here are concerned only with the process of coding, the modeling process being well understood. Arithmetic data compression coding generates an arithmetic code stream C(s) which is a number contained in the semi-open coding range [0,1). In the general case, the source string s consists of m-ary symbols. The next symbol i in s to be encoded has a joint probability that depends upon the probability of the portion of s that has preceded i. It should be evident that as i occurs further toward the end of the string s, its joint probability declines. Operatively, the arithmetic coding process reflects this attenuation of the joint probability of i by successively subdividing the available coding range. A subinterval of the range corresponding to the portion of the string s preceding i that has already been encoded is defined by a lower bound, C(s), positioned in the range, and a value A(s) that sizes the subinterval. Thus, the subinterval corresponding to the portion of the coding range available to encode i is expressed as [C(s),C(s)+A(s)). During the cycle of the recursive function in which the next symbol i is encoded, the subinterval magnitude A(s) is subdivided into as many parts as there are source symbols, with each part's magnitude corresponding to the conditional probability of the source symbol represented. The augend, the value added to C(s) to encode the next symbol i, is the sum of the conditional probability magnitudes of the symbols preceding i in the source alphabet. This, of course, implies the imposition of some prearranged order on the source alphabet, and in the binary source coding construct of U.S. Patent No. 4,467,317, this arbitrary order is: LPS (least-probable symbol), MPS (most-probable symbol). Subdivision of A(s) for the purpose of encoding the next symbol i requires partitioning the present interval size A(s) into as many parts as there are symbols in the source alphabet. In the art, the magnitudes of the subdivisions are approximated according to a control parameter k provided by the source model. For the binary source alphabet, two sizes result from subdividing A(s), with one being assigned to the MPS and the other to the LPS. The prior art subdivision operation results in the following specific magnitudes: size 1: A(s) '' (1 - 2 -k ) (1a) size 2: A(s) '' 2 -k (1b) resulting in the following subinterval coding: If LPS: [C(s), C(s) + size 1) (2a) If MPS: [C(s) + size 1, C(s) + size (2)) (2b) As can be seen from inspection of the MPS subinterval structure, an augend, size 1, is added to C(s) to form a new lower bound. Equations (2a) and (2b) imply that the action of an arithmetic encoder is sequential in the sense that a coding step is undertaken in response to each symbol in the string s. Further, the procedure is recursive in the sense that the resulting code string value C(s) and the current subinterval magnitude A(s) are modified each step to a value determined by their respective values at the end of the previous step. The prior art arithmetic data compression coding recursions for the binary alphabet are as follows: For each MPS: C(s '' MPS) = C(s) + 2 -k (3a) A(s '' MPS) = A(s) - 2 -k (3b) For each LPS: C(s '' LPS) = C(s) (3c) A(s '' LPS) = 2 -k (3d) In this prior art, decoding involves recursive examination of the magnitude of the most significant part of the code string C(s) and determining whether the current augend exceeds the remaining numerical value of the code string. Each such examination involves a trial subtraction in which the augend is tentatively subtracted out of the code string. If the trial result is negative, the subtraction is nullified and the current symbol is decoded as LPS, otherwise, the subtraction is let stand and the symbol is decoded as MPS. The algorithms for compressing and decompressing the string s involve the execution of binary numeric methods to produce C(s) and to recover the decoded string s. As is known, the procedures employed to encode and decode according to the recursions 3(a) - 3(d) result in high-entropy code strings, which provide no evidence to deduce whether the string was subject to random errors. Since, it is expected that, in the usual operational environments, an encoded data stream will be subjected to error sources which will corrupt its information content, it is essential to provide a means for protecting the integrity of the information. One means of detecting potential errors within an arithmetic encoder, an arithmetic decoder, and a channel over which an arithmetic code string is transmitted is suggested by "AN" arithmetic error coding. "AN" arithmetic error coding is a technique in which a first integer N, is encoded by multiplying it with a constant second integer A, to increase its redundancy and thereby obtain error protection. Inspection of the first integer's AN representation by dividing it with the second integer, will reveal errors in the first integer when the result of such a division does not have a remainder of zero. Note that the second integer, A, must be odd and not equal to 1 in order to provide single error detection. To avoid confusion with earlier use of the symbol "A" in arithmetic compression coding, we will hereafter use the symbol "n" to represent the integer multiplication factor normally called "A" in "AN" arithmetic error coding. We will continue to use the established conventions in these fields for positioning the binary point when describing a code stream as a binary number: (1) For arithmetic compression coding the binary point is left of the most-significant-bit of the code stream; (2) For arithmetic error coding the binary point is right of the least-significant-bit of the code stream. The technical difficulty met by this invention is that of protecting data integrity in the binary representations of arithmetically compressed code strings, even during their encoding and decoding processes. The problem is that of evaluating the integrity of arithmetically-compressed strings at all the critical points of string coding, transmission, and decoding. In the architecture of systems that require arithmetic compression of data, concern is often expressed regarding the ability of the system to detect errors in all of the code data stream path parts, including the coder and the decoder as well as the transmission channel between them. The invention provides this ability without requiring total decompression of the code string. This error detection ability entails the very low cost of increasing the bit count of an arithmetically- encoded stream by one to two bits. The simplicity of the procedure and the additional implementing hardware enhances the significance of the invention and makes the added cost trivial in comparison. The invention provides a method for detecting single-number-element errors during the recursive machine encoding of a symbol string s to produce a compressed multi-element-number C(s) as a representation of s, C(s) being a number in the semi-open interval [0,1), the interval being successively subdivided during successive encoding cycles, each subinterval being defined by its lower bound C(s) and a variable A(s) such that [C(s), C(s) + A(s)); the values of C(s) and A(s) being computed as arithmetically recursive functions of C(s) and A(s), wherein the basis of the notation used is m; the method comprising the steps of: scaling the arithmetically recursive functions by n, n being a number which is prime relative to m; transforming s into a compressed and error encoded representation C'(s) in the semi-open interval [0,n); and testing C'(s) by generating a modulo-n function and examining it for a non-standard residue to detect malfunction. The invention is founded on the critical observation that the method of arithmetic encoding involves a recursive function operating on a semi-open coding interval [0,1). Since arithmetic error coding basically involves the sequential multiplication of integer operands of a second constant integer, error coding insertion can be synchronised with the sequential performance of the recursive arithmetic compression function. Further, in binary operation the error coding is free to select any constant integer for n from the set of all odd integers not equal to one, since the compression coding function operates on an interval bounded by 0 and 1 which can without loss of generality be n-scaled to be bounded by 0 and n. Finally, the architecture of prior art arithmetic coders being based on serially-connected, functionally discrete units; the redundant error coding interger n can be multiplied with an early parametric representation of the codewords (augends) that build up the code, thereby permitting all portions of the code downstream from such parametric representation to be error-checked. The invention also provides an arithmetic encoder for the recursive machine encoding of a symbol string s to produce a compressed multi-element-number C(s) as a representation of s, C(s) being a number in the semi-open interval [0,1), the interval being successively subdivided during successive encoding cycles, each subinterval being defined by its lower bound C(s) and a variable A(s) such that [C(s), C(s) + A(s)); the values of C(s) and A(s) being computed as arithmetically recursive functions of C(s) and A(s) by generating a coding variable based upon a coding parameter representing the conditional probabilities of the symbols of s at their locations in s, wherein the basis of the notation used is m; said encoder including: a register C for containing the working end portion of C(s) resulting from the encoding of the portion of s preceding the next symbol i; a register A for containing A(s) as a normalising factor; an arithmetic logic means responsive to the coding parameter for the next symbol i for numerically adjusting the contents of C and A based on the conditional probability of i at its position in s and for shifting the contents of C and A in a predetermined magnitude direction based on the adjusted contents of A, such that C(s) includes the successive shifted contents of C; means for scaling the coding variable value for i by n, n being a number which is prime relative to m; and modulo means for testing the contents of C according to a modulo-n function for a non-standard residue. The invention further provides an arithmetic decoder of the type which receives an arithmetically compressed symbol-string C'(s) and generates therefrom successive symbols b(i) of a binary symbol string s=b(1), ...b(i)... b(n), wherein the arithmetically compressed symbol string C'(s) is a number in a semi-open interval [0, n), n being prime relative to the basis of the notation used, comprising means for generating a trial coding variable based upon a coding parameter (k); means for arithmetically testing the trial coding variable using recursively generated values of parameters A(s) and C(s) against the w most significant bits of the compressed string; means for decoding the next symbol b(i) of the string s based upon the outcome of the testing; and characterised by means for detecting single-number element errors comprising: means for scaling the trial coding variable by n; and means for testing C'(s) prior to the generation of b(i) using a modulo-n function and examining for a non-standard residue. The present invention will be described further by way of example with reference to embodiments thereof as illustrated in the accompanying drawings in which:- Figure 1 is a block diagram illustrating the interface of an unencoded binary source symbol stream s with its arithmetically-encoded representation C(s) and the inverse interface of C(s) with its decoded stream S; Figure 2 is a block diagram of the prior art binary source arithmetic compression encoder of Figure 1; Figure 3 illustrates a block diagram of the Figure 2 encoder adapted for practising the invention; Figure 4 illustrates the logic of a three-state machine for serially monitoring an arithmetically error-encoded stream for a modulo-3 non-zero residue; Figure 5 is a state diagram of a multi-state machine for testing modulo-3 for a non-zero residue in a binary code stream; Figure 6 is a block diagram of a binary source arithmetic compression decoder adapted for practicing the invention; and Figure 7 illustrates an example of error-checking an arithmetically error-encoded data stream. Figure 1 illustrates a block diagram of a system for arithmetically compressing an unencoded source symbol stream s. A binary signal source 10 provides the unencoded source stream s on a single line 12 to a statistical modeling unit 14 and an encoder 15. As is known, the modeling unit 14 operates on the occurrence history of the symbol stream s to provide a control parameter k on a single line 16. The parameter k corresponds to the conditional probability of an LPS for the next symbol i in the symbol stream s. Viewed from another aspect, the parameter k indicates the probability interval used for subdividing the current coding range. An indication is provided on signal path 18 to signify that the next symbol i is equal to a predetermined symbol b m in the source alphabet from which the symbols of the stream s are drawn. In the arithmetic coding prior art regarding binary symbol streams, the indication on line 18 indicates whether the symbol to be encoded is either the most probable (MPS) or the least probable (LPS). The encoder 15 implements a recursive arithmetic function to produce the encoded stream C(s) in response to the inputs on lines 16 and 18. The coded stream is transported on signal line 24 to an arithmetic decoder 26 operating in conjunction with a modeling unit 28 to extract the symbol stream s from the encoded stream C(s). In this regard, the modeling unit 28 corresponds to the modeling unit 14 in that it estimates the LPS symbol probability and provides the estimate in the form of a parameter k on the signal line 30. The decoder unit 26 also provides an indication of whether the currently-decoded symbol is MPS or LPS on signal line 31. The decoded symbol stream s is output from the decoder 26 on signal line 32 and fed back on signal line 34 to the modeling unit 28. In the prior art, the encoder 15 implements the recursions (3a) - (3d) for the next symbol i of the symbol stream s (present on signal line 18) in response to the probability value provided by the modeling unit 14 on the signal line 16. The action of the encoder is binary. Thus, the interval representations for C(s) and A(s) are expressed as binary numbers. As taught in U.S. Patent No. 4,467,317, it is necessary to maintain the alignment of the binary expressions for A(s) and C(s) in order to add the augend to the current code string at the proper place. Once addition is completed, the "working end" of the code string C(si), encompassing the w least significant bits of the string, is realigned to move the completed significant bits of the code string out of the working location of the encoder. Renormalisation and realignment are accomplished in a procedure that reduces the required arithmetic operations to a minimum complement. If i = LPS, the unnormalised subinterval in equation (3d) is 2 -k , expressed in binary form as 0.00...0100. Normalisation of the variable A(sLPS) to 1.00...0, requires shifting the binary representation of 2 -k to the left by k positions. The unnormalised significant bits of the code string C(sLPS) are unchanged from the previous cycle and require only a k-bit shift leftward. When the next symbol i is MPS, the value of the coding variable A(sMPS) is given by equation (3b) and the unnormalised code string is given by (3a). If equation (3b) reduces the value of A(sMPS) to less than one, it can be renormalised by shifting left one bit resulting in realignment of the significant end of the code string. This also requires shifting C(sMPS) in lock step with A(sMPS). In this case, where the source string s is binary, arithmetic data compression coding according to the recursions of (3a) - (3d) can be carried out in terms of two registers, A and C, according to the following algorithm: ARITHMETIC CODING ALGORITHM Initialisation: A x 1.000...0 (binary) C x 0.000...0 (binary) if next symbol i = MPS, then A x A - 2 -k C x C + 2 -k and, if A < 1, renormalisation is executed as: A x 2A C x 2c if next symbol i = LPS, then A x 2 -k and C and A are shifted in unison until the contents of A = 1.00...0 (binary) In performing the explicated encoding algorithm, the registers A and C are initialised to define the above- described semi-open coding interval [0,1). Then, if the next symbol i = MPS, the k parameter provided by the modeling unit 14 is converted to 2 -k , which is subtracted from the contents of A and added to the contents of C. Then, the contents of A are inspected and, if less than 1, A and C are shifted in lock-step by one bit. Assuming that A and C are conventional binary registers, whose contents are interpreted in high-to-low order position magnitude, the shifting operation results in conventionally serially shifting the contents of A and C in the direction of greatest magnitude. Similarly, if the next symbol i = LPS, the contents of A are simply reinitialised, while the contents of C are shifted in the high-magnitude direction by k places. The bits successively shifted from the high-magnitude end of register C form the code string C(s). Figure 2 illustrates an embodiment of a prior art arithmetic encoder that operates according to the proposed encoding algorithm. In the prior art encoder, the parameter k is provided to a transform unit 40 which produces the value 2 -k on signal line 41. This value, together with the MPS/LPS indicator on signal line 18, is provided to a pair of conventionally-structured arithmetic logic units (ALU) 42 and 44. The ALU's 42 and 44 operate on the contents of the C and A registers 46 and 48, respectively. The ALU 42 also receives as inputs the contents of the register 46 and an indication from the ALU 44 on signal line 49 when the contents of the A register are less than 1. The ALU 42 parallel-loads the augmented value of C(si) into the register 46 on signal line 52, and then shifts the contents of the register in the high-magnitude direction according to a shift-control signal on signal line 53. The ALU 44 performs all of the arithmetic and logical operations necessary to manipulate the contents of the register 48, and provides the updated contents on signal line 55. The contents of the register 48 are then shifted in the high magnitude direction according to a shift control signal on signal line 56. In addition, the ALU 44 provides the indication on signal line 49 when the encoding of an MPS would result in an A-register content magnitude less than 1. The prior art also discloses a buffer 57 for manipulating the code string produced by shifting the contents of the register 46. Such manipulations include construction of fixed-length code string segments as well as bit-stuffing to account for a carryover in the arithmetic operations affecting the contents of C. The method of the invention is based on the observation that the encoding procedure and mechanism of the prior art can be adapted through scaling by the value n. The resulting algorithm, like the original one, still compresses the source stream s by successively subdividing the available coding space according to the probabilities of the incoming signals. However, while the prior art algorithm begins by dividing the semi-open coding range [0,1), the new procedure starts with the semi-open coding range [0,n). Therefore, if, for example, the first symbol is an LPS, it is assigned the subinterval [0,n ″ 2 -k ), whereas with the original algorithm it got only [0,2 -k ) for the same probability indicated by the parameter k. In general with m-ary source alphabets, for encoding the i'th symbol, the adapted algorithm ends with a coding interval [na i ,nb i ), if the original algorithm yielded [a i ,b i ). The adapted algorithm produces a code C′(s) which, when viewed as a number, is exactly n times larger than the unadapted. This produces a code-string length that differs from the old by an increase of only log₂n bits. In summary, the adaptation of the arithmetic compression algorithm for error encoding is as follows: ADAPTED CODING ALGORITHM Initialisation: A′ x n.00...0 (binary) C′ x 0.00...0 (binary) if next symbol i = MPS, then A′ x A′ - n ″ 2 -k C′ x C′ + n ″ 2 -k and, if A < n, renormalisation is executed as: A′ x 2A′ C′ x 2C′ if next symbol i = LPS, then A′ x n '' 2 -k and C′ and A′ are shifted in unison until the contents of A′ = n.00...0 (binary) The changes to the original algorithm represented by the adapted algorithm enable the detection of a single error in the encoding process. Assume that one bit of the C′(s) code stream is flipped by the encoder of Figure 2. This would amount to a difference of + 2 j from the correct numeric value of the code string C′(s), when the code string is regarded as an integer. In the absence of errors, C′(s) represents an integer c′ which is divisible by n, that is, c′ = 0 (modulo-n). When an error occurs, c′ + 2 j = 2 j (modulo-n), and since for any j, 2 j ≠ 0 (modulo-n), errors will be detected by observing a non-zero residue. It will be evident to the skilled artisan that, although multiple errors are not guaranteed to be detected (for example, 2 j + 2 j-1 = 0 (modulo-n)), there is still a 2/3 chance for detection. Preferably, the encoder of Figure 2 is adapted according to Figure 3 for practicing the invention. In Figure 3, a transform unit 60 receives the parameter k and provides the parameter 2 -k to a conventional multiplier circuit 62 which scales the value by n to produce n 2 -k . The multiplier circuit 62 can be a conventional multiplier synchronised to the operations of the decoder 60. Alternatively, the transform unit 60 can absorb the operations of the multiplier circuit 62 to form a compound transform unit which would produce the scaled value n 2 -k directly. This can be implemented, for example, in a read-only memory (ROM) look-up table. The scaled coding variable is provided to a pair of ALU's 64 and 66, which operate in the same manner as the corresponding ALU's in Figure 2 to control the C and A registers, indicated by reference numerals 68 and 70, respectively, according to the adapted algorithm described above. Now, the shifting operations performed on the contents of the C register 68 produce a code string C′(s) representing the multiplication by n of the code string C(s) obtained by the unadapted coding algorithm. A buffer 72 may be provided for the purposes of bit stuffing and byte assembly described above, yielding the modified code string C″(s). For error-checking purposes, the scaled code string C′(s) is serially conducted on signal line 73 to a serial modulo-n circuit 74 which inspects the scaled code string for a non-zero residue. The circuit 74 can comprise, for example, a modulo-n divider which produces a remainder R on signal line 75. The remainder R is tested by a conventional comparator 76 for a non-zero value. When the modulo-n division of the circuit 74 results in a non-zero remainder R ≠ 0, the comparator 76 provides an error E indication on signal line 77. It should be evident that the test circuit comprising the modulo-n divider 74 and the comparator 76 can be replicated in parallel or serial form and placed at any preselected strategic location to test for non-zero residue in the formation, transmission, or decoding of the scaled code stream C′(s). Thus, for example, the contents of the C register 68 can be parallel tested in the feedback path 80 between the register and the ALU 64, as can the output of the ALU 64 when transferred to the C register 68. Furthermore, it should be evident that the old and new contents of the A register can be tested for error by inserting a parallel modulo-n tester in each of the signal lines 84 and 86, respectively. The inputs to the A and C registers from the multiplier unit 62 can also be tested by a parallel modulo-n tester. Finally, a modulo-n test circuit can be provided at the output of the buffer 72 to error-test the output of the coder of Figure 3 if bit- stuffing is done appropriately to preserve C″(s) mod n = 0. Thus, it should be evident that the operational reliability of the coder of Figure 3 can be enhanced by early detection of single-bit errors anywhere in the code stream from the output of the multiplier 62 or a compound transform unit to the output of the buffer 72. The modulo-n unit 74 can be structured in a variety of ways to test for modulo-n residue. For example, a serial modulo-n unit can be structured as a serial unit to perform bit-by-bit division of the serial representation of the code stream C′(s). Alternatively, the unit 74 can be built and operated as a parallel divider to perform test operations on the contents of the C and A registers and the parallel outputs of the ALU's 64 and 66. In this case, it will be evident that this single-error checking methodology can also be used to check serially-created multiple-bit errors in the generation of the stream C′(s). An exemplary embodiment of a bit-by-bit serial tester embodiment of the unit 74 can be understood with reference to Figures 4 and 5, where it is assumed that n = 3. In Figure 4, a pair of set-reset (S-R) flip-flops 80 and 82 each have complementary outputs Q₁/ Q ₁ and Q₂/ Q ₂, respectively. The state of the flip-flop 80 is conventionally determined by the outputs of the gates 83-85. Similarly, the states of the flip-flop 82 result from the outputs of the gates 87-89. The flip-flops 80 and 82 form a three-state machine that serially tests the current symbol c j of the n-scaled code stream C′(s). The Figure 4 n-state machine is configured as a three-state machine assuming, as stated above, that n = 3 in the encoder of Figure 3. The states defined by the flip-flops 80 and 82 are taken as: state 0 = 00 ( Q ₁, Q ₂ = 1); state 1 = 10 (Q₁, Q ₂ = 1); and state 2 = 11 (Q₁, Q₂ = 1). The transitions between the states are shown in Figure 5 by the arrows interconnecting the states. It is further assumed for the purposes of the example, that the initial state is state 0, that is, that the flip-flops 80 and 82 are initially reset at the same time the contents of the A and C registers are initialised according to the adapted algorithm. Then, as the n-scaled code stream is produced by successive shifting of the C register, the bits shifted out of the C register are provided as the inputs to the gates 83, 84, 87, and 88. The resulting states of the flip-flops 80 and 82 are determined by the condition of their outputs (that is, by the current state of the three-state machine). At the end of each completed code string from the adapted coding algorithm, the state of the three-state machine of Figure 4 is inspected. If the three-state machine is in any state but state 0, the comparator 76 provides the error E indication. Essentially, the three-state machine of Figure 4 detects encoder errors by determining the residue of c(modulo-3), where c is the accumulated numeric value from the output of the encoder during the current coding cycle. Since both of the above algorithms provide a first-in-first-out code, built up with its most significant bit first, the three-state machine of Figure 4 advantageously computes the residue concurrently with computation of the code. In the state transition diagram of Figure 5, each state is designated as a possible current residue. Thus, in state 0, the residue is 0, in state 1 the residue is 1, while in state 2 the residue is 2. It should be noted that if bit-stuffing is implemented in the buffer 72, the three- state machine of Figure 4 can be adapted by the bit stuffer to accommodate the slight changes in the code stream C′(s). However, to guarantee that the code stream C″(s), after bit stuffing in the buffer 72, has a residue of 0 when it is error-free (i.e., C″(s) mod n = 0) requires that b bits be stuffed containing one of p = 0,1,2,...,P permissible binary states. For n odd and not equal to +1 or -1, b must be a positive integer such that 2**b - 1 = P '' n , an integer multiple of n. The permissible states for a given set of b bits are of the form p ″ n, with P '' n < 2**b - 1 . For example, if n = 3, b = all positive integer multiples of 2. For b = 2, P = 1 and p = >00,11½. Similarly, if n = 5, b = all positive integer multiples of 4. For b = 4, P = 3 and p = >0000,0101,1010,1111½. To clarify the way the three-state machine of Figure 4 operates, consider the example of dividing by three the code string c = 101011. The conventional division is illustrated in Figure 7, with the code string c in binary representation being divided by the value 11 (binary) , equivalent to 3 (decimal) . As shown in Figure 7, R of each step of the division is indicated by the state of the Figure 4 three-state machine. In turn, the state of the three-state machine is determined by the current symbol c j of the symbol stream in combination with the prior state of the machine. Thus, the machine of Figure 4 is initialised to state 0 and transitions, with the first bit (c₀ = 1) to state 1. The fact that the last state is state 1 is indicative of either an incomplete code string or an error in a complete code string. Decoding according to the prior art is easily understood by reference to Figure 6 and the below-described decoding algorithm. Non-scaled decoding is done by initialising the w bit wide register C with the most significant w bits of the code string C(s), and setting A to 1.00...0. Then, for each incoming bit of the code string C(s), the decoding operation performed is based upon a trial subtraction of a coding variable. The symbol which is decoded depends upon the result of arithmetically testing the coding variable against the code string C(s). In the binary case, according to the prior art the test is: C - 2 -k (where k is provided by the modelling unit). If C - 2 -k > 0 , an MPS is decoded; then the contents of C and A are both reduced by 2 -k . If this results in the contents of A being less than 1, renormalisation occurs, with the most significant portion of C(s) shifted into C. If the difference is less than 0 an LPS is decoded, 2 -k is placed in A and both A and C are shifted in unison, with the next k most significant bits of C(s) shifted into C, until A = 1.00...0. The decoding algorithm is expressed as follows: DECODING Initialisation: A x 1.00...0 C x (first w most significant bits of C(s)) if C - 2 -k > 0, MPS decoded, and A x A - 2 -k C x C - 2 -k then, if A < 1, shift A and C in unison, with most significant portion of C(s) shifted into C, until A = 1.0...0; but if C - 2 -k < 0, LPS decoded, and A x 2 -k and A and C shifted in unison, with the next k most significant bits of C(s) shifted into C, until A = 1.00...0 When the encoding operation is scaled to produce C′(s), the above described decoding algorithm is adapted according to the invention as follows: ADAPTED DECODING ALGORITHM Initialisation: A′ x n.00...00 (binary) C′ x (first w most significant bits of C′(s)) if C′ - n 2 -k > 0, MPS decoded, and A′ x A′ - n ″ 2 -k C′ x C′ - n ″ 2 -k then, if A′ < n.0 (binary) , renormalisation is executed as A′ x 2A′ C′ x 2C′; but if C′ - n 2 -k < 0, LPS decoded, A′ x n ″ 2 -k and A′ and C′ are shifted in unison, with the next most significant bits of C′(s) shifted into C′ until A′ = 1.00...0. Figure 6 illustrates a decoder 90 that accepts the n-scaled code stream C'(s) and decodes it according to the adapted algorithm described above. In this regard, the decoder 90 includes a combined n-scaling transform unit 91 that produces an augend n '' 2 -k in response to k provided by a modeling unit (not shown). This n-scaled augend is provided to a pair of ALU's 92 and 94 that operate on the contents of the A and C registers, 96 and 98, respectively, according to the algorithm. A test logic circuit 100 tests the relationship of C - n 2 -k to 0 and makes the decoding determination whether i equals MPS or LPS. A buffer 99, operating on the incoming modified code stream C''(s), may be provided for the purpose of byte disassembly and bit unstuffing, yielding the n-scaled code string C'(s). The C'(s) input to the decoder 90 can be tested according to the means described above for the encoder by a serial modulo-n circuit 102 producing a residue tested by a comparator 103. Similarly, the output of the C register in the form of bits serially shifted out in response to the shifting in of most significant bits of C'(s) can be provided to the comparator 104. Since the successive subtractions performed on the contents of the C register will result in the shifted-out bits being 0 if the decoder operates correctly, the comparator 104 is also useful for detecting decoder errors. Further, it should also be evident that the parallel register-sourced inputs and the parallel numerical outputs of the ALU's 92 and 94 can be parallel modulo-n tested in the manner described earlier. It should be noted also that method and means for producing an arithmetic data compression code for a multi-character alphabet source stream is taught in United States Patent US-A-4 652 856, assigned to the assignee of this patent application, and incorporated herein by reference. This document corresponds to EP-A-0 231 736, which represents state of the art according to Article 54(3), EPC for the designed contracting states DE, FR, GB, IT. The multi-character alphabet arithmetic encoder of US-A-4 652 856 depends for its operation on statistics comprising occurrence counts of symbols in an unencoded string. The occurrence counts are provided by a modeling unit to an encoder for encoding into the semi-open coding range [0,1). The occurrence counts are related to the counting parameter k provided by the modeling unit for the binary source string, and support coding and decoding procedures which depend upon manipulation of an A and C register in a manner corresponding to that described above. Therefore, it would be evident to those skilled in the art that the invention described hereinabove with reference to a binary source stream could be practiced in the case of the invention taught in the incorporated United States patent US-A-4 652 856 simply by scaling the semi-open coding range to [0,n) and scaling the occurrence counts by n. In this regard, precisely the same residue testing as that taught above for both the encoder and the decoder would be performed to detect errors in the coded stream. For m-ary arithmetic compression coding, this description is also meant to cover other fixed, but arbitrary, orderings for the individual parts of the subinterval A(s). For example, instead of subdividing an interval with successive parts ordered by increasing conditional probabilities, the successive parts could easily be ordered by decreasing probabilities. Notwithstanding the previous descriptions of arithmetic coding where the subinterval is defined by [C(s),C(s)+A)), this description is also meant to cover the dual method where the subinterval is defined by the semi-open coding range (C(s)-A(s),C(s)]. For this dual, C(s) is an upper bound and is derived by subtracting the coding variables from an unscaled string initialised at 1.0. For the A-scaled codestring, the string is first initialised to A before subtracting any A-scaled subtrahends. The size of all unscaled or A-scaled subintervals are then computed as before. Decompression is accomplished by performing trial additions of the coding variables used in compression, to find the largest one that does not exceed the magnitude of the overall interval size (1.0; or A if error encoded).

Claims: A method for detecting single-number-element errors during the recursive machine encoding of a symbol string s to produce a compressed multi-element-number C(s) as a representation of s, C(s) being a number in the semi-open interval [0,1), the interval being successively subdivided during successive encoding cycles, each subinterval being defined by its lower bound C(s) and a variable A(s) such that [C(s), C(s) + A(s)); the values of C(s) and A(s) being computed as arithmetically recursive functions of C(s) and A(s), wherein the basis of the notation used is m; the method comprising the steps of: scaling the arithmetically recursive functions by n, n being a number which is prime relative to m; transforming s into a compressed and error encoded representation C'(s) in the semi-open interval [0,n); and testing C'(s) by generating a modulo-n function and examining it for a non-standard residue to detect malfunction. A method as claimed in claim 1, executable on a pair of registers, C and A, each having a finite dimension, w, further comprising the steps of: placing initial contents in registers A and C; for the next symbol i in the string s, reading in a coding variable corresponding to the conditional probability of i at its location in the string s; wherein the coding variable is scaled by n, the contents of C and A are altered based upon the scaled coding variable, and are shifted in a predetermined direction; and the contents of C are tested by means of a modulo-n function for a non-standard residue. A method as claimed in claim 2, wherein the step of testing is performed on the contents of C while the contents are being shifted. A method as claimed in claim 2, wherein the step of testing is performed on the contents of C before the contents are shifted. A method as claimed in any of claims 2 to 4 further including the step of testing the contents of A by means of a modulo-n function for a non-standard residue. A method as claimed in any of claims 2 to 5, wherein the initial contents of A are n.000..0 and the initial contents of C are 0.000..0. A method as claimed in any preceding claim, wherein the step of testing includes dividing C'(s) by n and testing for a non-zero residue. A method as claimed in any preceding claim, wherein m is 2 so that s, C(s) and C'(s) are all binary, and n is an odd number not equal to +1 or -1. An arithmetic encoder for the recursive machine encoding of a symbol string s to produce a compressed multi-element-number C(s) as a representation of s, C(s) being a number in the semi-open interval [0,1), the interval being successively subdivided during successive encoding cycles, each subinterval being defined by its lower bound C(s) and a variable A(s) such that [C(s), C(s) + A(s)); the values of C(s) and A(s) being computed as arithmetically recursive functions of C(s) and A(s) by generating a coding variable based upon a coding parameter (k) representing the conditional probabilities of the symbols of s at their locations in s, wherein the basis of the notation used is m; said encoder including: a register C (68) for containing the working end portion of C(s) resulting from the encoding of the portion of s preceding the next symbol i; a register A (66) for containing A(s) as a normalising factor; an arithmetic logic means (64, 66) responsive to the coding parameter for the next symbol i for numerically adjusting the contents of C and A based on the conditional probability of i at its position in s and for shifting the contents of C and A in a predetermined magnitude direction based on the adjusted contents of A, such that C(s) includes the successive shifted contents of C; means (62) for scaling the coding variable for i by n, n being a number which is prime relative to m; and modulo means (74, 76) for testing the contents of C according to a modulo-n function for a non-standard residue. An encoder as claimed in claim 9, wherein the arithmetic logic means includes means for initially setting the contents of C at 0.0 and the contents of A at n.0 prior to the encoding of the first symbol in s. An arithmetic decoder (90) of the type which receives an arithmetically compressed symbol-string C'(s) and generates therefrom successive symbols b(i) of a binary symbol string s=b(1), ...b(i)... b(n), wherein the arithmetically compressed symbol string C'(s) is a number in a semi-open interval [0, n), n being prime relative to the basis of the notation used, comprising means (91) for generating a trial coding variable based upon a coding parameter (k); means (92, 94, 100) for arithmetically testing the trial coding variable using recursively generated values of parameters A(s) and C(s) against the w most significant bits of the compressed string; means (100) for decoding the next symbol b(i) of the string s based upon the outcome of the testing; and characterised by means for detecting single-number element errors comprising: means (91) for scaling the trial coding variable by n; an means (102, 103) for testing C'(s) prior to the generation of b(i) using a modulo-n function and examining for a non-standard residue. A method for arithmetically decoding an arithmetically compressed symbol-string C'(s) and generating therefrom successive symbols b(i) of a binary symbol string s=b(1), ...b(i)... b(n), wherein the arithmetically compressed symbol string C'(s) is a number in a semi-open interval [0, n), n being prime relative to the basis of the notation used, comprising the steps of: generating a trial coding variable based upon a coding parameter (k); arithmetically testing the trial coding variable using recursively generated values of parameters A(s) and C(s) against the w most significant bits of the compressed string; decoding the next symbol b(i) of the string s based upon the outcome of the testing; and characterised by detecting single-element-number elements by the steps of: scaling the trial coding variable by n; and testing C'(s) prior to the generation of b(i) using a modulo-n function and examining for non-standard residue.

Inventors: ARPS RONALD BARTHOLD, KARNIN EHUD DOV, ARPS, RONALD BARTHOLD, KARNIN, EHUD DOV
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1987
Main classification: H03M7
IPC codes: G06F11, H03M7, H03M13