System and method for intracoding video data

A video system for coding a stream of video data that includes a stream of video frames divides each video frame into a matrix of a plurality of subblocks, wherein each subblock includes a plurality of pixels. The video system operates in accordance with nine prediction modes. Each prediction mode determines a prediction mode according to which a present subblock is to be coded. One of the nine prediction modes is selected to encode the present subblock, wherein the selected prediction mode provides for a minimum error value in the present subblock.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention pertains to a video system that compresses video data for transmission or storage and decompresses the video data for display. More particularly, the invention pertains to a video system and a method for intracoding video data.

2. Description of the Related Art

Video systems transmit, process and store large quantities of video data. To create a video presentation, such as a video movie, a rendering video system displays the video data as a plurality of digital images, also referred to as “frames,” thereby simulating movement. In order to achieve a video presentation with an acceptable video quality, or to enable transmission and storage at all, a conventional video system modifies the video data prior to transmission or storage. For instance, the video system compresses and encodes the video data to reduce the bit rate for storage and transmission.

In a conventional video system a video encoder is used to compress and encode the video data and a video decoder is used to decompress and to decode the video data. The video encoder outputs video data that has a reduced bit rate and a reduced redundancy. That is, the technique of video compression removes spatial redundancy within a video frame or temporal redundancy between consecutive video frames.

The video encoder and video decoder may be configured to apply one of two types of coding to compress the video stream, namely intracoding and intercoding. These two types of coding are based on the statistical properties of the video frames. When the video frames are coded using intracoding, the compression is based on information contained in a single frame (the frame that is compressed) by using the spatial redundancy within the frame. Intracoding, thus, does not depend on any other frames. In contrast, intercoding uses at least one other frame as a reference and codes a difference between the frame to be compressed and the reference frame. Intercoding is thus based on a temporal redundancy between consecutive frames in the video data.

The field of video compression is subject to international standards, e.g., International Telecommunications Union (ITU) standard H.263 that defines uniform requirements for video coding and decoding. In addition, manufacturers of video coders and decoders modify or build upon the international standards and implement proprietary techniques for video compression.

Despite the existence of the international standards and the proprietary techniques, there is still a need for improved techniques for video compression. For example, as the quality of a displayed video movie depends directly from the technique used for video compression, any improvement of the video compression technique makes the video movie more pleasing for the viewer.

SUMMARY OF THE INVENTION

An aspect of the invention involves a method of coding a stream of video data including a stream of video frames. The method divides each video frame into a matrix of a plurality of subblocks, wherein each subblock includes a plurality of pixels. The method further defines nine prediction modes, wherein each prediction mode determines a mode according to which a present subblock is to be coded. The method further selects one of the nine prediction modes to encode the present subblock. The selected prediction mode provides for a minimum error value in the present subblock.

Another aspect of the invention involves a video system for coding and decoding a stream of video data that includes a stream of video frames. The video system includes a video encoder and a mode selector. The video encoder is configured to receive a stream of video data including a stream of video frames and to divide each video frame into a matrix of a plurality of subblocks, wherein each subblock includes a plurality of pixels. The mode selector is in communication with the video encoder and is configured to define nine prediction modes. Each prediction mode determines a mode according to which a present subblock is to be coded. The mode selector is further configured to select one of the nine prediction modes to encode the present subblock, wherein the selected prediction mode provides for a minimum error value in the present subblock.

Once the video system has selected the best prediction mode to encode the pixels of the present subblock, the video system encodes the minimum error value and transmits the encoded minimum error value within a compressed bitstream to the decoder. The minimum error value represents a difference between predicted pixels of the present subblock and the original pixels of the subblock. The decoder uses the predicted pixels and the difference to the original pixels to accurately reconstruct the video frame.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

In the following description, reference is made to the accompanying drawings, which form a part hereof, and which show, by way of illustration, specific embodiments in which the invention may be practiced. It is to be understood that other embodiments may be utilized and structural changes may be made without departing from the scope of the present invention. Where possible, the same reference numbers will be used throughout the drawings to refer to the same or like components. Numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be obvious to one skilled in the art that the present invention may be practiced without the specific details or with certain alternative equivalent devices and methods to those described herein. In other instances, well-known methods, procedures, components, and devices have not been described in detail so as not to unnecessarily obscure aspects of the present invention.

FIG. 1is a high-level block diagram of a video compression and decompression system1(hereinafter “video system1”) having an encoder apparatus3and a decoder apparatus5that is coupled to the encoder apparatus3through a medium9. The encoder apparatus3includes a video encoder2, a mode selector14and a buffer8. The decoder apparatus5includes a buffer10, a video decoder12and a mode selector16. The encoder apparatus3receives a video sequence20(VIDEO IN) and encodes the video sequence20to generate an encoded and thus compressed representation in one of a number of possible formats. The format may be in an interleaved format tailored for “live” streaming of the encoded representation. The format may also be in a single file format in which each of the encoded representation is stored in a contiguous block within one file.

The video sequence20input to the encoder apparatus3may be either a live signal, e.g., provided by a video camera, or a prerecorded sequence in a predetermined format. The video sequence20includes frames of a digital video, an audio segment consisting of digital audio, combinations of video, graphics, text, and/or audio (multimedia applications), or analog forms of the aforementioned. If necessary, conversions can be applied to various types of input signals such as analog video, or previously compressed and encoded video to produce an appropriate input to the encoder apparatus3. In one embodiment, the encoder apparatus3may accept video in RGB or YUV formats. The encoder apparatus3, however, may be adapted to accept any format of input as long as an appropriate conversion mechanism is supplied. Conversion mechanisms for converting a signal in one format to a signal in another format are well known in the art.

The medium9may be a storage device or a transmission medium. In one embodiment, the video system1may be implemented on a computer. The encoder apparatus3sends an encoded video stream (representation) to the medium9that is implemented as a storage device. The storage device may be a video server, a hard disk drive, a CD rewriteable drive, a read/write DVD drive, or any other device capable of storing and allowing the retrieval of encoded video data. The storage device is connected to the decoder apparatus5, which can selectively read from the storage device and decode the encoded video sequence. As the decoder apparatus5decodes a selected one of the encoded video sequence, it generates a reproduction of the video sequence20, for example, for display on a computer monitor or screen.

In another embodiment, the medium9provides a connection to another computer, which may be a remote computer, that receives the encoded video sequence. The medium9may be a network connection such as a LAN, a WAN, the Internet, or the like. The decoder apparatus5within the remote computer decodes the encoded representations contained therein and may generate a reproduction of the video sequence20on a screen or a monitor of the remote computer.

Aspects of the video system1illustrated inFIG. 1and described above can be combined and supplemented to achieve other embodiments. Numerous other implementations are consistent with the scope of this invention. Such other implementations need not be restricted to video, but may include audio or other forms of media as well.

Pre-existing video encoding techniques typically break up a frame (picture) into smaller blocks of pixels called macroblocks. Each macroblock can consist of a matrix of pixels, typically a 16×16 matrix, defining the unit of information at which encoding is performed. The matrix of pixels is therefore referred to as a 16×16 macroblock. These video encoding techniques usually break each 16×16 macroblock further up into smaller matrices of pixels. For example, into 8×8 matrices of pixels or 4×4 matrices of pixels. Such matrices are hereinafter referred to as subblocks. In one embodiment of the present invention, a 16×16 macroblock is divided into 16 4×4 subblocks. Those skilled in the art will appreciate that the present invention is equally applicable to systems that use 8×8 subblocks, 4×4 subblocks or only 16×16 macroblocks without breaking it up into subblocks.

Further, the pre-existing encoding techniques provide for motion compensation and motion estimation using motion vectors. The motion vectors describe the direction, expressed through an x-component and a y-component, and the amount of motion of the 16×16 macroblocks, or their respective subblocks, and are transmitted to the decoder as part of the bit stream. Motion vectors are used for bidirectionally encoded pictures (B-pictures) and predicted pictures (P pictures) as known in the art.

The video encoder2performs a discrete cosine transform (DCT) to encode and compress the video sequence20. Briefly, the video encoder2converts the video sequence20from the spacial, temporal domain into the frequency domain. The output of the video encoder2is a set of signal amplitudes, called “DCT coefficients.” A quantizer receives the DCT coefficients and assigns each of a range (or step size) of DCT coefficient values a single value, such as a small integer, during encoding. Quantization allows data to be represented more compactly, but results in the loss of some data. Quantization on a finer scale results in a less compact representation (higher bit-rate), but also involves the loss of less data. Quantization on a more coarse scale results in a more compact representation (lower bit-rate), but also involves more loss of data. The mode selector14communicates with the video encoder2and monitors and controls encoding of the video sequence20. The mode selector14determines in accordance with the present invention prediction modes according to which the video encoder2encodes the video sequence20. The mode selector14may be a processor or a software module that are configured to operates in accordance with a method of the present invention.FIG. 1shows the mode selector14for illustrative purposes as an element separate from the video encoder2. Those skilled in the art will appreciate that the functionality of the mode selector14may be combined with the functionality of the video encoder2.

The buffer8of the encoder apparatus3receives the encoded and compressed video sequence (hereinafter “encoded video sequence”) from the video encoder2and adjusts the bit rate of the encoded video sequence before it is sent to the medium9. Buffering may be required because individual video images may contain varying amounts of information, resulting in varying coding efficiencies from image to image. As the buffer8has a limited size, a feedback loop to the quantizer may be used to avoid overflow or underflow of the buffer8. The bit-rate of the representation is the rate at which the representation data must be processed in order to present the representation in real time.

The decoder apparatus5performs the inverse function of the encoder apparatus3. The buffer10serves also to adjust the bit rate of the incoming encoded video sequence. The video decoder12decodes and decompresses in combination with the mode selector16the incoming video sequence reconstructing the video sequence. The mode selector16determines the prediction modes according to which the video encoder2encoded the incoming video sequence. The decoder apparatus5outputs a decoded and decompressed video sequence24illustrated as “VIDEO OUT” (hereinafter “decoded video sequence24”).

The video decoder12receives a bit stream that represents the encoded video sequence from the buffer10(FIG. 1). In one embodiment, the video decoder is a conventional video decoder, e.g., a MPEG-2 decoder, that includes a decoder controller, a VLC decoder (Variable Length Coding, VLC) and a reconstruction module. The operation and function of these components are known to those skilled in the art. These components are known to those skilled in the art and described in generally available MPEG documents and publications.

FIG. 2is a diagram illustrating a video frame30that is part of the video sequence20. As described above, known video encoding techniques typically break up a video frame30into macroblocks36,36a,36b,36c,36d. For example, the video frame30is divided into a matrix of 16×16 macroblocks36,36a,36b,36c,36d. The video system1encodes the macroblocks36,36a,36b,36c,36dline by line, from top to bottom and from left to right, as indicated through a dashed line34that illustrates the sequence of, e.g., intra encoding. In the illustrated embodiment, the dashed line34ends at the macroblock36a, which is the next macroblock to be encoded. All prior macroblocks36,36b,36c,36dhave already been encoded.

The macroblock36a, as a representative for all macroblocks36,36a,36b,36c,36d, is shown in greater detail below the video frame30. The video encoding technique of the video system1breaks each macroblock36,36a,36b,36c,36dfurther up into a matrix of pixels38, hereinafter referred to as a subblock38. In one embodiment, the subblock38is a 4×4 matrix of pixels, wherein the 16 pixels are labeled as a, b, c, . . . p. Bordering pixels of an adjacent subblock of a neighboring macroblock36b, which is located above the macroblock36a, are labeled as A, B, C, D. Further, bordering pixels of a subblock located above and to the right of the macroblock36aare labeled as E, F, G, H. Likewise, bordering pixels of an adjacent subblock of a neighboring macroblock36c, which is located to the left of the macroblock36a, are labeled as I, J, K, L. Bordering pixels of a subblock located below and to the left of the macroblock36aare labeled as M, N, O, P. A bordering pixel of a subblock of a macroblock36d, which is located above and to the left of the macroblock36a, is labeled as Q.

The video system1of the present invention codes each macroblock36as an intra macroblock. Intra macroblocks are transform encoded without motion compensated prediction. Thus, intra macroblocks do not reference decoded data from either previous or subsequent frames. An I-frame is a frame consisting completely of intra macroblocks. Thus, I-frames are encoded with no reference to previous or subsequent frames. I-frames are also known as “Intra-frames.”

FIG. 3is a subblock38illustrating possible directions according to which the subblock38may be encoded. In accordance with the present invention, the subblocks of a macroblock36,36a,36b,36c,36dcan be intra coded in one of nine modes (Modes 0, Mode 1, . . . , Mode 9) as listed hereinafter. That is, a particular subblock38may be predicted from a subblock above the current subblock that is currently decoded (“vertical prediction”), from the subblock to the left of the current subblock (“horizontal prediction”), or from both the left and the above subblocks (“diagonal prediction”). The Modes 1-8 predict the subblock in a predetermined direction and the Mode 0 uses a uniform average without prediction in a predetermined direction. InFIG. 3, each direction represents one of the eight prediction modes in accordance with the present invention.

In this mode, each pixel a-p is predicted by the following equation:

It is contemplated that in this mode as well as in the following modes, a “division” means to round the result down toward “minus infinity” (−∞). For instance, in mode 0, the term “+4” ensures that the division results in a rounding to the nearest integer. This applies also the other modes.

If four of the pixels A-P are outside the current picture (frame) that is currently encoded, the average of the remaining four pixels is used for prediction. If all eight pixels are outside the picture, the prediction for all pixels in this subblock is 128. A subblock may therefore always be predicted in mode 0.

If the pixels A, B, C, D are inside the current picture, the pixels a-p are predicted in vertical direction as shown inFIG. 3. That is, the pixels a-p are predicted as follows:

If the pixels I, J, K, L are inside the current picture, the pixels a-p are predicted in horizontal direction. That is, the pixels a-p are predicted as follows:

This mode is used if all pixels A-P are inside the current picture. This corresponds to a prediction in a diagonal direction as shown inFIG. 3. The pixels a-p are predicted as follows:

This mode is used if all pixels A-P are inside the current picture. This is also a diagonal prediction.

This mode is used if all pixels A-P are inside the current picture. This is also a diagonal prediction.

This mode is used if all pixels A-P are inside the current picture. This is a diagonal prediction.

This mode is used if all pixels A-P are inside the current picture. This is a diagonal prediction.

This mode is used if all pixels A-P are inside the current picture. This is a diagonal prediction.

In one embodiment of the present invention, a mode selection algorithm determines a criteria to select one of the nine modes. The subblock38is then encoded in accordance with the selected mode. The mode selection algorithm is described in detail below.

FIG. 4is a flow chart of a procedure illustrating the method in accordance with the present invention that codes video data including a stream of video frames and that selects one of the prediction modes Modes 0-8. In one embodiment, the method codes a luminance portion (Y) of a video frame.

In a step28, e.g., when a user activates the video system1, the procedure initializes the video system1. The initialization procedure includes, for example, determining whether the encoder apparatus3is operating and properly connected to receive the stream of video frames.

In a step30, the procedure receives the stream of video frames and divides each video frame into a matrix of a plurality of subblocks, wherein each subblock includes a plurality of pixels. The matrix of a plurality of subblocks may include 4×4 subblocks38that are part of a macroblock as described above.

In a step32, the procedure defines the nine prediction modes Mode 0-8, wherein each prediction mode determines a mode according to which a present subblock is to be coded. For example, the procedure may execute a subroutine to calculate and define the modes Mode 0-8.

In a step34, the procedure selects one of the nine prediction modes Mode 0-8 to encode the present subblock38. In one embodiment, the procedure calculates for each mode an error value, determines which mode provides a minimum error value and selects that mode for encoding the present subblock38.

Once the procedure has selected the “best” prediction mode to encode the pixels of the present subblock38, the procedure encodes the minimum error value and transmits the encoded minimum error value within a compressed bitstream to the decoder. The minimum error value represents a difference between the predicted pixels of the present subblock and the original pixels of the subblock. The difference may be encoded using a DCT, coefficient quantization and variable length coding as known in the art. The decoder uses the predicted pixels and the difference to the original pixels to accurately reconstruct the video frame. The procedure ends at a step36.

The procedure provides that each of the 4×4 subblocks38is coded in accordance with one of the nine prediction modes Mode 0-8. As this may require a considerable number of bits if coded directly, the video system1in accordance with the present invention may apply a more efficient way of coding the mode information. A prediction mode of a subblock is correlated with the prediction modes of adjacent subblocks.

FIG. 5illustrates this through three exemplary subblocks A, B, C. The subblock C is the subblock that is to be encoded (predicted) with the help of the subblocks A, B whose prediction modes are known. The subblock A is located above the subblock C and the subblock B is located left of the subblock C. In this case, an ordering of the most probable, next most probable etc. prediction mode for the subblock C is given. An example of such an ordering table is listed hereinafter. The table is divided into ten groups (Group 1-Group 10). In each group, the respective prediction mode for the subblock A is constant (e.g., Mode 0 of the subblock A is constant in Group 2), and the prediction mode for the subblock B varies. That is, the (constant) prediction mode for the subblock A within a group may be combined with one of the nine prediction modes for the subblock B within that group.

For each combination of the prediction modes of the subblocks A and B, a sequence of nine numbers is given, one number for each of the nine Modes 0-9. For example in Group 3, if the prediction modes for the subblock A and the subblock B are both Mode 1, a string “1 6 2 5 3 0 4 8 7” indicates that the Mode 1, i.e., the first number in the string, is the most probable mode for the subblock C. The Mode 6, i.e., the second number in the string, is the next most probable mode. In the exemplary string, the Mode 7 is the least probable since the number 7 is the last number in the string. The string will be part of the stream of bits that represents the encoded video sequence.

The stream of bits therefore includes information (Prob0=1 (see Table 1)) indicating the mode used for the subblock C. For example, the information may indicate that the next most probable intra prediction mode is Mode 6. Note that a “-” in the table indicates that this instance cannot occur. The term “outside” used in the Table 1 indicates “outside the frame.” If the subblock A or B is within the frame, but is not INTRA coded (e.g., in a P frame, the subblock C could be INTRA coded but either the subblock A or the subblock B may not be INTRA coded), there is no prediction mode. The procedure of the present invention assumes the Mode 0 for such subblocks.

The information about the prediction modes may be efficiently coded by combining prediction mode information of two subblocks38in one codeword. The stream of bits includes then the resulting codewords, wherein each codeword represents the prediction modes of the two subblocks. Table 2 lists exemplary binary codewords for code numbers (Code No.) between 0 and 80. The probability of a mode of the first subblock is indicated as Prob0 and the probability of a mode of the second subblock is indicated as Prob1.

With the nine prediction modes (Table 1) and the probabilities of the modes (Table 1, Table 2), a mode selection algorithm determines the mode according to which a particular subblock is predicted. In one embodiment of the present invention, the algorithm selects the mode using a sum of absolute differences (SAD) between the pixels a-p and the corresponding pixels in the original frame, and the above probabilities of the modes. The SAD and the probability table are used to select the mode for a particular subblock38. The algorithm calculates a parameter uError for each of the nine possible modes Mode 0-8. The mode that provides the smallest uError is the mode selected for the subblock38.

where SAD({a, . . . , p},{original frame} is the sum of absolute difference between the pixels a-p and the corresponding pixels in the original frame,

where rd_quant[uMBQP] is a table of constant values indexed by a quantization parameter uMBQP. uMBQP is given by
const U8 rd_quant[32]={1,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5,5,6,7,7,8,9,11,12,13,15,17,19,21,24,27,30}; and

where uProb is the probability of the mode occurring, provided by the position in the mode probability table (Table 1).

For example, the prediction mode for the subblocks A is the Mode 1 and the prediction mode for the subblock B is the Mode 1. The string “1 6 2 5 3 0 4 8 7” indicates that the Mode 1 is also the most probable mode for the subblock C. The Mode 6 is the second most probable mode, etc. Thus, when the algorithm calculates uError for the Mode 0, the probability uProb is 5. Further, for the Mode 1 the probability uProb is 0, for the Mode 2 the probability uProb is 2, for the Mode 3 the probability uProb is 4, and so forth.

In addition to coding the luminance portion (Y) of the video frame, the video system1of the present invention may also predict the chrominance portions (U, V) of the video frame. The chrominance portions may be considered as chrominance planes (U and V-planes). Typically, the chrominance planes (U and V-planes) are a quarter of the size of a luminance plane. Thus, in a 16×16 macroblock a corresponding 8×8 block of pixels exists in both the U and V-planes. These 8×8 blocks are divided into 4×4 blocks. In general, separate prediction modes are not transmitted for chrominace blocks. Instead, the modes transmitted for the Y-plane blocks are used as prediction modes for the U and V-plane blocks.

While the above detailed description has shown, described and identified several novel features of the invention as applied to a preferred embodiment, it will be understood that various omissions, substitutions and changes in the form and details of the described embodiments may be made by those skilled in the art without departing from the spirit of the invention. Accordingly, the scope of the invention should not be limited to the foregoing discussion, but should be defined by the appended claims.