Patent Description:
<CIT> proposes a method and an apparatus for video encoding/decoding based on an orthogonal transform and vector quantization. A video encoding method includes determining whether an input image is a residual image, if the input image is a residual image, performing first encoding on the input image through transform/quantization and performing second encoding on the input image through vector quantization, comparing data obtained through the first encoding and data obtained through the second encoding, and selecting an encoding type based on the result of the comparison, generating mode information indicating the selected encoding type, and outputting data obtained according to the selected encoding type.

A first aspect is an apparatus for decoding a current block of video as defined in claim <NUM>.

A second aspect is an apparatus for encoding a current block using vector quantization (VQ) as defined in claim <NUM>.

A third aspect is a method for encoding a current block using vector quantization (VQ) as defined in claim <NUM>.

These and other aspects of this disclosure are disclosed in the following detailed description of the implementations, the appended claims and the accompanying figures.

The description herein makes reference to the accompanying drawings described below, wherein like reference numerals refer to like parts throughout the several views.

Video compression schemes may include breaking respective images, or frames, into smaller portions, such as blocks, and generating an encoded bitstream using techniques to limit the information included for respective blocks thereof. The encoded bitstream can be decoded to re-create the source images from the limited information. For example, a video compression scheme can include transforming the prediction residual (i.e., the residual block) of a current block of a video stream from the pixel domain into transform coefficients of transform blocks in the frequency domain. The transform coefficients are quantized and entropy coded into an encoded bitstream. A decoder uses the encoded transform coefficients to decode or decompress the encoded bitstream to prepare the video stream for viewing or further processing. To reconstitute the prediction residual, a decoder may receive the quantized transformed coefficients, dequantize the transformed coefficients, and inverse transform the dequantized transform coefficients.

There may be many different transform types and transform sizes available for transforming the prediction residual of a given block. There may be as many as, or even more than, <NUM> transform types available, such as a discrete cosine transform (DCT) or an asymmetric discrete sine transform (ADST). There may be a varying number of transform sizes available, such as based on the size of the block representing the prediction residual. For example, an 8x8 block representing the prediction residual may be transformed using one 8x8 transform block or four 4x4 transform blocks.

To achieve the best compression efficiency, a typical encoder tries many transform types and transform sizes and selects, for use in transforming the prediction residual, the transform type and transform size combination resulting in a lowest rate-distortion cost. This process is referred to as transform search. However, the transform search can be a very time-consuming process, as the number of transform types and sizes may be large. Further, in many cases, the encoder may repeat the transform search process multiple times for the same prediction residual (e.g., where two different prediction modes result in the same prediction, and, therefore, the same prediction residual). In a typical coding process, after the prediction residual is transformed.

Implementations of this disclosure address problems such as these by omitting transforming the prediction residual to the frequency domain. As such, the coding steps related to transforming (in an encoder) and inverse transforming (in a decoder) of the prediction residual can be omitted (i.e., bypassed).

As further described below, a current block can be predicted using intra prediction or inter prediction. Some prediction residuals (i.e., the prediction signals) resulting from intra prediction can exhibit certain characteristics. Encoding the transform coefficients of such prediction residuals (i.e., the prediction residuals exhibiting the certain characteristics) tend to require a higher bitrate owing to the high frequencies in the transform coefficients.

<FIG> is a diagram of examples <NUM> of characteristics exhibited by residual blocks. The examples <NUM> include illustrative prediction residual blocks <NUM>-<NUM>. The prediction residual blocks <NUM>-<NUM> are examples of <NUM>×<NUM> residual blocks. However, the prediction residual blocks can be of any size. The prediction residual blocks <NUM>-<NUM> are examples of prediction residuals exhibiting localized characteristics. The contrast of the pixel values are indicative of the localized characteristics. The prediction residual blocks <NUM>-<NUM> are examples of prediction residuals exhibiting non-smooth characteristics. The prediction residual blocks <NUM>-<NUM> are examples of prediction residuals exhibiting diagonal patterns characteristics. Diagonal pattern in this case means either a northeast-to-southwest diagonal (e.g., the prediction residual block <NUM>) or a or northwest-to-southeast diagonal (e.g., the prediction residual block <NUM>).

According to implementations of this disclosure, instead of transforming a prediction residual to the frequency domain, an encoder can look-up a closest match to the prediction residual in a codebook (i.e., a lookup table). The codebook can include prototypical prediction residuals. The prototypical prediction residuals may be referred to herein as codewords or code vectors. The encoder can encode the index of the closest match in a compressed bitstream. As such, an approximation of the prediction block can be indicated (via the index) in the compressed bitstream. As such, the prediction residual is said to be quantized to the closest matching code vector. A decoder can decode the index, look up the of prototypical prediction residual in the codebook, and reconstitute the indicated prototypical prediction residual as the prediction residual. As further described below, the lookup table can be more than one lookup table. For example, the look up table can include a shape codebook and a gain codebook. As also further described below, the index can be more than one index. For example, the index can include a shape index (i.e., an indicator of an entry in the shape codebook) and a gain index (i.e., an indicator of an entry in the gain codebook).

By using a codebook of prediction residuals, transform coding can be by-passed. Consequently, the bit rate can be reduced, especially for those prediction residuals that exhibit high frequencies and would otherwise require high bit rates for the coding of the transform coefficients. Additionally, the decoding process can be faster as compared to a decoding process that involves inverse transforming of transform coefficients.

Further details of techniques for vector quantization in video compression are described herein with initial reference to a system in which they can be implemented, as shown in <FIG>.

<FIG> is a schematic of an example of a video encoding and decoding system <NUM>. A transmitting station <NUM> can be, for example, a computer having an internal configuration of hardware such as that described in <FIG>. However, other implementations of the transmitting station <NUM> are possible. For example, the processing of the transmitting station <NUM> can be distributed among multiple devices.

A network <NUM> can connect the transmitting station <NUM> and a receiving station <NUM> for encoding and decoding of the video stream. Specifically, the video stream can be encoded in the transmitting station <NUM>, and the encoded video stream can be decoded in the receiving station <NUM>. The network <NUM> can be, for example, the Internet. The network <NUM> can also be a local area network (LAN), wide area network (WAN), virtual private network (VPN), cellular telephone network, or any other means of transferring the video stream from the transmitting station <NUM> to, in this example, the receiving station <NUM>.

The receiving station <NUM>, in one example, can be a computer having an internal configuration of hardware such as that described in <FIG>. However, other suitable implementations of the receiving station <NUM> are possible. For example, the processing of the receiving station <NUM> can be distributed among multiple devices.

Other implementations of the video encoding and decoding system <NUM> are possible. For example, an implementation can omit the network <NUM>. In another implementation, a video stream can be encoded and then stored for transmission at a later time to the receiving station <NUM> or any other device having memory. In one implementation, the receiving station <NUM> receives (e.g., via the network <NUM>, a computer bus, and/or some communication pathway) the encoded video stream and stores the video stream for later decoding. In an example implementation, a real-time transport protocol (RTP) is used for transmission of the encoded video over the network <NUM>. In another implementation, a transport protocol other than RTP may be used (e.g., a Hypertext Transfer Protocol-based (HTTP-based) video streaming protocol).

When used in a video conferencing system, for example, the transmitting station <NUM> and/or the receiving station <NUM> may include the ability to both encode and decode a video stream as described below. For example, the receiving station <NUM> could be a video conference participant who receives an encoded video bitstream from a video conference server (e.g., the transmitting station <NUM>) to decode and view and further encodes and transmits his or her own video bitstream to the video conference server for decoding and viewing by other participants.

In some implementations, the video encoding and decoding system <NUM> may instead be used to encode and decode data other than video data. For example, the video encoding and decoding system <NUM> can be used to process image data. The image data may include a block of data from an image. In such an implementation, the transmitting station <NUM> may be used to encode the image data and the receiving station <NUM> may be used to decode the image data. Alternatively, the receiving station <NUM> can represent a computing device that stores the encoded image data for later use, such as after receiving the encoded or pre-encoded image data from the transmitting station <NUM>. As a further alternative, the transmitting station <NUM> can represent a computing device that decodes the image data, such as prior to transmitting the decoded image data to the receiving station <NUM> for display.

<FIG> is a block diagram of an example of a computing device <NUM> that can implement a transmitting station or a receiving station. For example, the computing device <NUM> can implement one or both of the transmitting station <NUM> and the receiving station <NUM> of <FIG>. The computing device <NUM> can be in the form of a computing system including multiple computing devices, or in the form of one computing device, for example, a mobile phone, a tablet computer, a laptop computer, a notebook computer, a desktop computer, and the like.

A processor <NUM> in the computing device <NUM> can be a conventional central processing unit. Alternatively, the processor <NUM> can be another type of device, or multiple devices, capable of manipulating or processing information now existing or hereafter developed. For example, although the disclosed implementations can be practiced with one processor as shown (e.g., the processor <NUM>), advantages in speed and efficiency can be achieved by using more than one processor.

A memory <NUM> in computing device <NUM> can be a read only memory (ROM) device or a random access memory (RAM) device in an implementation. However, other suitable types of storage device can be used as the memory <NUM>. The memory <NUM> can include code and data <NUM> that is accessed by the processor <NUM> using a bus <NUM>. The memory <NUM> can further include an operating system <NUM> and application programs <NUM>, the application programs <NUM> including at least one program that permits the processor <NUM> to perform the techniques described herein. For example, the application programs <NUM> can include applications <NUM> through N, which further include a video coding application that performs the techniques described herein. The computing device <NUM> can also include a secondary storage <NUM>, which can, for example, be a memory card used with a mobile computing device. Because the video communication sessions may contain a significant amount of information, they can be stored in whole or in part in the secondary storage <NUM> and loaded into the memory <NUM> as needed for processing.

The computing device <NUM> can also include one or more output devices, such as a display <NUM>. The display <NUM> may be, in one example, a touch sensitive display that combines a display with a touch sensitive element that is operable to sense touch inputs. The display <NUM> can be coupled to the processor <NUM> via the bus <NUM>. Other output devices that permit a user to program or otherwise use the computing device <NUM> can be provided in addition to or as an alternative to the display <NUM>. When the output device is or includes a display, the display can be implemented in various ways, including by a liquid crystal display (LCD), a cathode-ray tube (CRT) display, or a light emitting diode (LED) display, such as an organic LED (OLED) display.

The computing device <NUM> can also include or be in communication with an image-sensing device <NUM>, for example, a camera, or any other image-sensing device <NUM> now existing or hereafter developed that can sense an image such as the image of a user operating the computing device <NUM>. The image-sensing device <NUM> can be positioned such that it is directed toward the user operating the computing device <NUM>. In an example, the position and optical axis of the image-sensing device <NUM> can be configured such that the field of vision includes an area that is directly adjacent to the display <NUM> and from which the display <NUM> is visible.

The computing device <NUM> can also include or be in communication with a sound-sensing device <NUM>, for example, a microphone, or any other sound-sensing device now existing or hereafter developed that can sense sounds near the computing device <NUM>. The sound-sensing device <NUM> can be positioned such that it is directed toward the user operating the computing device <NUM> and can be configured to receive sounds, for example, speech or other utterances, made by the user while the user operates the computing device <NUM>.

Although <FIG> depicts the processor <NUM> and the memory <NUM> of the computing device <NUM> as being integrated into one unit, other configurations can be utilized. The operations of the processor <NUM> can be distributed across multiple machines (wherein individual machines can have one or more processors) that can be coupled directly or across a local area or other network. The memory <NUM> can be distributed across multiple machines such as a network-based memory or memory in multiple machines performing the operations of the computing device <NUM>. Although depicted here as one bus, the bus <NUM> of the computing device <NUM> can be composed of multiple buses. Further, the secondary storage <NUM> can be directly coupled to the other components of the computing device <NUM> or can be accessed via a network and can comprise an integrated unit such as a memory card or multiple units such as multiple memory cards. The computing device <NUM> can thus be implemented in a wide variety of configurations.

<FIG> is a diagram of an example of a video stream <NUM> to be encoded and subsequently decoded. The video stream <NUM> includes a video sequence <NUM>. At the next level, the video sequence <NUM> includes a number of adjacent frames <NUM>. While three frames are depicted as the adjacent frames <NUM>, the video sequence <NUM> can include any number of adjacent frames <NUM>. The adjacent frames <NUM> can then be further subdivided into individual frames, for example, a frame <NUM>. At the next level, the frame <NUM> can be divided into a series of planes or segments <NUM>. The segments <NUM> can be subsets of frames that permit parallel processing, for example. The segments <NUM> can also be subsets of frames that can separate the video data into separate colors. For example, a frame <NUM> of color video data can include a luminance plane and two chrominance planes. The segments <NUM> may be sampled at different resolutions.

Whether or not the frame <NUM> is divided into segments <NUM>, the frame <NUM> may be further subdivided into blocks <NUM>, which can contain data corresponding to, for example, 16x16 pixels in the frame <NUM>. The blocks <NUM> can also be arranged to include data from one or more segments <NUM> of pixel data. The blocks <NUM> can also be of any other suitable size such as 4x4 pixels, 8x8 pixels, 16x8 pixels, 8x16 pixels, 16x16 pixels, or larger. Unless otherwise noted, the terms block and macroblock are used interchangeably herein.

<FIG> is a block diagram of an example of an encoder <NUM>. The encoder <NUM> can be implemented, as described above, in the transmitting station <NUM>, such as by providing a computer software program stored in memory, for example, the memory <NUM>. The computer software program can include machine instructions that, when executed by a processor such as the processor <NUM>, cause the transmitting station <NUM> to encode video data in the manner described in <FIG>. The encoder <NUM> can also be implemented as specialized hardware included in, for example, the transmitting station <NUM>. In one particularly desirable implementation, the encoder <NUM> is a hardware encoder.

The encoder <NUM> has the following stages to perform the various functions in a forward path (shown by the solid connection lines) to produce an encoded or compressed bitstream <NUM> using the video stream <NUM> as input: an intra/inter prediction stage <NUM>, a transform stage <NUM>, a quantization stage <NUM>, and an entropy encoding stage <NUM>. The encoder <NUM> may also include a reconstruction path (shown by the dotted connection lines) to reconstruct a frame for encoding of future blocks. In <FIG>, the encoder <NUM> has the following stages to perform the various functions in the reconstruction path: a dequantization stage <NUM>, an inverse transform stage <NUM>, a reconstruction stage <NUM>, and a loop filtering stage <NUM>. Other structural variations of the encoder <NUM> can be used to encode the video stream <NUM>.

When the video stream <NUM> is presented for encoding, respective adjacent frames <NUM>, such as the frame <NUM>, can be processed in units of blocks. At the intra/inter prediction stage <NUM>, respective blocks can be encoded using intra-frame prediction (also called intra-prediction) or inter-frame prediction (also called inter-prediction). In any case, a prediction block can be formed. In the case of intra-prediction, a prediction block may be formed from samples in the current frame that have been previously encoded and reconstructed. In the case of inter-prediction, a prediction block may be formed from samples in one or more previously constructed reference frames.

Next, the prediction block can be subtracted from the current block at the intra/inter prediction stage <NUM> to produce a residual block (also called a residual). The transform stage <NUM> transforms the residual into transform coefficients in, for example, the frequency domain using block-based transforms. The quantization stage <NUM> converts the transform coefficients into discrete quantum values, which are referred to as quantized transform coefficients, using a quantizer value or a quantization level. For example, the transform coefficients may be divided by the quantizer value and truncated.

The quantized transform coefficients are then entropy encoded by the entropy encoding stage <NUM>. The entropy-encoded coefficients, together with other information used to decode the block (which may include, for example, syntax elements such as used to indicate the type of prediction used, transform type, motion vectors, a quantizer value, or the like), are then output to the compressed bitstream <NUM>. The compressed bitstream <NUM> can be formatted using various techniques, such as variable length coding (VLC) or arithmetic coding. The compressed bitstream <NUM> can also be referred to as an encoded video stream or encoded video bitstream, and the terms will be used interchangeably herein.

The reconstruction path (shown by the dotted connection lines) can be used to ensure that the encoder <NUM> and a decoder <NUM> (described below with respect to <FIG>) use the same reference frames to decode the compressed bitstream <NUM>. The reconstruction path performs functions that are similar to functions that take place during the decoding process (described below with respect to <FIG>), including dequantizing the quantized transform coefficients at the dequantization stage <NUM> and inverse transforming the dequantized transform coefficients at the inverse transform stage <NUM> to produce a derivative residual block (also called a derivative residual). At the reconstruction stage <NUM>, the prediction block that was predicted at the intra/inter prediction stage <NUM> can be added to the derivative residual to create a reconstructed block. The loop filtering stage <NUM> can be applied to the reconstructed block to reduce distortion such as blocking artifacts.

Other variations of the encoder <NUM> can be used to encode the compressed bitstream <NUM>. In some implementations, a non-transform based encoder can quantize the residual signal directly without the transform stage <NUM> for certain blocks or frames. In some implementations, an encoder can have the quantization stage <NUM> and the dequantization stage <NUM> combined in a common stage.

<FIG> is a block diagram of an example of a decoder <NUM>. The decoder <NUM> can be implemented in the receiving station <NUM>, for example, by providing a computer software program stored in the memory <NUM>. The computer software program can include machine instructions that, when executed by a processor such as the processor <NUM>, cause the receiving station <NUM> to decode video data in the manner described in <FIG>. The decoder <NUM> can also be implemented in hardware included in, for example, the transmitting station <NUM> or the receiving station <NUM>.

The decoder <NUM>, similar to the reconstruction path of the encoder <NUM> discussed above, includes in one example the following stages to perform various functions to produce an output video stream <NUM> from the compressed bitstream <NUM>: an entropy decoding stage <NUM>, a dequantization stage <NUM>, an inverse transform stage <NUM>, an intra/inter prediction stage <NUM>, a reconstruction stage <NUM>, a loop filtering stage <NUM>, and a deblocking filtering stage <NUM>. Other structural variations of the decoder <NUM> can be used to decode the compressed bitstream <NUM>.

When the compressed bitstream <NUM> is presented for decoding, the data elements within the compressed bitstream <NUM> can be decoded by the entropy decoding stage <NUM> to produce a set of quantized transform coefficients. The dequantization stage <NUM> dequantizes the quantized transform coefficients (e.g., by multiplying the quantized transform coefficients by the quantizer value), and the inverse transform stage <NUM> inverse transforms the dequantized transform coefficients to produce a derivative residual that can be identical to that created by the inverse transform stage <NUM> in the encoder <NUM>. Using header information decoded from the compressed bitstream <NUM>, the decoder <NUM> can use the intra/inter prediction stage <NUM> to create the same prediction block as was created in the encoder <NUM> (e.g., at the intra/inter prediction stage <NUM>).

At the reconstruction stage <NUM>, the prediction block can be added to the derivative residual to create a reconstructed block. The loop filtering stage <NUM> can be applied to the reconstructed block to reduce blocking artifacts. Other filtering can be applied to the reconstructed block. In this example, the deblocking filtering stage <NUM> is applied to the reconstructed block to reduce blocking distortion, and the result is output as the output video stream <NUM>. The output video stream <NUM> can also be referred to as a decoded video stream, and the terms will be used interchangeably herein. Other variations of the decoder <NUM> can be used to decode the compressed bitstream <NUM>. In some implementations, the decoder <NUM> can produce the output video stream <NUM> without the deblocking filtering stage <NUM>.

As mentioned above, the prediction residual can be quantized to a closest prototypical prediction residual using a codebook. The codebook of prediction residuals can be derived in any number of ways. In an example, the codebook can be derived using vector quantization (VQ). VQ is a quantization technique that allows the modelling of probability distribution of prototype data (i.e., training samples).

In an off-line training phase, many prediction residual blocks can be used as training samples. VQ divides the training samples into groups. VQ then represents each group of sample prediction residuals by its centroid. The centroids become the code vectors (e.g., the prototypical prediction residuals). That is, the centroids become the entries of the codebook. Several known techniques can be used to cluster the training prediction residual samples and derive the centroids (i.e., the code vectors). For example, Lloyd's algorithm, Generalized Lloyd's algorithm, Linde- Buzzo-Gray (LBG) algorithm, K-means, or some other technique can be used.

In an example of designing a codebook of luma <NUM>×<NUM> prediction residuals, training samples of <NUM>×<NUM> prediction residuals are used. Each of the training samples can be converted to an array (e.g., vector) of <NUM> values (i.e., pixel values) using a raster scan of the training sample. An input to the VQ algorithm used can be the number N (e.g., <NUM> or some other number) of desired code vectors (e.g., a size of the codebook). The resulting codebook will include N <NUM>-value code vectors. For generally, a codebook of size P for M×N prediction residuals includes P M*N-value code vectors. The same technique can be used for designing codebooks for any color component (chroma U, chroma Y, etc.) sized (e.g., M×N) prediction residual.

<FIG> is a diagram of an example of a codebook <NUM> according to implementations of this disclosure. The codebook <NUM> illustrates the learned (i.e., during the training phase) code vectors. As mentioned above, code vectors of a codebook can be represented as one-dimensional arrays of pixel values. For ease of visualization, the code vectors of the codebook <NUM> are illustrated as <NUM>-dimensional residual blocks, which are ordered from highest selection frequency during training (i.e., starting from the top left of the codebook <NUM>) to lowest selection frequency during training (i.e., ending at the bottom right of the codebook <NUM>). The codebook <NUM> includes <NUM> code vectors. However, only the top <NUM> and the bottom <NUM> are illustrated.

In an example, Gain-Shape Vector Quantization (GSVQ) can be used to derive a magnitude (i.e., gain) codebook and a shape (i.e., normalized signal) codebook. For simplicity of reference, GSVQ may also be referred to as VQ in the following description. In an example, the codebooks for <NUM>×<NUM> luminance (Y) prediction residuals can be such that the gain codebook includes <NUM> scalar codewords and the shape codebook can include <NUM> code vectors.

In GSVQ, during training, the norms of each of the training prediction residuals are extracted and a gain (i.e., magnitude) codebook is derived for the extracted norms. The norm can be the Euclidean norm (i.e., the length) of a training prediction residual. As is known, the Euclidean norm of a vector x = (x<NUM>, x<NUM>,. ,x<NUM>) is given by ||x|| = <MAT>.

A unit-norm training prediction residual refers to the training prediction residual where each of the values of the training prediction residual is divided by the norm of the training prediction residual. That is, given a training prediction residual x, the unit-norm training prediction residual is given by x/∥x∥. The unit-norm training prediction residual is so called because the length of the unit-norm training prediction residual is <NUM>.

The gain codebook can be derived using a K-means algorithm on the norms of the training prediction residuals. The shape codebook can be derived by, first, generating a Voronoi diagram from random unit-norm training prediction residuals; then iteratively applying a K-means algorithm. In each iteration, the steps of the K-means algorithm can include computing sign-invariant distance metrics; clustering the training samples based on the distances; and computing normalized cluster means. The sign-invariant distance metrics are computed between at least some of the training prediction residuals and each current centroid. In an example, for a unit-norm training prediction residual p and a centroid q, the sign-invariant distance metric d(p, q) can be calculated as d(x,y) = min {∥x - y∥, ∥x + y∥}. That is, the sign-invariant distance metric d(p, q) can be the minimum of a first length of the vector (x - y) and a second length of the vector (x + y).

<FIG> is a diagram of functionality of a prediction residual encoding stage <NUM> using vector quantization according to implementations of this disclosure. The prediction residual encoding stage <NUM> quantizes a prediction residual to a closest gain value and a closest shape vector.

In an example, the prediction residual encoding stage <NUM> can be or can be included in the transform stage <NUM> of <FIG>. In another example, the prediction residual encoding stage <NUM> may be a stage that is separate from the transform stage <NUM> of <FIG>. In any case, and while not specifically shown in <FIG>, when the encoder <NUM> (or one or more components therein) determines that VQ (i.e., GSVQ) is to be performed for the prediction residual (i.e., the prediction block) that is produced by the intra/inter prediction stage <NUM> of <FIG>, then at least the quantization stage <NUM>, the dequantization stage <NUM>, and the inverse transform stage <NUM> of <FIG> are by passed. In an example, VQ may be determined to be used (or at least tested) only when the prediction residual results from intra prediction. In an example, VQ may be determined to be used if the prediction block is smaller than or equal to a certain threshold block size. In an example, the threshold block size is <NUM>×<NUM> for luma prediction blocks.

The prediction residual encoding stage <NUM> includes a normalization stage <NUM> and an GSVQ stage <NUM>. The normalization stage <NUM> can receive a prediction residual x that is produced by intra/inter prediction stage <NUM>. In an example, the prediction residual x can be the result of intra prediction. In an example, the prediction residual x can be of size <NUM>×<NUM> or some other block size. The prediction residual x can be a luminance (Y) block, a chrominance (U or V) residual block, or some other color component residual block. For simplicity of explanation, the notation x for a prediction residual may be used to refer to either or both of the <NUM>-dimensional M×N (e.g., <NUM>×<NUM>) residual block or the equivalent <NUM>-dimensionsal, raster-scanned M*N (e.g., <NUM>*<NUM>=<NUM>) vector.

The normalization stage <NUM> generates (e.g., calculates, extracts, etc.) the norm (e.g., the Euclidean length, ∥x∥) of the prediction residual x. The norm ||x|| is scalar-quantized using the gain codebook. The gain index (i.e., the index of the value in the gain codebook to which the norm ||x|| is quantized) can be encoded in a compressed bitstream, such as the compressed bitstream <NUM> of <FIG>, as indicated by an arrow <NUM>.

The unit-norm prediction residual x/∥x∥ is input to the GSVQ stage <NUM>, which quantizes the unit-norm vector separately using the shape codebook. That is, the GSVQ stage <NUM> identifies the closest code vector to the unit-norm vector. A distance (e.g., an error) measure can be used to identity the closest code vector. In an example, the sign-invariant distance metric, as described above, between the unit-norm prediction residual x/∥x∥ and at least some of the code vectors of the shape codebook can be used. The distance measure can be the mean square error. The distance measure can be a sum of absolute differences error. Any other suitable distance measure can be used.

The shape index (i.e., the index of the code vector in the shape codebook to which the unit-norm x/∥x∥ is quantized) can be encoded in the compressed bitstream, such as the compressed bitstream <NUM> of <FIG>, as indicated by an arrow <NUM>. As such, the prediction residual can be approximated by (e.g., encoded to, compressed to, etc.) the product of an optimal (e.g., closest) gain and an optimal (e.g., closest) shape.

In an implementation, a sign can additionally be encoded in the compressed bitstream. The sign can be used to reduce the size of the codebook. The sign can be a binary symbol that represents the values +<NUM> or -<NUM>. For example, a sign bit value of <NUM> can represent a value of -<NUM> and a sign bit value of <NUM> can represent a value of +<NUM>, or vice versa. As such, a prediction residual can be represented by a gain index, a shape index, and a sign.

In the case that the sign is not used, the prediction residual can be represented by a gain and a shape, where the gain is a positive scalar and the shape is a unit norm vector.

Assuming, for illustration purposes only, the following two length-<NUM> vectors: v<NUM> = [-<NUM>,<NUM>,<NUM>,<NUM>] and v<NUM> = [<NUM>, -<NUM>, -<NUM>, -<NUM>], which may be represented, respectively, with (gain = <NUM>, shape = [-<NUM>, <NUM>, <NUM>, <NUM>]) and (gain = <NUM>, shape = [<NUM>, -<NUM>, -<NUM>, -<NUM>]). In such a definition, the shapes of the vectors v<NUM> and v<NUM> may be mapped to different shape codewords even though the vectors v<NUM> and v<NUM> are mere flipped versions of each other. In an implementation, the shapes of the vectors v<NUM> and v<NUM> can be treated as being the same shape and their signs as decoupled.

Accordingly, in an implementation, the vectors v<NUM> and v<NUM> can be represented, respectively, with the <NUM>-tuples (gain = <NUM>, sign = <NUM>, shape = [-<NUM>, <NUM>, <NUM>, <NUM>]) and (gain = <NUM>, sign = -<NUM>, shape = [-<NUM>, <NUM>, <NUM>, <NUM>]). As such, the size of the shape codebook can be halved. That is, for example, if the codebook includes [-<NUM>, <NUM>, <NUM>, <NUM>], then it need not include the code vector [<NUM>, -<NUM>, -<NUM>, -<NUM>]. As such, in implementations that use the sign, the search of code vectors in the codebook can be faster because the searches of gain, sign and shape can be done independently.

To summarize, using GSVQ, a prediction residual can be represented by a gain index and a shape index; alternatively, a prediction residual can be represented by a gain index, a shape index and a sign (which can be a binary symbol).

As is known, some codecs use what may be referred to as a transform skip mode. In the transform skip mode, an encoder can decide to skip transforming the residual block to the frequency domain but may still perform a quantization step on the residual block.

Transform skip can be selected by the encoder when a residual block has a sufficiently small energy such that the energy can be ignored. As such, in a skip block mode, the prediction signal itself is encoded along with a SKIP flag. Skip mode can be particularly useful for text, graphic, and/or screen content videos because those videos typically contain large areas of flat and/or smooth regions, such that intra and inter predictions of such regions yield almost perfect predictions with no (or little) prediction residue. In an example, to decide whether a transform block should be skipped, the encoder can compare the RD costs of skip and no skip, then can choose the one with the smaller RD cost.

For a current prediction residual, an encoder according to implementations of this disclosure has to communicate to a decoder (via a compressed bitstream) how the prediction residual is encoded (i.e., a prediction residual encoding mode). That is, the encoder needs to communicate whether or not transform coding is skipped, whether transform coefficients were generated for the prediction residual, or whether the prediction residual is encoded via GSVQ (as described with respect to <FIG>).

At least two (<NUM>) syntax elements can be used to describe the prediction residual encoding mode. A first syntax element (i.e., USE_VQ) indicates whether GSVQ is used to encode a residual block. A second syntax element (i.e., SKIP) indicates whether the prediction residual is encoded with the transform skip mode. The at least two syntax elements can be written to a compressed bitstream in a header of a prediction block, in a header of block containing the prediction block, in a header of a macro-block, in a header of a transform block, some other header, or a combination thereof.

In an example, USE_VQ and SKIP can each be a binary symbol. In an example, a value of <NUM> for USE_VQ indicates that the prediction residual is encoded using GSVQ and a value of <NUM> indicates that the prediction residual is not encoded using GSVQ. In an example, a value of <NUM> for SKIP indicates that the prediction residual is encoded using transform skip and a value of <NUM> indicates that the prediction residual is not encoded using transform skip. However, other values are possible for the USE_VQ and/or SKIP syntax elements.

<FIG> is a diagram of a flowchart of a technique <NUM> for bitstream syntax coding when using vector quantization in an encoder according to an implementation of this disclosure. In an example, the technique <NUM> can be performed (e.g., executed, carried out, etc.) for a prediction residual that is of size <NUM>×<NUM> and that results from intra prediction. However, the disclosure is not so limited. The technique <NUM> can write syntax elements describing modes of encoding residual blocks into a compressed bitstream, such as the compressed bitstream <NUM> of <FIG>.

The technique <NUM> can be implemented, for example, as a software program that may be executed by computing devices such as the transmitting station <NUM>. For example, the software program can include machine-readable instructions that may be stored in a memory such as the memory <NUM> or the secondary storage <NUM>, and that, when executed by a processor, such as the processor <NUM>, may cause the computing device to perform the technique <NUM>. The technique <NUM> can be implemented using specialized hardware or firmware. For example, a hardware component can be configured to perform the technique <NUM>. As explained above, some computing devices may have multiple memories or processors, and the operations described in the technique <NUM> can be distributed using multiple processors, memories, or both.

At <NUM>, the technique <NUM> can receive a macroblock. A macroblock can be a block of size <NUM>×<NUM>, <NUM>×<NUM>, or some other M×N size. The macroblock can be partitioned into smaller block, which can be known as coding blocks. A coding block may further be partitioned into one or more prediction blocks. A prediction block is then predicted, as described with above with respect to the intra/inter prediction stage <NUM> of <FIG>. As also described above, a prediction residual (e.g., a prediction block) is produced. For example, the prediction block can be a luminance block of size <NUM>×<NUM> and the residual block may be a corresponding <NUM>×<NUM> prediction block that results from intra predicting the block. A block being currently encoded by an encoder is referred to as a current block.

The technique <NUM> can perform a rate-distortion search between the GSVQ and transform coding to determine which results in the better RD cost. In an example, the search may be an exhaustive search. In an example, some (e.g., a subset) of the possible modes (e.g., transform types, code vectors) may be searched. If GSVQ does not result in the better RD cost, then the technique <NUM> writes <NUM> for USE_VQ to the compressed bitstream and proceeds to <NUM>; otherwise the technique <NUM> writes <NUM> for USE_VQ to the compressed bitstream and proceeds to <NUM>.

At <NUM>, the technique <NUM> determines whether transforming the prediction residual to the frequency domain is to be skipped, corresponding to encoding the prediction residual using the transform skip mode. If the prediction residual is to be encoded using the transform skip mode, then the technique <NUM> writes <NUM> for the syntax element SKIP to the compressed bitstream and ends at <NUM>. The prediction residual, in this case, may be itself quantized. In another example, the prediction example may itself be written to the compressed bitstream. If the prediction residual is not to be encoded using the transform skip mode, then the technique <NUM> writes <NUM> for the syntax element SKIP and proceeds to <NUM>.

At <NUM>, the technique <NUM> can select (e.g., choose, identify, search for, etc.) a transform type, which the technique <NUM> uses to convert the prediction residual to a transform block of transform coefficients, as described above with respect to transform stage <NUM> of <FIG>. The technique <NUM> then encodes (i.e., writes) the transform type and the transform coefficients to the compressed bitstream as described above with respect to <FIG>.

At <NUM>, the technique <NUM> quantizes the prediction residual to a closest shape vector and a closest gain value, as described with respect to <FIG>. The technique <NUM> writes (e.g., encodes) the shape index and the gain index to the compressed bitstream. In an example, a sign can also be used, as described with respect to <FIG>. As such, the technique <NUM> can also write the sign to the compressed bitstream.

Bitstream portions <NUM>, <NUM>, <NUM>, and <NUM> illustrate the different organizations of portions of the compressed bitstream.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag (e.g., binary value) for the USE_VQ syntax element followed by a <NUM> flag (e.g., binary value) for the SKIP syntax element.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag for the USE_VQ syntax element, followed by a <NUM> for the SKIP syntax element, followed by bits that encode the transform type, and followed by the entropy encoded transform coefficients.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag for the USE_VQ syntax element, followed by bits that encode the gain index, and followed by the bits that encode the shape index. It is noted that the bits that encode the shape index may precede the bits that encode the gain index in the bitstream portion <NUM>.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM> and when a sign is also written to the compressed bitstream. As such, the bitstream portion <NUM> includes a <NUM> flag for the USE_VQ syntax element, followed by bits that encode the gain index, followed by the bits that encode the shape index, followed by a binary symbol indicating the sign. It is noted that the gain index, the shape index, and the sign can be written in any order.

A decoder, such as the decoder <NUM> of <FIG>, can receive the compressed bitstream, such the compressed bitstream <NUM> of <FIG>. The decoder includes or can have access to the same lookup tables (i.e., the shape codebook and gain codebook) as the encoder that produced the compressed bitstream.

The decoder decodes a first syntax element (USE_VQ).

In an implementation, if USE_VQ is equal to <NUM>, then the decoder decodes a gain index and a shape index. The decoder uses the shape index to look up a shape vector (i.e., y) in a shape cookbook and uses the gain index to look up a gain scalar value (i.e., a) in the gain codebook. The decoder calculates the residual block as a · y.

In another implementation, if USE_VQ is equal to <NUM>, then the decoder decodes a gain index, a shape index, and a sign. The decoder uses the shape index to look up a shape vector (i.e., y) in a shape cookbook and uses the gain index to look up a gain scalar value (i.e., a) in the gain codebook. The decoder calculates the residual block as sign · a · y.

If, on the other hand, USE_VQ is equal to <NUM>, then the decoder proceeds to decode from the compressed bitstream another syntax element (SKIP).

If SKIP is equal to <NUM>, the decoder can decode the quantized prediction residual from the compressed bitstream to obtain the residual block. If SKIP is equal to <NUM>, the decoder can decode a transform type and transform coefficients from the compressed bitstream to obtain the prediction block, as described above with respect to <FIG>.

The decoder can them use the residual block to reconstruct a current block, as described above with respect to <FIG>.

At <NUM>, the technique <NUM> determines whether transforming the prediction residual to the frequency domain is to be skipped, corresponding to encoding the prediction residual using the transform skip mode. If the prediction residual is to be encoded using the transform skip mode, then the technique <NUM> writes <NUM> for the syntax element SKIP to the compressed bitstream and ends at <NUM>. The prediction residual, in this case, may be itself quantized or may be written to the compressed bitstream without quantization. If the prediction residual is not to be encoded using the transform skip mode, then the technique <NUM> writes <NUM> for the syntax element SKIP and proceeds to <NUM>.

At <NUM>, the technique <NUM> can perform a rate-distortion search between the GSVQ and transform coding to determine which results in the better RD cost, as described above with respect to <NUM> of <FIG>. If GSVQ does not result in the better RD cost, then the technique <NUM> writes <NUM> for USE_VQ to the compressed bitstream and proceeds to <NUM>; otherwise the technique <NUM> writes <NUM> for USE_VQ to the compressed bitstream and proceeds to <NUM>.

At <NUM>, the technique <NUM> quantizes the prediction residual to a closest shape vector and a closest gain value, as described with respect to <FIG>. The technique <NUM> writes (e.g., encodes) the shape index and the gain index to the compressed bitstream. In an example, and as also described with respect to <FIG>, the technique <NUM> can also write a sign.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag for the SKIP syntax element, followed by a <NUM> for the USE_VQ syntax element, followed by bits that encode the gain index, and followed by bits that encode the shape index. It is noted that the bits that encode the shape index may precede the bits that encode the gain index in the bitstream portion <NUM>.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>-<NUM> including writing a sign. As such, the bitstream portion <NUM> includes a <NUM> flag for the SKIP syntax element, followed by a <NUM> for the USE_VQ syntax element, followed by bits that encode the gain index, followed by bits that encode the shape index, and followed by the sign bit. It is noted that the gain index, shape index, and sign can be written in any order the bitstream portion <NUM>.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag for the SKIP syntax element, followed by a <NUM> for the USE_VQ syntax element, followed by bits that encode the transform type, and followed by the entropy encoded transform coefficients.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag for the SKIP syntax element.

The decoder decodes a first syntax element (SKIP). If SKIP is equal to <NUM>, the decoder can decode the quantized prediction residual from the compressed bitstream to obtain the residual block.

If SKIP is equal to <NUM>, the decoder decodes a second syntax element (USE_VQ).

If, on the other hand, USE_VQ is equal to <NUM>, the decoder can decode a transform type and transform coefficients from the compressed bitstream to obtain the prediction block, as described above with respect to <FIG>.

The decoder can then use the residual block to reconstruct a current block, as described above with respect to <FIG>.

<FIG> is a diagram of a flowchart of a technique <NUM> for bitstream syntax coding when using vector quantization in an encoder according to an implementation of this disclosure. The technique <NUM> includes blocks similar to those of the technique <NUM> of <FIG>. Descriptions of those similar blocks (i.e., similarly numbered blocks) are omitted with respect to <FIG>.

The technique <NUM> differs from the technique <NUM> in that, instead of transforming the prediction residual to the frequency domain to obtain a transform block at <NUM>, the technique <NUM> obtains (i.e., calculates, etc.) a differential prediction residual by subtracting a VQ prediction residual from the prediction block and then transforming the differential prediction residual to the frequency domain. The VQ prediction residual corresponds to the GSVQ quantization of the prediction residual.

As such, before writing the transform type and the transform coefficients at <NUM>, the technique <NUM> determines, for the prediction residual, a gain scalar (i.e., a) from the shape code vector and a shape vector (i.e., y) from the gain codebook and the shape codebook, respectively; calculates the VQ prediction residual as a · y; obtains, at <NUM>, the VQ prediction residual; transforms the VQ prediction residual using the transform type to obtain the transformed VQ prediction residual; encodes (i.e., writes), at <NUM>, the gain index of the gain scalar, and the shape index of the shape code vector in the compressed bitstream; and encodes (i.e., writes), at <NUM>, the transform type and the transformed VQ prediction residual to the compressed bitstream. As described above, in some examples, the technique <NUM> can additionally determine, for the prediction residual, a sign. As such, the technique <NUM> calculates the VQ prediction residual as sign · a · y.

Bitstream portions <NUM>, <NUM>, <NUM>, and <NUM> illustrate the different organizations of portions of the compressed bitstream. The bitstream portion <NUM>, the bitstream portion <NUM>, and the bitstream portion <NUM> are as described with respect to <FIG>.

The bitstream portion <NUM> illustrates the organization of the compressed bitstream when the technique <NUM> performs the sequence <NUM>-<NUM>-<NUM>. As such, the bitstream portion <NUM> includes a <NUM> flag for the SKIP syntax element, followed by a <NUM> for the USE_VQ syntax element, followed by bits (first bits) that encode the gain index, followed by bits (second bits) that encode the shape index, optionally followed (as illustrated by the dashed lines and depending on the implementation) by a sign bit, followed by bits that encode the transform type (third bits), and followed by bits (fourth bits) of entropy encoded coefficients of the transformed VQ prediction residual. It is noted that the sign bit (if included), the first, second, third, and fourth bits can be arranged in any order in the compressed bitstream.

The decoder decodes a first syntax element (SKIP). If SKIP is equal to <NUM>, the decoder can decode the quantized prediction residual from the compressed bitstream using the transform skip mode to obtain the residual block.

In an implementation. if USE_VQ is equal to <NUM>, then the decoder decodes a gain index and a shape index. The decoder uses the shape index to look up a shape vector (i.e., y) in a shape cookbook. The decoder uses the gain index to look up a gain scalar value (i.e., a) in the gain codebook. The decoder calculates the residual block as a · y.

In another implementation. if USE_VQ is equal to <NUM>, then the decoder decodes a gain index, a shape index, and a sign. The decoder uses the shape index to look up a shape vector (i.e., y) in a shape cookbook. The decoder uses the gain index to look up a gain scalar value (i.e., a) in the gain codebook. The decoder calculates the residual block as sign · a · y.

If USE_VQ is equal to <NUM>, the decoder can decode a gain index, a shape index, a transform type, and VQ transform coefficients from the compressed bitstream. The VQ transform coefficients corresponding to entropy encoded coefficients of the transformed VQ prediction residual.

Using the transform type and the VQ transform coefficients, the decoder can obtain (such as via stages including entropy decoding, dequantizing, and inverse transforming, or a subset thereof) the differential prediction residual. The decoder can use the gain index and the shape index to obtain (e.g., lookup, etc.), respectively, a gain value (i.e., a) from the gain codebook and a shape code vector (i.e., y) from the shape codebook. Using the gain value and the shape code vector, the decoder obtains the VQ prediction residual (i.e., a · y). The decoder can then reconstitute the prediction residual by adding the VQ prediction residual to the differential prediction residual.

<FIG> is a diagram of a flowchart of a technique <NUM> for decoding a current block according to an implementation of this disclosure. The technique <NUM> can be implemented in a decoder, such as the decoder <NUM> of <FIG>. The technique <NUM> decodes a residual block (i.e., a prediction residual) from the a compressed bitstream, which can be the compressed bitstream <NUM> of <FIG>, to reconstruct the current block, as described with respect to the reconstruction stage <NUM> of <FIG>.

The technique <NUM> can be implemented, for example, as a software program that may be executed by a computing device, such as the receiving station <NUM>. For example, the software program can include machine-readable instructions that may be stored in a memory such as the memory <NUM> or the secondary storage <NUM>, and that, when executed by a processor, such as the processor <NUM>, may cause the computing device to perform the technique <NUM>. The technique <NUM> can be implemented using specialized hardware or firmware. For example, a hardware component can be configured to perform the technique <NUM>. As explained above, some computing devices may have multiple memories or processors, and the operations described in the technique <NUM> can be distributed using multiple processors, memories, or both.

The technique <NUM> can also be implemented in an encoder, such as the encoder <NUM> of <FIG>. The technique <NUM> can be implemented in the reconstruction path of the encoder.

At <NUM>, the technique <NUM> can decode, from the compressed bitstream, a flag indicating whether the residual block for the current block is encoded using vector quantization (VQ). The flag can be the USE_VQ syntax element described above.

At <NUM>, the technique <NUM> determines whether the residual block is encoded using VQ. For example, if the residual block is not encoded using VQ (such us, for example, if USE_VQ syntax element is equal to <NUM>), then the technique <NUM> proceeds to <NUM>; if the residual block is encoded using VQ (such us, for example, if USE_VQ syntax element is equal to <NUM>), then the technique <NUM> proceeds to <NUM>.

At <NUM>, the technique <NUM> decodes a parameter indicating an entry in a codebook. As mentioned above, decoding the parameter indicating the entry in the codebook can include decoding a gain index and decoding a shape index. In an implementation, the technique <NUM> can also decode a sign. The gain index, the shape index, and the sign (if decoded) can be as described above. Using the gain index, the technique <NUM> can select a gain value (a gain scalar a) from a gain codebook, as described above. That is, the gain index can be used to look up the gain value in the gain codebook. Using the shape index, the technique <NUM> can select a shape vector (i.e., a shape code vector, y) from a shape codebook. As described above, the shape vector can be a unit-norm vector (i.e., a unit-norm prediction residual). The decoder uses the same (e.g., copies of) gain codebook and shape codebook used by the encoder that produced the compressed bitstream.

At <NUM>, the technique <NUM> decodes the residual block using the entry. That is, in an example, the residual block can be obtained by multiplying the gain shape by the shape vector (i.e., a · y). In another example, where a sign is also decoded, the residual block can be by multiplying the sign, the gain shape, and the shape vector (i.e., sign · a · y).

At <NUM>, the technique <NUM> reconstructs the current block using the prediction block. The current block can be reconstructed using the residual block as described above with respect to <FIG>.

At <NUM>, the technique <NUM> decodes the residual block based on a skip flag indicating whether the current block is encoded using transform skip (i.e., transform skip mode). In an example, and as described with respect to <FIG>, decoding the residual block based on a skip flag indicating whether the current block is encoded using transform skip can include: in response to the skip flag indicating that the current block is not encoded using skip transform, decoding a transform type, decoding a transform block, and generating the residual block using the transform type and the transform block; and in response to the skip flag indicating that the current block is encoded using transform skip, decoding the residual block without performing an inverse transform operation.

<FIG> is a diagram of a flowchart of a technique <NUM> for encoding a current block using vector quantization (VQ) according to an implementation of this disclosure. The technique <NUM> may be implemented in an encoder, such as the encoder <NUM> of <FIG>. The technique <NUM> encodes the current block into a compression bitstream, such as the compressed bitstream <NUM> of <FIG>. More specifically, the technique <NUM> obtains a residual block for the current block and writes (i.e., encodes) information related to the residual block in the compressed bitstream, which a decoder can use to decode the residual block.

At <NUM>, the technique <NUM> determines whether the current block is not to be encoded using a transform skip mode. For example, the current block is determined not to be encoded using the transform skip mode as described with respect to SKIP = <NUM> (i.e., when the technique <NUM> write SKIP = <NUM> to the compressed bitstream, at <NUM> of <FIG>). For example, the current block is determined not to be encoded using the transform skip mode as described with respect to SKIP = <NUM> (i.e., when the technique <NUM> write SKIP = <NUM> to the compressed bitstream, at <NUM> of <FIG>).

In response to determining that the current block is not to be encoded using transform skip mode, the technique <NUM> obtains (at <NUM>) a residual block (i.e., a prediction residual) for the current block. In an example, the prediction residual can be obtained using intra prediction. For example, the prediction residual can be obtained from/using the intra/inter prediction stage <NUM> of <FIG>. At <NUM>, the technique <NUM> selects a VQ gain index and a VQ shape index using the residual block. That is, and as described above, the technique <NUM> can obtain a norm (e.g., a length) of the prediction residual and can obtain a unit-norm prediction residual (i.e., a normalized residual block) by dividing the prediction block (which can be thought of as a one-dimensional or a two-dimensional array). Using a gain codebook, the norm (e.g., the magnitude, the length, etc.) of the norm can be quantized to the closest value in the gain codebook. The closest value in the gain codebook corresponds to a gain index (a VQ gain index, a first index) in the gain codebook. The norm-unit prediction residual can be quantized to the closest code vector in the shape codebook. The closest code vector in the shape codebook corresponds to a shape index (a VQ shape index, a second index) in the shape codebook.

At <NUM>, the technique <NUM> encodes the VQ gain index in the compressed bitstream. At <NUM>, the technique <NUM> encodes the VQ shape index in the compressed bitstream.

In an example, and as mentioned above, the current block can be a <NUM>×<NUM> luma (i.e., luminance) block. However, the current block can be a luma block or a chroma block of any other size. In an example, the gain codebook can include <NUM> entries and the shape codebook can include <NUM> entries. In an example, the encoder can use different pairs of gain codebooks and shape codebooks for different current block sizes. In an example, the encoder can use different pairs of gain codebooks and shape codebooks for different color components. As mentioned above, a pair of shape codebook and the gain codebook can be obtained during an off-line training using residual blocks as training samples.

In an example, and as described with respect to <FIG> and <FIG>, the technique <NUM> can include encoding, in the compressed bitstream, a first flag indicating that the current block is not to be encoded using the transform skip mode (e.g., SKIP=<NUM>); and encoding, in the compressed bitstream, a second flag indicating whether the current block is to be encoded using VQ (e.g., USE_VQ=<NUM> or USE_VQ=<NUM>).

In an example, and as described with respect to <NUM> of <FIG>, encoding the current block using the VQ gain index and the VQ shape index can include determining whether VQ is to be used for encoding the current block; and in response to determining that VQ is not to be used for encoding the current block, obtaining a VQ residual block using the VQ gain index and the VQ shape index, obtaining a differential prediction residual as a difference between the VQ residual block and the residual block, transforming the differential prediction residual to obtain a transformed differential prediction residual, and encode the transformed differential prediction residual.

In an example, encoding the current block using the VQ gain index and the VQ shape index can include determining whether VQ is to be used for encoding the current block; and in response to determining that VQ is to be used for encoding the current block, encode a first flag indicating that the current block is not to be encoded using the transform skip mode (i.e., SKIP = <NUM>), and encode a second flag indicating that the current block is to be encoded using VQ (i.e., USE_VQ = <NUM>).

In an example, at <NUM>, the technique <NUM> can, in addition to selecting a VQ gain index and a VQ shape index using the residual block, select a sign, as described above with respect to <FIG>. Accordingly, the technique <NUM> can also include encoding the sign in the compressed bitstream.

Using VQ for prediction residual coding can result in performance improvements. For example, as compared to not using VQ, decoder times have been shown to be reduced to <NUM>% for key frames and <NUM>% overall.

For simplicity of explanation, the techniques <NUM>, <NUM>, <NUM>, <NUM>, and <NUM> are each depicted and described as a series of blocks, steps, or operations. However, the blocks, steps, or operations in accordance with this disclosure can occur in various orders and/or concurrently. Additionally, other steps or operations not presented and described herein may be used. Furthermore, not all illustrated steps or operations may be required to implement a technique in accordance with the disclosed subject matter.

The aspects of encoding and decoding described above illustrate some examples of encoding and decoding techniques. However, it is to be understood that encoding and decoding, as those terms are used in the claims, could mean compression, decompression, transformation, or any other processing or change of data.

The word "example" is used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as "example" is not necessarily to be construed as being preferred or advantageous over other aspects or designs. Rather, use of the word "example" is intended to present concepts in a concrete fashion. As used in this application, the term "or" is intended to mean an inclusive "or" rather than an exclusive "or. " That is, unless specified otherwise or clearly indicated otherwise by the context, the statement "X includes A or B" is intended to mean any of the natural inclusive permutations thereof. That is, if X includes A; X includes B; or X includes both A and B, then "X includes A or B" is satisfied under any of the foregoing instances. In addition, the articles "a" and "an" as used in this application and the appended claims should generally be construed to mean "one or more," unless specified otherwise or clearly indicated by the context to be directed to a singular form. Moreover, use of the term "an implementation" or the term "one implementation" throughout this disclosure is not intended to mean the same implementation unless described as such.

Implementations of the transmitting station <NUM> and/or the receiving station <NUM> (and the algorithms, methods, instructions, etc., stored thereon and/or executed thereby, including by the encoder <NUM> and the decoder <NUM>) can be realized in hardware, software, or any combination thereof. The hardware can include, for example, computers, intellectual property (IP) cores, application-specific integrated circuits (ASICs), programmable logic arrays, optical processors, programmable logic controllers, microcode, microcontrollers, servers, microprocessors, digital signal processors, or any other suitable circuit. In the claims, the term "processor" should be understood as encompassing any of the foregoing hardware, either singly or in combination. The terms "signal" and "data" are used interchangeably. Further, portions of the transmitting station <NUM> and the receiving station <NUM> do not necessarily have to be implemented in the same manner.

Further, in one aspect, for example, the transmitting station <NUM> or the receiving station <NUM> can be implemented using a general purpose computer or general purpose processor with a computer program that, when executed, carries out any of the respective methods, algorithms, and/or instructions described herein. In addition, or alternatively, for example, a special purpose computer/processor can be utilized which can contain other hardware for carrying out any of the methods, algorithms, or instructions described herein.

The transmitting station <NUM> and the receiving station <NUM> can, for example, be implemented on computers in a video conferencing system. Alternatively, the transmitting station <NUM> can be implemented on a server, and the receiving station <NUM> can be implemented on a device separate from the server, such as a handheld communications device. In this instance, the transmitting station <NUM>, using an encoder <NUM>, can encode content into an encoded video signal and transmit the encoded video signal to the communications device. In turn, the communications device can then decode the encoded video signal using a decoder <NUM>. Alternatively, the communications device can decode content stored locally on the communications device, for example, content that was not transmitted by the transmitting station <NUM>. Other suitable transmitting and receiving implementation schemes are available. For example, the receiving station <NUM> can be a generally stationary personal computer rather than a portable communications device, and/or a device including an encoder <NUM> may also include a decoder <NUM>.

Further, all or a portion of implementations of this disclosure can take the form of a computer program product accessible from, for example, a computer-usable or computer-readable medium. A computer-usable or computer-readable medium can be any device that can, for example, tangibly contain, store, communicate, or transport the program for use by or in connection with any processor. The medium can be, for example, an electronic, magnetic, optical, electromagnetic, or semiconductor device. Other suitable mediums are also available.

Claim 1:
An apparatus for decoding a current block of video, comprising:
a memory; and
a processor, the processor configured to execute instructions stored in the memory to:
decode (<NUM>), from a compressed bitstream, a flag indicating whether a residual block for the current block is encoded using vector quantization (VQ);
in response to the flag indicating that the residual block is encoded using VQ, execute instructions to:
decode (<NUM>) a parameter indicating an entry in a codebook by:
decoding a gain index indicating an entry in a gain codebook and indicative of a magnitude of the residual block and used to lookup a quantized magnitude of the residual block in a gain lookup table; and
decoding a shape index indicating an entry in a shape codebook and used to obtain from a shape lookup table a code vector to which a unit-norm of the residual block is quantized; and
obtain (<NUM>) the residual block by multiplying at least the quantized magnitude and the code vector;
in response to the flag indicating that the residual block is not encoded using VQ, execute instructions to:
decode (<NUM>) the residual block based on a skip flag indicating whether the current block is encoded using transform skip mode; and
reconstruct (<NUM>) the current block using the residual block.