Patent Description:
One way to reduce power consumption from memory traffic is to use a cache hierarchy and another is to employ different types of compression of the data that is being transported.

<CIT> discloses a method of processing a digital image using color vector signals, comprising forming a histogram of the color vector signals and analyzing the histogram to identify clusters of color values. Once this is done, groups of adjacent or touching clusters are merged and each color value in the merged clusters is mapped to a single palette entry, in order to remove noise.

<NPL>, refers to a modified palette-based coding method. The modifications are that a "pixel mode" is removed and all the pixel values are converted to palette indices for encoding, the possible error (from pixel values to palette indices) is encoded using the HEVC residue coding method, and the palette index and the "run" are shared by all the three color components.

<NPL>, refers to coding technologies to the characteristics of screen content, i.e. improved palette coding and adaptive residue color space conversion.

<CIT> refers to a method of compressing a palletized image having colors arranged in a palette table in a hierarchical manner to form a hierarchical color palette. In addition, bit values for the colors are defined in accordance with the arrangement of the colors, such that the bit values for substantially close colors are related and at least one of the bit values is truncated to thereby compress the palletized image.

The invention is defined by a method, an apparatus, and machine-readable storage as defined in the independent claims.

Some embodiments are described with respect to the following figures:.

For certain areas of a rendered image, the best choice of compression-decompression (codec) is to use a palette-based codec. Palette-based compression may be based on clustering, which makes the actual palette much smaller to store, in turn improving compression success rates.

The palette in itself is a large portion of the entire compressed representation in a palette-based codec. The palette may be compressed using both a clustered approach and by skip encoding color channels that are constant.

The task at hand is to: (i) collect all individual colors in the tile and store these in a palette, and (ii) assign each sample/pixel value an index to this palette. The data collected, depicted in <FIG>, involves converting each of the colors (in this case these are only three colors), identifying each by a code or index (<NUM>, <NUM> or <NUM> in this example) and creating a palette which shows which colors (<NUM>) of the palette of available colors (in this case <NUM>) is actually being used.

At the end of this process, the total number of bits needed to store the palette along with the palette indices are counted. Then a check determines whether this number of bits fits in the bit budget of the compressed unit. This check may involve determining whether the proposed compression results in fewer number of cache lines than in raw format. If so, compression is achieved.

The palette itself takes fewer bytes to store than the full representation, and so, this will make the compression success rate higher in some cases. This, in turn, will reduce memory traffic and will increase energy efficiency, in some embodiments.

Given a palette-based codec, consisting of N colors, a palette is stored and then each pixel/sample needs k=ceil(log<NUM>N) index bits to "point" into the color palette. The colors in the palette are compressed, so they take up less space.

For example, for an 8x4 pixel tile, where each color takes <NUM> bits (RGBA), the uncompressed tile uses <NUM>*<NUM> = <NUM> bytes. Assume compression to <NUM> bytes, i.e., <NUM> bits is required. Each pixel needs k bits for the index, i.e., <NUM>*k bits in total are needed. Each color in the palette uses <NUM> bits (same as original data in the tile), and there are N palette colors. In total, this sums to <NUM>*k + <NUM>*N which is less than or equal to <NUM>.

In this case, this means that k+N is less than or equal to <NUM>, and hence, it makes sense to use k=<NUM> bits, which in theory makes it possible to use at most <NUM><NUM> or <NUM> different colors in the palette. Then, there are <NUM>-<NUM>*<NUM> or <NUM> bits left for the color palette, and this means that N is <NUM>/<NUM> or <NUM> colors in the palette.

However, one could compress more tiles if one were able to store <NUM> colors in the palette, and by using compression of the colors in the palette, this goal can be achieved. Alternatively, one can use k=<NUM> bits, which gives (<NUM>-<NUM>*<NUM>)/<NUM> or <NUM> colors in the palette. Since there are <NUM> bits per index, one can potentially use a palette with up to <NUM> colors. However, this can only be done if the palette is compressed.

As a first simple technique, one bit per color channel is used to indicate whether color is constant in one of the color channels. If a bit is <NUM>, as an example, all pixels in the tile have the same value for that channel. For example, all red values may be <NUM>. In this case, the constant value, i.e., <NUM> is also stored.

As an example, using the RGBA color space, the alpha (A) component is often <NUM> all over the tile, or <NUM> all over the tile. If one color channel is skipped, <NUM> bits are stored for the constant channel, since these are <NUM> bits for RGBA or <NUM> bits per channel times <NUM> values. A skip bit is also stored for each of the four channels to indicate whether the channel is skipped. So, in total, an extra <NUM> bits are stored in the example of having one constant color, and so each color in the palette is now only <NUM> (<NUM>*<NUM>) bits.

In the case with k=<NUM> bits, N equals (<NUM>-<NUM>-<NUM>*<NUM>)/<NUM>=<NUM> colors, or rounding down, <NUM> colors in the palette, compared to <NUM> colors before.

This compression technique can be called the skip bit technique. More than one channel may be constant. If two channels are constant, then the <NUM> skip bits and then <NUM>+<NUM> bits are stored for the constant channels, and so on.

In addition, one can store the minimum color value of all colors in the palette, and then encode the difference between a color in the palette and this minimum color. These differences can often be encoded done with fewer bits.

However, in many cases, the palette encoding method beats other encoding methods. These cases often include tiles where there are distinct groups of colors in the palette.

For example, assume a very dark gray background with a bit of noise in it, and then suddenly two white pixels appear. The difference from the minimum color (which would be the darkest gray) and the white pixels is huge, and all differences would be encoded with as many bits that are needed for the difference between white and the darkest gray pixel. As a result, no compression can be obtained. In this case, there were only two pixels that destroyed the possibility of compression. However these situations often occur in user interfaces, for example, and it is advantageous if they are very compressible.

The palette may be compressed using clustering. Clustering involves finding two or more minimum (lowest color value) colors and then compressing each color in the palette relative to one of these minimum colors. In the example above, the minimum dark gray color may be one minimum color, and the white color is one minimum color. All dark gray colors (called cluster <NUM>) are encoded relative the minimum dark gray color, and the two white colors (called cluster <NUM>) are encoded relative to the minimum white color.

Then skip bits can be used for each cluster. This can actually reduce data more as well.

An example of clustering is shown in <FIG>, using residual bits per sample/pixel, in addition to the color (now cluster) indices. In <FIG> there are only two redish colors (cross-hatched and double cross-hatched) and one blue color (no hatching) (using indices <NUM> (for the blue color) and <NUM> (for the two redish colors)). The residual bits encode the difference of one of the two redish color values from the minimum color value. The palette in this example only has two colors, with one of the variant red colors indicated via residual bits.

There are several ways to find clusters. Assume that one wants to find only two clusters. In this case, two colors that can act as "means" are found. The better these guesses are for the means, the faster the method will converge.

In one example, useful for understanding the invention, the means can be found by finding a minimal bounding box around the color in the space of the remaining color channels, e.g., RGB or RGBA, or RGA (if B is constant and, thus, skipped). Next, assume that the minimal bounding box is split in the middle in each color dimension, and this results in a number of sub-boxes. Next, the colors that are closest to each corner of this minimal bounding box are found. Two of these "corner colors" are picked, each having the most colors in its sub-box. These colors are the two means to initialize a k-means clustering algorithm.

Next, apply one or more steps of k-means clustering. The first step is simply to associate each color with the means that it is closest to (in RGB space, for example). When this has been done, each color in the palette has been assigned to one means (which is a color from the palette). The second step updates each means as the average of all the colors assigned to that cluster. Then one may do steps one and two a few more times if needed.

Yet another variant is more iterative, according to the invention. The idea is to take one color from the palette and build a cluster around that color as long as the added colors are sufficiently close. If a color is encountered that is too far away from the current cluster, then a new cluster color is allocated. Continue with the rest of the colors, and attempt to merge them into either of the current two clusters. Then a third cluster can be added, etc. To enable this, one bit per sample/pixel is used to signal if residual bits are stored or not.

Thus, referring to <FIG>, a sequence <NUM> according to the invention may be implemented in software, firmware and/or hardware. In software and firmware embodiments, it may be implemented by computer executed instructions stored in one or more non-transitory computer readable media, such as magnetic, optical, or semiconductor storage.

The sequence begins by looping over all samples or pixels in a tile, as indicated in block <NUM>. Then, the difference between a given color and colors already in the palette is checked, as indicated in block <NUM>. If the difference is small because it is less than a threshold, as determined in diamond <NUM>, then store residual bits and mark the sample, as indicated in block <NUM>. The residual bits are indicated at <NUM>.

On the other hand, if the difference is not small, a check at diamond <NUM> determines whether the color is already in the palette. If not, the color is stored in the palette, as indicated in block <NUM>. Then the palette is updated, as indicated at <NUM> and the flow iterates back to block <NUM>.

If the color is already in the palette, as determined in diamond <NUM>, the palette entry identifier (ID) is recorded, as indicated in block <NUM>. Then the sample or pixel is provided in the palette entry list, as indicated at <NUM>.

A check at diamond <NUM> determines whether there are any samples or pixels left. If so, the flow iterates back to block <NUM> and, otherwise, the flow ends.

The selection between storing a new palette entry or residual bits against an existing color, is arbitrary. In the general case, a gain in number of stored bits can be achieved as long as the number of residual bits per entry plus one bit per sample, is lower than a full color in the palette.

Assume that we have a tile with N colors, with RGB, for example. There is nothing that restricts this technique to any particular color space.

In <FIG>, an example is given that only visualizes the red and green channels (R and G). To the left, the red (R) and green (G) axes are labelled. There are <NUM> pixel colors here. Green pixels or samples are indicated by open circles and red pixels or samples are indicated by solid circles. In the middle, the minimal box around the pixel colors are found. The circle D is at the left-bottom corner, and so this is the minimum color of these <NUM> pixel colors. In the middle, split the minimal box into four 2x2 cells (indicated in dashed lines). To the right, the minimal boxes B1 and B2 are computed for each cell, which created two groups. The dark circles D1 and D2 show the minimal colors for these two groups.

In one clustering algorithm, simply encode each non-empty cell with the minimum color (dark circles D1 and D2 in <FIG>) and then add some encoding of residuals inside that box. This may be done with standard methods.

This example is in two dimensions, but usually there are three (RGB) or four (RGBA) dimensions. Since the coding of the minimal color of a group is rather expensive, sometimes it makes sense to merge two groups into one. One may also choose to transform the colors into another color space, such that YCoGg, in order to reduce the volume of each box, therefore reducing the number of residual bits.

In an iterative scheme, one pair of groups (boxes) that increases the total volume of the resulting merged groups (boxes) the least, are merged. In RGB-space, <NUM> cells are obtained by splitting once per dimension. Each group only has one direct neighbor in x, y or z. There are several heuristics to use here including the following examples:.

Merging only needs to continue until the target bit threshold is reached (or less). There is also the possibility to split more than once per dimension. This creates more cells whose minimal boxes must be merged. Each cell may get more direct neighbors in this case.

After two or more clusters have been generated, the minimum color of each cluster is stored. In addition, as mentioned above, the <NUM> skip bits may be stored per cluster, and if a channel is constant within a cluster, then that channel need not encode residuals. In this case <NUM> size bits are stored per channel to indicate how many residual bits are needed per channel. For example, if the maximum difference for the red channel within a cluster is <NUM>, then <NUM> bits are needed to store such differences, and hence then <NUM> size bits will be set to <NUM> in this case.

Sequence <NUM>, as shown in <FIG>, for compression using clustering, according to an example useful for understanding the invention, may be implemented in software, firmware and/or hardware. In software and firmware, it may be implemented by computer executed instructions stored in one or more non-transitory computer readable media such as a magnetic, optical or semiconductor storage. The sequence may be implemented for example by a graphics processing unit in some cases.

The sequence <NUM> begins by looping over a tile (block <NUM>). A tile is simply an image portion containing samples or pixels. First any constant color channels are found as indicated in block <NUM>. Then clusters are found in block <NUM>, coded in block <NUM> and added to palette <NUM>. Any clusters that are of constant color may also be skipped but encoded as well. One may also use separate skip bits per cluster, which may be useful in some cases. In block <NUM>, the flow loops over all samples or pixels in a tile. A cluster or palette entry is selected in block <NUM>.

The palette entry identification and residual is encoded, as indicated in block <NUM>. The sample or pixel residual values <NUM> are stored. The sample or pixel is stored in the palette entry list <NUM>.

A check at diamond <NUM> indicates whether there are more samples or pixels left to process and if so, the flow iterates back to loop over the tile. Otherwise, the flow ends.

With the described difference encoding in each cluster, better compression of the palette may be obtained, and this will make the succession rate for compression substantially higher, and compression hardware for color buffers will succeed more often, and as a result, the power usage will be reduced.

<FIG> is a block diagram of a processing system <NUM>, according to an embodiment. In various embodiments the system <NUM> includes one or more processors <NUM> and one or more graphics processors <NUM>, and may be a single processor desktop system, a multiprocessor workstation system, or a server system having a large number of processors <NUM> or processor cores <NUM>. In one embodiment, the system <NUM> is a processing platform incorporated within a system-on-a-chip (SoC) integrated circuit for use in mobile, handheld, or embedded devices.

An embodiment of system <NUM> can include, or be incorporated within a server-based gaming platform, a game console, including a game and media console, a mobile gaming console, a handheld game console, or an online game console. In some embodiments system <NUM> is a mobile phone, smart phone, tablet computing device or mobile Internet device. Data processing system <NUM> can also include, couple with, or be integrated within a wearable device, such as a smart watch wearable device, smart eyewear device, augmented reality device, or virtual reality device. In some embodiments, data processing system <NUM> is a television or set top box device having one or more processors <NUM> and a graphical interface generated by one or more graphics processors <NUM>.

In some embodiments, processor <NUM> is coupled to a processor bus <NUM> to transmit communication signals such as address, data, or control signals between processor <NUM> and other components in system <NUM>. In one embodiment the system <NUM> uses an exemplary 'hub' system architecture, including a memory controller hub <NUM> and an Input Output (I/O) controller hub <NUM>. A memory controller hub <NUM> facilitates communication between a memory device and other components of system <NUM>, while an I/O Controller Hub (ICH) <NUM> provides connections to I/O devices via a local I/O bus. In one embodiment, the logic of the memory controller hub <NUM> is integrated within the processor.

Memory device <NUM> can be a dynamic random access memory (DRAM) device, a static random access memory (SRAM) device, flash memory device, phase-change memory device, or some other memory device having suitable performance to serve as process memory. In one embodiment the memory device <NUM> can operate as system memory for the system <NUM>, to store data <NUM> and instructions <NUM> for use when the one or more processors <NUM> executes an application or process. Memory controller hub <NUM> also couples with an optional external graphics processor <NUM>, which may communicate with the one or more graphics processors <NUM> in processors <NUM> to perform graphics and media operations.

In some embodiments, ICH <NUM> enables peripherals to connect to memory device <NUM> and processor <NUM> via a high-speed I/O bus. The I/O peripherals include, but are not limited to, an audio controller <NUM>, a firmware interface <NUM>, a wireless transceiver <NUM> (e.g., Wi-Fi, Bluetooth), a data storage device <NUM> (e.g., hard disk drive, flash memory, etc.), and a legacy I/O controller <NUM> for coupling legacy (e.g., Personal System <NUM> (PS/<NUM>)) devices to the system. One or more Universal Serial Bus (USB) controllers <NUM> connect input devices, such as keyboard and mouse <NUM> combinations. A network controller <NUM> may also couple to ICH <NUM>. In some embodiments, a high-performance network controller (not shown) couples to processor bus <NUM>. It will be appreciated that the system <NUM> shown is exemplary and not limiting, as other types of data processing systems that are differently configured may also be used. For example, the I/O controller hub <NUM> may be integrated within the one or more processor <NUM>, or the memory controller hub <NUM> and I/O controller hub <NUM> may be integrated into a discreet external graphics processor, such as the external graphics processor <NUM>.

<FIG> is a block diagram of an embodiment of a processor <NUM> having one or more processor cores 202A-202N, an integrated memory controller <NUM>, and an integrated graphics processor <NUM>. Those elements of <FIG> having the same reference numbers (or names) as the elements of any other figure herein can operate or function in any manner similar to that described elsewhere herein, but are not limited to such. Processor <NUM> can include additional cores up to and including additional core 202N represented by the dashed lined boxes. Each of processor cores 202A-202N includes one or more internal cache units 204A-204N. In some embodiments each processor core also has access to one or more shared cached units <NUM>.

The internal cache units 204A-204N and shared cache units <NUM> represent a cache memory hierarchy within the processor <NUM>. The cache memory hierarchy may include at least one level of instruction and data cache within each processor core and one or more levels of shared mid-level cache, such as a Level <NUM> (L2), Level <NUM> (L3), Level <NUM> (L4), or other levels of cache, where the highest level of cache before external memory is classified as the LLC. In some embodiments, cache coherency logic maintains coherency between the various cache units <NUM> and 204A-204N.

In some embodiments, processor <NUM> may also include a set of one or more bus controller units <NUM> and a system agent core <NUM>. The one or more bus controller units <NUM> manage a set of peripheral buses, such as one or more Peripheral Component Interconnect buses (e.g., PCI, PCI Express). System agent core <NUM> provides management functionality for the various processor components. In some embodiments, system agent core <NUM> includes one or more integrated memory controllers <NUM> to manage access to various external memory devices (not shown).

In some embodiments, one or more of the processor cores 202A-202N include support for simultaneous multi-threading. In such embodiment, the system agent core <NUM> includes components for coordinating and operating cores 202A-202N during multi-threaded processing. System agent core <NUM> may additionally include a power control unit (PCU), which includes logic and components to regulate the power state of processor cores 202A-202N and graphics processor <NUM>.

In some embodiments, processor <NUM> additionally includes graphics processor <NUM> to execute graphics processing operations. In some embodiments, the graphics processor <NUM> couples with the set of shared cache units <NUM>, and the system agent core <NUM>, including the one or more integrated memory controllers <NUM>. In some embodiments, a display controller <NUM> is coupled with the graphics processor <NUM> to drive graphics processor output to one or more coupled displays. In some embodiments, display controller <NUM> may be a separate module coupled with the graphics processor via at least one interconnect, or may be integrated within the graphics processor <NUM> or system agent core <NUM>.

In some embodiments, a ring based interconnect unit <NUM> is used to couple the internal components of the processor <NUM>. However, an alternative interconnect unit may be used, such as a point-to-point interconnect, a switched interconnect, or other techniques, including techniques well known in the art. In some embodiments, graphics processor <NUM> couples with the ring interconnect <NUM> via an I/O link <NUM>.

The exemplary I/O link <NUM> represents at least one of multiple varieties of I/O interconnects, including an on package I/O interconnect which facilitates communication between various processor components and a high-performance embedded memory module <NUM>, such as an eDRAM module. In some embodiments, each of the processor cores <NUM>-202N and graphics processor <NUM> use embedded memory modules <NUM> as a shared Last Level Cache.

In some embodiments, processor cores 202A-202N are homogenous cores executing the same instruction set architecture. In another embodiment, processor cores 202A-202N are heterogeneous in terms of instruction set architecture (ISA), where one or more of processor cores 202A-N execute a first instruction set, while at least one of the other cores executes a subset of the first instruction set or a different instruction set. In one embodiment processor cores 202A-202N are heterogeneous in terms of microarchitecture, where one or more cores having a relatively higher power consumption couple with one or more power cores having a lower power consumption. Additionally, processor <NUM> can be implemented on one or more chips or as an SoC integrated circuit having the illustrated components, in addition to other components.

<FIG> is a block diagram of a graphics processor <NUM>, which may be a discrete graphics processing unit, or may be a graphics processor integrated with a plurality of processing cores. In some embodiments, the graphics processor communicates via a memory mapped I/O interface to registers on the graphics processor and with commands placed into the processor memory. In some embodiments, graphics processor <NUM> includes a memory interface <NUM> to access memory. Memory interface <NUM> can be an interface to local memory, one or more internal caches, one or more shared external caches, and/or to system memory.

In some embodiments, graphics processor <NUM> also includes a display controller <NUM> to drive display output data to a display device <NUM>. Display controller <NUM> includes hardware for one or more overlay planes for the display and composition of multiple layers of video or user interface elements. In some embodiments, graphics processor <NUM> includes a video codec engine <NUM> to encode, decode, or transcode media to, from, or between one or more media encoding formats, including, but not limited to Moving Picture Experts Group (MPEG) formats such as MPEG-<NUM>, Advanced Video Coding (AVC) formats such as H. <NUM>/MPEG-<NUM> AVC, as well as the Society of Motion Picture & Television Engineers (SMPTE) 421MNC-<NUM>, and Joint Photographic Experts Group (JPEG) formats such as JPEG, and Motion JPEG (MJPEG) formats.

In some embodiments, graphics processor <NUM> includes a block image transfer (BLIT) engine <NUM> to perform two-dimensional (2D) rasterizer operations including, for example, bit-boundary block transfers. However, in one embodiment, 2D graphics operations are performed using one or more components of graphics processing engine (GPE) <NUM>. In some embodiments, graphics processing engine <NUM> is a compute engine for performing graphics operations, including three-dimensional (3D) graphics operations and media operations.

In some embodiments, GPE <NUM> includes a 3D pipeline <NUM> for performing 3D operations, such as rendering three-dimensional images and scenes using processing functions that act upon 3D primitive shapes (e.g., rectangle, triangle, etc.). The 3D pipeline <NUM> includes programmable and fixed function elements that perform various tasks within the element and/or spawn execution threads to a 3D/Media sub-system <NUM>. While 3D pipeline <NUM> can be used to perform media operations, an embodiment of GPE <NUM> also includes a media pipeline <NUM> that is specifically used to perform media operations, such as video post-processing and image enhancement.

In some embodiments, media pipeline <NUM> includes fixed function or programmable logic units to perform one or more specialized media operations, such as video decode acceleration, video de-interlacing, and video encode acceleration in place of, or on behalf of video codec engine <NUM>. In some embodiments, media pipeline <NUM> additionally includes a thread spawning unit to spawn threads for execution on 3D/Media sub-system <NUM>. The spawned threads perform computations for the media operations on one or more graphics execution units included in 3D/Media sub-system <NUM>.

In some embodiments, 3D/Media subsystem <NUM> includes logic for executing threads spawned by 3D pipeline <NUM> and media pipeline <NUM>. In one embodiment, the pipelines send thread execution requests to 3D/Media subsystem <NUM>, which includes thread dispatch logic for arbitrating and dispatching the various requests to available thread execution resources. The execution resources include an array of graphics execution units to process the 3D and media threads. In some embodiments, 3D/Media subsystem <NUM> includes one or more internal caches for thread instructions and data. In some embodiments, the subsystem also includes shared memory, including registers and addressable memory, to share data between threads and to store output data.

<FIG> is a block diagram of a graphics processing engine <NUM> of a graphics processor in accordance with some embodiments. In one embodiment, the GPE <NUM> is a version of the GPE <NUM> shown in <FIG>. Elements of <FIG> having the same reference numbers (or names) as the elements of any other figure herein can operate or function in any manner similar to that described elsewhere herein, but are not limited to such.

In some embodiments, GPE <NUM> couples with a command streamer <NUM>, which provides a command stream to the GPE 3D and media pipelines <NUM>, <NUM>. In some embodiments, command streamer <NUM> is coupled to memory, which can be system memory, or one or more of internal cache memory and shared cache memory. In some embodiments, command streamer <NUM> receives commands from the memory and sends the commands to 3D pipeline <NUM> and/or media pipeline <NUM>. The commands are directives fetched from a ring buffer, which stores commands for the 3D and media pipelines <NUM>, <NUM>. In one embodiment, the ring buffer can additionally include batch command buffers storing batches of multiple commands. The 3D and media pipelines <NUM>, <NUM> process the commands by performing operations via logic within the respective pipelines or by dispatching one or more execution threads to an execution unit array <NUM>. In some embodiments, execution unit array <NUM> is scalable, such that the array includes a variable number of execution units based on the target power and performance level of GPE <NUM>.

In some embodiments, a sampling engine <NUM> couples with memory (e.g., cache memory or system memory) and execution unit array <NUM>. In some embodiments, sampling engine <NUM> provides a memory access mechanism for execution unit array <NUM> that allows execution array <NUM> to read graphics and media data from memory. In some embodiments, sampling engine <NUM> includes logic to perform specialized image sampling operations for media.

In some embodiments, the specialized media sampling logic in sampling engine <NUM> includes a de-noise/de-interlace module <NUM>, a motion estimation module <NUM>, and an image scaling and filtering module <NUM>. In some embodiments, de-noise/de-interlace module <NUM> includes logic to perform one or more of a de-noise or a de-interlace algorithm on decoded video data. The de-interlace logic combines alternating fields of interlaced video content into a single fame of video. The de-noise logic reduces or removes data noise from video and image data. In some embodiments, the de-noise logic and de-interlace logic are motion adaptive and use spatial or temporal filtering based on the amount of motion detected in the video data. In some embodiments, the de-noise/de-interlace module <NUM> includes dedicated motion detection logic (e.g., within the motion estimation engine <NUM>).

In some embodiments, motion estimation engine <NUM> provides hardware acceleration for video operations by performing video acceleration functions such as motion vector estimation and prediction on video data. The motion estimation engine determines motion vectors that describe the transformation of image data between successive video frames. In some embodiments, a graphics processor media codec uses video motion estimation engine <NUM> to perform operations on video at the macro-block level that may otherwise be too computationally intensive to perform with a general-purpose processor. In some embodiments, motion estimation engine <NUM> is generally available to graphics processor components to assist with video decode and processing functions that are sensitive or adaptive to the direction or magnitude of the motion within video data.

In some embodiments, image scaling and filtering module <NUM> performs image-processing operations to enhance the visual quality of generated images and video. In some embodiments, scaling and filtering module <NUM> processes image and video data during the sampling operation before providing the data to execution unit array <NUM>.

In some embodiments, the GPE <NUM> includes a data port <NUM>, which provides an additional mechanism for graphics subsystems to access memory. In some embodiments, data port <NUM> facilitates memory access for operations including render target writes, constant buffer reads, scratch memory space reads/writes, and media surface accesses. In some embodiments, data port <NUM> includes cache memory space to cache accesses to memory. The cache memory can be a single data cache or separated into multiple caches for the multiple subsystems that access memory via the data port (e.g., a render buffer cache, a constant buffer cache, etc.). In some embodiments, threads executing on an execution unit in execution unit array <NUM> communicate with the data port by exchanging messages via a data distribution interconnect that couples each of the sub-systems of GPE <NUM>.

<FIG> is a block diagram of another embodiment of a graphics processor <NUM>. Elements of <FIG> having the same reference numbers (or names) as the elements of any other figure herein can operate or function in any manner similar to that described elsewhere herein, but are not limited to such.

In some embodiments, graphics processor <NUM> includes a ring interconnect <NUM>, a pipeline front-end <NUM>, a media engine <NUM>, and graphics cores 580A-580N. In some embodiments, ring interconnect <NUM> couples the graphics processor to other processing units, including other graphics processors or one or more general-purpose processor cores. In some embodiments, the graphics processor is one of many processors integrated within a multi-core processing system.

In some embodiments, graphics processor <NUM> receives batches of commands via ring interconnect <NUM>. The incoming commands are interpreted by a command streamer <NUM> in the pipeline front-end <NUM>. In some embodiments, graphics processor <NUM> includes scalable execution logic to perform 3D geometry processing and media processing via the graphics core(s) 580A-580N. For 3D geometry processing commands, command streamer <NUM> supplies commands to geometry pipeline <NUM>. For at least some media processing commands, command streamer <NUM> supplies the commands to a video front end <NUM>, which couples with a media engine <NUM>. In some embodiments, media engine <NUM> includes a Video Quality Engine (VQE) <NUM> for video and image post-processing and a multi-format encode/decode (MFX) <NUM> engine to provide hardware-accelerated media data encode and decode. In some embodiments, geometry pipeline <NUM> and media engine <NUM> each generate execution threads for the thread execution resources provided by at least one graphics core 580A.

In some embodiments, graphics processor <NUM> includes scalable thread execution resources featuring modular cores 580A-580N (sometimes referred to as core slices), each having multiple sub-cores 550A-550N, 560A-560N (sometimes referred to as core sub-slices). In some embodiments, graphics processor <NUM> can have any number of graphics cores 580A through 580N. In some embodiments, graphics processor <NUM> includes a graphics core 580A having at least a first sub-core 550A and a second core sub-core 560A. In other embodiments, the graphics processor is a low power processor with a single sub-core (e.g., 550A). In some embodiments, graphics processor <NUM> includes multiple graphics cores 580A-580N, each including a set of first sub-cores 550A-550N and a set of second sub-cores 560A-560N. Each sub-core in the set of first sub-cores 550A-550N includes at least a first set of execution units 552A-552N and media/texture samplers 554A-554N. Each sub-core in the set of second sub-cores 560A-560N includes at least a second set of execution units 562A-562N and samplers 564A-564N. In some embodiments, each sub-core 550A-550N, 560A-560N shares a set of shared resources 570A-570N. In some embodiments, the shared resources include shared cache memory and pixel operation logic. Other shared resources may also be included in the various embodiments of the graphics processor.

<FIG> illustrates thread execution logic <NUM> including an array of processing elements employed in some embodiments of a GPE. Elements of <FIG> having the same reference numbers (or names) as the elements of any other figure herein can operate or function in any manner similar to that described elsewhere herein, but are not limited to such.

In some embodiments, thread execution logic <NUM> includes a pixel shader <NUM>, a thread dispatcher <NUM>, instruction cache <NUM>, a scalable execution unit array including a plurality of execution units 608A-608N, a sampler <NUM>, a data cache <NUM>, and a data port <NUM>. In one embodiment the included components are interconnected via an interconnect fabric that links to each of the components. In some embodiments, thread execution logic <NUM> includes one or more connections to memory, such as system memory or cache memory, through one or more of instruction cache <NUM>, data port <NUM>, sampler <NUM>, and execution unit array 608A-608N. In some embodiments, each execution unit (e.g. 608A) is an individual vector processor capable of executing multiple simultaneous threads and processing multiple data elements in parallel for each thread. In some embodiments, execution unit array 608A-608N includes any number individual execution units.

In some embodiments, execution unit array 608A-608N is primarily used to execute "shader" programs. In some embodiments, the execution units in array 608A-608N execute an instruction set that includes native support for many standard 3D graphics shader instructions, such that shader programs from graphics libraries (e.g., Direct 3D and OpenGL) are executed with a minimal translation. The execution units support vertex and geometry processing (e.g., vertex programs, geometry programs, vertex shaders), pixel processing (e.g., pixel shaders, fragment shaders) and general-purpose processing (e.g., compute and media shaders).

Each execution unit in execution unit array 608A-608N operates on arrays of data elements. The number of data elements is the "execution size," or the number of channels for the instruction. An execution channel is a logical unit of execution for data element access, masking, and flow control within instructions. The number of channels may be independent of the number of physical Arithmetic Logic Units (ALUs) or Floating Point Units (FPUs) for a particular graphics processor. In some embodiments, execution units 608A-608N support integer and floating-point data types.

The execution unit instruction set includes single instruction multiple data (SIMD) instructions. The various data elements can be stored as a packed data type in a register and the execution unit will process the various elements based on the data size of the elements. For example, when operating on a <NUM>-bit wide vector, the <NUM> bits of the vector are stored in a register and the execution unit operates on the vector as four separate <NUM>-bit packed data elements (Quad-Word (QW) size data elements), eight separate <NUM>-bit packed data elements (Double Word (DW) size data elements), sixteen separate <NUM>-bit packed data elements (Word (W) size data elements), or thirty-two separate <NUM>-bit data elements (byte (B) size data elements). However, different vector widths and register sizes are possible.

One or more internal instruction caches (e.g., <NUM>) are included in the thread execution logic <NUM> to cache thread instructions for the execution units. In some embodiments, one or more data caches (e.g., <NUM>) are included to cache thread data during thread execution. In some embodiments, sampler <NUM> is included to provide texture sampling for 3D operations and media sampling for media operations. In some embodiments, sampler <NUM> includes specialized texture or media sampling functionality to process texture or media data during the sampling process before providing the sampled data to an execution unit.

During execution, the graphics and media pipelines send thread initiation requests to thread execution logic <NUM> via thread spawning and dispatch logic. In some embodiments, thread execution logic <NUM> includes a local thread dispatcher <NUM> that arbitrates thread initiation requests from the graphics and media pipelines and instantiates the requested threads on one or more execution units 608A-608N. For example, the geometry pipeline (e.g., <NUM> of <FIG>) dispatches vertex processing, tessellation, or geometry processing threads to thread execution logic <NUM> (<FIG>). In some embodiments, thread dispatcher <NUM> can also process runtime thread spawning requests from the executing shader programs.

Once a group of geometric objects has been processed and rasterized into pixel data, pixel shader <NUM> is invoked to further compute output information and cause results to be written to output surfaces (e.g., color buffers, depth buffers, stencil buffers, etc.). In some embodiments, pixel shader <NUM> calculates the values of the various vertex attributes that are to be interpolated across the rasterized object. In some embodiments, pixel shader <NUM> then executes an application programming interface (API)-supplied pixel shader program. To execute the pixel shader program, pixel shader <NUM> dispatches threads to an execution unit (e.g., 608A) via thread dispatcher <NUM>. In some embodiments, pixel shader <NUM> uses texture sampling logic in sampler <NUM> to access texture data in texture maps stored in memory. Arithmetic operations on the texture data and the input geometry data compute pixel color data for each geometric fragment, or discards one or more pixels from further processing.

In some embodiments, the data port <NUM> provides a memory access mechanism for the thread execution logic <NUM> output processed data to memory for processing on a graphics processor output pipeline. In some embodiments, the data port <NUM> includes or couples to one or more cache memories (e.g., data cache <NUM>) to cache data for memory access via the data port.

<FIG> is a block diagram illustrating a graphics processor instruction formats <NUM> according to some embodiments. In one or more embodiment, the graphics processor execution units support an instruction set having instructions in multiple formats. The solid lined boxes illustrate the components that are generally included in an execution unit instruction, while the dashed lines include components that are optional or that are only included in a sub-set of the instructions. In some embodiments, instruction format <NUM> described and illustrated are macro-instructions, in that they are instructions supplied to the execution unit, as opposed to micro-operations resulting from instruction decode once the instruction is processed.

In some embodiments, the graphics processor execution units natively support instructions in a <NUM>-bit format <NUM>. A <NUM>-bit compacted instruction format <NUM> is available for some instructions based on the selected instruction, instruction options, and number of operands. The native <NUM>-bit format <NUM> provides access to all instruction options, while some options and operations are restricted in the <NUM>-bit format <NUM>. The native instructions available in the <NUM>-bit format <NUM> vary by embodiment. In some embodiments, the instruction is compacted in part using a set of index values in an index field <NUM>. The execution unit hardware references a set of compaction tables based on the index values and uses the compaction table outputs to reconstruct a native instruction in the <NUM>-bit format <NUM>.

For each format, instruction opcode <NUM> defines the operation that the execution unit is to perform. The execution units execute each instruction in parallel across the multiple data elements of each operand. For example, in response to an add instruction the execution unit performs a simultaneous add operation across each color channel representing a texture element or picture element. By default, the execution unit performs each instruction across all data channels of the operands. In some embodiments, instruction control field <NUM> enables control over certain execution options, such as channels selection (e.g., predication) and data channel order (e.g., swizzle). For <NUM>-bit instructions <NUM> an exec-size field <NUM> limits the number of data channels that will be executed in parallel. In some embodiments, exec-size field <NUM> is not available for use in the <NUM>-bit compact instruction format <NUM>.

Some execution unit instructions have up to three operands including two source operands, src0 <NUM>, src1 <NUM>, and one destination <NUM>. In some embodiments, the execution units support dual destination instructions, where one of the destinations is implied. Data manipulation instructions can have a third source operand (e.g., SRC2 <NUM>), where the instruction opcode <NUM> determines the number of source operands. An instruction's last source operand can be an immediate (e.g., hard-coded) value passed with the instruction.

In some embodiments, the <NUM>-bit instruction format <NUM> includes an access/address mode information <NUM> specifying, for example, whether direct register addressing mode or indirect register addressing mode is used. When direct register addressing mode is used, the register address of one or more operands is directly provided by bits in the instruction <NUM>.

In some embodiments, the <NUM>-bit instruction format <NUM> includes an access/address mode field <NUM>, which specifies an address mode and/or an access mode for the instruction. In one embodiment the access mode to define a data access alignment for the instruction. Some embodiments support access modes including a <NUM>-byte aligned access mode and a <NUM>-byte aligned access mode, where the byte alignment of the access mode determines the access alignment of the instruction operands. For example, when in a first mode, the instruction <NUM> may use byte-aligned addressing for source and destination operands and when in a second mode, the instruction <NUM> may use <NUM>-byte-aligned addressing for all source and destination operands.

In one embodiment, the address mode portion of the access/address mode field <NUM> determines whether the instruction is to use direct or indirect addressing. When direct register addressing mode is used bits in the instruction <NUM> directly provide the register address of one or more operands. When indirect register addressing mode is used, the register address of one or more operands may be computed based on an address register value and an address immediate field in the instruction.

In some embodiments instructions are grouped based on opcode <NUM> bit-fields to simplify Opcode decode <NUM>. For an <NUM>-bit opcode, bits <NUM>, <NUM>, and <NUM> allow the execution unit to determine the type of opcode. The precise opcode grouping shown is merely an example. In some embodiments, a move and logic opcode group <NUM> includes data movement and logic instructions (e.g., move (mov), compare (cmp)). In some embodiments, move and logic group <NUM> shares the five most significant bits (MSB), where move (mov) instructions are in the form of 0000xxxxb and logic instructions are in the form of 0001xxxxb. A flow control instruction group <NUM> (e.g., call, jump (jmp)) includes instructions in the form of 0010xxxxb (e.g., 0x20). A miscellaneous instruction group <NUM> includes a mix of instructions, including synchronization instructions (e.g., wait, send) in the form of 0011xxxxb (e.g., 0x30). A parallel math instruction group <NUM> includes component-wise arithmetic instructions (e.g., add, multiply (mul)) in the form of 0100xxxxb (e.g., 0x40). The parallel math group <NUM> performs the arithmetic operations in parallel across data channels. The vector math group <NUM> includes arithmetic instructions (e.g., dp4) in the form of 0101xxxxb (e.g., 0x50). The vector math group performs arithmetic such as dot product calculations on vector operands.

In some embodiments, graphics processor <NUM> includes a graphics pipeline <NUM>, a media pipeline <NUM>, a display engine <NUM>, thread execution logic <NUM>, and a render output pipeline <NUM>. In some embodiments, graphics processor <NUM> is a graphics processor within a multi-core processing system that includes one or more general purpose processing cores. The graphics processor is controlled by register writes to one or more control registers (not shown) or via commands issued to graphics processor <NUM> via a ring interconnect <NUM>. In some embodiments, ring interconnect <NUM> couples graphics processor <NUM> to other processing components, such as other graphics processors or general-purpose processors. Commands from ring interconnect <NUM> are interpreted by a command streamer <NUM>, which supplies instructions to individual components of graphics pipeline <NUM> or media pipeline <NUM>.

In some embodiments, command streamer <NUM> directs the operation of a vertex fetcher <NUM> that reads vertex data from memory and executes vertex-processing commands provided by command streamer <NUM>. In some embodiments, vertex fetcher <NUM> provides vertex data to a vertex shader <NUM>, which performs coordinate space transformation and lighting operations to each vertex. In some embodiments, vertex fetcher <NUM> and vertex shader <NUM> execute vertex-processing instructions by dispatching execution threads to execution units 852A, 852B via a thread dispatcher <NUM>.

In some embodiments, execution units 852A, 852B are an array of vector processors having an instruction set for performing graphics and media operations. In some embodiments, execution units 852A, 852B have an attached L1 cache <NUM> that is specific for each array or shared between the arrays. The cache can be configured as a data cache, an instruction cache, or a single cache that is partitioned to contain data and instructions in different partitions.

In some embodiments, graphics pipeline <NUM> includes tessellation components to perform hardware-accelerated tessellation of 3D objects. In some embodiments, a programmable hull shader <NUM> configures the tessellation operations. A programmable domain shader <NUM> provides back-end evaluation of tessellation output. A tessellator <NUM> operates at the direction of hull shader <NUM> and contains special purpose logic to generate a set of detailed geometric objects based on a coarse geometric model that is provided as input to graphics pipeline <NUM>. In some embodiments, if tessellation is not used, tessellation components <NUM>, <NUM>, <NUM> can be bypassed.

In some embodiments, complete geometric objects can be processed by a geometry shader <NUM> via one or more threads dispatched to execution units 852A, 852B, or can proceed directly to the clipper <NUM>. In some embodiments, the geometry shader operates on entire geometric objects, rather than vertices or patches of vertices as in previous stages of the graphics pipeline. If the tessellation is disabled the geometry shader <NUM> receives input from the vertex shader <NUM>. In some embodiments, geometry shader <NUM> is programmable by a geometry shader program to perform geometry tessellation if the tessellation units are disabled.

Before rasterization, a clipper <NUM> processes vertex data. The clipper <NUM> may be a fixed function clipper or a programmable clipper having clipping and geometry shader functions. In some embodiments, a rasterizer/depth <NUM> in the render output pipeline <NUM> dispatches pixel shaders to convert the geometric objects into their per pixel representations. In some embodiments, pixel shader logic is included in thread execution logic <NUM>. In some embodiments, an application can bypass the rasterizer <NUM> and access un-rasterized vertex data via a stream out unit <NUM>.

The graphics processor <NUM> has an interconnect bus, interconnect fabric, or some other interconnect mechanism that allows data and message passing amongst the major components of the processor. In some embodiments, execution units 852A, 852B and associated cache(s) <NUM>, texture and media sampler <NUM>, and texture/sampler cache <NUM> interconnect via a data port <NUM> to perform memory access and communicate with render output pipeline components of the processor. In some embodiments, sampler <NUM>, caches <NUM>, <NUM> and execution units 852A, 852B each have separate memory access paths.

In some embodiments, render output pipeline <NUM> contains a rasterizer and depth test component <NUM> that converts vertex-based objects into an associated pixel-based representation. In some embodiments, the rasterizer logic includes a windower/masker unit to perform fixed function triangle and line rasterization. An associated render cache <NUM> and depth cache <NUM> are also available in some embodiments. A pixel operations component <NUM> performs pixel-based operations on the data, though in some instances, pixel operations associated with 2D operations (e.g. bit block image transfers with blending) are performed by the 2D engine <NUM>, or substituted at display time by the display controller <NUM> using overlay display planes. In some embodiments, a shared L3 cache <NUM> is available to all graphics components, allowing the sharing of data without the use of main system memory.

In some embodiments, graphics processor media pipeline <NUM> includes a media engine <NUM> and a video front end <NUM>. In some embodiments, video front end <NUM> receives pipeline commands from the command streamer <NUM>. In some embodiments, media pipeline <NUM> includes a separate command streamer. In some embodiments, video front-end <NUM> processes media commands before sending the command to the media engine <NUM>. In some embodiments, media engine <NUM> includes thread spawning functionality to spawn threads for dispatch to thread execution logic <NUM> via thread dispatcher <NUM>.

In some embodiments, graphics processor <NUM> includes a display engine <NUM>. In some embodiments, display engine <NUM> is external to processor <NUM> and couples with the graphics processor via the ring interconnect <NUM>, or some other interconnect bus or fabric. In some embodiments, display engine <NUM> includes a 2D engine <NUM> and a display controller <NUM>. In some embodiments, display engine <NUM> contains special purpose logic capable of operating independently of the 3D pipeline. In some embodiments, display controller <NUM> couples with a display device (not shown), which may be a system integrated display device, as in a laptop computer, or an external display device attached via a display device connector.

In some embodiments, graphics pipeline <NUM> and media pipeline <NUM> are configurable to perform operations based on multiple graphics and media programming interfaces and are not specific to any one application programming interface (API). In some embodiments, driver software for the graphics processor translates API calls that are specific to a particular graphics or media library into commands that can be processed by the graphics processor. In some embodiments, support is provided for the Open Graphics Library (OpenGL) and Open Computing Language (OpenCL) from the Khronos Group, the Direct3D library from the Microsoft Corporation, or support may be provided to both OpenGL and D3D. Support may also be provided for the Open Source Computer Vision Library (OpenCV). A future API with a compatible 3D pipeline would also be supported if a mapping can be made from the pipeline of the future API to the pipeline of the graphics processor.

<FIG> is a block diagram illustrating a graphics processor command format <NUM> according to some embodiments. <FIG> is a block diagram illustrating a graphics processor command sequence <NUM> according to an embodiment. The solid lined boxes in <FIG> illustrate the components that are generally included in a graphics command while the dashed lines include components that are optional or that are only included in a sub-set of the graphics commands. The exemplary graphics processor command format <NUM> of <FIG> includes data fields to identify a target client <NUM> of the command, a command operation code (opcode) <NUM>, and the relevant data <NUM> for the command. A sub-opcode <NUM> and a command size <NUM> are also included in some commands.

In some embodiments, client <NUM> specifies the client unit of the graphics device that processes the command data. In some embodiments, a graphics processor command parser examines the client field of each command to condition the further processing of the command and route the command data to the appropriate client unit. In some embodiments, the graphics processor client units include a memory interface unit, a render unit, a 2D unit, a 3D unit, and a media unit. Each client unit has a corresponding processing pipeline that processes the commands. Once the command is received by the client unit, the client unit reads the opcode <NUM> and, if present, sub-opcode <NUM> to determine the operation to perform. The client unit performs the command using information in data field <NUM>. For some commands an explicit command size <NUM> is expected to specify the size of the command. In some embodiments, the command parser automatically determines the size of at least some of the commands based on the command opcode. In some embodiments commands are aligned via multiples of a double word.

The flow diagram in <FIG> shows an exemplary graphics processor command sequence <NUM>. In some embodiments, software or firmware of a data processing system that features an embodiment of a graphics processor uses a version of the command sequence shown to set up, execute, and terminate a set of graphics operations. A sample command sequence is shown and described for purposes of example only as embodiments are not limited to these specific commands or to this command sequence. Moreover, the commands may be issued as batch of commands in a command sequence, such that the graphics processor will process the sequence of commands in at least partially concurrence.

In some embodiments, the graphics processor command sequence <NUM> may begin with a pipeline flush command <NUM> to cause any active graphics pipeline to complete the currently pending commands for the pipeline. In some embodiments, the 3D pipeline <NUM> and the media pipeline <NUM> do not operate concurrently. The pipeline flush is performed to cause the active graphics pipeline to complete any pending commands. In response to a pipeline flush, the command parser for the graphics processor will pause command processing until the active drawing engines complete pending operations and the relevant read caches are invalidated. Optionally, any data in the render cache that is marked 'dirty' can be flushed to memory. In some embodiments, pipeline flush command <NUM> can be used for pipeline synchronization or before placing the graphics processor into a low power state.

In some embodiments, a pipeline select command <NUM> is used when a command sequence requires the graphics processor to explicitly switch between pipelines. In some embodiments, a pipeline select command <NUM> is required only once within an execution context before issuing pipeline commands unless the context is to issue commands for both pipelines. In some embodiments, a pipeline flush command is <NUM> is required immediately before a pipeline switch via the pipeline select command <NUM>.

In some embodiments, a pipeline control command <NUM> configures a graphics pipeline for operation and is used to program the 3D pipeline <NUM> and the media pipeline <NUM>. In some embodiments, pipeline control command <NUM> configures the pipeline state for the active pipeline. In one embodiment, the pipeline control command <NUM> is used for pipeline synchronization and to clear data from one or more cache memories within the active pipeline before processing a batch of commands.

In some embodiments, return buffer state commands <NUM> are used to configure a set of return buffers for the respective pipelines to write data. Some pipeline operations require the allocation, selection, or configuration of one or more return buffers into which the operations write intermediate data during processing. In some embodiments, the graphics processor also uses one or more return buffers to store output data and to perform cross thread communication. In some embodiments, the return buffer state <NUM> includes selecting the size and number of return buffers to use for a set of pipeline operations.

The remaining commands in the command sequence differ based on the active pipeline for operations. Based on a pipeline determination <NUM>, the command sequence is tailored to the 3D pipeline <NUM> beginning with the 3D pipeline state <NUM>, or the media pipeline <NUM> beginning at the media pipeline state <NUM>.

The commands for the 3D pipeline state <NUM> include 3D state setting commands for vertex buffer state, vertex element state, constant color state, depth buffer state, and other state variables that are to be configured before 3D primitive commands are processed. The values of these commands are determined at least in part based the particular 3D API in use. In some embodiments, 3D pipeline state <NUM> commands are also able to selectively disable or bypass certain pipeline elements if those elements will not be used.

In some embodiments, 3D primitive <NUM> command is used to submit 3D primitives to be processed by the 3D pipeline. Commands and associated parameters that are passed to the graphics processor via the 3D primitive <NUM> command are forwarded to the vertex fetch function in the graphics pipeline. The vertex fetch function uses the 3D primitive <NUM> command data to generate vertex data structures. The vertex data structures are stored in one or more return buffers. In some embodiments, 3D primitive <NUM> command is used to perform vertex operations on 3D primitives via vertex shaders. To process vertex shaders, 3D pipeline <NUM> dispatches shader execution threads to graphics processor execution units.

In some embodiments, 3D pipeline <NUM> is triggered via an execute <NUM> command or event. In some embodiments, a register write triggers command execution. In some embodiments execution is triggered via a 'go' or 'kick' command in the command sequence. In one embodiment command execution is triggered using a pipeline synchronization command to flush the command sequence through the graphics pipeline. The 3D pipeline will perform geometry processing for the 3D primitives. Once operations are complete, the resulting geometric objects are rasterized and the pixel engine colors the resulting pixels. Additional commands to control pixel shading and pixel back end operations may also be included for those operations.

In some embodiments, the graphics processor command sequence <NUM> follows the media pipeline <NUM> path when performing media operations. In general, the specific use and manner of programming for the media pipeline <NUM> depends on the media or compute operations to be performed. Specific media decode operations may be offloaded to the media pipeline during media decode. In some embodiments, the media pipeline can also be bypassed and media decode can be performed in whole or in part using resources provided by one or more general purpose processing cores. In one embodiment, the media pipeline also includes elements for general-purpose graphics processor unit (GPGPU) operations, where the graphics processor is used to perform SIMD vector operations using computational shader programs that are not explicitly related to the rendering of graphics primitives.

In some embodiments, media pipeline <NUM> is configured in a similar manner as the 3D pipeline <NUM>. A set of media pipeline state commands <NUM> are dispatched or placed into in a command queue before the media object commands <NUM>. In some embodiments, media pipeline state commands <NUM> include data to configure the media pipeline elements that will be used to process the media objects. This includes data to configure the video decode and video encode logic within the media pipeline, such as encode or decode format. In some embodiments, media pipeline state commands <NUM> also support the use one or more pointers to "indirect" state elements that contain a batch of state settings.

In some embodiments, media object commands <NUM> supply pointers to media objects for processing by the media pipeline. The media objects include memory buffers containing video data to be processed. In some embodiments, all media pipeline states must be valid before issuing a media object command <NUM>. Once the pipeline state is configured and media object commands <NUM> are queued, the media pipeline <NUM> is triggered via an execute command <NUM> or an equivalent execute event (e.g., register write). Output from media pipeline <NUM> may then be post processed by operations provided by the 3D pipeline <NUM> or the media pipeline <NUM>. In some embodiments, GPGPU operations are configured and executed in a similar manner as media operations.

<FIG> illustrates exemplary graphics software architecture for a data processing system <NUM> according to some embodiments. In some embodiments, software architecture includes a 3D graphics application <NUM>, an operating system <NUM>, and at least one processor <NUM>. In some embodiments, processor <NUM> includes a graphics processor <NUM> and one or more general-purpose processor core(s) <NUM>. The graphics application <NUM> and operating system <NUM> each execute in the system memory <NUM> of the data processing system.

In some embodiments, 3D graphics application <NUM> contains one or more shader programs including shader instructions <NUM>. The shader language instructions may be in a high-level shader language, such as the High Level Shader Language (HLSL) or the OpenGL Shader Language (GLSL). The application also includes executable instructions <NUM> in a machine language suitable for execution by the general-purpose processor core <NUM>. The application also includes graphics objects <NUM> defined by vertex data.

In some embodiments, operating system <NUM> is a Microsoft® Windows® operating system from the Microsoft Corporation, a proprietary UNIX-like operating system, or an open source UNIX-like operating system using a variant of the Linux kernel. When the Direct3D API is in use, the operating system <NUM> uses a front-end shader compiler <NUM> to compile any shader instructions <NUM> in HLSL into a lower-level shader language. The compilation may be a just-in-time (JIT) compilation or the application can perform shader pre-compilation. In some embodiments, high-level shaders are compiled into low-level shaders during the compilation of the 3D graphics application <NUM>.

In some embodiments, user mode graphics driver <NUM> contains a back-end shader compiler <NUM> to convert the shader instructions <NUM> into a hardware specific representation. When the OpenGL API is in use, shader instructions <NUM> in the GLSL high-level language are passed to a user mode graphics driver <NUM> for compilation. In some embodiments, user mode graphics driver <NUM> uses operating system kernel mode functions <NUM> to communicate with a kernel mode graphics driver <NUM>. In some embodiments, kernel mode graphics driver <NUM> communicates with graphics processor <NUM> to dispatch commands and instructions.

One or more aspects of at least one embodiment may be implemented by representative code stored on a machine-readable medium which represents and/or defines logic within an integrated circuit such as a processor. For example, the machine-readable medium may include instructions which represent various logic within the processor. When read by a machine, the instructions may cause the machine to fabricate the logic to perform the techniques described herein. Such representations, known as "IP cores," are reusable units of logic for an integrated circuit that may be stored on a tangible, machine-readable medium as a hardware model that describes the structure of the integrated circuit. The hardware model may be supplied to various customers or manufacturing facilities, which load the hardware model on fabrication machines that manufacture the integrated circuit. The integrated circuit may be fabricated such that the circuit performs operations described in association with any of the embodiments described herein.

<FIG> is a block diagram illustrating an IP core development system <NUM> that may be used to manufacture an integrated circuit to perform operations according to an embodiment. The IP core development system <NUM> may be used to generate modular, re-usable designs that can be incorporated into a larger design or used to construct an entire integrated circuit (e.g., an SOC integrated circuit). A design facility <NUM> can generate a software simulation <NUM> of an IP core design in a high level programming language (e.g., C/C++). The software simulation <NUM> can be used to design, test, and verify the behavior of the IP core. A register transfer level (RTL) design can then be created or synthesized from the simulation model <NUM>. The RTL design <NUM> is an abstraction of the behavior of the integrated circuit that models the flow of digital signals between hardware registers, including the associated logic performed using the modeled digital signals. In addition to an RTL design <NUM>, lower-level designs at the logic level or transistor level may also be created, designed, or synthesized. Thus, the particular details of the initial design and simulation may vary.

The RTL design <NUM> or equivalent may be further synthesized by the design facility into a hardware model <NUM>, which may be in a hardware description language (HDL), or some other representation of physical design data. The HDL may be further simulated or tested to verify the IP core design. The IP core design can be stored for delivery to a <NUM>rd party fabrication facility <NUM> using non-volatile memory <NUM> (e.g., hard disk, flash memory, or any non-volatile storage medium). Alternatively, the IP core design may be transmitted (e.g., via the Internet) over a wired connection <NUM> or wireless connection <NUM>. The fabrication facility <NUM> may then fabricate an integrated circuit that is based at least in part on the IP core design. The fabricated integrated circuit can be configured to perform operations in accordance with at least one embodiment described herein.

<FIG> is a block diagram illustrating an exemplary system on a chip integrated circuit <NUM> that may be fabricated using one or more IP cores, according to an embodiment. The exemplary integrated circuit includes one or more application processors <NUM> (e.g., CPUs), at least one graphics processor <NUM>, and may additionally include an image processor <NUM> and/or a video processor <NUM>, any of which may be a modular IP core from the same or multiple different design facilities. The integrated circuit includes peripheral or bus logic including a USB controller <NUM>, UART controller <NUM>, an SPI/SDIO controller <NUM>, and an I<NUM>S/I<NUM>C controller <NUM>. Additionally, the integrated circuit can include a display device <NUM> coupled to one or more of a high-definition multimedia interface (HDMI) controller <NUM> and a mobile industry processor interface (MIPI) display interface <NUM>. Storage may be provided by a flash memory subsystem <NUM> including flash memory and a flash memory controller. Memory interface may be provided via a memory controller <NUM> for access to SDRAM or SRAM memory devices. Some integrated circuits additionally include an embedded security engine <NUM>.

Additionally, other logic and circuits may be included in the processor of integrated circuit <NUM>, including additional graphics processors/cores, peripheral interface controllers, or general purpose processor cores.

The graphics processing techniques described herein may be implemented in various hardware architectures. For example, graphics functionality may be integrated within a chipset. Alternatively, a discrete graphics processor may be used. As still another embodiment, the graphics functions may be implemented by a general purpose processor, including a multicore processor.

Claim 1:
A method comprising:
receiving color values for a tile of an image to be encoded using a palette-based encoder;
defining clusters of color values for a palette, each cluster associated with a different color value in the palette, and encoding color values of the tile within respective clusters with respect to the associated color values, wherein the defining and the encoding is done by looping (<NUM>) over all pixels in the tile, including:
checking (<NUM>) a difference between a color value of a given pixel in the tile and color values already in the palette;
if (<NUM>) the difference is less than a threshold, then storing (<NUM>) residual bits against an existing color value in the palette and marking the given pixel;
otherwise, if the color value is not in the palette, storing (<NUM>) the color value of the given pixel in the palette as a new palette entry and updating (<NUM>) the palette, and if the color value is in the palette, recording (<NUM>) the palette entry identifier for the given pixel; and
if (<NUM>) there are pixels left in the tile, iterating the loop with a next pixel in the tile.