Graphics processing system, operation method thereof, and computer program product
By storing YUV texture data in the form of macro-textiles in the cache, the problem of low processing efficiency of YUV texture data in graphics processing systems is solved, achieving more efficient rendering performance, similar to the performance of multi-core GPUs.
Patent Information
- Application Number
- CN201810771118.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2017-07-13
- Filing Date
- 2018-07-13
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-07-19
AI Technical Summary
Existing technologies suffer from low processing efficiency when handling YUV texture data in graphics processing systems, especially during rendering output when frequent memory accesses are required, leading to performance bottlenecks.
YUV texture data is stored in the cache as macrovellus, each macrovellus containing a chromaticity data element and one or more associated luminance data elements, and the location of these groups is identified by an identifier to allow direct access to the data in the cache.
This approach significantly improves the processing throughput of YUV texture data, enabling performance comparable to dual or triple-core GPUs with a single-core graphics processing unit, while saving area and power, especially in digital TV and set-top box applications.
Smart Images

Figure CN109255750B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method and a device for storing data in a cache in a graphics processing system, and in particular to a method and a device for storing texture data in a cache in a graphics processing system. Background Art
[0002] It is common in graphics processing systems to generate colors for sampling locations in a rendered output (e.g., an image to be displayed) generated by applying so-called textures or texture data to a surface to be drawn. Such textures are typically applied by storing an array of texture elements or "texels", each texel representing a given texture data (such as a color, brightness, and / or light / shadow value), and then mapping the texels onto corresponding elements (such as (and in practice usually are) groups of sampling locations) for the rendered output (e.g., an image to be displayed) in question.
[0003] Thus, a graphics texture will typically be structured as an array of data elements (texture elements (texels)), each data element having a corresponding set of texture data stored for it. The texture data for a given position within the texture is then determined by sampling the texture at that position (e.g., using a bilinear interpolation process).
[0004] Texture data may be provided as data in a "YUV" color space. A YUV color is described by a "brightness" (Y) value representing the brightness of the color and two "chrominance" values (U and V) representing the chrominance information of the color. YUV data is often used for video images, and its use has become more common in graphics processing systems, for example, as the use of digital TVs and set-top boxes has increased. As a result, efficient processing of this type of data has become more important.
[0005] In the case of a "YUV" texture, for each data element within the texture, the appropriate luma (Y) and chroma (U and V) values will be stored.
[0006] Where luma and chroma data for a YUV texture is stored at the same resolution, for each data element in the texture there will be a corresponding luma (Y) value and two chroma (U and V) values. In other words, for each "chroma" data element in the texture there will be a corresponding set of one luma data element.
[0007] The human eye is more sensitive to brightness than to chrominance, so YUV data is often compressed using a technique known as “chroma subsampling.” Chroma subsampling stores chroma (U and V) information at a lower resolution than luma (Y) information.
[0008] Where the chroma data is subsampled, the chroma data will accordingly be stored and represented in the texture at a lower resolution than the luma data. Thus, the array of data elements storing the chroma data will be at a lower resolution than the array of data elements storing the luma data. The effect of this will then be that for each chroma data element (position), there will be a group of multiple luma data elements (positions) for that chroma data element (i.e., the region in the texture to which the chroma data element corresponds will have a group of multiple luma data elements effectively associated with it, since the luma data is stored at a higher resolution than the chroma data).
[0009] Thus, typically for YUV texture data, for each chrominance data element (position (sample)) in the YUV texture, there will be a group of one or more associated luminance data elements (position (sample)) depending on whether the chrominance data is subsampled and to what extent the chrominance data is subsampled.
[0010] Three exemplary chroma subsampling modes are:
[0011] 1. YUV444 - Luma and chroma data are stored at the same resolution (no chroma subsampling); in this case, each chroma data element (sample) will have one luma data element (sample) associated with it.
[0012] 2. YUV422 - Chroma data is stored at half the resolution of luma data horizontally, but at the same resolution as luma data vertically; in this case, each chroma data element (sample) will have two luma data elements (samples) associated with it.
[0013] 3. YUV420 - Chroma data is stored at half the resolution of luma data both horizontally and vertically; in this case, each chroma data element (sample) will have four luma data elements (samples) associated with it.
[0014] Figure 1 An exemplary array (or portion of a larger array) of chroma and luma data elements for a YUV420 subsampling mode is shown. In this figure (and in other such figures), circles indicate locations for chroma data elements 40, and crosses indicate locations for luma data elements 41. It can be seen that the chroma data is sampled at half the resolution of the luma data both horizontally and vertically. Thus, each chroma data element has four luma data elements associated with it.
[0015] YUV texture data, especially chroma subsampled YUV data (e.g., in YUV422 or YUV420 mode), is often stored in memory as two or three separate data arrays (in a so-called "multi-plane" format), one data array (plane) containing luma (Y) information, and one or two other data arrays (planes) containing chroma (U and V) information. In the case where one data array (plane) is provided for chroma data, both U and V chroma data are stored in the same array. In the case where two data arrays (planes) are provided for chroma data, U chroma data is stored in one array, and V chroma data is stored in another array.
[0016] When a graphics processor needs texture data (e.g., to render an image to be displayed), the texture data is typically first extracted from a memory storing the texture data required for the rendering process and loaded into a cache (e.g., a texture cache) of the graphics processor or accessible by the graphics processor. The graphics processor (the rendering pipeline implemented by the graphics processor) then reads the texture data from the cache for use.
[0017] Applicants believe that there is scope for improvement in processing YUV texture data in graphics processing systems. Summary of the invention
[0018] According to a first aspect of the present invention, there is provided a method of operating a graphics processing system, in which a graphics texture can be used when rendering a rendering output, and data of the texture to be used when rendering the rendering output is loaded from a memory into a cache so as to be used by the graphics processing system when rendering the rendering output, the method comprising the following steps:
[0019] When using a graphics texture stored in memory as YUV texture data including luminance and chrominance texture data:
[0020] storing YUV texture data for a texture in a buffer from which the texture data is to be read by a graphics processing system when generating rendered output, such that data values for a group of chrominance data elements and one or more luma data elements of an associated texture are stored together as a group in the buffer; and
[0021] An identifier for a data value for a group of a chroma data element and its associated one or more luma data elements is stored in association with the buffer, the identifier being usable to identify the group of the chroma data element and its associated one or more luma data elements in the buffer and indicating a location in a graphics texture.
[0022] According to a second aspect of the present invention, there is provided a graphics processing system, the graphics processing system comprising:
[0023] Memory;
[0024] Graphics processing unit; and
[0025] caching; and
[0026] wherein a graphics texture may be used when rendering the render output, and data of the texture to be used when rendering the render output is loaded from the memory into the cache for use by the graphics processing unit when rendering the render output;
[0027] The graphics processing system also includes:
[0028] Processing circuitry, when using a graphics texture stored in a memory as YUV texture data including luminance and chrominance texture data, the processing circuitry being operable to:
[0029] storing YUV texture data for a texture in a buffer such that data values of a group of chrominance data elements and associated one or more luma data elements for the texture are stored together as a group in the buffer; and
[0030] An identifier for a data value for a group of a chroma data element and its associated one or more luma data elements is stored in association with the buffer, the identifier being usable to identify the group of the chroma data element and its associated one or more luma data elements in the buffer and indicating a location in a graphics texture.
[0031] The present invention relates to the use (and in particular the caching) of graphics textures in the form of YUV texture data (ie data in the "YUV" color space as described above).
[0032] In the present invention, texture data for a YUV texture is stored in a buffer for use in rendering a rendering output (such as an image (frame) to be displayed) such that (preferably each) chroma data element (data value) is stored in the buffer together with (the data value of) its associated set of one or more luma data elements (the number of luma data elements (values) depends, for example, on the chroma subsampling mode used for the texture data) (rather than, for example, storing chroma and luma data values separately in the buffer).
[0033] Furthermore, in the present invention, a group of chrominance data elements and their associated group of one or more luma data elements are identified in the cache by means of an identifier indicating a location in the graphics texture. The effect of this is then that, as will be discussed further below, texture data in the cache can be accessed in the cache (can be read from the cache) for use directly based on the desired texture location (rather than, for example, having to convert that location into an appropriate memory address where the texture data can be stored).
[0034] As will be discussed further below, this all facilitates use of YUV texture data (e.g., for rendering render output) because the chrominance and luma data values for a given texture location can be read together from a cache based on (e.g., using) the desired texture location (to be sampled) (e.g., as opposed to having to read the luma and chrominance data values separately from a cache, e.g., using a storage address).
[0035] In fact, the applicant has found that by using the present invention, the processing throughput of YUV texture data can be accelerated by a factor of 2 (e.g., for a 2-plane YUV format) or 3 (e.g., for a 3-plane YUV format). This means that a single-core graphics processing unit (GPU) can be used to perform the same operations as a dual- or triple-core GPU. This can be equivalent to a huge saving in both area and power. This is particularly useful, for example, in the case of digital TVs and set-top boxes. When rendering at 4K resolution for digital TV at 60Hz, approximately 500 million pixels must be read per second. If the system runs at 500MHz, this means that a single-core GPU can be used instead of a 2-core or 3-core GPU. Thus, a more efficient GPU can be provided with very little overhead per core, especially in the case of video.
[0036] The YUV texture used may be any suitable and desired such texture. In a preferred embodiment, it represents an image (frame) to be displayed. In a particularly preferred embodiment, it comprises a video frame to be displayed, for example from a sequence of video frames to be displayed.
[0037] The YUV texture can be configured according to any desired and suitable chroma subsampling mode. In a preferred embodiment, it is configured according to one of the three modes discussed above (thus YUV444, YUV422 or YUV420).
[0038] Thus, the chrominance (U and V) data (of the YUV texture data) may be provided for the texture at a lower resolution than the luma (Y) data (of the YUV texture data), e.g., the chrominance data (of the YUV texture data) may be subsampled. For example, in some cases, the chrominance data may be stored at half the resolution of the luma data in the horizontal direction, but at the same resolution as the luma data in the vertical direction. In other cases, the chrominance data may be stored at half the resolution of the luma data in both the horizontal and vertical directions.
[0039] Other chroma subsampling modes may also be used.
[0040] As discussed above, in the present invention, texture data for a YUV texture is stored in a buffer such that a group of chrominance data elements (data values) and their associated one or more luma data elements (values) are stored together in the buffer.
[0041] As discussed above, Applicants have recognized at this point that for each chroma data element (position) in a YUV texture, there will (depending on whether and which chroma subsampling mode is used) be a corresponding group of one or more luma data elements (positions). In other words, a YUV texture can be effectively considered to be composed of a plurality of "macrotexels" ("macro data elements"), each such macrotexel comprising one chroma data element (one chroma sample) of the YUV texture and a group of one or more luma data elements (luma samples) of the associated YUV texture (and having corresponding positions within the texture, e.g., corresponding in effect to the positions of the chroma data elements of the macrotexel in the texture).
[0042] For example, for a YUV444 texture, each "macrotexel" will include one chroma data element (sample) and one luma data element (luminance sample). For a YUV422 texture, each macrotexel will include one chroma data element and a pair of luma data elements. For YUV420, each macrotexel will include one chroma data element and four luma data elements.
[0043] In the present invention, the data values (luminance and chrominance data values) for such macrotexels are stored together as a group in a buffer.
[0044] In other words, the YUV texture data is stored in the buffer as groups of that data (as "macrotexels"), which include data values for a chroma sample and its associated one or more luma samples. For example, a chroma sample (data value) may have associated one, two, or four luma samples (data values).
[0045] This is preferably done for all data of the YUV texture data stored in the buffer (ie, regardless of whether the data of the YUV texture is stored in the buffer or not).
[0046] Thus, YUV texture data is preferably stored in a cache as groups of that data ("macrotexels"), each such group (macrotexel) comprising a data value for one chrominance data element (sample) and its associated one or more luminance data elements (samples).
[0047] Correspondingly, in a preferred embodiment, when a particular macrotexel of a YUV texture is needed, the data is stored in a cache such that a group of chrominance data values and one or more luminance data values associated therewith are stored together in the cache as a group, and then when an additional YUV texture macrotexel is needed, the additional macrotexel is correspondingly stored in the cache such that a group of chrominance data values and one or more luminance data values associated therewith are stored together in the cache as a group.
[0048] The group(s) of YUV texture data stored in the buffer (macrotexels) will include a data value for one chroma data element (sample) and a data value for the associated one or more luma data elements (samples). The number of luma samples stored for a group (macrotexel) will depend on the chroma subsampling mode used for the YUV texture.
[0049] For example, when chroma and luma data are provided at the same resolution (i.e., without chroma subsampling), each group (macrotexel) should and preferably does contain an equal number of chroma and luma data values, such as and preferably one chroma data value and one luma data value.
[0050] When chroma data is provided at a lower resolution than luma data, each group should, and preferably does, include one chroma data value and multiple (two or more) (eg, four) luma data values.
[0051] More specifically, when chroma data is provided at half the resolution of luma data in the horizontal direction but at the same resolution as luma data in the vertical direction, each group (macrotexel) should and preferably does include one chroma data value and two luma data values.
[0052] When chroma data is stored at half the resolution of luma data in both the horizontal and vertical directions, each group (macrotexel) should, and preferably does, contain one chroma data value and four luma data values.
[0053] In alternative embodiments and even where chroma data is stored in memory at a lower resolution than luma data, each group (macrotexel) may contain an equal number of chroma and luma data values, e.g., a single chroma data value for a given group of luma values (for each of U and V) may be replicated in the group to equal the number of luma data values.
[0054] Thus, although groups of texture data (macrotexels) stored in the cache preferably contain a single chrominance data value, a given chrominance data value may be replicated, for example so that an equal number of chrominance and luma data values are stored in the cache.
[0055] This may be done, for example, when the system is to be operated in "copy colorimetric" mode.
[0056] In this case, texture data may be stored as groups (macrotexels) that contain one (single) chroma (one U and one V) data value and one (single) corresponding luma data value (e.g., as opposed to macrotexels having multiple luma data values for a given chroma (U and V) value). Thus, in effect, chroma subsampled texture data may be converted to non-subsampled YUV444 data (i.e., an equal number of chroma and luma data values) during cache line fetches from memory, by virtue of this "copy chroma" system.
[0057] Data values for groups (macrotexels) comprising a group of chrominance data elements and their associated one or more luma data elements may be stored together in the cache in any suitable and desired manner. In a particularly preferred embodiment, the data values are stored in the cache as defined data units, such as and preferably as respective data words. Respective groups of data values (respective "macrotexels") may, for example, be and preferably are stored in the cache as 64-bit data words.
[0058] Preferably, a common data unit (e.g., data word) structure is used for each respective group of chrominance and luma data values stored in the cache (for each macrotexel). Preferably, the data unit (e.g., data word) has respective fields for the data values, and each such data unit (data word) has the same order and configuration of these fields.
[0059] In one example, a data unit (e.g., a data word) contains fields for data values in the order of a field for one or more luma data values and then a field for chroma data values (U and V). Alternatively, a field containing (or for) chroma data values (U and V) may be provided first in a data unit (e.g., a data word), followed by a field containing (or for) one or more luma data values, or a field containing (or for) chroma data values (U and V) may be interleaved with a field containing (or for) one or more luma data values. Other structures are of course possible.
[0060] Preferably, fixed size data units (data words) are used, even though such units may be larger than required by the data value. Preferably, the data units (eg data words) are sized to fit the cache and buffer system (and storage system) of the graphics processing system.
[0061] In the event that the chroma and luma data for a particular group (macrotexel) does not fill a data unit (word), any unused bits in the data unit may be filled with a "dummy value" and / or used to encode other characteristics, such as transparency. This can help ensure that the chroma and / or luma data is stored at a consistent location within each data unit (word), thereby facilitating the reading of cached texture data.
[0062] Preferably, the same amount of storage (e.g., the same amount of bits) is used to store each luma and each chroma (e.g., U and V) data value in the buffer. For example, in a preferred case, 10 bits may be used to store each luma data value and each chroma data value. Any unused bits are preferably padded with dummy values (e.g., as described above).
[0063] For example, where chroma data is stored in a YUV texture at half the resolution of luma data both horizontally and vertically, each group (macrotexel) may contain two chroma data values (one U and one V) and four luma data values. With 10 bits used to store each luma and each chroma data value, this would add up to 60 bits (10 bits for each of the four luma data values, and 10 bits for each of the two chroma (U and V) data values). If 64-bit words are used to store the data (e.g., as is preferred), then this would result in 4 bits of the word remaining, and these four bits are preferably "padded" or filled with dummy values, or are transparent masks.
[0064] Corresponding structures are preferably used for other chroma (sub)sampling modes.
[0065] A cache should, and preferably does, include one or more (preferably multiple) cache lines.
[0066] Preferably, multiple groups (macrotexels) of YUV texture data are stored in a cache line (preferably in each cache line) (a cache line is used to store data from a YUV texture). Correspondingly, the cache line (each cache line) preferably includes multiple data units (data words), each data unit containing data for a group (macrotexel) of texture data.
[0067] A cache line may store any suitable and desired number of groups (macropexels) of texture data. This may depend, for example, on the size of each cache line and the size of the data unit (data word) used to store each group (macropexel) of texture data. For example, where each cache line contains 1024 bits and 64-bit data words are used to store data for macrotexels, each cache line may and preferably does contain up to (and preferably does contain) 16 groups (macropexels) of texture data.
[0068] Thus, in the preferred case, each cache line can, and preferably does, contain 16 groups (macrotexels) of texture data.
[0069] Preferably, the multiple groups of texture data (macropexels) stored in the cache line include groups of consecutive macrotexels of the YUV texture (i.e., groups of adjacent (or consecutive) chroma data element positions (and their corresponding luminance data element positions) representing the texture).
[0070] In other words, the multiple groups of texture data (macroporexes) stored in the cache line preferably include a group of macrotexels covering a specific region (area) of the YUV texture (and thus also a group of chroma data element positions (and their corresponding luminance data element positions) of the texture for the specific region (area) of the YUV texture).
[0071] The group of consecutive macrotexels stored in a cache line may have any suitable and desired configuration of macrotexels. In a preferred embodiment, the group of consecutive macrotexels is rectangular (including square). For example, a cache line may store rows or columns of macrotexels that are one macrotexel high or wide, respectively.
[0072] In a preferred embodiment, a cache line is used to store groups of contiguous macrotexels that are two rows (or columns) of macrotexels high (or wide) (the number of macrotexels in a row or column is then determined by the overall capacity of the cache line). In another embodiment, a cache line stores square groups of contiguous macrotexels.
[0073] Thus, where each cache line contains 16 groups (macropexels) of texture data, these 16 groups (macropexels) preferably comprise 8 x 2, 2 x 8 or 4 x 4 sets of such groups (macropexels) from a YUV texture.
[0074] The groups of texture data (macrotexels) may be stored in a cache line in any suitable and desired order. In a particularly preferred embodiment, they are stored in a cache line in a specific, preferably selected, preferably predetermined order (e.g. and preferably with respect to groups of consecutive macrotexels of the texture to which they correspond). This will then facilitate identification of a corresponding group of texture data (macrotexels) within a cache line, e.g. from knowing the position of one of the groups of texture data in the cache line.
[0075] Preferably, multiple groups of texture data (or macrotexels) are stored in cache lines in the order in which they correspond to the image to be processed (eg, in Morton (Z) order, raster order, etc.).
[0076] By arranging and storing the texture data in a cache like this, this can facilitate later processing of the texture data for a particular area or sample location of the texture because all of the texture data for the area of the texture is stored together in a cache line.
[0077] In the present invention, identifiers ("lookup" keys) for identifying groups of texture data (macroporectels) stored in a cache are also stored in association with (and preferably in) the cache so as to be used to identify groups of texture data (macroporectels) in the cache (i.e., these macroripples can and are preferably used to read texture data from the cache).
[0078] The identifier may be provided in any suitable and desired manner. In a particularly preferred embodiment, the identifier is provided as a tag to the cache line in question (in which the group (macrotexel) of texture data is stored).
[0079] The identifier indicates the location of the YUV texture (as opposed to, for example, a storage address comprising the stored data).
[0080] The location in the texture used as an identifier for a group (macrotexel) of texture data may be any suitable and desired location in the texture. In a preferred embodiment, the identifier indicates a location in the graphics texture of a group of a chrominance data element (of a macrotexel) and its associated one or more luminance data elements.
[0081] The position need not be the position of the group of texture data (macrotexel) in question (and indeed, in preferred embodiments typically will not be, as will be discussed further below), but rather should be a position from which the position of the group of texture data (macrotexel) in question in the YUV texture can be determined.
[0082] In a preferred embodiment, the identifier indicates the location of a chroma data element (value) in the texture. Because each group of texture data (macrotexel) will contain a single chroma data element (location) (but may contain multiple luma data elements (locations)), by storing identifiers indicating the location of chroma data elements in the cache, this can help facilitate determining which texture data should be read in order to texturize, for example, a particular sample location of an image to be rendered.
[0083] In a particularly preferred embodiment, the identifier indicates a region within the texture within which the group of chrominance data elements (of a macrotexel) and its associated one or more luminance data elements falls.
[0084] Although separate identifiers may be provided for each group (macrotexel) of texture data, preferably a single (one) identifier (tag) is provided and used for more than one group (macrotexel) of texture data. In a particularly preferred embodiment, a single "location" identifier (tag) is provided and used for a given cache line (thereby being common to multiple groups (macrotexels) of texture data stored in the cache line).
[0085] In a particularly preferred embodiment of this invention, where a single "location" identifier (tag) is provided to and used for a given cache line, the single "location" identifier (tag) provided to and used for a given cache line indicates the locations of multiple groups (macroporexes) (groups of contiguous macrotexels) of texture data stored in the cache line in question.
[0086] In a particularly preferred such structure, the entire texture is considered to be divided into respective regions (blocks). Each such region preferably has the same size and shape (configuration), and preferably contains the same number (and layout) of macrotexels. Each region preferably corresponds to a given group (block of macrotexels) of macrotexels to be stored in (to be filled with) a cache line.
[0087] In this case, the respective regions (blocks) into which the texture is divided are preferably indexed across the texture, and the location identifier (tag) for a given cache line is then set to the index location (coordinates) of the texture data region within the texture to which the plurality of macrotexels (groups of macrotexels) stored in the cache line corresponds. Thus, the location identifier (e.g., cache line tag) preferably indicates one of the texture regions (blocks).
[0088] Thus, in a particularly preferred embodiment, the texture stored in the cache is divided into multiple regions (blocks), each region corresponding to a group of multiple macro-texels to be stored in a single cache line, and the location identifier (tag) for the cache line in the texture cache indicates the relative position within the texture of the texture region (block) to which the group of macro-texels stored in the cache line corresponds.
[0089] Other configurations would of course be possible.
[0090] For example, an identifier (tag) for a cache line may (and in preferred embodiments does) indicate the location of (preferably chrominance) data elements of one texture data group (macrotexel) stored in the cache line. For example, an identifier for a cache line may (and in preferred embodiments does) indicate the location of chrominance data elements in a first texture data group (macrotexel) stored in the cache line.
[0091] In such an embodiment, the identifier for the cache line preferably indicates the location of a specific, preferably selected, and preferably predetermined one group (macrotexels) of data elements (preferably chrominance data elements) of texture data for a group of multiple consecutive macrotexels stored in the cache line. For example, the identifier for the cache line may indicate the location of a first group (macrotexels) of data elements (and preferably chrominance data elements) of texture data stored in the cache line.
[0092] In a preferred such embodiment, the identifier for a cache line indicates the position of the (preferably chrominance) data element of the top left macrotexel of a contiguous group (array) of macrotexels stored in the cache line. However, in alternative embodiments, the identifier may indicate the position of a different (e.g., chrominance) data element stored in the cache line.
[0093] The identifier indicating a position in the YUV texture may be configured in any suitable and desired form. Thus, it may, for example, comprise an "absolute" position in the YUV texture. However, in a particularly preferred embodiment, the identifier indicates the position as a position index, for example and preferably by indicating the (relative) position index (coordinates) (x and y index) of a group of macrotexels stored in a cache line as discussed above. Alternatively, the identifier may, for example and preferably, indicate the position as a position index by indicating the index of, for example, the chrominance data element in question to which the position corresponds.
[0094] In the former case, the position index may indicate the position of a region (group of macrotexels) in the texture, with the index (0,0) (for example) indicating the top left region (block), (1,0) indicating the next region (block) along the horizontal direction, and (0,1) indicating the next region (block) below the region at (0,0). Thus, the index would extend from (0,0) to (x-1,y-1), where x is the number of texture regions (blocks) in the horizontal direction, and y is the number of texture regions (blocks) in the vertical direction, and the index (x-1,y-1) would indicate the bottom right region (block) in the texture.
[0095] Correspondingly, in the latter case, the position index may indicate, for example, the position of a chroma data element in an array of data elements in a texture, with the index (0,0) indicating the top left (chroma) data element, (1,0) indicating the next (chroma) data element along the horizontal direction, and (0,1) indicating the next (chroma) data element below the element at (0,0). Thus, the index will extend from (0,0) to (x-1,y-1), where x is the number of (chroma) data elements in the horizontal direction and y is the number of (chroma) data elements in the vertical direction, and the index (x-1,y-1) will indicate the bottom right (chroma) data element in the texture.
[0096] The YUV texture will be stored in a memory of the data processing system of which the graphics processing system is a part. The memory storing the YUV texture may be any suitable and desired memory of the entire data processing system, such as and preferably is the main memory for the graphics processing system (e.g., where there is a separate memory system for the graphics processor), or the main memory of the data processing system shared with other elements of the data processing system, such as a main processor (CPU). Other configurations are of course possible.
[0097] Therefore, the data of the YUV texture will need to be fetched from the memory where it is stored and loaded into the cache (in the structure of the present invention).
[0098] Thus, in a preferred embodiment, the present invention further comprises (and the graphics processing system is further configured to) extract the data of the YUV texture from the memory and store it in the buffer in the desired manner.
[0099] Storing the texture data in the buffer in the required manner when the texture data is fetched from the memory storing the YUV texture can be performed in any suitable and desired manner. This can and preferably does depend on the format in which the data for the YUV texture is stored in the memory.
[0100] For example, where data for a YUV texture is stored in memory such that data values for groups of chrominance data elements (positions) and their associated one or more luminance data elements (positions) have been stored together, then it may be the case that the data can be read from memory in the layout in which it is stored and stored directly in the cache (and in this case this is preferably what is done).
[0101] On the other hand, as discussed above, the data for the YUV texture may be stored separately in memory, for example, as a separate data array in memory. This would be the case if the texture data were stored in a multi-planar format (as discussed above). Thus, in this case, the texture data would not be stored in memory in the proper groups (macrotexels) and would therefore need to be arranged into the proper groups (macrotexels) as (or before) it is stored in the cache.
[0102] Thus, in this case, the texture data will be stored in the cache in a different structure (format) than the structure in which it is stored in memory. Therefore, the process of extracting data from memory and storing it in the cache should, and preferably does, operate to restructure the data from the structure in which it is stored in memory to the desired structure in the cache.
[0103] Thus, in a particularly preferred embodiment, the operation of storing texture data in a cache is operable to group data values for data positions in a YUV texture so that data values for corresponding groups of groups of chrominance data elements (positions) and their associated one or more luminance data elements (positions) are stored together in the cache (in adjacent data positions (fields) in the cache, and preferably together in the same commonly defined data unit (data word) in the cache).
[0104] Thus, the chrominance and luminance data values for a particular group (macro-texels) of texture data are read from the memory and stored in consecutive data locations (data fields) in the cache, so that the chrominance and luminance data values for the particular group (macro-texels) of texture data are stored together even though they are read separately from the memory.
[0105] Thus, in a particularly preferred embodiment, the method of the present invention comprises the following steps (and the graphics processing system is correspondingly configured to): in the case where the YUV texture is stored as one or more separate arrays of chroma data elements and a separate array of luminance data elements, the data values for the chroma data elements in the texture and the data values for the luminance data elements corresponding to the chroma data elements are read separately, but these data values are then stored together in a row of a cache (for example, in data units (data words)).
[0106] For example, in the method, a chrominance data value (e.g., U or V or both) (e.g., for a group (macrotexel) of texture data) may be retrieved from memory and stored in a cache in an appropriate (determined) data location. Another chrominance data value (e.g., V or U, when the U and V chrominance data values are stored separately in the cache, such as in separate data arrays (planes)) may be retrieved from memory and stored in the cache in an appropriate (determined) data location. An associated luma data value may be retrieved from memory and stored in the cache in an appropriate (determined) data location (or multiple appropriate determined data locations). The chrominance and luma data values may be retrieved from memory and stored in the cache (in their appropriate data locations) in any temporal order.
[0107] The chrominance and associated luma data values may be fetched from memory and written directly into the cache (in their appropriate data locations). Thus, in this case, the chrominance and associated luma data values will be grouped into their respective groups (macrotexels) along with the luma and chrominance data values stored in the cache (when the luma and chrominance data values are stored in the cache) (in the case where these data values are separately provided in memory (e.g., in a multi-plane structure)).
[0108] To facilitate this operation (and others), the cache is preferably configured to be addressable at a suitable data subdivision level. For example, the cache may be addressable at a single bit or single byte level. In a preferred embodiment, the cache may be addressable in units of four bits.
[0109] This can be achieved, for example, by using bit gating for storage writes. For example, a bit enable can be set for a luma data location in a cache line only when luma data is written to the cache line (and vice versa).
[0110] In other embodiments, the chrominance and luma data values may not be stored directly in the cache after being retrieved from the memory, but may first be stored in some form of intermediate storage (such as a cache). Thus, in this case, the chrominance and luma data values retrieved from the memory will first be stored in the intermediate storage (e.g., the cache), and then written to the cache from the intermediate storage (the cache). In this case, setting the chrominance and luma data values to their respective groups (macrotexels) may be performed when writing the values to the intermediate storage (the cache), so that they will be stored in the cache in their respective groups, and the respective groups (macrotexels) of chrominance and luma data values are then written to the cache, for example as a group (as a whole data word), at the appropriate location in a cache line of the cache.
[0111] Storing chroma and luma data values retrieved from memory in an intermediate storage such as a buffer before storing them in a cache can facilitate re-arranging (grouping) the chroma and luma data values into groups (macropexels) before storing the data in the cache as groups (macropexels).
[0112] Regardless of the temporal order and regardless of whether a buffer is used, once the chrominance and associated luminance data values (e.g., for groups (macropexels) of texture data) have been fetched from memory and stored in the cache, the end result should and preferably is that they are stored in the cache (e.g., consecutive data locations in a cache line) in groups, each group including the chrominance and associated luminance data values (e.g., for groups (macropexels) of texture data).
[0113] As discussed above, multiple groups of texture data (macrotexels), for example and preferably corresponding to groups of consecutive macrotexels of a YUV texture, are preferably stored in a cache line in a specific, preferably selected, preferably predetermined order.
[0114] Thus, the method preferably comprises the following steps (and the system is preferably configured to): for a texture data element value, determining a data position in a cache line based on the (relative) position within the texture of a group of texture data (macro-texel) to which the data element belongs, and then storing the texture data element value in the data position in the cache line.
[0115] The position of the group of texture data (macrotexels) on which the data position in the cache line is based is preferably the relative position of the group of texture data (macrotexels) in the group of consecutive macrotexels of the YUV texture stored in the cache line in question.
[0116] As discussed above, data locations are preferably determined such that groups of texture data (macrotexels) fetched from memory are stored in cache lines in an order corresponding to the order in which they are arranged in groups of preferably consecutive macrotexels of the YUV texture.
[0117] As described above, a data unit (e.g., a data word) in a cache line for storing texture data should contain fields for texture data (e.g., luma and chroma data). Thus, the method preferably includes (and the system is preferably configured to) determine in which fields within the data unit to store luma and chroma data from an extracted group (macrotexel) of texture data.
[0118] Each group of texture data (macrotexels), e.g., from a group of consecutive macrotexels of a YUV texture to be extracted, may be extracted from the memory individually or separately. For example, the groups of texture data (macrotexels), e.g., from a group of consecutive macrotexels of a YUV texture to be extracted, may be extracted from the memory in any order. Thus, preferably, for each group of texture data (macrotexels), e.g., as it is extracted from the memory, the data location in the cache line at which the group of texture data (macrotexels) extracted from the memory is to be stored is determined individually.
[0119] The groups of texture data (macrotexels) can preferably be fetched from the memory in any order. They can preferably also be stored in the cache line in any time order (but preferably in data locations determined by them, e.g. the location of each group of texture data (macrotexels) fetched from the memory in a group of consecutive macrotexels of the fetched YUV texture). Thus, the data units (e.g. data words) in the cache line can preferably be filled in any order.
[0120] This "resetting" of texture data when loading it into a texture cache is considered to be an independent invention, so from a further aspect there is provided a method of operating a graphics processing system in which a graphics texture is available for use when rendering a render output, and data for the texture to be used when rendering the render output is loaded from a memory into a cache for use by the graphics processing system when rendering the render output, the method comprising the steps of:
[0121] When a graphics texture stored in memory is used as YUV texture data (YUV texture data includes a data array storing luminance data of the texture and one or more other data arrays storing chrominance data of the texture):
[0122] reading chroma data values for chroma data elements from one or more other data arrays storing chroma data of the YUV texture in memory;
[0123] reading from a data array storing luma data of a YUV texture in a memory one or more luma data values for a group of luma data elements associated with the chroma data element whose value has been read; and
[0124] The read chrominance data values and luma data values are stored in a buffer such that data values for a group of chrominance data elements and associated one or more luma data elements are stored together as a group in the buffer.
[0125] According to another aspect of the present invention, there is provided a graphics processing system, the graphics processing system comprising:
[0126] Memory;
[0127] Graphics processing unit; and
[0128] caching; and
[0129] wherein a graphics texture may be used when rendering the render output, and data of the texture to be used when rendering the render output is loaded from the memory into the cache for use by the graphics processing unit when rendering the render output;
[0130] The graphics processing system also includes:
[0131] Processing circuitry, when using a graphics texture stored in a memory as YUV texture data (the YUV texture data comprising a data array storing luminance data of the texture and one or more other data arrays storing chrominance data of the texture), the processing circuitry being operable to:
[0132] reading chroma data values for chroma data elements from one or more other data arrays storing chroma data of the YUV texture in memory;
[0133] reading from a data array storing luma data of a YUV texture in a memory one or more luma data values for a group of luma data elements associated with the chroma data element whose value has been read; and
[0134] The read chrominance data values and luma data values are stored in a buffer such that data values for a group of chrominance data elements and associated one or more luma data elements are stored together as a group in the buffer.
[0135] Thus, in these aspects of the invention, the YUV texture data is read from two or more data arrays (e.g., one each for chrominance and luma texture data) where it is stored in a memory, for example, in a multi-planar format, but the YUV texture data is then rearranged into groups when stored in a cache, each group comprising a set of chrominance data values and their associated one or more luma data values.
[0136] Thus, for example, chroma data values are read from a data array storing chroma data elements and stored in data locations in a cache, followed by reading one or more luma data values from a luma data array and storing those luma data values in data locations in the cache adjacent to (contiguous with) the data locations storing the chroma data values (or vice versa, i.e., the luma data values are read and stored first, followed by the chroma data values).
[0137] As described above, by rearranging and storing the YUV texture data in such groups in the cache, this can mean that reading the required texture data for an image to be processed requires reading the cache fewer times (e.g., compared to a situation where the YUV texture data is not stored in such groups in the cache, such as when the chroma and luma texture data are stored in separate rows and / or data words in the cache), because both the chroma and luma data samples for a given area of the texture (e.g., a macrotexel) are stored together in the cache (and can be accessed together in the cache).
[0138] As will be appreciated by those skilled in the art, these aspects and embodiments of the present invention may include any one or more or all of the preferred and optional features of the present invention described herein, as appropriate.
[0139] Thus, for example, a read set of chrominance data values and associated one or more luma data values are preferably stored in consecutive data fields in a cache line, which data fields preferably belong to a given (recognizable) data word in the cache. Equally, the set of chrominance values and associated one or more luma data values may actually be written directly from memory to the cache in order to group them together (e.g., in one of the ways discussed above), or the setting of the data values into groups may be performed via an intermediate buffer from which the data values are then written to the cache.
[0140] As described in more detail above, the texture data may preferably be stored in the cache in any temporal order, as long as the end result is that the texture data is stored in the cache in groups, each group comprising a set of chrominance data values and their associated one or more luma data values.
[0141] Preferably, the method further comprises the following steps: storing in a cache an identifier for a data value of a group of a chroma data element and its associated one or more luminance data elements, the identifier being operable to identify the group of a chroma data element and its associated one or more luminance data elements in the cache and indicating a location in a graphics texture (e.g., as described above).
[0142] These aspects of the invention may include any of the other optional or preferred features described above or below.
[0143] In any aspect of the invention and as described above, chrominance data values may be replicated when storing data in a cache, such that, where chrominance data is stored in memory at a lower resolution than luma data, each group (macrotexel) in the cache contains a single chrominance data value (for each of U and V) and a single luma data value. In this case, when a chrominance data value is retrieved from memory, the chrominance data value may, for example and preferably, be stored in the cache (i.e., replicated) in more than one location depending on the chroma subsampling mode used. In this case, preferably, each chrominance data value is stored at one data location in the cache line for each luma data value to which it is associated. For example, in YUV422 mode, each chrominance data value will be stored twice in the cache and once for each luma data value associated therewith. Alternatively, in YUV420 mode, each chrominance data value will be stored four times in the cache and, again, once for each luma data value associated therewith.
[0144] Alternatively, and when it is desired to copy chroma, the chroma data values may be copied when the data is read out from the buffer.
[0145] In order to fetch the data into the cache, the data processing system will need to send appropriate storage requests for the texture data to the memory. These requests can be, and preferably are, triggered by the graphics processor attempting to read the texture data from the cache or checking whether the desired texture data is stored in the cache and then finding that the texture data is not present in the cache (i.e., encountering a cache miss). Requests are preferably then sent to the memory to retrieve the "missing" data, and preferably to retrieve multiple groups of texture data (e.g., corresponding to regions of the texture) that include the desired "missing" texture data (e.g., to fill or be sufficient to fill a cache line).
[0146] In the present invention and as will be discussed further below, the graphics processor will use the appropriate texture location to address the cache for texture data (because the texture data is identified in the cache using the texture location). However, in order to fetch the data from memory into the cache, the texture location used to address the cache will need to be translated into the appropriate storage address in memory to store the texture data for that texture location.
[0147] Thus, the method preferably comprises the following steps (and the graphics processing system is further configured to): for a texture position where texture data is required (to be sampled) (and the texture is determined to be not already stored in the cache), converting the texture position into one or more storage addresses, the one or more storage addresses being used to address a memory storing texture data including the texture data for the texture position.
[0148] For example and in some cases, a texture location may be converted to, for example, a single memory address where all texture data (e.g., both chrominance and luma texture data) for the texture location is stored together in memory. All required texture data may be stored at a single memory address, or alternatively, the texture data may be stored in several texture addresses, with other memory addresses being determinable from the single memory address to which the texture location is converted (e.g., the required texture data may be stored in a group of, for example, a series of consecutive memory addresses, where only one of the memory addresses (e.g., the first) is needed to determine all of the memory addresses from which to extract the required texture data).
[0149] In other cases, a texture position may be converted into two or more storage addresses, such as where the texture data required for each texture position (the texture position in question) is stored in two or more locations (storage locations) in memory (e.g., where chroma and luma texture data are stored separately in memory (e.g., in two or more data arrays)).
[0150] The conversion of a texture location to a storage address (or to two or more storage addresses) may be performed in any suitable and desired manner. For example and preferably, the conversion may be performed by applying one or more predetermined rules or formulas for such conversion. Alternatively, the conversion may be performed by using a lookup table or other suitable means.
[0151] The texture position itself may be indicated in any desired manner. For example and in a preferred embodiment, the texture position is indicated as a fractional position across the width of the texture and a fractional position across the height of the texture, for example by providing x and y coordinates in the range 0 to 1 or -1 / 2 to +1 / 2.
[0152] In some preferred embodiments, the texture position is first converted to a position (e.g., a position index) of a texture data element in a YUV texture (e.g., the position of the texture data element in the YUV texture that is closest to the texture position), and then the position of the texture data element is converted to one or more storage addresses. This can be done separately for luma and chroma data elements, for example, where the chroma data is provided at a lower resolution than the luma data and / or where the luma and chroma data are stored separately in memory. The conversion of texture positions to positions of texture data elements in a YUV texture is described in more detail below.
[0153] Thus, an x, y (for example) position index may be provided for each or both of the luma and chroma data elements to be sampled for a given texture position. The position index is then preferably converted to a storage address. The position index is preferably converted to a storage address based on one or more, and preferably all, of the following for the sampled texture: a base address (the storage address of the first data element in the sampled texture), a stride (address difference) between the start addresses of two consecutive scan lines for the data type in question (luminance or chroma), and a size (preferably in bytes) occupied by data values of the data type in question (luminance or chroma). For example, the position index may be converted to a storage address corresponding to the base address plus (vertical index (y) times the stride) plus (horizontal index (x) times the data value size).
[0154] Thus, in any aspect of the invention but where the texture data is stored in a memory, the invention preferably comprises performing one or more storage requests to fetch the required texture data from the memory into a cache (cache line). The number of storage requests may depend on how the texture data is stored in the memory and, for example, the number of (different) locations where the texture data is stored. The number of storage requests may also (or alternatively) depend on the structure of the group of texture data to be stored in the cache or cache line.
[0155] Where texture data is stored in memory in a multi-planar format (or multiple distinct arrays of data), preferably at least one (and preferably only one) storage request is performed for each plane (array) of the texture.
[0156] For example, multi-plane texture data (e.g., in two or three planes) may be read with one pass (storage request) per plane, which means that reading a two-plane texture may take two passes, thus taking two cycles per load, and reading a three-plane texture may take three passes, thus taking three cycles per load.
[0157] Preferably, texture data is fetched from memory with one storage request for (or corresponding to) a (given) row of data in the texture. In this case, if, for example, chrominance data is subsampled vertically, there may be more requests for rows of luminance data than for rows of chrominance data.
[0158] For example, where 16 macrotexels (groups of texture data) are to be stored in a cache line from, for example, an 8x2 (two rows of eight) block of macrotexels in a texture, and the texture data is provided in a YUV420 subsampling mode, each macrotexel will contain 2x2 luma data locations (values) and one chroma data location (value), so the 8x2 block of macrotexels will correspond to 16x4 luma data values and 8x2 chroma data values. Thus, a cache line fetch from memory from a 3-plane YUV420 texture will involve 8 storage requests: 4 requests for four consecutive luma scans, 2 requests for two rows of chroma in the U plane, and 2 requests for two rows of chroma in the V plane.
[0159] As each store request returns (which may, for example, be in any order (in practice, the operation preferably supports "out-of-order" data fetches or data fetches in any order)), the data values are preferably written to the cache line in the appropriate data locations (e.g., in the appropriate bits) depending on their corresponding locations in the texture. The store request may, for example, include an indication of one or more of the following: the cache line and location within the cache line in which the data is to be stored, the format in which the data is to be stored in the cache, etc., to facilitate this.
[0160] Preferably, a cache line is (only) indicated as "valid" (i.e., all requested texture data is stored in the cache line and is therefore available for use) once all storage requests for the cache line have been returned. For example, the number of storage requests sent and returned may be tracked and / or recorded in order to determine when all storage requests have been returned. Preferably, this includes using a reference count corresponding to the number of storage requests required to fill the cache line.
[0161] Any suitable cache "fill" structure may be used to select the cache line into which the fetched texture data is stored, such as a least recently used cache line replacement structure or the like.
[0162] Once texture data has been stored in a cache (in a cache line), the texture data may be read from the cache (cache line) for use in rendering a rendering output (such as an image to be displayed).
[0163] The required texture data will typically and preferably be indicated by indicating the location in the YUV texture to be sampled (for which texture data is required).
[0164] Correspondingly, in a preferred embodiment, the graphics processor (or a texture mapper of the graphics processor) addresses a buffer storing YUV texture data using the location of the texture indicating the required texture data.
[0165] As described above, the position to be sampled in the YUV texture (texture or sampling position) can be indicated as desired. In a preferred embodiment, the position is indicated as a fractional position across the width of the texture and a fractional position across the height of the texture, for example by providing x and y coordinates in the range of 0 to 1 or -1 / 2 to +1 / 2.
[0166] In a preferred embodiment, the indicated sampling position is mapped to the position of a texture data element in a YUV texture (and preferably mapped to the position of the nearest data element in the YUV texture (e.g., one of the four data elements closest to the sampling position and preferably the one in the upper left corner)), that is, mapped to the corresponding data element (texel) index in the YUV texture.
[0167] The YUV texture data element (texel) index can be derived from the indicated sampling position as desired. In a preferred embodiment, the texel index is determined from the indicated sampling position and the width and height of the YUV texture, which are defined in view of the number of data positions across the width and height of the texture (respectively).
[0168] In a preferred embodiment, the texture data element (texel) x and y indices (macrotexel_index_x and macrotexel_index_y, respectively, in the following formula) corresponding to the texture position to be sampled are determined as:
[0169] macrotexel_index_x=floor(sample_position_x*macrotexel_horizontal_count–chroma_offset_x) (1)
[0170] macrotexel_index_y=floor(sample_position_y*macrotexel_vertical_count–chroma_offset_y) (2)
[0171] Where sample_position_x and sample_position_y are the x and y coordinates of the position in the texture to be sampled, and are defined in the range from 0 to 1 (thus giving the fractional position of the sample position across the texture); and the "macrotexel_horizontal_count" and "macrotexel_vertical_count" variables correspond to the number of chroma data positions across the width and height of the texture, respectively. For YUV444, macrotexel_horizontal_count and macrotexel_vertical_count are the same as the width and height of the texture, respectively, measured in texels. For YUV420 and YUV422, macrotexel_horizontal_count is equal to half the width of the texture measured in texels. For YUV422, macrotexel_vertical_count is the same as the height of the texture measured in texels. For YUV420, macrotexel_vertical_count is equal to half the height of the texture measured in texels.
[0172] In a preferred embodiment, the texture has a uniform / constant width and height.
[0173] The chroma_offset_x and chroma_offset_y values correspond to the fractional horizontal and vertical positions, respectively, of the chroma samples within the macrotexel (referred to as the chroma "sitting" within the macrotexel). This is described in more detail below.
[0174] The chroma_offset_x and chroma_offset_y values can be found from the following tables for different chroma locations in chroma subsampling modes YUV444, YUV422, and YUV420, respectively:
[0175] YUV444
[0176] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.50 0.50 center Co-site 0.50 0.50 Co-site center 0.50 0.50 center center 0.50 0.50
[0177] YUV422
[0178] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.25 0.50 center Co-site 0.50 0.50 Co-site center 0.25 0.50 center center 0.50 0.50
[0179] YUV420
[0180] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.25 0.25 center Co-site 0.50 0.25 Co-site center 0.25 0.50 center center 0.50 0.50
[0181] In a particularly preferred embodiment, the data position (index) of the chroma data element corresponding to the desired sampling position (i.e., the one of the several (e.g., four) chroma data elements closest to the desired sampling position) is determined. Thus, in this case, the width and height of the texture (e.g., used in the above formula) will therefore be defined in view of the number of chroma data positions (elements) (chroma texels) across the width and height of the texture.
[0182] Because each group of texture data (macrotexel) stored in the cache will contain only a single chroma data position value (but potentially more than one luma data position value, depending on the chroma subsampling mode used and whether the chroma data values have been copied when stored in the cache), this then has the effect of directly identifying the group of texture data (macrotexel) to which the desired sampling position corresponds. This then facilitates more direct identification of the required texture data in the cache and simultaneously reading from the cache all the chroma data and luma data that would be required for the sampling position.
[0183] In a preferred embodiment, the texel index (texture data location) determination also takes into account the relative position of the chroma data location with respect to its associated group of one or more luma data locations.
[0184] Chroma and luma data may have various (relative) positions and / or structures within groups (macrotexels) of texture data. These depend on the chroma subsampling mode used (e.g. how many luma data positions are associated with a single chroma data position). Different (relative) positions and / or structures may also be used for each chroma subsampling mode. However, preferably, the same relative positions and structures of chroma and luma data positions within groups (macrotexels) of texture data are used for a given texture (as a whole).
[0185] In one embodiment (and in the presence of subsampling of the chroma data), the (single) chroma data position is located (preferably, but not necessarily, centrally located) between the associated luma data positions in the texture data group (macrotexel). In this case, the luma data positions are preferably evenly distributed around the chroma data position (e.g., on either side in the horizontal direction and / or vertical direction), and / or form a square around the chroma data position, with the chroma data position preferably being at the center of the square.
[0186] In an alternative embodiment, the (single) chroma data position may have the same position as one of the luma data positions (or a single luma data position if there is no chroma subsampling). For example and preferably, the chroma data position may have the same position as the left or top left luma data position in the texture data group (macrotexel). Alternatively, the chroma data position may have the same position as a different (e.g. bottom left, right, top right or bottom right) luma data position in the texture data group (macrotexel).
[0187] In an alternative embodiment, the chrominance data values are replicated so that there are the same number (e.g., two or four) of chrominance data locations as luminance data locations. In this case, each chrominance data location will have the same data value. The replicated chrominance data values are preferably provided at the same location as the luminance data location.
[0188] Other locations and arrangements of chrominance and / or luminance data locations are possible.
[0189] The texel index (texture data position) determination preferably takes into account the relative position of the chrominance data element with respect to its associated group of one or more luminance data elements, for example by including a horizontal and / or vertical "offset" in the above formula depending on the relative position of the chrominance data elements in the texture data group (macrotexel).
[0190] Once a texture element position (e.g., a chroma data element position) in the YUV texture has been determined, the determined position can be, and preferably is, used to read corresponding data for a texture data group stored in a cache for the determined texture data position (e.g., chroma data position) (the texture data position is used to address a texture data cache to retrieve texture data from the cache).
[0191] At this point it would be possible to simply read and use a single group of texture data (macrotexel) to determine the data for the location to be sampled in the YUV texture. However, in a preferred embodiment, the texturing process is operable to interpolate the value for the location in the YUV texture from data values for a plurality of defined texture data element locations in the YUV texture. Preferably, the data value for the location in the YUV texture is determined using bilinear interpolation of the data values for the texture data elements in the YUV texture.
[0192] Therefore, in a particularly preferred embodiment, groups of 2x2 macrotexels in a YUV texture are identified and used to determine data values for locations in the texture to be sampled. This can be done by, for example, separately determining the corresponding texel index for each macrotexel in the manner discussed above.
[0193] However, in a particularly preferred embodiment, a single macrotexel position (index) is identified in the manner discussed above so as to identify the macrotexel position of one of the 2x2 groups of macrotexels to be used (and preferably so as to identify the top left macrotexel of the 2x2 macrotexel block), and thereby then identify (determine) the other (e.g., three) macrotexels of the 2x2 group.
[0194] Thus, preferably, an index of a texture data position (preferably a chrominance data position) that is close to or closest to a sample position (e.g., the upper left corner) is determined, and then indices of other (e.g., three other) texture data positions (preferably chrominance data positions) surrounding or closest to the sampled position are determined based on the first determined texture data position (preferably chrominance data position) index, for example by adding the relevant number of positions to the index or subtracting it from it (e.g., by adding one along one or each axis).
[0195] The above expressions (1) and (2) specify the index of the top left chroma data value of the 2x2 (macrotexel) block surrounding the sample position where the chroma data value is located at the center of the macrotexel. Alternative (e.g., appropriately modified) expressions may be used to specify a different one of the four chroma data values surrounding the sample position, for example by replacing "-chroma_offset_x" and / or "-chroma_offset_y" with "+chroma_offset_x" and / or "+chroma_offset_y", respectively.
[0196] Once the indices of the texture data values (preferably, for example, four chrominance data values) closest to the sample position have been determined, a group of texture data values corresponding to these texture data values (for example, a group of one chrominance data value and its associated luminance data value) is preferably read from the cache.
[0197] As explained above, after or as the YUV texture data is loaded from memory and stored in the cache, an identifier for the data value of the group of chrominance data elements and their associated one or more luma data elements is also (and in some cases preferably) stored in the cache. Such an identifier can be used to identify the group of chrominance data elements and their associated one or more luma data elements in the cache and indicate a location in the graphics texture.
[0198] Thus, the identifier (these identifiers) can be used to determine where the texture data value required for the sample position in question (e.g., as determined above) is stored in the cache (e.g., in which cache line and / or in which data unit (word)), so that the required texture data value can then be read from the cache.
[0199] Once the data values from the (e.g., four) macrotexels (e.g., chroma data locations) to be used for the texture location to be sampled have been fetched from the cache read, the data values from these macrotexels are preferably appropriately interpolated to determine the chroma and luma data values for the texture location to be sampled. Preferably, the data values are interpolated using bilinear sampling (bilinear interpolation).
[0200] Because each macrotexel will have only a single chrominance data location (data value) associated with it, the chrominance data value for the sampled position can be and preferably is determined by appropriate interpolation using the chrominance data value of each macrotexel (e.g. and preferably the four chrominance data values of the four macrotexels that have been identified).
[0201] However, because each macrotexel chrominance data (position) may have more than one luminance data value associated with it (e.g. where the texture data is chrominance subsampled and each texture data group (macrotexel) contains two or more (e.g. two or four) luminance data values), rather than simply using all luminance values of all macrotexels to determine the luminance value for the sampled position, it is preferred to determine a group of, for example and preferably four luminance data values which will determine the luminance value for the sampled texture position from the texture data group (macrotexel) for the sample position in question.
[0202] Thus, in this case, the present invention preferably includes determining which (e.g. four) luminance data values from a group of texture data values (macro-texels) are closest to the sampled texture position, and then using (interpolating) these determined luminance values to determine the luminance value for the sampled texture position.
[0203] Determining which (e.g. four) luma data values from the (e.g. four) groups (macrotexels) of texture data values are closest to the sampled texture position is for example and preferably done by examining the fractional index position of the sample position (i.e. the fractional part of the sample index position) and then for example following a rule or formula for determining which (e.g. four) luma data values are closest to the sampled texture position. Depending on the positioning of the sample position and the chroma subsampling mode used, the required (e.g. four) luma data values may for example come from a single, two or four groups (macrotexels) of texture data values (e.g. depending on the chroma location).
[0204] Once a subset of (e.g. four) luminance data values from the group of texture data values (macrotexels) closest to the sampled texture position has been determined, these luminance data values are preferably interpolated (e.g. and preferably using bilinear interpolation) to determine the luminance value for the texture sample position in question.
[0205] When interpolating data values for a YUV texture in the manner described above, interpolation weights (weight_top_left, weight_top_right, weight_bottom_left and weight_bottom_right) for each of the four chroma (or luma) data elements surrounding the sample position to be determined are preferably determined from the fractional position of the chroma (or luma) data elements in each group, for example and preferably so as to represent a measure of the distance of the chroma (or luma) data element from the texture position to be determined.
[0206] For example, the following expressions (3) to (6) may be used to determine the weight of each of the four chrominance (or luma, by replacing references to "chrominance" with "luma") data element values around (near) the sample position (upper left, upper right, lower left, and lower right, respectively):
[0207] weight_top_left=(1–chroma_texel_index_frac_x)*(1–chroma_texel_index_frac_y) (3)
[0209] weight_top_right=chroma_texel_index_frac_x*(1–chroma_texel_index_frac_y) (4)
[0211] weight_bottom_left=(1–chroma_texel_index_frac_x)*chroma_texel_index_frac_y (5)
[0213] weight_bottom_right=chroma_texel_index_frac_x*chroma_texel_index_frac_y (6)
[0215] where chroma_texel_index_frac_x and chroma_texel_index_frac_y are the fractional parts of the x and y sample position indices, respectively, and can be determined using the following expressions:
[0216] chroma_texel_index_frac_x=frac(sample_position_x*macrotexel_horizontal_count–chroma_offset_x)(7)
[0217] as well as
[0218] chroma_texel_index_frac_y=frac(sample_position_y*macrotexel_vertical_count–chroma_offset_y) (8)
[0219] chroma_offset_x and chroma_offset_y are provided in the table for each of the three chroma subsampling modes described above.Where the above formulas (3) to (8) are used to determine the luma weight, the offsets for luma are provided in the following table.
[0220] In the case of YUV444 texturing where for example a macrotexel contains one chroma sample and one luma sample, chroma_offset_x and chroma_offset_y are both equal to 0.5, and macrotexel_horizontal_count and macrotexel_vertical_count are equal to the width and height of the texture in a number of texels, respectively.
[0221] In one embodiment, interpolation weights for luma and chroma data values are calculated separately (and preferably in parallel) (eg, by applying equations (3) to (8) above to both chroma and luma data values).
[0222] In a preferred embodiment, the fractional values for luma samples are calculated from the fractional values for chroma samples. For example, the interpolation weights for luma data values may be calculated using the following formula:
[0223] luma_texel_index_frac_x=frac(chroma_texel_index_frac_x*downsampling_factor_x+luma_offset_x) (9)
[0224] luma_texel_index_frac_y=frac(chroma_texel_index_frac_y*downsampling_factor_y+luma_offset_y) (10)
[0225] in,
[0226] downsampling_factor_x is 1 for YUV444 and 2 for YUV420 and YUV422, and
[0227] downsampling_factor_y is 1 for YUV444 and YUV422 and 2 for YUV420.
[0228] The offsets luma_offset_x and luma_offset_y can be found from these tables:
[0229] YUV444
[0230] Chroma Location X Chroma location Y luma_offset_x luma_offset_y Co-site Co-site 0.0 0.0 center Co-site 0.0 0.0 Co-site center 0.0 0.0 center center 0.0 0.0
[0231] YUV422
[0232] Chroma Location X Chroma location Y luma_offset_x luma_offset_y Co-site Co-site 0.0 0.0 center Co-site 0.5 0.0 Co-site center 0.0 0.0 center center 0.5 0.0
[0233] YUV420
[0234] Chroma Location X Chroma location Y luma_offset_x luma_offset_y Co-site Co-site 0.0 0.0 center Co-site 0.5 0.0 Co-site center 0.0 0.5 center center 0.5 0.5
[0235] The interpolation weights for the luma data samples may then be calculated using equations (3) to (6) but with luma_texel_index_frac_x and luma_texel_index_frac_y replacing texel_index_frac_x and texel_index_frac_y in these equations.
[0236] Once the interpolation weights for the determined set of chrominance and luma data elements (chrominance and luma data element values around the sample position in question) have been determined (e.g. as described above), they are preferably applied to the chrominance and luma data element values around the sample position in question to determine texture data for the sample position in question (e.g. a weighted sum of the texture data values around the sample position in question). The determined texture data is then preferably used to perform image texturing at that sample position.
[0237] In a preferred embodiment, in the case where the sampling of a texture for a sampling position will actually require a texel value from a texel that is outside the edge of a defined texture (such as may be the case when sampling at or near a texture edge), then this "edge" situation is preferably treated as a special case of the sampling operation and then considered. In a preferred such embodiment, such "edge" situations are handled by clamping the "missing" chrominance and luma values to the nearest corresponding defined such values for the texture. Preferably, the luma and chroma values are clamped separately, and the clamping is preferably dependent on the chroma location. Thus, in a preferred embodiment, luma values for positions that will be outside the texture will be clamped in the appropriate direction to the nearest luma value defined for the texture (and correspondingly for the chroma values).
[0238] As described above, when operating in a "copy chroma" mode, chroma data values may be copied upon storage into the cache, such that a single (copied) chroma data value is stored in association with each luma data value. However, in alternative embodiments, chroma data values may be stored in the cache in an "uncopied" condition (i.e., only once for each chroma data value), but then they may be copied as (or thereafter) they are read from the cache.
[0239] In this case, after the required texture data has been read from the cache, the weights for the luma data values are preferably adjusted so that the output becomes the same as if the chroma data values were stored in the cache in a replicated manner. More specifically, one of the chroma data samples is preferably assigned a weight of 1.0 at all locations within the area between the corresponding luma data samples, and at locations between macrotexels (e.g., between luma data samples from different macrotexels), chroma data values from surrounding macrotexels are interpolated (e.g., with bilinear interpolation).
[0240] To determine the interpolation weights (frac_x_chr and frac_y_chr) for the chroma data values (U and V, respectively) using this replicated chroma technique, the following formulas may be used.
[0241] first:
[0242] frac_x_chr = frac(texel_x) (11)
[0243] frac_y_chr = frac(texel_y) (12)
[0244] Then:
[0245] frac_x_chr = max( min( frac_x_chr*2 – 0.5, 1.0 ), 0.0 ) (13)
[0246] frac_y_chr = max( min( frac_y_chr*2 – 0.5, 1.0 ), 0.0 ) (14)
[0247] Where texel_x and texel_y are the x and y coordinates for the location of the texture being sampled.
[0248] This weight adjustment process is preferably performed at the start of the weight calculation process.
[0249] In the above description, texture data surrounding a sampling position is determined and interpolated to provide texture data for the sampling position. However, in an alternative embodiment, there is no interpolation, and the texture data for one macrotexel corresponding to the sampling position is simply read and used as the texture data for the sampling position. For example, the top left macrotexel (i.e., the macrotexel with the upper left chroma data position to the sampling position) may be read and its chroma data value used for the sampling position.
[0250] In this case, the above formulas (1) and (2) are preferably modified as follows:
[0251] texel_index_x=floor(sample_position_x*width)(1')
[0252] as well as
[0253] texel_index_y=floor(sample_position_y*height)(2')
[0254] In alternative embodiments, a different macrotexel may be used (e.g., top right, bottom left, or bottom right). Alternatively, the macrotexel whose chrominance data value is closest to the sampling position may be determined and read. If the macrotexel read contains more than one luma data value, then similarly a single luma data value (e.g., top left, top right, bottom left, bottom right, or closest) may be used as the luma data value for the sampling position in question.
[0255] In this case, because there is no interpolation, this can result in a "blocky" appearance to the generated texture (e.g. when it is scaled up). However, this mode is sometimes used in graphics processing.
[0256] As will be understood from the foregoing, the present invention is preferably implemented in a system comprising a memory, a cache, and a graphics processing unit (GPU). Texture data for a rendered output (e.g., an image to be displayed) is preferably stored in the memory. The GPU is preferably arranged to extract the required texture data from the memory in the manner described above and store it in the cache. The GPU then preferably reads the required texture data from the cache in order to generate the rendered output (e.g., in the manner described above). Once the rendered output is generated in this way, the rendered output is preferably displayed on a display such as, for example, a digital television, a computer screen, etc.
[0257] The present invention can be used for any form of output that a graphics processing system can be used to generate. In a preferred embodiment, the present invention can be used when a graphics processing system is used to generate an image for display, but it can be used for any other form of graphics processing output that a graphics processing system can produce as desired, such as a graphics texture rendered into a texture operation, etc.
[0258] The graphics processing system preferably includes a graphics processor, which for example and preferably implements and executes a graphics processing pipeline, which performs graphics processing. In a particularly preferred embodiment, the graphics processing system includes a main processor, which executes applications that may require graphics processing by the graphics processing pipeline and the graphics processor. The system preferably also includes appropriate storage (e.g., memory), cache, etc.
[0259] The present invention may be implemented and used in conjunction with any suitable and desired graphics processing systems and processors.
[0260] The present invention is particularly suitable for use with a tile renderer (a tile-based graphics processing system).Thus, in a preferred embodiment, the graphics processor (processing pipeline) is a tile-based graphics processor (processing pipeline).
[0261] The graphics processor (processing pipeline) may include (and preferably does include) any one or more (and preferably all) of the processing stages that a graphics processor (processing pipeline) may typically include. Thus, for example, the graphics processor preferably includes a primitive setup stage, a rasterizer, and a renderer. In a preferred embodiment, the renderer is in the form of or includes a programmable fragment shader.
[0262] The graphics processor (processing pipeline) preferably also includes one or more programmable shading stages, such as one or more (and preferably all) of a vertex shading stage, a hull shader, a tessellation stage (e.g., where tessellation is performed by executing a shader program), a domain (evaluation) shading stage (shader), a geometry shading stage (shader), and a fragment shader.
[0263] The graphics processor (processing pipeline) may also include any other suitable and desired processing stages that a graphics processing pipeline may include, such as a depth (or depth and stencil) tester, a blender, a block buffer, a write-output unit, and the like.
[0264] The graphics processing system and / or processor preferably also includes and / or communicates with one or more memories and / or storage devices that store the data described herein and / or store software for the processing described herein. The graphics processing system and / or processor may also communicate with a main microprocessor and / or with a display for displaying images based on data generated by the graphics processor (processing pipeline).
[0265] In a particularly preferred embodiment, the various functions of the present invention are performed on a single graphics processing platform, which generates and outputs rendered fragment data, for example, written to a frame buffer for a display device.
[0266] The invention may be implemented in any suitable system, such as a suitably configured microprocessor-based system. In some embodiments, the invention is implemented in a computer and / or microprocessor-based system.
[0267] The various functions of the present invention may be performed in any desired and suitable manner. For example, the functions of the present invention may be implemented in hardware or software (as desired). Thus, for example, the various functional elements, stages, and "devices" of the present invention may include suitable processors, controllers, functional units, circuits, processing logic, microprocessor structures, etc., which are operable to perform various functions, etc., such as appropriate dedicated hardware elements (processing circuits) and / or programmable hardware elements (processing circuits) that can be programmed to operate in a desired manner.
[0268] It should also be noted here that, as will be appreciated by those skilled in the art, the various functions of the present invention etc. may be repeated and / or performed in parallel on a given processor. Equally, the various processing stages may share processing circuitry etc. (if desired).
[0269] Furthermore, any one or more or all of the processing stages of the present invention may be embodied as processing stage circuitry, for example in the form of one or more fixed function units (hardware) (processing circuitry), and / or in the form of programmable processing circuitry that can be programmed to perform desired operations. Equally, any one or more of the processing stages and processing stage circuitry of the present invention may be provided as separate circuit elements to any one or more of other processing stages or processing stage circuitry, and / or any one or more or all of the processing stages and processing stage circuitry may be formed at least in part by shared processing circuitry.
[0270] As will also be appreciated by those skilled in the art, all described embodiments of the present invention may include any one or more or all of the preferred optional features described herein, as appropriate.
[0271] The method according to the invention may be implemented at least in part using software (e.g., a computer program). It will be seen from this that when viewed from another embodiment, the invention provides computer software that is specifically adapted to perform the method described herein when installed on a data processing device; a computer program element that includes a computer software code portion for performing the method described herein when the program element is running on a data processing device; and a computer program that includes code means that are adapted to perform all steps of the method described herein when the program is running on a data processing system. The data processing system may be a microprocessor, a programmable FPGA (field programmable gate array), or the like.
[0272] The invention also extends to a computer software carrier comprising such software which, when used to operate a graphics processor, a renderer or other system comprising a data processor, in combination with a data processing device causes the processor or system to perform the steps of the method of the invention. Such a computer software carrier may be a physical storage medium such as a ROM chip, CD ROM, RAM, flash memory or disk, or may be a signal such as an electrical signal on a wire, an optical signal or a radio signal such as a satellite or the like.
[0273] It will be further understood that not all steps of the method of the present invention need to be performed by computer software, and thus according to a broader embodiment, the present invention provides computer software and such software is installed on a computer software carrier for performing at least one of the steps of the method set forth herein.
[0274] The present invention may therefore be suitably embodied as a computer program product for use with a computer system. Such an implementation may include a series of computer-readable instructions fixed on a tangible, permanent medium, such as a computer-readable medium, for example, a disk, CD-ROM, ROM, RAM, flash memory, or hard disk. It may also include a series of computer-readable instructions that are sent to a computer system via a modem or other interface device on a tangible medium (including but not limited to, optical or analog communication lines), or intangibly using wireless technology (including but not limited to, microwave, infrared or other transmission technology). The series of computer-readable instructions implements all or part of the functions previously described herein.
[0275] Those skilled in the art will appreciate that such computer readable instructions may be written in a variety of programming languages for use with many computer architectures or operating systems. Further, such instructions may be stored using any storage technology (storage technology now or in the future includes, but is not limited to, semiconductor, magnetic, or optical), or sent using any communication technology (communication technology now or in the future includes, but is not limited to, optical, infrared, or microwave). It is contemplated that such a computer program product may be distributed as a removable medium, with a printed or electronic document attached, e.g., off-the-shelf software; preloaded on a system ROM or fixed disk, for example, using a computer system; or distributed over a network (e.g., the Internet or the World Wide Web) from a server or electronic bulletin board. BRIEF DESCRIPTION OF THE DRAWINGS
[0276] Preferred embodiments of the present invention will now be described, by way of example only, and with reference to the accompanying drawings, in which:
[0277] Figure 1 An example array (or portion of an array) showing chroma and luma data sample locations in a YUV texture;
[0278] Figure 2 Schematically illustrates a graphics processing system in which embodiments of the present invention may be implemented;
[0279] Figure 3 is a flow chart illustrating the main steps of a method according to an embodiment of the present invention;
[0280] Figure 4 (a) to (c) show examples of macrotexels for YUV444, YUV422, and YUV420 chroma subsampling modes, respectively, each example having interstitial chroma samples;
[0281] Figure 5(a) to (d) show additional examples of macrotexels for YUV422 ((a) and (b)) and YUV420 ((c) and (d)) chroma subsampling modes, each with co-sited or replicated chroma samples;
[0282] Figure 6 An embodiment showing how texture data from a YUV420 macrotexel may be stored in a data word;
[0283] Figure 7 shows another embodiment of how texture data from a YUV420 macrotexel may be stored in a data word;
[0284] Figure 8 illustrates a region of a texture in which texture data is stored in one texture cache line according to an embodiment of the present invention;
[0285] Fig. 9 shows an embodiment of how data from sixteen macrotexels are stored in a cache line according to an embodiment of the present invention;
[0286] Fig.10 illustrates which brightness data samples are selected for a particular sampling position according to an embodiment of the present invention;
[0287] Fig.11 illustrates bilinear interpolation of luminance and chrominance texture data according to an embodiment of the present invention;
[0288] Fig.12 An exemplary data processing system in which the present invention may be implemented is shown;
[0289] Fig.13 shows how to store brightness data in a memory according to an embodiment of the present invention;
[0290] Fig.14 shows how chromaticity data is stored in a memory according to an embodiment of the present invention;
[0291] Fig.15 shows a cache line coordinate system according to an embodiment of the present invention;
[0292] Fig.16 illustrates a region of a texture in which texture data is stored in one texture cache line according to an embodiment of the present invention;
[0293] Fig.17 shows an embodiment of how texture data from thirty-two macrotexels are stored in a cache line according to an embodiment of the present invention;
[0294] Fig.18An embodiment showing how texture data from a YUV422 macrotexel may be stored in a data word;
[0295] Fig.19 An embodiment showing how texture data from a YUV444 macrotexel may be stored in a data word; and
[0296] Fig. 20 An area of a texture in which texture data is stored in one texture cache line according to an embodiment of the present invention is illustrated.
[0297] Like reference numerals are used in the drawings for like features where appropriate. DETAILED DESCRIPTION
[0298] Fig.12 An exemplary data processing system is shown in which the present invention and embodiments may be implemented.
[0299] Fig.12 The exemplary data processing system shown includes: a main processor including a central processing unit (CPU) 57; a graphics processing unit (GPU) 10; a video codec 51; a display controller 55; and a storage controller 58. Fig.12 As shown, these units communicate via interconnect 59 and access off-chip memory 20. In this system, GPU 10, video codec 51 and / or CPU 57 will generate frames (images) to be displayed, and display controller 55 will then provide these frames to display 54 for display.
[0300] In use of the system, an application 60, such as a game, executing on the main processor (CPU) 57, for example, will need to display frames on the display 54. To do this, the application 60 will submit appropriate commands and data to the driver 61 for the graphics processing unit 10 executing on the CPU 57. The driver 61 will then generate the appropriate commands and data to cause the graphics processing unit 10 to render the appropriate frames for display and store them in the appropriate frame buffer (e.g., in the main memory 20). The display controller 55 will then read the frames into the buffer for the display, from which the frames are then read out and displayed on the display panel of the display 54.
[0301] The present embodiment and the present invention are particularly concerned with the case where a graphics processing unit 10 uses a texture, in particular a YUV texture, when rendering a frame for output (e.g., for display). Such a texture will include an array of data elements, texture elements (texels), each having an associated data value in the data format of the texture in question.
[0302] Textures will typically comprise images to be applied to graphics entities (such as primitives) to be rendered, and will typically be stored in off-chip memory 20 from which they can then be read into the graphics entities when needed by the GPU 10. Specifically, when a texture is used to generate rendered output, the GPU 10 will fetch the texture data from memory 20 and store it in a local texture cache of the GPU 10. The texture data will then be read from the texture cache when needed and used to generate rendered output, e.g., a frame for display.
[0303] Figure 2 The operation of this embodiment is schematically shown. Fig.12 1. As will be appreciated by those skilled in the art, there may be Figure 2 Other elements of the graphics processing unit 10 are not illustrated.
[0304] In the present embodiment, GPU 10 is a tile-based graphics processor. However, other configurations are of course possible.
[0305] like Figure 2 As shown, the graphics processing unit 10 implements a graphics processing pipeline, which includes, among other things, a rasterizer 11, a renderer 12 in the form of a (programmable) shader core, a buffer 13 (e.g., in a memory 20) for storing output rendering targets (e.g., frames to be displayed), and a texture mapper 14, and the graphics processing unit communicates with the system memory 20.
[0306] The system memory 20 will store, among other things, graphics textures to be used by the GPU 10. The system memory 20 may be, for example, a disk drive or other storage medium (e.g., a hard disk, a RAID array of hard disks or solid-state disks) of a host system in which the graphics processing unit 10 is located or accessible to the host system, and may be an internal storage medium of the host system, or an external or removable storage medium.
[0307] The texture mapper 14 includes an input parameter extraction unit 15 , a coordinate calculation unit 16 , a texture cache lookup unit 17 , a texture filtering unit 18 , a texture cache 21 for storing texture data, and a data extraction unit 19 .
[0308] The texture cache 21 is a local memory for storing texture data and may comprise RAM, for example. It may be in the form of SRAM memory. Other structures are of course possible.
[0309] Figure 2 The arrows in indicate the main paths by which data flows between the various components of the graphics processing pipeline and memory 20. There may also be other communication routes or directions not indicated.
[0310] The rasterizer 11 receives as its input primitives (e.g., triangles) to be used to generate rendering output (such as a frame to be displayed), and rasterizes these primitives into independent graphics fragments for processing. To do so, the rasterizer 11 rasterizes the primitives into sampling points representing the rendering output, and generates graphics fragments representing the appropriate sampling positions for rendering the primitives. The fragments generated by the rasterizer 11 are then sent forward to the shader core (renderer) 12 for shading. The fragments are output from the rasterizer 11 in an order that maximizes the efficiency of the texture cache lookup module 17.
[0311] The shader core 12 executes the shader program for the fragment issued by the rasterizer 11 in order to render (shade) the fragment. The shader program may have no, one or more texturing instructions (texturing operations) that need to be executed by the texture mapper 14. When the shader core 12 encounters a texturing instruction, a texturing message is sent from the shader core 12 to the texture mapper 14, which instructs the texture mapper 14 to comply with the one or more texturing instructions. After the texture mapper 14 has completed its texture processing (performing these instructions), the final result is sent back to the shader core 12 in a response message for use in shading the fragment in question.
[0312] The texture mapper 14 comprises suitable processing circuitry to execute texturing instructions. The processing circuitry may for example be in the form of a suitably configured dedicated hardware element, or it may for example comprise programmable processing circuitry that has been suitably programmed. In an embodiment, a dedicated hardware texture mapper is used.
[0313] The "shaded" fragments from the shader core 12 are then stored as part of an output render target in a buffer 13 (eg, main memory 20), for example, for subsequent display.
[0314] Thus, when directed by the shader core 12 , the texture mapper 14 reads the texture from the memory 20 (as needed), performs the various processing steps, and returns the color sampled from the texture to the shader core 12 .
[0315] Within the texture mapper 14, an input parameter extraction unit 15 reads in the parameters of the texture to be sampled and the parameters of how to sample the texture from the appropriate state information for the texture.
[0316] In the present embodiment, the texture state information includes a "texture descriptor" and a "sampler descriptor" respectively. In the present embodiment, the "texture descriptor" contains parameters such as image width and height (in pixels), pixel format (for example, YUV in the present embodiment or uncompressed RGB or compressed RGB in other cases), information about the number of mip-map layers associated with the texture, etc. The "sampler descriptor" contains parameters such as texture filtering mode, mip-map clamp, border color, wrapping mode, etc.
[0317] After the parameters of the texture to be sampled have been read by the parameter extraction unit 15, these parameters are passed to the coordinate calculation unit 16. The texturing request message from the shader core 12 usually contains the coordinates of the sample in the texture given in a normalized coordinate system, where (0.0, 0.0) is the upper left corner of the texture and (1.0, 1.0) is the lower right corner of the texture. The coordinate calculation unit 16 receives these coordinates together with the parameters read in the input parameter extraction stage unit 15 and determines the actual texel index in the texture to be looked up from the texture cache 21.
[0318] The texture cache lookup unit 17 checks whether the required texture data is stored in the cache 21, and if so, reads the texture data from the texture cache 21. For a typical bilinear lookup, texture data extracted from four texels (or macrotexels) are read from a 2 x 2 texel (or macrotexel) area of the texture.
[0319] The texture filtering unit 18 receives the four texels (or macrotexels) of the bilinear lookup from the texture cache lookup unit 17 , determines the interpolation weights, and calculates a weighted average of the texture data for the sampling position in question. This is then output to (returned to) the shader core 12 .
[0320] In the event that the required texture data is not already stored in the texture cache 21, the data fetch unit 19 operates to read the texture data from the system memory 20 and store the data in the texture cache 21 so that the texture cache lookup unit 17 then retries its lookup (read) into the texture cache 21. This may be achieved in any suitable and desired manner.
[0321] The present embodiment specifically relates to the following scenario: the texture data to be used by the graphics processing unit 10 when rendering the rendering output includes YUV texture data (ie, textures in which the relevant image data is stored in the YUV format).
[0322] According to the present invention, in this embodiment when using YUV texture data, the texture data is stored in the texture cache 21, so that the YUV texture data for a specific texture position (area) is grouped together into macro-texels, which are the basic units of storage, and each macro-texel contains the chrominance (U and V) and associated brightness (Y) data for the texture position (area) in question.
[0323] Figure 4 and Figure 5 Examples of macrotexels used for different chroma subsampling modes in this embodiment are shown.
[0324] exist Figure 4 and Figure 5 in (and in Figure 8 , Fig.10 as well as Fig.11 ), the crosses represent luminance data elements, and the circles represent chrominance data elements.
[0325] Figure 4 (a) shows an example of macrotexel 1 for YUV444 chroma subsampling mode, i.e., where luma and chroma data are stored at the same resolution (no subsampling), so there is one luma sample and one chroma sample in macrotexel 1.
[0326] Figure 4 (b) shows an example of a macrotexel 2 for a YUV422 chroma subsampling mode, i.e., where the chroma data is stored horizontally at half the resolution of the luma data but vertically at the same resolution as the luma data, so there are two luma samples and one chroma sample arranged horizontally in macrotexel 2.
[0327] Figure 4 (c) shows an example of macrotexel 3 for YUV420 chroma subsampling mode, i.e., where chroma data is stored at half the resolution of luma data both horizontally and vertically, so there are four luma samples and one chroma sample in macrotexel 3.
[0328] exist Figure 4 In the example of , the chroma samples are shown as being centered in each macrotexel 1, 2, 3. This is called "interstitial chroma". In an alternative "interstitial chroma" macrotexel (not shown) for YUV420, the chroma sample is located between two of the luma samples (e.g., the top two luma samples).
[0329] However, the location of the chroma samples within the macrotexel may also vary depending on the specific mode used.
[0330] Figure 5(a) to (d) show additional examples of macrotexels for YUV422 ((a) and (b)) and YUV420 ((c) and (d)) chroma subsampling modes.
[0331] Figure 5 (a) shows a YUV422 macrotexel 2' with "co-located" chroma, ie the chroma samples are located at the same position as (in this example, to the left of) the luma samples.
[0332] Figure 5 (b) shows a YUV422 macrotexel 2 with “duplicated” chroma, i.e., the chroma samples are duplicated at two luma sample positions. In this case, the entire area between the luma samples has the same chroma value, and upon further processing, the chroma values are interpolated only in the area between the macrotexels. The line connecting the two chroma samples indicates that they have the same value.
[0333] Figure 5 (c) shows a YUV420 macrotexel 3' with "co-located" chroma. In this case, the chroma samples are co-located with (demonstrated to be at the same position as) the top left luma sample.
[0334] Figure 5 (d) shows a YUV420 macrotexel 3 with "duplicated" chroma, i.e., the chroma samples are duplicated at each of the four luma sample positions, and the entire area between the luma samples has the same chroma value. Figure 5 , in which case, upon further processing, chroma values are interpolated only in the regions between macrotexels. Again, the line connecting the chroma samples indicates that they have the same value.
[0335] Thus, in this embodiment, the YUV texture data is fetched from the memory 20 and sorted into groups or macro-texels (such as Figure 4 (a) to (c) or Figure 5 The macro texels shown in (a) to (d) are stored in the cache 21.
[0336] In the present embodiment, the texture cache 21 storing texture data comprises a plurality of cache lines. Each cache line stores a plurality of data words (e.g., sixteen), and each data word stores texture data for one macrotexel. Each data word comprises a plurality of data fields (e.g., depending on the chroma subsampling mode used and whether replicated chroma is used), and each data field stores data for one texture data element (e.g., Y, U, or V).
[0337] Figure 6An example of how a YUV420 macrotexel 3 containing one U chrominance value, one V chrominance value, and four luma values (Y0-Y3) may be stored in a 64-bit data word 4a is shown. In this example, 10 bits are set in each of the six fields 4b for the four luma (Y0, Y1, Y2, and Y3) and two chroma (U and V) sample values, respectively, and 4 bits are padded with a dummy value (or transparency mask, for example) 4c to obtain a total of 64 bits in the data word 4a.
[0338] exist Figure 6 In the embodiment shown, four luminance values Y0, Y1, Y2 and Y3 are stored first in word 4a, followed by chrominance U and V values, and then 4 bits of virtual value 4c. However, in other embodiments, other orders of luminance, chrominance and virtual (or other) values may be used.
[0339] Figure 7 An alternative example of how one YUV420 macrotexel may be stored in a 64-bit data word 4a is shown. Again, in this example, 10 bits are set in field 4b for each of the four luma (Y0, Y1, Y2, and Y3) and two chroma (U and V) sample values, and 4 bits 4c are padded with dummy (or other) values (A0, A1, A2, and A3) to obtain a total of 64 bits in data word 4a. In this case, the four luma values Y0, Y1, Y2, and Y3 are stored first in word 4a, followed by the chroma U value, then two bits of the dummy (or other) value (A0 and A1), followed by the chroma V value, and then two further bits of the dummy (or other) value (A2 and A3).
[0340] Figure 8 Region 6 of a texture is illustrated in which texture data values are stored together in a cache row according to an embodiment. In this case, region 6 contains sixteen macrotexels 3 (two rows of eight macrotexels) in an 8 x 2 structure. The macrotexels 3 are numbered 0 to 15 from left to right in the row and from the top row to the bottom row. As indicated in the top left macrotexel in region 6, the luminance samples in each macrotexel 3 are numbered Y0 to Y3.
[0341] Fig. 9 shows how, according to an embodiment, Figure 8 Sixteen macrotexels 3 of a region 6 of the texture shown are stored in a cache line 4. The macrotexels 3 (0 to 15) are stored in sequential order (from 0 to 15) in consecutive data words 4a in cache line 4.
[0342] Each data word 4a has 64 bits (as discussed above), and cache line 4 contains 16 data words 4a (corresponding to the sixteen macrotexels of texture data it contains), so Fig. 9Indicates that cache line 4 contains 1024 bits.
[0343] Cache line 4 is labeled 4f with the X,Y position of the region (block) of the texture to which (from) the group of sixteen macrotexels 3 stored in the cache line corresponds. This will be discussed in more detail below.
[0344] In other embodiments, cache lines of different (or the same) sizes containing different numbers of macrotexels (data words) and / or data words of different sizes (e.g., with different numbers of data fields for different subsampling modes) are possible.
[0345] For example, Fig.18 An example of how one YUV422 macrotexel may be stored in a 32-bit data word 4a' is shown. In this example, 8 bits are set in field 4b' for each of the two luma sample values Y0 and Y1 and the two chroma sample values U and V. This fills the entire data word 4a', so in this case there is no padding of the data word with dummy (or other) values. First the two luma values Y0 and Y1 are stored in word 4a', followed by the chroma U value and then the chroma V value.
[0346] Fig.16 Region 6' of a texture in YUV422 subsampling mode is illustrated, with texture data values stored together in a cache row according to an embodiment. In this case, region 6' contains 32 YUV422 macrotexels 2 (four rows of eight macrotexels) in an 8x 4 structure. The macrotexels 2 are numbered 0 to 31 from left to right in the row and from the top row to the bottom row. As indicated in the top left macrotexel in region 6', the luma samples in each macrotexel 2 are numbered Y0 and Y1.
[0347] Fig.17 shows how, according to an embodiment, Fig.16 The 32 macrotexels 2 of a region 6' of the texture shown are stored in a cache line 4. The macrotexels 2 (0 to 31) are stored in consecutive data words 4a' in cache line 4 in order (from 0 to 31).
[0348] Each data word 4a' has 32 bits (as discussed above), and cache line 4 contains 32 data words 4a' (corresponding to the 32 macrotexels of texture data it contains), so Fig.17 Indicates that cache line 4 contains 1024 bits.
[0349] Again, cache line 4 is labeled 4f' with the X,Y position of region 6' of the texture to which the group of macrotexels 2 stored in the cache line corresponds (from).
[0350] Fig.19 and Fig. 20Additional examples are presented.
[0351] Fig.19 An example of how one YUV444 macrotexel may be stored in a 32-bit data word 4a' is shown. In this example, 8 bits are set in field 4b' for each of the luma Y and two chroma (U and V) sample values, and 8 bits are set in field 4c' padded with the value A to make a total of 32 bits in the data word 4a'. In this case, the luma value Y is stored first in word 4a', followed by the chroma U value, the chroma V value, and then the value A. The value A is typically used to encode transparency on a scale from 0.0 to 1.0, where a value of 1.0 means fully opaque and a value of 0.0 means fully transparent.
[0352] Fig. 20 Region 6" of a texture in YUV444 mode (and therefore without subsampling of chroma data) is illustrated, with texture data values stored together in a cache row in accordance with an embodiment. In this case, region 6" contains 32 YUV444 macrotexels 1 in a 16x2 structure (two rows of sixteen macrotexels). Macrotexels 1 are numbered 0 to 31 from left to right in the row and from the top row to the bottom row.
[0353] Fig.17 shows how, according to an embodiment, Fig. 20 The 32 macrotexels 1 of the region 6 ″ of the texture shown are stored in cache line 4 . The macrotexels 1 ( 0 to 31 ) are stored in sequential order (from 0 to 31 ) in consecutive data words 4 a ′ in cache line 4 .
[0354] Again, cache line 4 is labeled with the X,Y position of region 6" of the texture to which the group of macrotexels 2 stored in the cache line corresponds (from).
[0355] In the case of copying chrominance data, the copying of the chrominance data may be performed before writing the data into cache line 4 or after reading from cache line 4. If the copying is performed before writing the data into cache line 4, the data structure in cache line 4 is the same as described above and Fig.17 , Fig.19 and Fig. 20 The same is shown for mode YUV444. If the copy is performed after reading from cache line 4, the data structure in cache line 4 will be the same as when the chrominance data is not copied (eg, corresponding to the data discussed above for modes YUV420 or YUV422).
[0356] As explained above, each cache line 4 stores a block of macrotexels. In one example, cache line 4 stores 16 macrotexels from an 8 x 2 block 6 in a texture. Alternatively, for example, where the texture data in memory is in a tile-based compressed form, cache line 4 may contain 16 macrotexels from a 4 x 4 block of macrotexels. Different size and / or shape blocks may be used in other embodiments.
[0357] To facilitate storage of texture data in the cache 21, each cache line may be addressed with single-bit four bits, ie, each data field 4b (or 4b') may be individually addressed to be filled with appropriate texture data.
[0358] The texture data elements may be returned in any order from the memory 20. Therefore, it is necessary to determine in which data field 4b (or 4b') in the cache line the returned texture data element value should be stored (the data field 4b (or 4b') may be filled in any time order and not necessarily sequentially), and then store the returned texture data element in the determined data field 4b (or 4b').
[0359] In the present embodiment, the relevant data field 4b (or 4b') for the returned texture data element is determined based on the (relative) position within the texture of the macrotexel to which the data element belongs.
[0360] In this embodiment, the data word 4a (or 4a') in the cache line storing the returned texture data element value is based on the relative position of its corresponding macrotexel in the region 6 (or 6' or 6") of the texture that the cache line is used to store (e.g. Figure 8 (or Fig.16 or Fig. 20 )) (e.g., corresponding to the number of macrotexels it corresponds to in region 6 (or 6' or 6") of the texture (when counting from left to right, from the upper left corner to the lower right corner) (e.g., as Figure 8 (or Fig.16 or Fig. 20 )).
[0361] The data field 4b (4b') within the data word 4a (or 4a') depends on what type of texture data is returned (Y, U or V), if luma (Y) texture data is returned then it corresponds to the luma data element within the macrotexel. As described above, the texture data elements are always stored in the same order in the data word 4a (or 4a') (i.e., in the same relative data field 4b (or 4b')).
[0362] As discussed above, each cache line 4 is provided with an associated "tag" to identify the data (macrotexels) it stores.
[0363] In this embodiment, as discussed above and as Fig.15 As shown, each cache line 4 in the texture cache 21 stores texture data (macro-texels) from a corresponding region (block) of the texture. Fig.15 As shown, these texture regions (blocks) can be and are x and y indexed (assigned with corresponding x and y coordinates) to indicate their relative position within the overall texture.
[0364] Therefore, cache line 4 is marked with a texture region index (in Fig.15 is referred to as (chunk_x, chunk_y)).
[0365] Therefore, in this embodiment, if Fig.15 As indicated, the tag for cache line 4 corresponds to the "texture region" index of the region (block) of texture that the cache line stores.
[0366] Other configurations would of course be possible.
[0367] For example, in an alternative embodiment, the tag for cache line 4 may include a position in the YUV texture, such as the upper left corner (x, y) coordinates of the texture region 6 stored in the cache line 4 in question. The tag may instead correspond to different coordinates (e.g., the center or a different corner) of the texture region 6, if desired.
[0368] In this structure, the coordinates of the upper left corner of the texture region 6 preferably correspond to the coordinates of the chrominance data element of the upper left corner (i.e., first) macrotexel of the texture region 6 stored in the cache line 4. The coordinates indicate the position of the chrominance data element as a position index of the entire texture (i.e., not just in the texture region 6), i.e., where the index (0,0) indicates the upper left chrominance data element in the texture, (1,0) indicates the next chrominance data element along the horizontal direction, and (0,1) indicates the next chrominance data element below (0,0). Thus, the index will extend from (0,0) to (x-1,y-1), where x is the number of chrominance data elements in the horizontal direction and y is the number of chrominance data elements in the vertical direction, and the index (x-1,y-1) indicates the lower right chrominance data element in the texture.
[0369] In this embodiment, if Figure 8 For example, the 16 macrotexels stored in cache line 4 correspond to an 8 x 2 block 6 (two rows of eight) of macrotexels 3 in the texture. In YUV420 mode, each macrotexel contains 2 x 2 luma samples and one chroma sample, so an 8 x 2 block of macrotexels corresponds to 16 x 4 luma samples and 8 x 2 chroma samples.
[0370] Thus, a cache line fetch from memory 20 from a linear 3-plane YUV420 texture involves 8 storage requests: 4 requests for 4 consecutive luma scans, 2 requests for two rows of chroma in the U plane, and 2 requests for two rows of chroma in the V plane.
[0371] As each of these store requests returns (this can be in any order), the data (luminance and / or chrominance) is written to the appropriate data fields 4b of the appropriate data words 4a in cache line 4 (as described above) depending on their location in the texture. When all eight requests have returned, the cache line is considered "valid" and can be used in the texturing process.
[0372] Cache line 4 is only indicated as "valid" once all storage requests for cache line 4 have been returned (ie, all required texture data is stored in cache line 4 and is therefore available for use).
[0373] In order to determine when all store requests have returned, a "valid counter" is set that counts down from the total number of requests (8 in this case) as each store request is returned, and when all store requests have returned, the valid counter is equal to zero, and this indicates that cache line 4 is "valid" (i.e., texture data is available for use). When a store request is first sent, the valid counter is set equal to the number of store requests sent (i.e., 8 in this case). The valid counter then counts down by 1 each time a store request is returned. Thus, when the valid counter reaches zero, this indicates that all store requests have returned, and the cache line is valid (texture data is available for use).
[0374] In the present embodiment, the YUV texture data is read from memory 20 and stored directly in cache 21 (in the appropriate data location / structure). The retrieved texture data is grouped into the appropriate structure of the RAM bank of cache 21 itself (i.e., in macrotexels) by bit-selecting for storage writes. More specifically, when the luma response is returned from memory 20, only the luma bits in cache line 4 are set to bit enable, and the luma data is written to cache 21. If there is already chroma data in cache line 4, it will remain unchanged. When the chroma response is returned from memory 20, only the chroma bits in the cache line are set to bit enable, and the chroma data is written to cache 21. Any luma data already in cache line 4 will remain unchanged. When both responses come back, cache line 4 is marked as valid.
[0375] In other embodiments, before the YUV texture data is stored in the buffer 21, it is first stored in an intermediate buffer (not shown).
[0376] Figure 3is a flow chart illustrating the main steps of a method according to an embodiment of the present invention.
[0377] Figure 3 The illustrated method is performed by components of the texture mapper 14 as described below.
[0378] At step 30, upon receiving an instruction from the shader core 12 for rendering a sample position in the graphics texture to be rendered (and after the input parameter extraction unit 15 has extracted the input parameters as described above), the coordinate calculation unit 16 converts the sample position in question into the chroma data element index of the chroma data element that is closest (upper left) to the sample position. Then, at step 31, the coordinate calculation unit 16 determines the other three (upper right, lower left, and lower right) chroma data elements that are closest to the sample position, so that the four closest chroma data elements surrounding the sample position are determined.
[0379] At step 32 , the texture cache lookup unit 17 checks whether texture data of the macrotexel corresponding to the determined four nearest chrominance data elements surrounding the sampling position is already stored in the cache 21 .
[0380] If the required texture data is not already stored in the cache 21, then at step 33, the data fetch unit 19 fetches the required texture data from the memory 20. At step 34, the data fetch unit 19 groups (rearranges) the texture data (if necessary) and stores it in the required structure in the cache 21 with appropriate tags (identifiers) (as discussed above). The texture cache lookup unit 17 then performs step 35.
[0381] If the required texture data already exists in the cache 21 , steps 33 and 34 are omitted and the texture mapper 14 moves directly to step 35 .
[0382] At step 35 , the texture cache lookup unit 17 reads the required texture data from the cache 21 .
[0383] At step 36, texture filtering unit 18 performs bilinear interpolation of the relevant texture data read from cache 21 to determine the texture data value for the sampling position in question.
[0384] These steps will now be described in more detail.
[0385] Step 30
[0386] To read texture data from the buffer 21, the texture mapper 14 addresses the buffer 21 storing the YUV texture data using a texture location indicating the desired texture data, ie, a texel index of a desired texel (or macrotexel).
[0387] Thus, at step 30, the position in the texture to be sampled is converted into the chroma data element index of the chroma data element that is closest (upper left) to the sampling position.
[0388] In this embodiment, the position to be sampled in the YUV texture is indicated by providing x and y coordinates in the range 0 to 1 as fractional positions across the texture width and fractional positions across the texture height, the x and y coordinates being specified as 2D floating point vectors (specifically 32-bit IEEE 754-2008 floating point vectors).
[0389] The sampling position is converted to the position of the chroma data element in the YUV texture that is closest to the sampled position (specifically, the upper left side). (This may not be the chroma data element closest to the sampled position, but rather one of the four closest elements, specifically the one above the left side.)
[0390] From the x and y coordinates of the indicated sample position (sample_position_x and sample_position_y, respectively) and the width and height of the YUV texture (width and height), defined in view of the number of chroma data elements (position) across the width and height of the texture, respectively, the top left chroma data element index (given position x and y coordinates macrotexel_index_x and macrotexel_index_y) is determined using the following formulas (1) and (2):
[0391] macrotexel_index_x=floor(sample_position_x*macrotexel_horizontal_count–chroma_offset_x)(1)
[0392] macrotexel_index_y=floor(sample_position_y*macrotexel_vertical_count–chroma_offset_y)(2)
[0393] Where sample_position_x and sample_position_y are the x and y coordinates of the position in the texture to be sampled, and are defined in the range from 0 to 1 (thus giving the fractional position of the sample position across the texture); and the "macrotexel_horizontal_count" and "macrotexel_vertical_count" variables correspond to the number of chroma data positions across the width and height of the texture, respectively. For YUV444, macrotexel_horizontal_count and macrotexel_vertical_count are the same as the width and height of the texture, respectively, measured in texels. For YUV420 and YUV422, macrotexel_horizontal_count is equal to half the width of the texture measured in texels. For YUV422, macrotexel_vertical_count is the same as the height of the texture measured in texels. For YUV420, macrotexel_vertical_count is equal to half the height of the texture measured in texels.
[0394] The values for "macrotexel_horizontal_count" and "macrotexel_vertical_count" (width and height respectively) are obtained as described above by the input parameter extraction unit 15. These are unsigned integers in the range from 1 to 65536.
[0395] The chroma_offset_x and chroma_offset_y values correspond to the fractional horizontal and vertical positions, respectively, of the chroma samples within the macrotexel (referred to as the chroma "siting" within the macrotexel). This is described in more detail below.
[0396] The chroma_offset_x and chroma_offset_y values can be found from the following tables for different chroma locations in chroma subsampling modes YUV444, YUV422, and YUV420, respectively:
[0397] YUV444
[0398] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.50 0.50 center Co-site 0.50 0.50 Co-site center 0.50 0.50 center center 0.50 0.50
[0399] YUV422
[0400] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.25 0.50 center Co-site 0.50 0.50 Co-site center 0.25 0.50 center center 0.50 0.50
[0401] YUV420
[0402] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.25 0.25 center Co-site 0.50 0.25 Co-site center 0.25 0.50 center center 0.50 0.50
[0403] The differential chromaticity landing mode is described in more detail below.
[0404] Step 31
[0405] At step 31, the other three (upper right, lower left and lower right) chroma data elements closest to the sampling position are determined, so that the four nearest chroma data elements surrounding the sampling position are determined. By identifying the four nearest chroma data elements to the sampling position, this also identifies the four nearest macrotexels surrounding the sampling position, because each chroma data element corresponds to a single macrotexel.
[0406] As explained above, the above formula identifies the macrotexel that is closest (upper left) to the sampled position. It is then a straightforward process to determine the upper right, lower left, and lower right macrotexels that are closest to the sampled position (i.e., by increasing the x and / or y index by 1). Specifically, to determine the upper right macrotexel from the upper left macrotexel, the x index is increased by 1, to determine the lower left macrotexel from the upper left macrotexel, the y index is increased by 1, and to determine the lower right macrotexel from the upper left macrotexel, both the x index and the y index are increased by 1.
[0407] Fig.10 A sample position 5 of a texture is illustrated which is surrounded by the four nearest macrotexels 3 (top left, top right, bottom left and bottom right).
[0408] Step 32
[0409] At step 32 , the texture cache lookup unit 17 checks whether the texture data for the macrotexel corresponding to the four nearest chroma data elements surrounding the sampling position (as determined above) is already stored in the cache 21 .
[0410] To do this, the texture cache lookup unit 17 determines in which cache line(s) the texture data for the macrotexel in question will be stored. This is done by checking the cache line tags (identifiers) to see which of these corresponds to a region (block) of texture that will include a block of macrotexels containing the macrotexel or macrotexels in question. As discussed above, the cache line tags (using a position index) identify (using a position index) a region of texture (block of macrotexels) of a predetermined size and shape.
[0411] If a cache line is not found with a tag corresponding to a block containing one (or more) of the required macrotexels, then the texture cache lookup unit 17 determines that the texture data (texture data for the macrotexel, or the block containing the macrotexel) is not yet stored in the cache 21.
[0412] On the other hand, if a cache line is found with a tag corresponding to a region (block) containing one (or more) of the required macrotexels, the texture cache lookup unit 17 checks the valid indicator for the cache line. The valid indicator indicates whether the cache line contains all the texture data for the macrotexel block to which it corresponds. If the valid indicator indicates that the cache line in question is valid, the texture cache lookup unit 17 determines that the texture data (texture data for the macrotexel (these macrotexels) or the block containing the macrotexel (these macrotexels)) is stored in the cache 21. On the other hand, if the valid indicator indicates that the cache line in question is invalid, the texture cache lookup unit 17 determines that the texture data (texture data for the macrotexel (these macrotexels)) is fetched into the cache 21, but has not yet arrived in the cache 21 (therefore, its operation is stopped until the data arrives in the cache line).
[0413] In some cases, all required macrotexels will come from a single texture region (block of macrotexels) (and therefore will be stored in a single cache line). In other cases, the required macrotexels may come from two or four different texture regions (blocks) (blocks of macrotexels) (and therefore will be stored in two or four different cache lines).
[0414] If the required texture data already exists in (or has been fetched into) the cache 21 , the texture mapper 14 omits steps 33 and 34 and moves directly to step 35 .
[0415] Step 33
[0416] If step 32 determines that the required texture data is not already present in (or fetched into) cache 21 , then step 33 is performed, whereby data fetch unit 19 fetches the required texture data from memory 20 .
[0417] To do this, a cache line is first allocated for the texture data (eg, using a least recently used allocation process).
[0418] In an embodiment of the present invention, YUV texture data (e.g., chroma subsampled YUV data (e.g., in YUV422 or YUV420 mode)) is stored in memory as two or three separate data arrays (in a so-called "multi-plane" format), one data array (plane) containing luma (Y) information, and one or two other data arrays (planes) containing chroma (U and V) information. In the case where one data array (plane) is provided for chroma data, both U and V chroma data are stored in the same array. In the case where two data arrays (planes) are provided for chroma data, U chroma data is stored in one array, and V chroma data is stored in another array.
[0419] Fig.13 and Fig.14An example is shown of how luma and chroma data from a texture region of 8 x 4 pixels (luma sample sized) may be stored in memory in separate memory planes (buffers) 50 and 60, respectively.
[0420] like Fig.13 As shown, luma data is stored in memory in a storage plane (buffer) 50, which in this example contains 32 (8 x 4) luma data samples 51. In the example of these figures, the texture data is provided in a YUV420 sampling mode, so the chroma data is provided at a lower resolution than the luma data. Thus, in a storage plane (buffer) 60 containing corresponding chroma data (i.e., corresponding to the luma data stored in the storage plane 50), there are only eight (4 x 2) chroma data samples 61. As shown, in this example, each chroma data sample 61 contains both U and V chroma data for that sample.
[0421] In other embodiments, the YUV texture data is stored in memory 20 in other formats, such as packed storage (where all texture data for a macrotexel is stored in one word, e.g., 32 bits or 64 bits) or compressed storage (where a compression scheme is used to compress the data).
[0422] In order to fetch the required texture data from the memory 20, the data fetch unit 19 converts the sample index position into the appropriate memory address(es) where the texture data for that texture position is stored in the memory 20.
[0423] In some cases, a texture location (index location) is converted to, for example, a single memory address where all texture data (e.g., both chrominance and luma texture data) for the texture location is stored together in memory. All required texture data may be stored at a single memory address, or alternatively, the texture data may be stored in several texture addresses, with other memory addresses being determined from the single memory address to which the texture location is converted (e.g., the required texture data is stored in a group of, for example, a series of consecutive memory addresses, where only one of the memory addresses (e.g., the first) is needed to determine all of the memory addresses from which to fetch the required texture data).
[0424] In other cases, the texture position is converted into two or more storage addresses, such as where the texture data required for each texture position (the texture position in question) is stored in two or more locations (storage locations) in memory (e.g., where chroma and luma texture data are stored separately in memory (e.g., in two or more data arrays)).
[0425] In one embodiment, the texture location is converted to a memory address (or two or more memory addresses) by using a lookup table and / or by applying one or more predetermined rules or formulas for such conversion.
[0426] In texture data such as Fig.13 and Fig.14 In the example case of storage in memory (as described above), to determine the chroma and luma storage addresses for a particular sample index, the following method may be performed.
[0427] Luma sample index positions are expressed as (x,y).
[0428] The starting address (the address of sample (0,0)) in the luma storage buffer 50 is luma_base_address.
[0429] The corresponding address in the chroma storage buffer 60 is chroma_base_address.
[0430] The address difference between the start addresses of two consecutive luminance scan lines is luma_stride, and the corresponding value for chroma buffer 60 is chroma_stride.
[0431] The addresses of the luma and chroma data at the sample index location ( luma_address and chroma_address respectively) can then be calculated as:
[0432] luma_address=luma_base_address+y*luma_stride+x*luma_value_size (15)
[0434] where luma_value_size is the size of the luma value (in bytes), which in this case (i.e., in Fig.13 and Fig.14 In the YUV420 sampling mode shown), it is 1.
[0435] and
[0436] chroma_address=chroma_base_address+floor(y / 2)*chroma_stride+floor(x / 2)*chroma_value_size(16)
[0437] where chroma_value_size is the size of the chroma value in bytes, which in this case (i.e., in Fig.13 and Fig.14In the YUV420 sampling mode shown), it is 2.
[0438] For 16-bit 2-plane YUV data, luma_value_size will be 2, and chroma_value_size will be 4.
[0439] Where chrominance data is provided at different resolutions and / or U and V chrominance data are stored in separate buffers (planes), the formulas for the storage addresses for the chrominance data may be modified appropriately (e.g., by replacing y / 2 and / or x / 2 with y or x, as appropriate).
[0440] Once the memory address for the required texture data has been determined, a request is sent to the memory address(es) of the memory 20 and the texture data is fetched from the memory address(es).
[0441] In the case where the luminance data and the chrominance data are stored in separate planes (arrays) in the memory 20 (e.g., as in Fig.13 and Fig.14 A separate storage request is sent to each array, as in . Storage requests can be returned in any order.
[0442] The storage address calculation unit in the data extraction unit 19 converts the texture area (block) index (coordinate) (such as Fig.15 exemplified and described above) as input and issues multiple memory read requests to fetch the required texture data from memory to fill cache lines with texture data corresponding to texture regions (blocks).
[0443] In data such as Fig.13 and Fig.14 When stored in memory as shown, for example, six storage requests are required to extract all the required data. Four luma scan lines require four requests, and two chroma scan lines require two requests. These requests extract data from the following six storage addresses (luma_0_address to luma_3_address, chroma_0_address, and chroma_1_address):
[0444] luma_0_address=luma_base_address+(chunk_y*4+0)*luma_stride+chunk_x*16*luma_value_size(17)
[0445] luma_1_address=luma_base_address+(chunk_y*4+1)*luma_stride+chunk_x*16*luma_value_size(18)
[0446] luma_2_address=luma_base_address+(chunk_y*4+2)*luma_stride+chunk_x*16*luma_value_size(19)
[0447] luma_3_address=luma_base_address+(chunk_y*4+3)*luma_stride+chunk_x*16*luma_value_size(20)
[0448] chroma_0_address=chroma_base_address+(chunk_y*2+0)*chroma_stride+chunk_x*16*chroma_value_size(21)
[0449] chroma_1_address=chroma_base_address+(chunk_y*2+1)*chroma_stride+chunk_x*16*chroma_value_size(22)
[0450] where chunk_y and chunk_x are the y and x indices, respectively, for the texture region (chunk) in question.
[0451] In the above formulas (17) to (22), for luma and chroma, chunk_x is multiplied by 16. This is because there are only half the number of chroma samples compared to luma, but each of them occupies two bytes instead of one.
[0452] These storage requests are sent to the memory 20 which will perform the reads. As mentioned above, the responses to the reads may be returned from the memory 20 in any order. Therefore, the texture cache 21 needs to keep track of what data has been returned from the memory 20 and only set the cache line state to "VALID" after all responses to the storage requests have been returned and all the required data for each response has been written to the texture cache 21. This is done with a request counter for each cache line 4. The request counter is initialized to a value equal to the number of storage requests sent for the cache line 4 in question. For each response in the cache line 4 in question that has been written to the texture cache 21, the request counter is decremented by one. Once it reaches zero, the cache line state is set to "VALID".
[0453] Step 34
[0454] After fetching the texture data from the memory 20 as described above, the data fetch unit 19 then groups the texture data retrieved from the memory 20 into the required structure (if the texture data is not already in the memory 20 in the required format) at step 34, and stores the grouped texture data in the texture cache 21 with the required identifiers (tags) (as discussed above).
[0455] Step 35
[0456] Once step 32 has determined that the required texture data is present in cache 21 or if not, the required texture data has been fetched from memory 20 and stored in cache 21 (steps 33 and 34 ), then at step 35 the required texture data is read from cache 21 .
[0457] The indices of the four chroma data elements of the YUV texture surrounding the sampling position are determined at steps 30 and 31 (see above). These determined chroma data element indices are then used at step 35 to address the buffer 21 to read the texture data for the macrotexels corresponding to these chroma data element indices.
[0458] As explained above, each cache line in the texture cache 21 is tagged with an identifier corresponding to the location in the texture of the texture region (block of macrotexels) stored in the cache line in question.
[0459] As described above, the identifier(s) are used to determine whether and where in cache 21 (eg in which cache line 4) the texture data value required for the sample position in question (eg determined as above) is stored.
[0460] The determined index locations of the desired macrotexels are each converted into (or used to determine) a cache line location corresponding to the data word 4a storing the desired macrotexel (eg, as Fig. 9 ), the required texture data (for the macrotexel in question) are then read from cache 21 from these data words 4a in the associated cache line 4.
[0461] Step 36
[0462] Once the texture data values for the four macrotexels (e.g., chroma data locations) for the texture location to be sampled have been read from cache 21 (step 35), then at step 36, the associated texture data values from these macrotexels are interpolated using bilinear interpolation to determine the chroma and luminance data values for the texture location to be sampled.
[0463] Because each macrotexel has only a single chroma data value associated with it, the chroma data value for the sampled position is determined by performing bilinear interpolation using the chroma data values from the four macrotexels. Fig.11 This is exemplified in Fig.11 Four macrotexels 3 are shown surrounding sampling position 5, and the lines connecting the chroma data elements (circles) indicate the bilinear interpolation that is performed.
[0464] However, because each macrotexel chrominance data value may be associated with more than one luminance data value (e.g., Fig.11 In the case shown, where there are four luma data values in each macrotexel (i.e., four luma data values are associated with each chroma data value), rather than simply using all (e.g., 16) luma values for all macrotexels to determine the luma value for the sampled position, a group of four luma data values closest to the sampled texture position is determined and then used to determine the luma value for the sampled position.
[0465] Thus, the texture filtering unit 18 determines which four luminance data values from the macrotexel 3 are closest to the sampled texture position 5 and then uses these determined luminance values to determine a luminance value for the sampled texture position 5 .
[0466] To determine which four luma data values from the four macrotexels 3 are closest to the sampled texture location 5, the fractional index position of sample location 5 (i.e., the fractional portion of the sample index position) is examined, and then a rule or formula is applied to determine which four luma data values are closest to the sampled texture location 5. Depending on the positioning of sample location 5 and the chroma subsampling mode used, the required four luma data values may come from a single, two, or four macrotexels. (However, because each macrotexel contains only a single chroma data value, the required chroma data values will always come from four macrotexels.)
[0467] In an embodiment, the following formula is used to select which four luma data values (closest to the sample position) from the group of 2 x 2 macrotexels should be used:
[0468] x_lum = frac(sample_position_x)*2 + offset_x_lum (23)
[0469] y_lum = frac(sample_position_y)*2 + offset_y_lum (24)
[0470] x_lum_origin = floor(x_lum) (25)
[0471] y_lum_origin = floor(y_lum) (26)
[0472] in,
[0473] sample_position_x and sample_position_y are the x and y coordinates of the sample position, respectively; and
[0474] offset_x_lum and offset_y_lum are the x and y offsets, respectively, of the top left luminance data element within the macrotexel.
[0475] The values x_lum_origin and y_lum_origin are then integers in the set {0, 1, 2}. These two values then identify which 2 x 2 luma samples should be picked from the 4 x 4 luma samples (e.g. in the case of YUV420 chroma subsampling mode) that are read from the texture cache 21 by identifying the top left luma sample of the group of 4 x 4 luma samples read from the cache 21.
[0476] Fig.11 This is exemplified in Fig.11 The selected 2x2 luma samples to be used for the interpolation of the sample points 5 connected by the lines are shown.
[0477] Once the subset of four luminance data values from the macrotexel 3 closest to the sampled texture position has been determined, these luminance data values are interpolated using bilinear interpolation to determine the luminance value for the texture sample position 5 in question. Fig.11 This is illustrated in , where the line connecting the four luminance data elements (the cross) closest to sample position 5 indicates the bilinear interpolation being performed.
[0478] When interpolating data values for a YUV texture in the manner described above, interpolation weights (weight_top_left, weight_top_right, weight_bottom_left, and weight_bottom_right) for each of the four chroma (or luminance) data elements surrounding the sample position 5 to be determined are determined from the fractional position of the chroma (or luminance) data element in each macrotexel to represent a measure of the distance of the chroma (or luminance) data element from the texture position to be determined. The interpolation weights are calculated so that the sample closest to the sample position 5 is given the largest interpolation weight.
[0479] Specifically, the following expressions (3) to (6) are used to determine the weight for each of the four chrominance data element values closest to sample position 5 (upper left, upper right, lower left, and lower right, respectively):
[0480] weight_top_left=(1–chroma_texel_index_frac_x)*(1–chroma_texel_index_frac_y) (3)
[0481] weight_top_right=chroma_texel_index_frac_x*(1–chroma_texel_index_frac_y) (4)
[0482] weight_bottom_left=(1–chroma_texel_index_frac_x)*chroma_texel_index_frac_y (5)
[0483] weight_bottom_right=chroma_texel_index_frac_x*chroma_texel_index_frac_y (6)
[0484] where chroma_texel_index_frac_x and chroma_texel_index_frac_y are the fractional parts of the x and y sample position indices, respectively, and can be determined using the following expressions:
[0485] chroma_texel_index_frac_x=frac(sample_position_x*macrotexel_horizontal_count–chroma_offset_x) (7)
[0486] as well as
[0487] chroma_texel_index_frac_y=frac(sample_position_y*macrotexel_vertical_count–chroma_offset_y) (8)
[0488] chroma_offset_x and chroma_offset_y are provided in the following table.
[0489] YUV444
[0490] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.50 0.50 center Co-site 0.50 0.50 Co-site center 0.50 0.50 center center 0.50 0.50
[0491] YUV422
[0492] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.25 0.50 center Co-site 0.50 0.50 Co-site center 0.25 0.50 center center 0.50 0.50
[0493] YUV420
[0494] Chroma Location X Chroma location Y chroma_offset_x chroma_offset_y Co-site Co-site 0.25 0.25 center Co-site 0.50 0.25 Co-site center 0.25 0.50 center center 0.50 0.50
[0495] In the case of YUV444 texturing where for example a macrotexel contains one chroma sample and one luma sample, chroma_offset_x and chroma_offset_y are both equal to 0.5, and macrotexel_horizontal_count and macrotexel_vertical_count are equal to the width and height of the texture in a number of texels, respectively.
[0496] In one embodiment, the interpolation weights for luma and chroma data values are calculated in parallel (e.g., using equations (3) through (8) above, but modified so that references to "chroma" are replaced with "luma"). To do this, the weight calculator circuits are doubled in size (compared to the case where they were calculated serially).
[0497] In a preferred embodiment, the score values for the luma samples are calculated from the score values for the chroma samples.
[0498] For example, the interpolation weights for luma data values can be calculated using the following formula:
[0499] luma_texel_index_frac_x=frac(chroma_texel_index_frac_x*downsampling_factor_x+luma_offset_x) (9)
[0500] luma_texel_index_frac_y=frac(chroma_texel_index_frac_y*downsampling_factor_y+luma_offset_y) (10)
[0501] in,
[0502] downsampling_factor_x is 1 for YUV444 and 2 for YUV420 and YUV422, and
[0503] downsampling_factor_y is 1 for YUV444 and YUV422 and 2 for YUV420.
[0504] The offsets luma_offset_x and luma_offset_y can be found from these tables:
[0505] YUV444
[0506] Chroma Location X Chroma location Y luma_offset_x luma_offset_y Co-site Co-site 0.0 0.0 center Co-site 0.0 0.0 Co-site center 0.0 0.0 center center 0.0 0.0
[0507] YUV422
[0508] Chroma Location X Chroma location Y luma_offset_x luma_offset_y Co-site Co-site 0.0 0.0 center Co-site 0.5 0.0 Co-site center 0.0 0.0 center center 0.5 0.0
[0509] YUV420
[0510] Chroma Location X Chroma location Y luma_offset_x luma_offset_y Co-site Co-site 0.0 0.0 center Co-site 0.5 0.0 Co-site center 0.0 0.5 center center 0.5 0.5
[0511] In this embodiment, in the case where sampling of a texture will actually require a texel value from a texel located outside the edge of a defined texture (e.g., such as might be the case when sampling at or near a texture edge), the luminance value at the location outside the texture is clamped to the nearest luminance value defined for the texture (and correspondingly for the chrominance value) in the appropriate direction.
[0512] Once the determined set of interpolation weights for chrominance and luminance data elements have been determined (the four chrominance and luminance data element values around the sample position 5 in question), they are used to weight the chrominance and luminance data element values around the sample position 5 in question, respectively, so as to determine the texture data for the sample position 5 in question (i.e., the weighted sum of the texture data values around the sample position 5 in question).
[0513] like Figure 6 As shown, once the texture filtering unit 18 has determined the chrominance and luminance values for the sample position in question, these chrominance and luminance values are returned to the shader core 12 for use in generating a render target (e.g., shading the fragment in question) for output to the render target 13.
[0514] The above mainly describes the structure of the present embodiment when operating in the non-copy chrominance value mode and bilinear filtering is used to determine the texture value to be used.
[0515] As discussed above, it would also be possible to operate the invention in a "copy" chroma mode, in which chroma values are copied to correspond to the number of distinct luma values present in a macrotexel. In such a configuration, chroma values may be copied when writing texture data to the texture cache (in which case the process would convert the data stored in memory to YUV444 during cache line fetches from memory) or when reading texture data from the texture cache (in which case the data is stored in the cache as macrotexels in the same manner as for all other chroma siting modes).
[0516] In the case of copied chroma, after reading from the buffer, in this embodiment the luma weights are adjusted so that the output becomes exactly the same as if the chroma values had been copied in the buffer. In effect, one of the chroma samples is given a weight of 1.0 in the area between the corresponding luma samples. In the case of sampling between macrotexels, the corresponding chroma values for these macrotexels will be interpolated.
[0517] Example pseudo-code for performing this weight adjustment showing the full chrominance calculation (ie, for both copied and non-copied chrominance values) is shown below.
[0518]
[0519]
[0520] This weight adjustment process is executed when the weight calculation process starts.
[0521] The pseudocode also shows the selection between bilinear interpolation (LINEAR) and an alternative "nearest" sampling mode (NEAREST), in which only one macrotexel (the top left one) is read from the cache, and the chroma value of that macrotexel is used for the entire area covered by the macrotexel without any interpolation (from neighboring macrotexels) occurring. Luma values are treated similarly without interpolation. In the case of this "nearest" (point sampling) filtering mode, the texel index determination (discussed above) corresponding to the texel position to be sampled is determined as:
[0522] macrotexel_index_x=floor(sample_position_x*macrotexel_horizontal_count) (27)
[0524] as well as
[0525] macrotexel_index_y=floor(sample_position_y*macrotexel_vertical_count) (28)
[0527] From the above, it can be seen that the present invention, at least in its preferred embodiments, can provide a more efficient mechanism for using YUV textures in graphics processing systems and units. This is achieved, at least in the preferred embodiments of the present invention, by storing chrominance and luminance data values for associated positions in the YUV texture together in a group in a texture cache, and then retrieving the data from the texture cache using the position within the texture to be sampled (such as compared to addressing the cache using a storage address, for example).
Claims
1. A method of operating a graphics processing system in which data of a texture to be used in rendering a rendering output is loaded from a memory into a cache for use by the graphics processing system in rendering the rendering output, the method comprising the steps of: When using a graphics texture stored in memory as YUV texture data including luminance and chrominance texture data: storing YUV texture data for the texture in a cache from which the texture data is to be read by the graphics processing system when generating a rendered output such that data values for a group of chrominance data elements and associated one or more luma data elements of the texture are stored together as a group in a cache line of the cache, wherein the cache comprises a plurality of cache lines; and An identifier for the data value for the group of the chroma data element and its associated one or more luma data elements is stored in association with the cache, the identifier being usable to identify the cache line in the cache storing the group of the chroma data element and its associated one or more luma data elements, and the identifier indicating a location in the graphics texture.
2. The method according to claim 1, wherein: When chroma and luminance data are provided at the same resolution, each group of YUV texture data contains one chroma data value and one luminance data value; When the chrominance data is provided at half the resolution of the luma data in the horizontal direction but at the same resolution as the luma data in the vertical direction, each group of YUV texture data includes one chrominance data value and two luma data values; and When the chrominance data is stored at half the resolution of the luma data in both the horizontal and vertical directions, each group includes one chrominance data value and four luma data values.
3. The method according to claim 1 or 2, wherein: Multiple groups of YUV texture data are stored in the cache line, the multiple groups of YUV texture data stored in the cache line comprising groups of adjacent chroma data element positions and their corresponding luma data element positions of the texture.
4. The method according to claim 1 or 2, wherein: The identifier indicates a location of a chroma data element in the graphics texture.
5. The method according to claim 1 or 2, wherein: A plurality of groups of YUV texture data are stored in the cache line, and a single identifier is provided and commonly used for the plurality of groups of YUV texture data stored in the cache line.
6. The method according to claim 1 or 2, wherein: The YUV texture data is stored in a memory as a data array storing luminance data for the texture, and one or more other data arrays storing chrominance data for the texture; Furthermore, the method comprises the following steps: reading chroma data values for chroma data elements from the one or more other data arrays in the memory storing the chroma data of the YUV texture; reading from the data array in the memory storing the luma data of the YUV texture one or more luma data values for the group of luma data elements associated with the chroma data element whose value has been read; and The read chrominance data values and luma data values are stored in the buffer such that the data values for the group of the chrominance data elements and the associated one or more luma data elements are stored together as a group in the buffer.
7. The method according to claim 1 or 2, wherein: Once a cache line of the cache is filled with valid YUV texture data, the cache line is indicated as valid.
8. The method according to claim 1 or 2, wherein: Texture data required from the buffer is indicated by a sample position in the YUV texture; and The method comprises the following steps: Converting the sample position into a position of a chrominance data element in the YUV texture corresponding to a desired sampling position; Wherein, converting the sample position into the position of a chrominance data element in the YUV texture takes into account the relative position of the chrominance data element with respect to its associated group of one or more luma data elements.
9. The method according to claim 1 or 2, further comprising the following steps: selecting a subset of luma data values from the luma data values for a plurality of groups of texture data comprising chroma data values and their associated luma data values read from the buffer for a sampled texture location; as well as The luma data values for the sampled texture locations are interpolated using the selected subset of luma data values.
10. A method of operating a graphics processing system in which data of a texture to be used in rendering a rendering output is loaded from a memory into a cache for use by the graphics processing system in rendering the rendering output, the method comprising the steps of: When using a graphics texture stored in a memory as YUV texture data, wherein the YUV texture data comprises a data array storing luminance data of the texture and one or more other data arrays storing chrominance data of the texture: reading chroma data values for chroma data elements from the one or more other data arrays in the memory storing the chroma data of the YUV texture; reading from the data array in the memory storing the luma data of the YUV texture one or more luma data values for the group of luma data elements associated with the chroma data element whose value has been read; and The read chroma data values and luma data values are stored in the cache such that the data values for the group of the chroma data elements and the associated one or more luma data elements are stored together as a group in the cache, wherein the cache includes a plurality of cache lines and the multi-group YUV texture data is stored in the cache lines.
11. The method according to claim 10, wherein: Once a cache line of the cache is filled with valid YUV texture data, the cache line is indicated as valid.
12. The method according to claim 10, further comprising the steps of: reading YUV texture data from the buffer by addressing the buffer using a location in the YUV texture from which texture data is to be sampled; And using the indicated sampling position and the identifier of the group of YUV texture data stored in the buffer to identify desired texture data in the buffer.
13. The method according to claim 10, wherein: Texture data required from the buffer is indicated by a sample position in the YUV texture; and The method comprises the following steps: Converting the sample position into a position of a chrominance data element in the YUV texture corresponding to a desired sampling position; Wherein, converting the sample position into the position of a chrominance data element in the YUV texture takes into account the relative position of the chrominance data element with respect to its associated group of one or more luma data elements.
14. The method according to claim 10, further comprising the steps of: selecting a subset of luma data values from the luma data values for a plurality of groups of texture data comprising chroma data values and their associated luma data values read from the buffer for a sampled texture location; as well as The luma data values for the sampled texture locations are interpolated using the selected subset of luma data values.
15. A graphics processing system, the graphics processing system comprising: Memory; Graphics processing unit; as well as a cache, the cache comprising a plurality of cache lines; and wherein data of a texture to be used in rendering a rendering output is loaded from the memory into the cache so as to be used by the graphics processing unit in rendering the rendering output, The graphics processing system further comprises: processing circuitry operable, when using a graphics texture stored in the memory as YUV texture data comprising luminance and chrominance texture data, to: storing the YUV texture data for the texture in the cache such that data values for a group of chrominance data elements and associated one or more luma data elements for the texture are stored together as a group in a cache line of the cache; and An identifier for the data value for the group of the chroma data element and its associated one or more luma data elements is stored in association with the cache, the identifier being usable to identify the cache line in the cache storing the group of the chroma data element and its associated one or more luma data elements, and the identifier indicating a location in the graphics texture.
16. The graphics processing system according to claim 15, wherein: When chroma and luminance data are provided at the same resolution, each group of YUV texture data contains one chroma data value and one luminance data value; When the chrominance data is provided at half the resolution of the luma data in the horizontal direction but at the same resolution as the luma data in the vertical direction, each group of YUV texture data includes one chrominance data value and two luma data values; and When the chrominance data is stored at half the resolution of the luma data in both the horizontal and vertical directions, each group includes one chrominance data value and four luma data values.
17. The graphics processing system according to claim 15 or 16, wherein: Multiple groups of YUV texture data are stored in the cache line, the multiple groups of YUV texture data stored in the cache line comprising groups of adjacent chroma data element positions and their corresponding luma data element positions of the texture.
18. The graphics processing system according to claim 15 or 16, wherein: The identifier indicates a location of a chroma data element in the graphics texture.
19. The graphics processing system according to claim 15 or 16, wherein: A plurality of groups of YUV texture data are stored in the cache line, and a single identifier is provided and commonly used for the plurality of groups of YUV texture data stored in the cache line.
20. The graphics processing system according to claim 15 or 16, wherein: When using a graphics texture stored in a memory as YUV texture data, wherein the YUV texture data comprises a data array storing luminance data for the texture and one or more other data arrays storing chrominance data for the texture, the processing circuitry is operable to: reading chroma data values for chroma data elements from the one or more other data arrays in the memory storing the chroma data of the YUV texture; reading from the data array in the memory storing the luma data of the YUV texture one or more luma data values for the group of luma data elements associated with the chroma data element whose value has been read; and The read chrominance data values and luma data values are stored in the buffer such that the data values for the group of the chrominance data element and the associated one or more luma data elements are stored together in the buffer.
21. The graphics processing system according to claim 15 or 16, wherein: Once a cache line of the cache is filled with valid YUV texture data, the cache line is indicated as valid.
22. The graphics processing system according to claim 15 or 16, wherein: Texture data required from the buffer is indicated by a sample position in the YUV texture; and The graphics processing system comprises: processing circuitry operable to convert the sample position into a position of a chroma data element in the YUV texture corresponding to a desired sampling position; Wherein, converting the sample position into the position of a chrominance data element in the YUV texture takes into account the relative position of the chrominance data element with respect to its associated group of one or more luma data elements.
23. The graphics processing system of claim 15 or 16, further comprising a processing circuit operable to: selecting a subset of luma data values from the luma data values for a plurality of groups of YUV texture data comprising chroma data values and their associated luma data values read from the buffer for a sampled texture position; and The luma data values for the sampled texture positions are interpolated using the selected subset of luma data values.
24. A graphics processing system, the graphics processing system comprising: Memory; Graphics processing unit; as well as a cache, the cache comprising a plurality of cache lines; and wherein data of a texture to be used in rendering a rendering output is loaded from the memory into the cache so as to be used by the graphics processing unit in rendering the rendering output, The graphics processing system further comprises: Processing circuitry, when using a graphics texture stored in a memory as YUV texture data, wherein the YUV texture data comprises a data array storing luminance data of the texture and one or more other data arrays storing chrominance data of the texture, the processing circuitry being operable to: reading chroma data values for chroma data elements from the one or more other data arrays in the memory storing the chroma data of the YUV texture; reading from the data array in the memory storing the luma data of the YUV texture one or more luma data values for the group of luma data elements associated with the chroma data element whose value has been read; and The read chroma data values and luma data values are stored in the cache such that the data values for a group of the chroma data elements and the associated one or more luma data elements are stored together as a group in the cache, wherein multi-group YUV texture data is stored in a cache line.
25. The graphics processing system according to claim 24, wherein: Once a cache line of the cache is filled with valid YUV texture data, the cache line is indicated as valid.
26. The graphics processing system of claim 24 , further comprising a processing circuit operable to read YUV texture data from the cache by: addressing the cache using a location in the YUV texture from which texture data is to be sampled; and using the indicated sampling location and an identifier for a group of YUV texture data stored in the cache to identify desired texture data in the cache.
27. The graphics processing system according to claim 24, wherein: Texture data required from the buffer is indicated by a sample position in the YUV texture; and The graphics processing system comprises: processing circuitry operable to convert the sample position into a position of a chroma data element in the YUV texture corresponding to a desired sampling position; Wherein, converting the sample position into the position of a chrominance data element in the YUV texture takes into account the relative position of the chrominance data element with respect to its associated group of one or more luma data elements.
28. The graphics processing system of claim 24, further comprising a processing circuit operable to: selecting a subset of luma data values from the luma data values for a plurality of groups of YUV texture data comprising chroma data values and their associated luma data values read from the buffer for a sampled texture position; and The luma data values for the sampled texture positions are interpolated using the selected subset of luma data values.
29. A computer program product comprising computer software code for performing the method according to any one of claims 1 to 14 when said program is run on data processing means.
