Implementations of the claimed invention generally may relate to decoding variable-length codes and, more particularly, to decoding Exponential Golomb (Exp-Golomb) codes.
Exp-Golomb codes are variable length codes of a regular construction. Exp-Golomb codes are widely used in the Advanced Video Coding (AVC) (e.g., H.264 and/or MPEG-4, Part 10). Similar to other variable-length codes (e.g., Huffman code), decoding Exp-Golomb codes may be somewhat difficult, because the input data length is varied and unpredictable.
One proposed scheme for decoding Exp-Golomb codes, defined in an AVC standard (i.e., ISO/IEC FDIS 14496-10), may serially search leading bits to decode the Exp-Golomb code. Because the length of the incoming code word is unknown and unpredictable, such a serial decoding scheme may read the leading 0 or 0's repeatedly until the first non-zero bit is received. Such a serial decoding scheme may check leading bits one by one and may take significant time for longer codes. Also for the serial scheme, the decoding time for a code word may vary depending on its code length.
Another proposed scheme for decoding Exp-Golomb codes may use table mapping to look up a code number corresponding to a given code word. In such a scheme, the number of entries the decoding table may equal 2(longest code length). For example, if the maximum code length is 7, then the table may have 128 entries, and longer code lengths implicate a larger memory size for the table.
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate one or more implementations consistent with the principles of the invention and, together with the description, explain such implementations. The drawings are not necessarily to scale, the emphasis instead being placed upon illustrating the principles of the invention. In the drawings,
The following detailed description refers to the accompanying drawings. The same reference numbers may be used in different drawings to identify the same or similar elements. In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular structures, architectures, interfaces, techniques, etc. in order to provide a thorough understanding of the various aspects of the claimed invention. However, it will be apparent to those skilled in the art having the benefit of the present disclosure that the various aspects of the invention claimed may be practiced in other examples that depart from these specific details. In certain instances, descriptions of well known devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
Processor 210 may include a general-purpose processor, a specific-purpose processor, and/or logic configured for a specific purpose. Although not explicitly illustrated in
During the course of operation, processor 210 may keep track of a current computing position within data from the input bit stream, for example via a pointer to the position. Processor 210 may be arranged to compute a code number based on the feedback from the detector 220 that finds valid leading bits for a given Exp-Golomb code. Although illustrated in
Detectors 220 may include logic arranged to perform specific detection and communication functions. Detectors 220 collectively may receive leading bits from processor 210 and may return feedback bit to processor 210. In some implementations, detectors 220 may communicate serially with processor 210. In some implementations, detectors 220 may communicate in parallel with processor 210. For example, processor 210 may output N leading bits in parallel, and detector 220-0 D0 may be hardwired to receive the first one bit of these N bits. Detector 220-1 D1 may receive the first two bits, and so on. The feedback bits from detectors 220 may be similarly aggregated into a parallel input to processor 210.
Each of detectors 220 may be logically arranged to output a 1 as its feedback bit if its last input bit is one and all other input bits (if present) are 0. Otherwise, detectors 220 may output a 0 as their respective feedback bits. Thus, only the detector 220 (e.g., the second detector 220-1) that detects a valid sequence of leading bits (e.g., 01) may output a 1, and the rest of the feedback bits from the other detectors 220 may be 0.
Detectors 220 may simultaneously detect for valid leading b its, and the one detector 220 finding the valid leading bits may trigger processor 210 to compute the Exp-Golomb code number, find the code length, and advance the bit-stream pointer appropriately. It should be noted that the number N of detectors 220 in system 200 may correspond to the maximum number N of leading bits that may be expected for a maximum expected Exp-Golomb code length M. The particular relationship between N and M will be further described herein.
Table 300 illustrates the output of the various detectors 220 to a leading bit stream of 01xxxxx. Detector D0 does not output a 1, because the first leading bit is not a 1. By contrast, detector D1 may output a 1, because the first leading bit is 0 and the second leading bit is 1. Subsequent detectors D2 to D(N-1) may output 0, because they have non-zero leading bit(s) (e.g., B1) before their last leading bit.
Processing may begin with processor 210 bringing M bits of data from bit stream, without change the pointer from the end of the last code word. Processor 220 may supply up to N of these bits to leading-bit detectors 220 at the same time [act 410]. For example, detector 220-0 D0 may receive the first bit, detector 220-1 D1 may receive the first two bits, etc. Because of the nature of the Exp-Golomb code and the arrangement of detectors 220, only one of the detectors 220 D0-DN-1 will find a valid leading bit or series of valid leading bits.
Processor 210 may receive feedback bits from each of detectors 220 [act 420]. Processor 210 may receive a triggering signal from the detector 220-n (Dn) that finds the valid leading bit(s). In some implementations, processor 210 may receive N parallel feedback bits from detectors 220, one of which is a 1 and the rest of which are 0. In some implementations, other signaling schemes may be used to alert processor 210 of the detector Dn that detects a valid string of leading bits.
Once processor 210 is triggered by detector Dn (and hence the leading bit length, n+1, is known), processor 210 may compute the corresponding Exp-Golomb code number [act 430]. In one scheme for computing, processor 210 may acquire the n value bits following the leading bits and may computing the code number as follows:
Code Number=(1<<n)−1+value bits
where (1<<n) denotes a left bit-shift of the value 1 by n bits. As noted previously, for Golomb code words, the n value bits following a 1 may help specify the code number in accordance with the above equation. Processor 210 may send the code number to another portion (not shown) of system 200 for further processing. In some implementations, however, processor 210 may perform further processing on the code number without sending it out.
Processor 210 may also advance the bit-stream pointer (or other mechanism for place holding in the input bit stream) to the proper beginning position for the next Exp-Golomb code word [act 440]. In some implementations, processor 210 may advance the pointer from its present position by ((n<<1)+1) bits, where (n<<1) denotes a left bit-shift of the value n by 1 bit. Once processor 210 has produced an Exp-Golomb code word and advanced the pointer appropriately, it may repeat acts 210-240 for the next M bits in the bit stream.
A brief numerical example will now be presented to aid in understanding
Processor 210 may obtain the next 7 bits, 1001100, and may send the first 4 of these, 1001, to detectors 220. 1 is received by D0 detector 220-0; 10 is received by D1 detector 220-1; 100 is received by D2 detector 220-2; and 1001 is received by D3 detector 220-3. Only D0 detector 220-0 detects the valid leading bit (without corresponding value bits). Processor 210 may compute code number, ((1<<0)−1)=0, and may advance the pointer by ((0<<1)+1)=1 bit to 0011001010 . . . .
Concluding by showing a third iteration in the example, processor 210 may obtain the next 7 bits, 0011001, and may send the first 4 of these, 0011, to detectors 220. 0 is received by D0 detector 220-0; 00 is received by D1 detector 220-1; 001 is received by D2 detector 220-2; and 0011 is received by D3 detector 220-3. Only D2 detector 220-2 detects valid leading bits. In response, processor 210 may grab 2 value bits (i.e., 10) and compute the corresponding code number, 5. Processor 210 may advance the stream pointer to 01010 . . . . and continue decoding in a similar manner.
The foregoing description of one or more implementations provides illustration and description, but is not intended to be exhaustive or to limit the scope of the invention to the precise form disclosed. Modifications and variations are possible in light of the above teachings or may be acquired from practice of various implementations of the invention.
For example, although system 200 and process 400 have been described with regard to Exp-Golomb codes, these parallel hardware decoding schemes may be applied to any variable-length code. For example, the techniques described herein may be applied to decode Huffman codes or other types of variable-length codes.
Moreover, the acts in
No element, act, or instruction used in the description of the present application should be construed as critical or essential to the invention unless explicitly described as such. Also, as used herein, the article “a” is intended to include one or more items. Variations and modifications may be made to the above-described implementation(s) of the claimed invention without departing substantially from the spirit and principles of the invention. All such modifications and variations are intended to be included herein within the scope of this disclosure and protected by the following claims.