The present invention relates to the field of implementing video encoding schemes. More particularly, the invention relates to a method for implementing the binarization part of the CABAC encoding scheme using a lookup table.
The increasing demand to improve the quality of transmitted video has prompted rapid advancements in video compression techniques. During the last decade, many ISO/ITU standards on video compression have evolved, such as standard ISO/14496-10.2005 AVC referred to hereinafter as the H.264 standard. This standard exploits the spatio-temporal correlation in the video data and utilizes entropy coding techniques to achieve a high compression ratio. Entropy coding is a loss-less compression process that is based on the statistical properties of data. The entropy machines first assign codes to symbols so as to match code lengths with the probabilities of occurrence of the symbols. The basic idea is to express the most frequently occurring symbols with the least number of bits.
Some of the commonly used Entropy coding techniques used in video compression include Golomb coding, Hauffman coding and arithmetic coding. The main idea behind arithmetic coding is to assign an interval to a sequence of symbols. Starting with the interval [0->1), it is divided into several subintervals, which sizes are proportional to the current probability of the corresponding symbols. The subinterval corresponding to the first symbol is then taken as the interval for the next symbol, and so on. At the end of the process the output is the subinterval corresponding to the last symbol. At this point the arithmetic encoder selects an optimized fractional number from within the borders of the last subinterval, which represents the initial sequence of symbols. Thus an arithmetic encoder is capable of converting a sequence of data symbols into an optimized single fractional number.
Due to its high compression efficiency, the Arithmetic coding has been chosen for the H.264 standard as the higher compression mode. The H.264 supported arithmetic coding is combined with context-adaptive modeling techniques and is known as the Context-based Adaptive Binary Arithmetic Coding (CABAC). The context-adaptive modeling techniques use local spatial and temporal characteristics to estimate the probability of a symbol. Thus, context-adaptive modeling has shown an even better compression results compared to the other forms of coding, as the successful entropy coding depends largely on accurate models of symbol probability.
The CABAC encoding algorithm includes two basic steps: binarization and binary arithmetic encoding. In the binarization step, a syntax element is mapped to a unique binary sequence. In the H.264 standard, the binarization mappings are either specifically defined or are obtained by a combination of four elementary binarization processes. The four elementary binarization processes are Unary binarization process, the Truncated Unary binarization process, the Concatenated Unary/K-th order Exp-Golomb binarization process, and the Fixed-Length binarization process. Each bit of the binary sequence, referred to hereinafter as bin, is passed through a context modeling stage, where a Context-Index is attached to each bin. The Context-Index (CI) indicates the chosen context-dependent probability model for the attached bin. The bin, along with its CI, is then passed on to the arithmetic encoding engine, where coding of the bin takes place and the probability model is updated.
In some of the cases, where the encoder is part of a setup box or part of any system which receives a continual bitstream of video, any delay in processing and encoding of the received video data may result in lose of data, an incident which is unacceptable. Therefore, in order to obtain a fast binarization process the binarization algorithm is preferably implemented in ASIC hardware. The implementation of video encoding in hardware allows the system to perform the complex encoding calculations in a rapid rate which can sometimes be crucial for in the video encoding process. However, once the binarization algorithm is implemented in hardware it may lose its flexibility in terms of updating and debugging as hardware modifications can be very costly.
It is an object of the present invention to provide a method for implementing the binarization process in hardware.
It is another object of the present invention to provide a method for adding flexibility to the hardware implemented binarization process.
It is still another object of the present invention to provide a method for easily and efficiently modifying parameters of the hardware implemented binarization process.
Other objects and advantages of the invention will become apparent as the description proceeds.
The present invention relates to a system for performing binarization comprising: (a) an updateable lookup table for storing a plurality of Syntax Element types, their corresponding binarization schemes, their corresponding Context Indexes constructing parameters, their corresponding bypass flags, and their corresponding terminate flags; (b) a hardware implemented Binarization Machine, logically connected to said lookup table, and capable of: (1) receiving a Syntax Element with its binarization parameters; (2) acquiring the corresponding binarization scheme of said Syntax Element using said lookup table; (3) transforming said Syntax Element value into a corresponding binary sequence; (4) acquiring a Context Index, a bypass flag and a terminate flag for each of the bins of said corresponding binary sequence using said lookup table; (5) attaching each of said Context Indexes, said bypass flags and said terminate flags to its bin of said corresponding binary sequence; (6) outputting said bins of said corresponding binary sequence, their said Context Indexes, said bypass flags, and said terminate flags; and (c) a Microcode Unit for controlling said Binarization machine and for feeding said Syntax Element and its binarization parameters into said Binarization machine.
In one embodiment, the output of the Binarization Machine is connected to a CABAC Engine.
Preferably, a FIFO repository is connected between the Binarization Machine and the CABAC Engine.
In one embodiment, the output of the Binarization Machine is connected to a Microcode Unit.
The present invention also relates to a binarization method for generating a binary sequence, comprising the steps of: (a) receiving a Syntax Element with its binarization parameters; (b) acquiring the corresponding binarization scheme of said Syntax Element using an updateable lookup table; (c) transforming said Syntax Element value into a corresponding binary sequence; (d) acquiring a Context Index, a bypass flag and a terminate flag for each of the bins of said corresponding binary sequence using said lookup table; (e) attaching each of said Context Indexes, said bypass flags, and said terminate flags to its bin of said corresponding binary sequence; and (f) generating said bins of said corresponding binary sequence, their said Context Indexes, said bypass flags, and said terminate flags.
In the drawings:
The following terms are described explicitly:
Syntax Element (SE)—is a basic element of data, intended for processing and encoding by the system of the invention in order to generate a CABAC encoded bitstream. Different SEs can represent different types of data (e.g. motion vectors, DCT coefficients, etc.)
Binarization—the process of transforming a SE to a corresponding binary sequence.
Bin—a bit from the binary sequence that has been produced by the binarization process.
Binstream—a stream of bins, constructed of the concatenated bins at the output of the binarization process.
Context Index (CI)—an index for indicating the chosen context-dependent probability model for the accompanying bin.
Binarization parameters—are data elements which represent information on the manner for applying binarization on the accompanying SE and information on the manner for attaching Context-Indexes (CIs) to the output bins.
As stated in the H.264 standard, each bin can be encoded using one of three methods: (1) Normal encoding, using the probabilities as indexed by its attached CI, (2), Bypass encoding and (3) Terminate encoding. Hence, two flags are attached to each bin, to specify the encoding method to be used: bypass_flag and terminate_flag. The bypass flag is used to mark a bin that has a probability close to 0.5 for each possible value of ‘1’ or ‘0’. The CABAC Engine processes bins differently, if their bypass_flag is on. The terminate flag is used to indicate a possible end of the binstream.
For the sake of brevity an example is set forth of encoding a SE of an ‘mb_qp_delta’ type having a value of 6, according to the prior art implementation described in relations to
The method of the invention, according to the embodiment described in relations to
The invention may also be used for updating the system in case the standard is changed or extended. For example, if a new binarization scheme is added to the standard, no hardware modifications are required. In addition the invention may be used for fixing bugs in hardware. For example if the hardware does not process one of the binarization schemes correctly, the lookup table may be updated to include the specific binary sequence outcome for that specific scenario. Thus in that specific scenario the outcome will not be processed, effectively circumnavigating the bug.
As understood the implementing of a process in hardware using an updateable lookup table may be used for any other binarization processes, encoding schemes or other implementations as well.
While some embodiments of the invention have been described by way of illustration, it will be apparent that the invention can be carried into practice with many modifications, variations and adaptations, and with the use of numerous equivalents or alternative solutions that are within the scope of persons skilled in the art, without departing from the invention or exceeding the scope of claims.