Decoding compressed data structure
By encoding and decoding the Haar coefficients in the texture, and using system parameters to optimize bit allocation, the problem of data volume and artifact balance in the texture encoding and decoding process is solved, and efficient texture processing and frame buffer compression are achieved.
Patent Information
- Application Number
- CN202410202100.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-02-27
- Filing Date
- 2024-02-23
- Publication Date
- 2024-08-27
AI Technical Summary
Existing technologies struggle to balance data volume reduction, artifact minimization, and processing cost during texture encoding and decoding, especially in high-quality texture filtering and frame buffer compression scenarios, often sacrificing one factor for the other.
Using a compressed data structure based on Haar coefficients, by encoding and decoding differential coefficients and summation coefficients, and using system parameters to optimize bit allocation, efficient encoding and decoding of pixel blocks is achieved, and anisotropic filtering is supported.
It can reduce the amount of data stored and transmitted while reducing processing costs and power consumption, and provides flexible compression ratio and decompression quality to adapt to different texture and image processing needs.
Smart Images

Figure CN118555404A_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to UK patent applications 2302838.4 and 2302841.8, both filed on February 27, 2023, which are incorporated herein by reference in their entirety. Technical Field
[0003] The present disclosure relates to techniques for encoding a block of pixels into a compressed data structure and / or for decoding a compressed data structure to determine a decoded value.A block of pixels may be part of a texture or other image within a computer graphics system. Background Art
[0004] In computer graphics, graphics processing units (GPUs) often use texturing to add surface detail to objects within a scene being rendered. Textures are often stored as images that can be accessed to return the color value of the pixel being processed. To obtain the texture color value of a pixel, the values of multiple texels of the texture can be sampled, and the sampled texture pixel values can then be filtered to obtain the final texture value of the pixel.
[0005] Sampling texel values typically involves fetching a block of texels, such as a 2x2 texel quad (or a block of texels of a different size and / or shape, such as a 4x4, 8x8, or 16x4 texel block), from memory or cache. Thus, it may be beneficial to encode (or "compress") the block of texels into a compressed data structure so that the compressed data structure uses less space in memory or cache and so that the amount of data transferred between memory and the GPU (i.e., "memory bandwidth") is reduced. The GPU may decode the compressed data structure (using a decoding technique complementary to the encoding technique used to encode the block of texels into the compressed data structure) to determine a decoded value, such as a decoded texture value applicable to the geometry of the pixel.
[0006] The decoded value may represent one of the texels of the texel block. Decoded values representing a plurality (eg, all) of the texels of the texel block may be determined. In this manner, the encoding and decoding processes may perform compression and decompression of the texel block.
[0007] Furthermore, because the texture is projected onto the 3D geometry within the image, a single pixel of the rendered image generally cannot be precisely mapped to a single texel of the texture. For example, for texels depicting a relatively close view of the texture, each pixel may be associated with a footprint that maps to a relatively small area of the texture (e.g., covering zero or one texel), while for texels depicting a relatively far view of the texture, each pixel may be associated with a footprint that maps to a relatively large area of the texture (e.g., covering many (e.g., two or more) texels).
[0008] In some cases, anisotropic texture filtering may be performed. Anisotropic texture filtering identifies that the sampling rate of the texture is a function of the direction of travel in screen space, and the sampling rate depends on the mapping from screen space (where the image is depicted and pixel coordinates are defined) to texture space (where the texture is depicted and texture pixel coordinates are defined). In other words, the optimal texture sampling rate may be different along different directions of travel or axes in screen space. In this case, the mapping between screen space and texture space can be said to be anisotropic. Examples of anisotropic mapping are 3D projections of planar textured surfaces near the horizontal plane, or any other situation where a texture is applied to a surface in the scene that is at a significantly larger angle to the viewpoint (e.g., near the outline edge of an object).
[0009] For anisotropic texture mapping, the sampling kernel in texture space that is mapped to a pixel in screen space is elongated along an axis in texture space whose direction depends on the mapping between screen space and texture space. Figure 1 As schematically shown in Figure 1An image 100 formed by pixels having coordinates defined in image space, and a texture 102 formed by texels having coordinates defined in texel space are shown. Image 100 includes an object 104 having surface details specified by texture 102, i.e., texture 102 is mapped to the surface of object 104. For clarity, the remaining objects within image 100 have been omitted. Object 104 is at an oblique perspective within image 100. As mentioned above, if a texture is applied to a geometric shape that is oblique to the viewing direction (i.e., if a texture is applied to a surface whose normal vector is significantly non-parallel to the viewing direction vector), then the isotropic coverage area for a pixel in image space is mapped to an anisotropic coverage area in texture space. Therefore, in the case of mapping to texture space, the circular shape of the coverage area of the texture-mapped pixel within image 100 is not maintained. Number 106 represents a pixel coverage area that is circular in image space, and number 108 represents a corresponding pixel coverage area that is oval in texel space. It can be seen that the footprint has been elongated in texture space to form an ellipse, making it anisotropic. In general, the mapping of a pixel with a circular footprint in image space to texture space can be approximated by an ellipse, since the texture mapping itself can be approximated by an affine mapping at the pixel origin (i.e., including linear scaling / rotation and translation). It should be noted herein that the term "footprint" used with respect to a pixel does not necessarily refer to the physical shape of the pixel in a display device, but may refer to the area of the pixel filter used to construct the final pixel value for that pixel (which is generally larger than the physical pixel shape). Therefore, it can be said that the footprint of a pixel in texture space is equivalent to the sampling kernel of the pixel in texture space; that is, the footprint in texture space identifies the texture pixels to be sampled and filtered to form the texture color value of the pixel.
[0010] It is generally considered acceptable that the texture encoding and decoding process is a lossy process, i.e., when a texture is encoded and then decoded, some information may be lost. By allowing the texture encoding and decoding process to be lossy, textures can be compressed to a much greater degree than lossless compression, so that memory storage and memory bandwidth requirements can be reduced. The encoding / decoding process typically has three competing goals: (i) it is beneficial to reduce the amount of data used to represent the encoded texture, (ii) it is beneficial to minimize any artifacts introduced by the encoding and decoding process, and (iii) it is beneficial for the encoding and decoding process to be cheap to implement (e.g., in terms of processing latency, power consumption, and / or silicon area). Typically, improving one of these three factors will compromise one or two of the other factors. These costs can be compounded when combined with texture filtering. For example, high-quality texture filtering (such as minimizing sampling artifacts) is typically expensive in terms of memory bandwidth and throughput requirements.
[0011] Another scenario where encoding and / or decoding of pixel blocks may be useful is for compressing images, such as for compressing images rendered by a graphics processing unit (GPU). This process may be referred to as frame buffer compression and / or frame buffer decompression. Compressing images reduces the amount of data used to represent those images, which may be useful in reducing the amount of storage used to store images and reducing the amount of data transmitted between a processing unit (e.g., GPU) and a memory. This can reduce latency, power consumption, and silicon area. For frame buffer compression / decompression techniques, filtering is not applied, and typically the decompressed values are intended to be similar (or identical) to the original values before compression. For example, if the compression / decompression technique is lossless, the decompressed values will be the same as the original values before compression, and if the compression / decompression technique is lossy, the decompressed values may not be identical (but they are approximate representations of the original values) to the original values before compression. A lossy compression scheme that achieves high-level decompression quality can be described as a "visually / perceptually lossless" lossy compression scheme. One benefit of lossy compression over lossless compression is that, in addition to achieving better compression ratios, lossy compression can also guarantee a fixed worst-case bit rate (as opposed to just an expected bit rate for lossless compression, which is necessarily a variable bit rate).
[0012] UK patent application published as GB2603559 discloses a method of encoding a block of pixels into a compressed data structure by determining a set of Haar coefficients for 2x2 pixel quads of the block of pixels and storing data in a compressed data structure to represent the set of Haar coefficients. Summary of the invention
[0013] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
[0014] A method is provided for decoding a compressed data structure to determine a decoded value based on a system parameter in a computer system, wherein the compressed data structure encodes a set of Haar coefficients for a pixel block, wherein the set of Haar coefficients includes a plurality of differential coefficients and sum coefficients,
[0015] wherein the first portion of the compressed data structure includes a set of exponent bits representing an exponent for a differential coefficient, the second portion of the compressed data structure includes a set of sign bits representing a sign for the differential coefficient, and the third portion of the compressed data structure includes a set of sum bits representing a sum coefficient, wherein the number of bits in the first portion, the second portion, and the third portion of the compressed data structure is consistent with a system parameter,
[0016] The method comprises:
[0017] unpacking the packed data structure to identify the set of exponent bits, the set of sign bits, and the set of sum bits;
[0018] determining an exponent for the differential coefficient using the identified set of exponent bits;
[0019] determining a sign for one or more of the differential coefficients using the identified set of sign bits;
[0020] determining a sum coefficient using the identified set of sum bits;
[0021] Determining a decoded value by determining a result of a weighted sum of the differential coefficients and the sum coefficients for the pixel block using: (i) the determined exponents for the differential coefficients, (ii) the determined signs for the one or more of the differential coefficients, (iii) the determined sum coefficients, and (iv) respective weights for the differential coefficients and the sum coefficients; and
[0022] The determined decoded value is output.
[0023] One or more of the system parameters may define a number of exponent bits in a set of exponent bits.
[0024] Decompressing the compressed data structure may include:
[0025] reading a first portion of the compressed data structure and determining, based on the set of exponent bits, how many differential coefficients are non-zero; and
[0026] The number of sign bits in the set of sign bits is determined to be equal to the number of non-zero differential coefficients.
[0027] Unpacking the compressed data structure may also include determining a number of sum bits in the set of sum bits using: (i) one or more of the system parameters, and (ii) a determined number of sign bits in the set of sign bits.
[0028] The fourth portion of the compressed data structure may include a set of mantissa bits representing mantissas for the differential coefficients, wherein the number of bits in the fourth portion of the compressed data structure may be consistent with the system parameters, and wherein the unpacking of the compressed data structure may identify the set of mantissa bits. The method may also include using the identified set of mantissa bits to determine mantissas for one or more of the differential coefficients, and determining the decoded value by determining the result of the weighted sum of the differential coefficients and the sum coefficients for the pixel block may further use the determined mantissas for the one or more of the differential coefficients.
[0029] Unpacking the compressed data structure may also include determining a number of mantissa bits in the set of mantissa bits using: (i) one or more system parameters in the system parameters, (ii) a determined number of sign bits in the set of sign bits, and (iii) a determined number of sum bits in the set of sum bits.
[0030] In order to encode the pixel block, the compressed data structure may include only the set of exponent bits in the first part, the set of sign bits in the second part, the set of sum bits in the third part, and the set of mantissa bits in the fourth part, so that the number of bits N in the compressed data structure is equal to the sum of the number of exponent bits in the set of exponent bits, the number of sign bits in the set of sign bits, the number of sum bits in the set of sum bits, and the number of mantissa bits in the set of mantissa bits.
[0031] Determining the decoded value by determining a result of a weighted sum of the differential coefficient and the sum coefficient for the pixel block may include determining the differential coefficient using a determined exponent and sign for the differential coefficient.
[0032] The determining of the differential coefficient may further use the determined mantissa for the differential coefficient.
[0033] Determining the decoded value may include performing a binary right shift of the result of the weighted sum by 2 binary bits, thereby dividing the result of the weighted sum by 4, wherein rounding may be applied to determine the decoded value.
[0034] The determining of the result of the weighted sum of the differential coefficient and the sum coefficient for the pixel block may include:
[0035] performing a binary shift of the weights according to the determined exponent for a corresponding one or more of the non-zero differential coefficients; and
[0036] The determined sum coefficient and the shifted weight are summed according to the determined signs for the corresponding one or more of the non-zero differential coefficients.
[0037] The corresponding weights for the differential coefficients may be predetermined, and the decoded value may represent a value at a pixel position of one of the pixels of the pixel block.
[0038] All weights in the weights for the differential coefficients may have a magnitude of 1.
[0039] The pixel block can be a 2x2 pixel quad, and four decoded values can be determined for corresponding four pixels of the 2x2 pixel quad by determining the results of four weighted sums of differential coefficients and sum coefficients for the pixel block, wherein each of the four weighted sums can use a corresponding set of weights for the differential coefficients, and wherein the set of weights can be set so that the four decoded values represent values at four pixel positions of the 2x2 pixel quad.
[0040] The method may further include determining corresponding weights for the differential coefficients, wherein the weights may be determined based on one or more of the following:
[0041] The position of the decoded value relative to the pixel block to be determined;
[0042] an indication of a level of detail provided by the decoded value; and
[0043] An indication of the amount and / or direction of anisotropy to be provided by the decoded value.
[0044] A pixel block may be a block of 4 pixels, such as a 2x2 pixel quad.
[0045] The pixel block may be a 2×2 pixel quad, and the plurality of differential coefficients may include three directional differential coefficients respectively indicating horizontal differential, vertical differential, and diagonal differential in the 2×2 quad.
[0046] System parameters may be set prior to receiving the compressed data structure.
[0047] System parameters can be read from registers in the computer system.
[0048] The computer system may be hard coded to operate according to the set of system parameters.
[0049] Each pixel in the pixel block may be represented by an n-bit pixel value, where n may be one of the system parameters. The compressed data structure may have N bits, where N may be one of the system parameters.
[0050] The system parameters may include a plurality of configurable system parameters and a plurality of subordinate system parameters, wherein the subordinate system parameters are determined based on one or more of the configurable system parameters. The configurable system parameters may be:
[0051] The number of bits n representing the pixel value of each of the pixels in the pixel block;
[0052] The number of bits N in the compressed data structure;
[0053] The minimum number of sum bits D in the set of sum bits minand the maximum sum of digits D max ;
[0054] The minimum exponent value e for the first differential coefficient among the differential coefficients x,min and the maximum exponent value e x,max ;
[0055] The minimum exponent value e for the second differential coefficient among the differential coefficients y,min and the maximum exponent value e y,max ;as well as
[0056] The minimum exponent value e of the third differential coefficient in the differential coefficients xy,min and the maximum exponent value e xy,max .
[0057] Slave system parameters can be:
[0058] the number E of exponent bits in the set of exponent bits without applying exponent compression;
[0059] the number E' of exponent bits in the set of exponent bits in case exponent compression is applied;
[0060] The difference between E and E', ΔE;
[0061] the number of bits F of the compressed data structure allocated after the exponent bits and the minimum number of sum bits have been allocated if exponent compression is not applied; and
[0062] In case exponential compression is applied, the number of bits F' of the compressed data structure is allocated after the exponent bits and the minimum number of sum bits have been allocated.
[0063] The number of sign bits in the set of sign bits may be equal to the number of non-zero differential coefficients, and determining the sign of the one or more of the differential coefficients using the identified set of sign bits may include, for each of the non-zero differential coefficients, determining that the sign of the differential coefficient is positive if the corresponding sign bit is set to a first value, and determining that the sign of the differential coefficient is negative if the corresponding sign bit is set to a second value.
[0064] The pixel values of the pixels of the block may be in an unsigned format, and determining the sum coefficient using the identified set of sum bits may include mapping the sum bits to sum values from a sequence of representable sum values while operating in an odd mode, wherein there are an odd number of steps between consecutive representable sum values from a minimum representable sum value to a maximum representable sum value in the sequence.
[0065] The pixel values of the pixels of the block may be in a signed format, and determining the sum coefficient using the identified set of sum bits may include mapping the sum bits to sum values from a sequence of representable sum values while operating in an even mode, wherein there are an even number of steps between consecutive representable sum values from a minimum representable sum value to a maximum representable sum value in the sequence.
[0066] Determining an exponent for a differential coefficient using the identified set of exponent bits may include:
[0067] For the differential coefficient δ i For each differential coefficient in, determine the exponential value Exp i The encoded representation of ; and
[0068] For each differential coefficient in the differential coefficients, replace the exponential value e i Set equal to Exp i -1+e i,min ,
[0069] where e i,min is one of the system parameters and indicates the differential coefficient δ i The minimum index value of .
[0070] If the differential coefficient δ i The exponential value Exp i If the encoded representation of is zero, it can be determined that the differential coefficient is zero.
[0071] The number of exponent bits in the set of exponent bits may be less than the sum of the number of bits in the encoded representation of the exponent value for the differential coefficient, and the determining i The exponential value Exp of each differential coefficient in i The encoded representation of the exponent may include decompressing the set of exponent bits into an encoded representation of the exponent value.
[0072] Each pixel in the pixel block may have a channel value in a plurality of channels, and the method may include performing channel re-correlation on the decoded values.
[0073] The plurality of channels may include a red channel, a green channel, and a blue channel. The plurality of channels may also include an alpha channel.
[0074] A decoding unit is provided, the decoding unit being configured to decode a compressed data structure according to a system parameter in a computer system to determine a decoded value, wherein the compressed data structure encodes a set of Haar coefficients for a pixel block, wherein the set of Haar coefficients includes a plurality of differential coefficients and a sum coefficient,
[0075] wherein the first portion of the compressed data structure includes a set of exponent bits representing an exponent for a differential coefficient, the second portion of the compressed data structure includes a set of sign bits representing a sign for the differential coefficient, and the third portion of the compressed data structure includes a set of sum bits representing a sum coefficient, wherein the number of bits in the first portion, the second portion, and the third portion of the compressed data structure is consistent with a system parameter,
[0076] The decoding unit comprises:
[0077] an unpacking unit configured to unpack the compressed data structure to identify the set of exponent bits, the set of sign bits, and the set of sum bits;
[0078] A coefficient decoding module, wherein the coefficient decoding module is configured to:
[0079] determining an exponent for the differential coefficient using the identified set of exponent bits;
[0080] determining a sign for one or more of the differential coefficients using the identified set of sign bits; and
[0081] determining a sum coefficient using the identified set of sum bits; and
[0082] A decoding value determination module, wherein the decoding value determination module is configured to:
[0083] Determining a decoded value by determining a result of a weighted sum of the differential coefficients and the sum coefficients for the pixel block using: (i) the determined exponents for the differential coefficients, (ii) the determined signs for the one or more of the differential coefficients, (iii) the determined sum coefficients, and (iv) respective weights for the differential coefficients and the sum coefficients; and
[0084] The determined decoded value is output.
[0085] The fourth portion of the compressed data structure may include a set of mantissa bits representing a mantissa for the differential coefficient, wherein the number of bits in the fourth portion of the compressed data structure may be consistent with a system parameter, and wherein:
[0086] The unpacking unit may be configured to unpack the compressed data structure to further identify the set of mantissa bits;
[0087] The coefficient decoding module may be configured to determine a mantissa for one or more differential coefficients using the identified set of mantissa bits, and
[0088] The decoded value determination module may be configured to determine the decoded value by further determining a result of a weighted sum of the differential coefficients and the sum coefficient for the pixel block using the determined mantissa for the one or more of the differential coefficients.
[0089] A method for encoding a pixel block into a compressed data structure according to a system parameter in a computer system may be provided, the method comprising:
[0090] receiving the pixel block;
[0091] determining a set of Haar coefficients for the pixel block, wherein the set of Haar coefficients comprises a plurality of differential coefficients and a sum coefficient;
[0092] determining a set of exponent bits representing an exponent for the differential coefficient, wherein a number of exponent bits in the set of exponent bits is consistent with the system parameter;
[0093] determining a set of sign bits representing a sign for one or more of the differential coefficients, wherein a number of sign bits in the set of sign bits is consistent with the system parameter;
[0094] determining a set of sum bits representing the sum coefficient, wherein the number of sum bits in the set of sum bits is consistent with the system parameter;
[0095] (i) packing the determined set of exponent bits into a first portion of the compressed data structure, (ii) packing the determined set of sign bits into a second portion of the compressed data structure, and (iii) packing the determined set of sum bits into a third portion of the compressed data structure; and
[0096] The compressed data structure is stored.
[0097] A coding unit may be provided, the coding unit being configured to be implemented in a computer system and being configured to encode a pixel block into a compressed data structure according to a system parameter, the coding unit comprising:
[0098] a Haar coefficient determination module configured to determine a set of Haar coefficients for the pixel block, wherein the set of Haar coefficients includes a plurality of differential coefficients and a sum coefficient;
[0099] A coefficient encoding module, wherein the coefficient encoding module is configured to:
[0100] determining a set of exponent bits representing an exponent for the differential coefficient, wherein a number of exponent bits in the set of exponent bits is consistent with the system parameter;
[0101] determining a set of sign bits representing a sign for one or more of the differential coefficients, wherein a number of sign bits in the set of sign bits is consistent with the system parameter; and
[0102] determining a set of sum bits representing the sum coefficient, wherein the number of sum bits in the set of sum bits is consistent with the system parameter; and
[0103] A packaging unit, wherein the packaging unit is configured to:
[0104] (i) packing the determined set of exponent bits into a first portion of the compressed data structure, (ii) packing the determined set of sign bits into a second portion of the compressed data structure, and (iii) packing the determined set of sum bits into a third portion of the compressed data structure; and
[0105] The compressed data structure is caused to be stored.
[0106] An encoding unit and a decoding unit configured to perform the method described herein are provided.
[0107] The encoding unit / decoding unit may be implemented in hardware on an integrated circuit. A method of manufacturing the encoding unit / decoding unit at an integrated circuit manufacturing system may be provided. An integrated circuit definition data set may be provided, which, when processed in the integrated circuit manufacturing system, configures the system to manufacture the encoding unit / decoding unit. A non-transitory computer-readable storage medium may be provided, the non-transitory computer-readable storage medium having stored thereon a computer-readable description of the encoding unit / decoding unit, which, when processed in the integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit implementing the encoding unit / decoding unit.
[0108] An integrated circuit manufacturing system is also provided, comprising: a non-transitory computer-readable storage medium having stored thereon a computer-readable description of a hardware unit; a layout processing system configured to process the computer-readable description so as to generate a circuit layout description of an integrated circuit containing the hardware unit; and an integrated circuit generation system configured to manufacture the hardware unit according to the circuit layout description.
[0109] A computer program code for performing any of the methods described herein may be provided. In other words, a computer readable code may be provided, which is configured to cause any of the methods described herein to be performed when the code is run. A non-transitory computer readable storage medium having computer readable instructions stored thereon may be provided, which, when executed at a computer system, causes the computer system to perform any of the methods described herein.
[0110] As will be apparent to those skilled in the art, the above-described features may be combined as appropriate and may be combined with any of the aspects of the examples described herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0111] Examples will now be described in detail with reference to the accompanying drawings, in which:
[0112] Figure 1 Diagram showing the mapping of sampling kernels between screen space and texture space;
[0113] Figure 2 A computer system for encoding a block of pixels is shown;
[0114] Figure 3 is a flow chart of a method for encoding a pixel block into a compressed data structure;
[0115] Figure 4 It shows how to determine the Haar coefficients for a 2×2 pixel quad.
[0116] Figure 5 An example format of data in a compressed data structure is shown;
[0117] Figure 6 A computer system for decoding a compressed data structure is shown;
[0118] Figure 7 is a flow chart of a method for decoding a compressed data structure to determine a decoded value;
[0119] Figure 8 A pixel quad is shown, wherein the sampling position is within a region defined by the pixel quad;
[0120] Fig. 9 A computer system is shown in which the encoding and / or decoding unit is implemented; and
[0121] Fig.10 An integrated circuit manufacturing system for producing an integrated circuit embodying an encoding and / or decoding unit is shown.
[0122] The accompanying drawings show various examples. It will be appreciated by the skilled person that the element boundaries (e.g., boxes, groups of boxes, or other shapes) shown in the accompanying drawings represent an example of boundaries. In some examples, it may be the case that an element can be designed as multiple elements, or multiple elements can be designed as one element. Where appropriate, common reference numerals are used throughout the accompanying drawings to indicate similar features. DETAILED DESCRIPTION
[0123] The following description is presented by way of example to enable one skilled in the art to make and use the invention.The present invention is not limited to the embodiments described herein, and various modifications to the disclosed embodiments will be apparent to those skilled in the art.
[0124] Embodiments are now described only by way of example. The examples described herein provide an encoding unit for encoding a pixel block (e.g., representing a portion of a texture) using Haar coefficients. Similarly, a decoding unit is provided for decoding a compressed data structure to determine a decoded value (e.g., representing a pixel from a pixel block) using Haar coefficients. The Haar coefficients include a plurality of differential coefficients and a sum coefficient. The examples described herein can cheaply decompose an image into a reduced image with directional derivatives (e.g., Haar wavelet coefficients). The compression format is designed to reduce the complexity of the reconstructed image, whereby the wavelet coefficients (i.e., Haar coefficients) are independently weighted according to an algorithm that can be used as a specific implementation of a parametric texture filter that can automatically pass a range of isotropic and anisotropic filtering as part of a decoding process. The encoding format is simple enough to allow fast online compression of small coverage areas of pixels.
[0125] The examples described herein relate to encoding pixel blocks. A pixel block may be part of a texture, where a "pixel" is a "texel" of the texture. In some other examples, a pixel block may be part of an image rendered by a graphics processing system so that the image may be compressed before being written out to memory. In the examples described herein, the terms "pixel" and "texel" refer to a color value in a (usually) 2D array of a single-channel or multi-channel color value. In the examples of processing multi-channel color values described herein, different channels may be processed separately, and the terms "pixel" and "texel" may refer to the value of a single channel of a multi-channel color value.
[0126] An example is described herein in which a coding unit in a computer system encodes a pixel block (e.g., a block of 4 pixels, such as a 2x2 pixel quad) into a compressed data structure according to system parameters in the computer system. The system parameters are configurable so that the encoding process performed by the coding unit can be configured to adapt (and the decoding process performed by the decoding unit can be adapted accordingly). For example, the pixel values can each have n bits (e.g., for a 2x2 quad, a total of 4n bits), and the compressed data structure can have N bits (e.g., where N<4n). The values of n and N are two system parameters in the system parameters, which can be set (e.g., by a user or designer of the system) to allow the coding unit (and the decoding unit) to be configured for use with pixel values having different numbers of bits (also referred to as different bit widths), and to allow different compression ratios to be achieved (by setting the value of N accordingly in the system parameters). In the system disclosed in GB2603559 mentioned in the background technology section above, flexibility in the number of bits and compression ratios of the input values is not possible. As described in more detail below, system parameters can also define how to assign bits in the compressed data structure to different types of data, such as being assigned to summation coefficients, exponents of differential coefficients, or mantissas of differential coefficients. In order to realize these benefits in terms of flexibility, in the technology described herein, the compressed data structure has different parts for the following items: a group of summation bits representing the summation coefficients, a group of exponent bits representing the exponents for the differential coefficients, a group of (possible) sign bits representing the signs for one or more differential coefficients in the differential coefficients, and an optional group of mantissa bits representing the mantissas for one or more differential coefficients in the differential coefficients. Storing these multiple groups of bits in the different parts in the compressed data structure means to adjust the size of different data parts more simply without significantly changing the operating principle of the encoding or decoding technology. The size of the different data parts in the compressed data structure is consistent with the system parameters.
[0127] System parameters are set before receiving a pixel block. The system parameters may be stored (e.g., in registers) and the encoding unit and the decoding unit may access (i.e., read) the system parameters. Alternatively, the system parameters may be hard-coded into the hardware (e.g., fixed function circuits) of the encoding unit and the decoding unit during manufacturing. Hard-coding the system parameters into hardware avoids exhausting register space for storing system parameters and may provide a more efficient system (in terms of reducing latency), but storing the system parameters (e.g., in registers) allows greater flexibility because the values of the system parameters may be changed after manufacturing (e.g., in response to changes in the input data format, or changes in the required compression rate, i.e., changes in the size of the output compressed data structure). For example, the system parameters may even be changed on the fly due to changes in the format, and there may be a "timestamp" or other "tag" stored with the system parameters (e.g., encoding a particular input data format) so that the decoding unit can determine which system parameters are the correct system parameters for decoding a given compressed data structure. In some examples, there may be multiple sets of system parameters (stored (e.g., in registers) or hard-coded into different bits of the circuit), where the encoding unit and the decoding unit may select a set of system parameters (the same set as each other) from the multiple sets of system parameters for encoding and decoding a pixel block. This allows the same system to be used to encode pixel blocks with different formats (e.g., different number of bits per pixel value, such as 8-bit pixel values or 10-bit pixel values, etc.) and / or to encode pixel blocks into compressed data structures of different sizes (i.e., to achieve different compression ratios, such as 25%, 50%, or 75%; or different bit rates, such as 4 bits or 8 bits per pixel value).
[0128] The encoding methods described herein can be implemented efficiently (e.g., in terms of processing latency, power consumption, and / or silicon area). In addition, the encoding methods encode data in a compressed data structure in a format such that decoding of the compressed data structure to determine decoded pixel blocks can be performed efficiently (e.g., in terms of processing latency, power consumption, and / or silicon area). In addition, the encoding and decoding methods described herein have predictable latency and / or power consumption. In other words, the difference between the best case and worst case behavior is very small (e.g., zero), which meets one of the criteria for being an effective real-time codec.
[0129] Furthermore, as mentioned above, the encoding method described herein involves determining Haar coefficients for a pixel block (e.g., a 2x2 pixel quad) and encoding those Haar coefficients. As described in more detail below, the Haar coefficients for a 2x2 pixel quad include three directional differential coefficients (δ x ,δ y and δ xy) and a sum coefficient (Σ). The directional differential coefficients may also be referred to as 'δ values'. The sum coefficients may also be referred to as 'average coefficients'. When the compressed data structure is decoded, the directional differential coefficients allow different levels of detail to be represented in different directions. The decoding process involves representing the decoded pixel block as the value of the sum coefficient + some differential term, which is done by performing an operation on the δ x , δ y and δ xy The weighted sum of coefficients is determined by representing the pixel quad as just the value of the sum coefficient (Σ) (as a 2x2 box filter does) effectively blurs the entire pixel quad so that details with spatial frequencies higher than the spatial frequency of the pixel quad are lost, but then the details can be added using the derivative terms, and by choosing the weights of different derivative terms, different levels of detail can be added in different directions. For example, if in addition to the sum coefficient (Σ) a horizontal derivative coefficient (δ x ) to decode the 2x2 pixel quad (by setting the weight of the horizontal differential coefficient to a non-zero value), but without using the vertical and diagonal differential coefficients (δ y and δ xy ) to decode the 2x2 pixel quad (by setting the weights of the vertical differential coefficient and the diagonal differential coefficient to zero), the level of detail of the decoded pixel block in the horizontal direction will be twice that of the decoded pixel block in the vertical direction. In this example, the decoding process implements anisotropic filtering with an anisotropy ratio of 2 and with an anisotropy direction along the vertical direction (because the maximum blur occurs along that axis). By varying the value applied to δ x , δ y and δ xy The weights of the differential coefficients can change the anisotropy ratio and the anisotropy direction. In this way, when decoding the compressed data structure, the encoding / decoding process can apply different types of filtering (e.g., depending on the desired anisotropy ratio and anisotropy direction). As another example, if applied to δ x and δ y The weights are of equal magnitude and applied to δ xy The weight applied to δ is equal to x and δ y The product of the weights of (i.e., the filter is a separable filter), the decoding unit will operate as an isotropic filter. Specifically, when applied to δ x , δ y and δ xy The weights all have unit magnitude and are applied to δ xy The sign of the weight is applied to δ x and δ y The decoder will reconstruct one pixel out of the original 4 pixels in the 2x2 quad if the sign of the product of the weights of δx and δ y The weights of δ are all -1 (where xy The weight of is +1), the upper left pixel will be restored; if applied to δ x The weight of is +1, the upper right pixel will be restored, but the value applied to δ y The weight is -1 (where for δ xy The weight is -1); if applied to δ x The weight of is -1, the lower left pixel will be restored, but the value applied to δ y The weight is +1 (where for δ xy The weight is -1); if applied to δ x and δ y The weights of δ xy The weight of is +1), then the lower right pixel will be restored. These cases correspond to isotropic parametric texture filters, where the parameter level of detail (LOD) is zero and the sampling position falls on the pixel itself.
[0130] coding
[0131] Figure 2 An example computer system 200 for encoding a pixel block is shown. The computer system 200 includes an encoding unit 202 and a memory 204. The encoding unit 202 includes a Haar coefficient determination module 206, a pre-encoding module 208, a coefficient encoding module 210, and a packing unit 212. The pre-encoding module 208 includes early rounding logic 214 and bit width calculation logic 216. The coefficient encoding module 210 includes sign encoding logic 218, sum encoding logic 220, mantissa rounding logic 222, mantissa encoding logic 224, exponent encoding logic 226, and exponent compression logic 228. Figure 2 The illustrated components of encoding unit 202 may be implemented in hardware (eg, fixed function circuitry), software, or a combination thereof.
[0132] Figure 3 is a flow chart for a method of encoding a pixel block into a compressed data structure according to system parameters in computer system 200. The system parameters determine how to encode the pixel block so that the compressed data structure has N bits.
[0133] In step S302, the encoding unit 202 (specifically, the Haar coefficient determination module 206) receives a pixel block. In the example described in detail herein, the pixel block is a block of four pixels (e.g., a continuous block), specifically, the pixel block is a 2x2 pixel quad, but in other examples, the pixel block can be a pixel block other than a 2x2 pixel quad, for example, the pixel block can be a row of four pixels or the pixel block can have a number of pixels other than four, for example, where the number of pixels is some other power of 2. Other wavelet transforms can be used in other examples, but using the Haar wavelet transform to encode the 2x2 pixel quad as described in detail herein has many desirable properties, such as: (i) the "average" is the average of the four pixel values in the quad, (ii) the transform is fixed under any arrangement of pixel values (assuming that the quantization of the delta value is relatively uniform), and (iii) the transform has horizontal, vertical, and diagonal delta values corresponding to two first-order derivatives and second-order derivatives, respectively, which can be exploited by wavelet techniques. We will first describe an example where each pixel of a 2x2 pixel quad includes a value in a single channel, but as further described below, in some examples, each pixel in a pixel block can have channel values in multiple channels (e.g., red, green, blue, and alpha channels). Each single-channel pixel (hereinafter referred to as a "pixel") in a pixel block is represented by an n-bit pixel value. In some examples, n can be 8 or 10.
[0134] In step S304, the Haar coefficient determination module 206 determines a set of Haar coefficients for the pixel block. As described above, the set of Haar coefficients includes a plurality of differential coefficients (δ x ,δ y and δ xy ) and the sum coefficient (Σ).
[0135] Figure 4 4 shows how to determine the Haar coefficients for a 2×2 pixel quad 402. The pixel quad 402 includes pixels having n-bit values a, b, c, and d. A set of four n-bit values (a, b, c, and d) for the pixel quad is mapped to a set of four (n+2)-bit values (Σ, δ x ,δ y and δ xy In this example, each pixel value (a, b, c, and d) in the pixel value is a pixel value that includes the range [0,2 n -1] is an unsigned integer. In this example, the sum coefficient (Σ) is an unsigned integer, and the differential coefficient (δ x ,δ y and δ xy ) is a signed integer. Although the differential coefficients are signed integers, they are each encoded in a pseudo-floating point format in terms of sign, mantissa, and exponent as described below.
[0136] As an example, the system parameters may include a plurality of (e.g., 10) configurable system parameters and a plurality of (e.g., 5) subordinate system parameters, which are determined based on one or more of the configurable system parameters. In the main example described in this article, the configurable system parameters are:
[0137] - The number of bits n representing the pixel value of each pixel in the (single channel) pixels in the pixel block. As an example, n may be 10.
[0138] - The number of bits N in the compressed data structure. For example, in the case of a pixel block having four pixels, N may be set such that N≤4n, so that the encoding process does not expand the number of bits used to represent the pixel block. As an example, N may be 16.
[0139] - the expected minimum number D of sum bits in a set of sum bits included in the compressed data structure min and the maximum number D max For example, in the case where the pixel block has four pixels, D min and D max The value of can be set so that 0≤D min ≤D max ≤n+2. As an example, D min It can be 5, and D max It can be 6.
[0140] -For the differential coefficient δ x The minimum and maximum exponent values of the first differential coefficient in (e x,min and e x,max ). As an example, e x,min can be 6, and e x,max It can be 10.
[0141] -For the differential coefficient δ y The minimum and maximum exponent values of the second differential coefficient in (e y,min and e y,max ). As an example, e y,min can be 6, and e y,max It can be 10.
[0142] -For the differential coefficient δ xy The minimum and maximum exponent values of the third differential coefficient in (e xy,min and e xy,max ). For example, xy,min can be 5, and e xy,max It can be 10. x,min 、e y,min and e xy,minThe values of are very similar and may be equal (e.g., the difference between any two of these three values may not be greater than 1). Similarly, e x,max 、e y,max and e xy,max The values of are very similar and may be equal (eg, the difference between any two of these three values may not be greater than 1).
[0143] It should be noted that different combinations of configurable system parameter values may not always be unique, i.e., two different sets of values may produce two functionally equivalent systems. Furthermore, in the main example described in this article, the dependent system parameters are:
[0144] - The number of exponent bits E in a set of exponent bits included in the compressed data structure, if no exponent compression is applied ("exponent compression" is described below). As an example, E may be 9.
[0145] - In case exponential compression is applied, the number E' of exponent bits in the set of exponent bits included in the compressed data structure. As an example, E' may be 8.
[0146] - The difference ΔE between E and E'. As an example, ΔE may be 1.
[0147] - The number of bits F of the compressed data structure that can be allocated after the exponent bits and the minimum number of sum bits have been allocated if no exponential compression is applied. As an example, F may be 2.
[0148] - In case exponential compression is applied, the number of bits F' of the compressed data structure that can be allocated after the exponent bits and the minimum number of sum bits have been allocated. As an example, F' may be 3.
[0149] Based on these system parameters, the sum coefficient (Σ) and the differential coefficient (δ x , δ y and δ xy ), such that:
[0150] Σ=+a+b+c+d
[0151]
[0152]
[0153]
[0154] The clamping for the differential coefficient in the equation given above is to ensure that the value is within a valid range according to system parameters so that the value can be efficiently encoded in the bits to be included in the compressed data structure.
[0155] Horizontal differential coefficient (δx ) provides the average change in pixel values within the quad in the horizontal direction. The horizontal differential coefficient (δ x )exist Figure 4 is represented as 404. The vertical differential coefficient (δ y ) provides the average change in pixel values within the quad in the vertical direction. The vertical differential coefficient (δ y )exist Figure 4 It is represented as 406. x and δ y The coefficient represents the linear change of the pixel value within the 2x2 quadruple, that is, the total derivative. xy ) or cross derivatives represent nonlinear changes in pixel values within a 2x2 quad and can be thought of as first the derivative of x and then the derivative of y (hence the notation), or vice versa. As a second-order term, δ xy does not have a unique direction associated with it (but since this second-order term still plays a role in the directional filtering described herein, we refer to it elsewhere in this specification as the directional derivative). xy The differential coefficient is Figure 4 denoted as 408 in . The sum coefficient (Σ) represents the sum of the pixel values in the quadruple. The sum coefficient (Σ) can be viewed as representing the average value of the pixel values in the quadruple (implicitly multiplied by a factor of four). Figure 4 is represented as 410. (δ x ,δ y and δ xy ) is passed from the Haar coefficient determination module 206 to the pre-coding module 208 (specifically, to the early rounding logic 214).
[0156] In step S306, the early rounding logic 214 checks to see (for i∈x,y,xy) the differential coefficient δ i Whether each differential coefficient in e i,min is not zero) is strictly between zero and exponent e i,min In response to determining the differential coefficient δ i In range Early rounding logic 214 converts δ i The value is rounded to 0 or Any suitable type of rounding can be used, such as rounding away from zero, rounding toward zero, or rounding to nearest value (e.g., rounding away from zero by half or rounding toward zero by half). For example, if the round to nearest value mode (e.g., rounding away from zero by half) is used, then in When |δi | can round toward zero, and When |δ i | can be rounded to If e i,min is zero, then there is no need to round for δ i After early rounding (and initial clamping), δ i The range of possible values has three parts: (i) not greater than (and is strictly greater than ), (ii) zero, (iii) not less than (and is strictly less than ) is a positive value range.
[0157] Figure 5 The format of the data in the compressed data structure 502 is shown. The compressed data structure has N bits. The compressed data structure 502 includes multiple distinct parts for storing different groups of bits. Specifically, the compressed data structure 502 includes: (i) a first part for storing a group of exponent bits 504 representing the exponent for the differential coefficient, (ii) a second part for storing a group of sign bits 506 representing the sign for the differential coefficient, (iii) a third part for storing a group of sum bits 508 representing the sum coefficient, and (iv) a fourth part for storing a group of mantissa bits 510 representing the mantissa for the differential coefficient. The number of bits in the first part, the second part, the third part, and the fourth part of the compressed data structure is consistent with a (configurable and / or dependent) system parameter. Specifically, the number of exponent bits in the set of exponent bits is denoted as E (or E' in the case where exponent compression is used as described herein), the number of sign bits in the set of sign bits is denoted as S, the number of mantissa bits in the set of mantissa bits is denoted as M, and the number of sum bits in the set of sum bits is denoted as D. A system parameter (D) in the (configurable) system parameter min ) indicates the minimum number of sum bits for the set of sum bits, and these sum bits are the most significant bits (MSBs) of the sum bits. Depending on the pixel block being encoded and the value of one or more of the (configurable and / or dependent) system parameters, there may also be some additional sum bits (least significant bits (LSBs) of the sum bits), which are in Figure 5 Therefore, the total number of summation bits D in the set of summation bits is given as D=D min+D2. In the examples described herein, for encoding the pixel block 402, the compressed data structure 502 includes only the determined set of exponent bits 504, the determined set of sign bits 506, the determined set of sum bits 508, and the determined set of tail bits 510, such that the number of bits N in the compressed data structure is equal to the sum of the number of exponent bits E (or E’) in the set of exponent bits 504, the number of sign bits S in the set of sign bits 506, the number of sum bits D in the set of sum bits 508, and the number of tail bits M in the set of tail bits 510. However, in some alternative examples, if the compressed data structure cannot be continuously packed and / or additional data (such as flag bits) needs to be stored, the number of bits (N) in the compressed data structure can be padded to a power of two, and in these alternative examples, the number of bits N in the compressed data structure can be greater than the sum of the number of exponent bits in the set of exponent bits, the number of sign bits in the set of sign bits, the number of sum bits in the set of sum bits, and the number of tail bits in the set of tail bits.
[0158] In the examples described herein, one or more system parameters in the (dependent) system parameters define the number of exponent bits E (or E’) in the set of exponent bits. Additionally, one or more system parameters in the (configurable) system parameters define the minimum number of sum bits D in the set of sum bits. min . These values (E, E’ and D min ) do not depend on the specific pixel block being encoded. However, the values of S, D2, and M do depend on the specific pixel block being encoded and one or more system parameters in the (configurable and / or dependent) system parameters. After allocating E (or in the case of using exponent compression, E’, < E) exponent bits and the minimum number of sum bits (D min ), the number of free bits in the compressed data structure is represented as F (or in the case of using exponent compression, F’, > F) in Figure 5 . As described below, these free bits can be allocated to S, M, or D2. When not using exponent compression, N = E + D min + F and F = D2 + M + S. When using exponent compression, N = E’ + D min + F’ and F’ = D2 + M + S.
[0159] Depending on the set of (configurable and / or dependent) system parameters and / or the pixel block being encoded, in some cases, M=0, i.e. there may be zero mantissa bits in the set of mantissa bits (also referred to as the fourth part), so that the compressed data structure comprises only the first part, the second part and the third part. For example, this occurs for all pixel blocks whenever the (configurable) system parameters satisfy Dmin+3+E (or E')=N. A constant pixel quadruple (i.e. a quadruple with four equal pixel values) is always an example of such a pixel block, regardless of the (configurable and / or dependent) system parameters. The number of sign bits S in the set of sign bits 506 (in the second part) may also be zero: this may occur when the pixel quadruple is constant, so that δ x =δ y =δ xy =0.
[0160] In step S308, the bit width calculation logic 216 determines a bit width that depends at least in part on the pixel block. That is, after receiving the pixel block, in step S308, the bit width calculation logic 216 determines a plurality of block-specific parameters based on one or more of the (configurable and / or dependent) system parameters and one or more of the Haar coefficients in the determined set of Haar coefficients. The block-specific parameters include: (i) a number of sign bits S in the set of sign bits, (ii) a number of sum bits D in the set of sum bits, and (iii) a number of mantissa bits M in the set of mantissa bits to be packed into the compressed data structure for the pixel block.
[0161] Specifically, in step S308, the bit width calculation logic 216 determines the number of sign bits S in the set of sign bits according to one or more system parameters in the system parameters and one or more Haar coefficients in the determined set of Haar coefficients. x ,δ y and δ xy To calculate the number of sign bits S. Specifically, the number of sign bits S is determined as the non-zero differential coefficient δ x ,δ y and δ xy The number of sign bits S in the set of sign bits is consistent with the (configurable and / or dependent) system parameters, i.e., the number is consistent with E (or E'), F (or F'), D min and the value of N, that is, S ≤ F (or F' when exponential compression is applied), where N = E (or E') + F (or F') + D min In other words, the system parameters are set so that S can take any value within the range [0,3]. Therefore, F (or F') ≥ 3, and E (or E'), D min and N is set so that N = Dmin +F (or F') +E (or E'), as described above.
[0162] Furthermore, in step S308, the bit width calculation logic 216 determines the number of sum bits in the set of sum bits based on one or more of the (configurable and / or dependent) system parameters and one or more of the determined set of Haar coefficients for the pixel block. This may involve assigning as many free bits (F or F') as are left to D2 after the number of sign bits has been determined, while the number of sum bits D (typically) does not exceed the system parameter D. max , which is a system parameter indicating the maximum number of summed bits to be included in the compressed data structure. Figure 5 As shown in min +D2, where D min is one of the system parameters, so step S308 may involve determining D2, where D2 (usually) does not exceed D max With D min If S>0, and if no exponential compression is applied, then D2=min(FS,D max -D min ). If S>0, and if exponential compression is applied, then D2=min(F ′ -S,D max -D min ). If S = 0, then the differential coefficient (δ x ,δ y and δ xy ) are zero, and thus no bits need to be assigned as mantissa bits for the differential coefficients, i.e. M=0. Therefore, any remaining bits of the free bits (F or F') can be allocated to the sum bits, even if this remaining bit exceeds the maximum parameter D max (Otherwise these bits would be wasted.) The maximum number of digits in the sum is n+2, so this maximum number of digits can be substituted for D in the expression for D2. max That is, if S = 0, and if no exponential compression is applied, then D2 = min(F,n+2-D min ). If S = 0, and if exponential compression is applied, then D2 = min(F′,n+2-D min ). When D2 is determined, the number of summation bits D in the set of summation bits can be determined as D=D min +D2.
[0163] Furthermore, in step S308, the bit width calculation logic 216 may determine the number of mantissa bits in the set of mantissa bits based on one or more of the (configurable and / or dependent) system parameters and one or more of the Haar coefficients in the determined set of Haar coefficients for the pixel block. Any remaining free bits (F or F') left after the number of sign bits and the number of sum bits have been determined are used to represent the three differential coefficients δ x , δ y and δ xy If no exponent compression is applied, the number of mantissa bits M is given by M=FS-D2; and if exponent compression is applied, the number of mantissa bits M is given by M=F'-S-D2.
[0164] When step S308 has been completed, all bit widths in the bit width have been determined, i.e. the values of E (or E'), S, M and D have been determined in a manner that is based on (configurable and / or dependent) system parameters and is applicable to the specific pixel block being encoded. Figure 2 The four branches of the pipeline of the coefficient encoding module 210 shown in can (simultaneously) (in steps S310 to S316) determine the values to be included in the four parts of the compressed data structure: the set of exponent bits 504, the set of sign bits 506, the set of sum bits 508 and the set of mantissa bits 510.
[0165] In step S310, the coefficient encoding module 210 (particularly the sign encoding logic 218) determines a set of sign bits representing the sign of one or more of the differential coefficients. As described above, the number of sign bits S in the set of sign bits is non-zero for the differential coefficients (δ x , δ y and δ xy In step S310, for each of the non-zero differential coefficients, if the differential coefficient is positive, the sign encoding logic 218 sets the corresponding sign bit to a first value (e.g., 0), and if the differential coefficient is negative, the sign encoding logic sets the corresponding sign bit to a second value (e.g., 1).
[0166] In step S312, the coefficient encoding module 210 (particularly the sum encoding logic 220) determines a set of sum bits representing the sum coefficient. Specifically, the sum encoding logic 220 down-quantizes the sum coefficient Σ from n+2 bits to a quantized value Σ having D bits. quantised , so that the sum coefficient Σ is in the range [0,2 n+2 -4] becomes a value in the range [0,2 D -1] within the quantized value Σ quantised. The sum encoding logic 220 may be capable of operating in two modes: an odd mode and an even mode. In odd mode, there are an odd number of steps (and therefore an even number of codes in total) between consecutive representable sum values from the minimum representable sum value to the maximum representable sum value; while in even mode, there are an even number of steps (and therefore an odd number of codes in total) between consecutive representable sum values from the minimum representable sum value to the maximum representable sum value. For unsigned input values, odd mode may be considered better than even mode because odd mode gives a better peak signal-to-noise ratio (PSNR) due to fewer codes, while for signed input values, even mode may be considered better than odd mode, where we want to be able to accurately represent intermediate values (indicating zero). For unsigned formats, intermediate values do not indicate zero, so odd mode may be preferred for unsigned formats due to the better average PSNR of odd mode.
[0167] The quantization mapping can be implemented by any suitable quantization technique. A simple quantization technique is truncation, in which a certain number of LSBs are simply removed. However, truncation does not usually give good results, for example because the representable input values may not be evenly distributed over the range of representable quantized values, and because the full value range may not be representable without introducing errors after decoding (for example, decoded values representing absolute white and absolute black may not be representable without introducing errors into the decoded values). Another quantization technique (which often gives better results than truncation) is to perform division by a constant with no remainder, as shown in the following equation. A half least precision unit (ULP) shift before division can be used to implement rounding to the nearest neighbor value (for example, rounding half an integer to positive infinity). In other examples, different rounding modes, such as an upward rounding mode or a downward rounding mode, can be used instead of the rounding to the nearest value method.
[0168] For example, in odd mode, the quantized sum coefficient Σ quantised can be determined such that The brackets It should be noted that since the (unquantized) sum coefficient (Σ) is determined by summing four n-bit values (a, b, c, and d), the maximum value that the sum coefficient can take is 2. n+2 –4, and the D-bit quantized sum coefficient (Σ quantised The maximum value that can be obtained is 2 D –1, which is why the fraction in the first expression is The reason is that the numerator of the second expression ((2 D -1)Σ+2 n+1-2) can be calculated using simple fixed-point operations (such as a combination of shift operations, addition operations, and multiplication operations). The numerator is divided by the denominator (2 n+2 -4) can be implemented using a lookup table (eg when implementing statically configurable system parameters) or by performing a full division operation (eg when implementing dynamically configurable system parameters).
[0169] In even mode, the maximum value of the (unquantized) sum coefficient (Σ) is 2 n –1 (rescaled by a factor of four). Therefore, the median value is 2 (n-1) –1 / 2 (rescaled by a factor of four). For signed input values, intermediate values representing zero may be useful, but 2 (n-1) –1 / 2 is not a whole number. Therefore, we can choose to use 2 (n-1) –1 or 2 (n-1) (rescaled by a factor of four) represents zero, and in the example shown below, the latter is chosen (i.e., 2 (n-1) ), because it simplifies the operation slightly. Choosing an intermediate value to represent zero extends the range of the (unquantized) sum coefficient Σ to 2 n (rescaled by a factor of four), exceeds its actual maximum value. This corresponds to 2 (n+2) (without rescaling by a factor of four), resulting in different denominators in the following equations. In addition, in even mode, the quantized sum coefficient (Σ quantised ) has one less representable value than in odd mode, so the maximum value that the D-bit quantized sum coefficient can achieve is 2 D –2. Thus, in the odd mode above, it is given by The score is divided by the score Therefore, in even mode, the quantized sum coefficient Σ quantised can be determined such that Molecules ((2 D -1)Σ+2 n ) can be calculated using simple fixed-point operations such as a combination of shift operations, addition operations, and multiplication operations. The numerator divided by the denominator (2 n+1 ) may be implemented using a lookup table (eg, when implementing statically configurable system parameters) or by performing a full division operation (eg, when implementing dynamically configurable system parameters).
[0170] In step S314, the coefficient encoding module 210 (particularly the mantissa rounding logic 222 and the mantissa encoding logic 224) determines a set of mantissa bits representing the mantissa for one or more of the differential coefficients. It should be noted that in some alternative examples, the mantissa bits of the differential coefficients may not be determined, so step S314 may not be performed, and the coefficient encoding module 210 may not include the mantissa rounding logic 222 and / or the mantissa encoding logic 224. However, in the examples described herein, the mantissa bits are determined and (if there is room for the mantissa bits in the compressed data structure, i.e., if M>0) included in the compressed data structure.
[0171] Typically, M will not be large enough to store enough mantissa bits for all the differential coefficients to be encoded with full precision. In other words, since the number of mantissa bits M to be included in the compressed data structure is limited, some information will be lost in most cases. Only the most significant mantissa bits (e.g., the most significant bits) of the mantissa bits are retained. For example, from the differential coefficients (|δ x |、|δ y | and |δ xy |) (excluding the initial 1) and select M mantissa bits.
[0172] 1. Select the MSB of the differential coefficient among the more significant bits.
[0173] 2. If the bits are equal according to rule (1), the MSB of the differential coefficient with the smaller exponent is selected.
[0174] 3. If these bits are equal according to rules (1) and (2), a tie-breaking condition is used, for example to select the MSB of the differential coefficient given by a predetermined priority order, for example δ x , followed by δ y , followed by δ xy .
[0175] For the three differential coefficients (|δ x |、|δ y | and |δ xy |), an example selection of a finite number of M mantissa bits is shown below, where M = 5, so that M x =2,M y =2, and M xy =1, giving their corresponding exponential values:
[0176] |δ x |:
[0177] 1 <![CDATA[M x,1 ]]> <![CDATA[M x,2 ]]> +1
[0178] |δ y|:
[0179] 1 <![CDATA[M y,1 ]]> <![CDATA[M y,2 ]]> +1
[0180] |δ xy |:
[0181] 1 <![CDATA[M xy,1 ]]> +1
[0182] In this example, δ x The exponent of is 3, δ y The exponent of is 4, and δ xy The exponent of is 3. According to the three rules given above, the five mantissa digits are chosen so that:
[0183] (i) Because δ y The MSB of (excluding the initial 1) is in the more significant bit δ x and δ xy The (including the initial 1) corresponds to the MSB, so the mantissa is M y,1 Select the first last digit (i.e. rule 1);
[0184] (ii) After the tie-breaking condition of Rule 3 given above, change the last digit to M x,1 Select the second last digit;
[0185] (iii) Due to rule 2, the last digit is M xy,1 Select the third last digit;
[0186] (iv) Due to rule 1, the last digit is M y,2 Select the fourth last digit; and
[0187] (v) Due to rule 3, the last digit is M. x,2 Select the fifth digit.
[0188] The mantissa rounding logic 222 may be used to round the absolute differential coefficient value (|δ x |、|δ y | and |δ xy |) are added to the half-ULP positions relative to their corresponding number of encoded mantissa bits (as indicated by "+1" above). If the half-ULP position falls in a fractional position, no rounding is performed for that differential coefficient (even if rounding is applied, it will have no effect because the bits in the fractional position will be 0). In the above example, for |δ x | and |δ y |Retain 2 mantissa digits, and for |δ xy |Retain 1 mantissa. Because |δ x The exponent of | is 3, and two of its mantissa bits will be stored, so its half ULP bit means adding 1 to the absolute differential coefficient |δx |. Because |δ y The exponent of | is 4, and two of its mantissa bits will be stored, so its half ULP bit means adding 2 to the absolute differential coefficient |δ y |. Because |δ xy The exponent of | is 3, and one of its mantissa bits will be stored, so its half ULP bit means adding 2 to the absolute differential coefficient |δ xy |.
[0189] The rounding operation performed by the mantissa rounding logic 222 can convert the three absolute differential coefficients δ (|δ x |、|δ y | and |δ xy |) is increased by 1, and if this is the case, an indication of this is passed to the "exponent encoding" logic 226. As the exponent increases, the distribution of the mantissa bits may differ between the "mantissa rounding" and "mantissa encoding" stages, and the determination of how to split the M mantissa bits between the mantissas of different differential coefficients may be repeated based on the new exponent value. Rule 2 given above (i.e., selecting the MSB of the differential coefficient with a smaller exponent rather than a larger exponent) means that the second level rounding will have no effect. Therefore, the three rules given in the above example do not need to be applied more than twice: once for mantissa rounding and once for mantissa encoding. It should be noted that the mantissa rounding logic 222 and the rounding operations performed by the mantissa rounding logic are optional, and some specific implementations will not include the mantissa rounding logic and the rounding operations.
[0190] As long as the encoding technique and the subsequent decoding technique use the same order as each other, the selected M mantissa bits can be included in the set of mantissa bits (to be stored in the fourth part of the compressed data structure) in any suitable order. For example, the mantissa bits can be stored as:
[0191] <![CDATA[m4]]> <![CDATA[m3]]> <![CDATA[m2]]> <![CDATA[m1]]> <![CDATA[m0]]>
[0192] Where m4=M x,1 , m3=M x,2 , m2=M y,1 , m1=M y,2 , and m0=M xy,1 .
[0193] In step S316, the coefficient encoding module 210 (particularly the exponent encoding logic 226 and the exponent compression logic 228) determines a set of exponent bits representing the exponent for the differential coefficient. Exponent compression is an optional feature, so some examples do not include the exponent compression logic 228, such that the set of exponent bits will include E bits. However, in the main example described herein, the exponent compression logic 228 is included, which does perform exponent compression, such that the set of exponent bits includes E' bits. The values of E and E' are two of the (subordinate) system parameters.
[0194] The exponential encoding logic 226 performs the three absolute differential coefficients (|δ x |、|δ y | and |δ xy |). This can be done by taking the floor integer result of the base 2 logarithm of each absolute differential coefficient to calculate the raw exponent e as shown in the following equation: x 、e y and e xy This function is described in this way only to express the function as a mathematical operation, and other examples may implement this function differently. In addition, it should be noted that 'floor(log2(n))' is an integer operation that is equivalent to finding the position of the leading 1 in the binary representation of n, which is relatively simple to implement with logic gates. As indicated by the mantissa rounding logic 222, this calculation includes any increments to the result due to mantissa rounding. As described below, if the differential coefficient δ i is zero, then this differential coefficient is treated as a special case and mapped to e i,min -1. The original exponent e is determined according to the following equation x 、e y and e xy :
[0195]
[0196]
[0197]
[0198] Let the original index (e x 、e y and e xy ) i,min -1 to ensure that the encoding index starts at zero. After this shift has occurred, the encoding index (Exp x ,Exp y and Exp xy) falls within the range that can be represented by the number of index states provided by the configuration system according to system parameters. The shifted encoding index is given by:
[0199] Exp x =e x +1-e x,min ∈[0,e x,max -e x,min +1]
[0200] Exp y =e y +1-e y,min ∈[0,e y,max -e y,min +1]
[0201] Exp xy =e xy +1-e xy,min ∈[0,e xy,max -e xy,min +1]
[0202] In other words, in step S316, the exponential encoding logic 226 calculates the differential coefficient δ i For each differential coefficient in (for i∈x,y,xy) the following operation is performed to determine a set of exponent bits:
[0203] If the differential coefficient δ i is zero, the exponent value for the differential coefficient is set equal to e i,min -1;
[0204] If the differential coefficient δ i is nonzero, the exponent value for the differential coefficient is set equal to as well as
[0205] Make the exponential value of the differential coefficient offset by e i,min -1 shift, so that the shifted exponent value starts from zero, where the set of exponent bits represents the shifted exponent value for the differential coefficient. As described above, e i,min is one of the (configurable) system parameters and indicates the derivative coefficient δ i The minimum index value of .
[0206] Used to express exponential values (Exp x ,Exp y and Exp xy ) is given by the (dependent) system parameter E. In one example, Exp x =Exp y =Exp xy=3 and E = 9. If exponent compression is not implemented, then these bits are simply concatenated and included in a set of E exponent bits 504 to be included in the compressed data structure 502.
[0207] However, depending on (by the system parameter e i,min and e i,max The allowed range of exponential values is determined by simply connecting the exponential values (Exp x ,Exp y and Exp xy ) may not be the most efficient way to represent the exponent value in the set of exponent bits. The exponent compression logic 228 may reduce the number of bits in the set of exponent bits, for example by 1 or 2 bits. For example, if ΔE is greater than zero, then exponent compression may be performed. The value of ΔE is one of the (dependent) system parameters, and ΔE=E–E'. Exponent compression converts the exponent value (Exp x ,Exp y and Exp xy ) is compressed into the set of exponent bits, such that the number of exponent bits in the set of exponent bits (assuming ΔE>0) is less than the sum of the number of bits required to represent each of the individually determined exponent values. Specifically, the set of exponent bits (Exp) may be determined according to the following formula:
[0208] Exp=Exp x (e y,max -e y,min +2)(e xy,max -e xy,min +2)+Exp y (e xy,max -
[0209] e xy,min +2)+Exp xy .
[0210] It should be noted that steps S310 to S316 may be performed (at least partially) in parallel / simultaneously and / or in any suitable order, provided that if the mantissa rounding logic 222 is implemented, it can provide its input to the exponent encoding logic 226 in advance.
[0211] In step S318, the packing unit 212 (i) packs the determined set of exponent bits 504 into a first part of the compressed data structure, (ii) packs the determined set of sign bits 506 into a second part of the compressed data structure, (iii) packs the determined set of sum bits 508 into a third part of the compressed data structure, and (iv) packs the determined set of mantissa bits 510 into a fourth part of the compressed data structure. As mentioned above, the different parts of the compressed data structure are distinct (i.e., non-overlapping). The different parts are generally continuous. In addition, as mentioned above, in some specific implementations, M=0, so that no mantissa bits are stored in the compressed data structure. Similarly, as mentioned above, the number of sign bits S in the set of sign bits 506 (in the second part) may also be zero: this may occur when the pixel quad is constant, so that δ x =δ y =δ xy =0.
[0212] In step S320, the compressed data structure is stored. Specifically, the packaging unit 212 sends the compressed data structure to the memory 204 for storage in the memory.
[0213] In the examples described above, the pixel values are associated with a single data channel, and if the pixel values have channel values in multiple channels, the different channels can be encoded separately (i.e., independently), and the number of input bits (n) in the channel values can be the same or different for different color channels, and the number of bits (N) in the output compressed block can be the same or different for different color channels. However, in some other examples, each pixel in a pixel block can have channel values in multiple channels (e.g., a red channel, a green channel, a blue channel, and sometimes an alpha channel), and channel decorrelation can be performed on the non-alpha channel values of the pixels in the pixel block before determining a set of Haar coefficients for the pixel block. For example, the green channel can be used as a reference channel, and color decorrelation can be performed on the red channel by replacing the pixel value R(x) in the red channel for pixel position x with the decorrelation value R'(x), where R'(x) = R(x) - G(x). Furthermore, color decorrelation may be performed on the blue channel by replacing the pixel value B(x) in the blue channel for pixel position x with the decorrelation value B′(x), where B′(x)=B(x)−G(x).
[0214] Color decorrelation can improve the quality of encoding (i.e., reduce the amount of information lost during the encoding process), particularly when different channels are highly correlated, such as for grayscale images. For example, for a reference channel (e.g., a green channel), the number of bits in the compressed data structure can be greater than the number of bits for non-reference channels (e.g., red and blue channels) that have been color decorrelation performed. As an example, N-1 bits can be used for the compressed data structure for each of the blue channel and the red channel (which are non-reference channels), and N+2 bits can be used for the compressed data structure for the green channel (which is the reference channel). If the color channels (e.g., for nearly grayscale images) are highly correlated, using N-1 bits for the non-reference channels that have been color decorrelation performed will not introduce much (if any) data loss, and the extra two bits for the compressed data structure for the reference channel can improve the decompression quality. The range of pixel values in the non-reference channels is doubled by the color decorrelation process, but in the system described herein, this situation is more easily addressed by simply incrementing the (configurable) system parameter n for those channels (i.e., using a configurable system parameter n+1 for the pixel value bit width). In addition, for non-reference channels, the value can be shifted up by 2 n , so that the value is non-negative, or the value can be retained as a signed value. If the values are retained as signed values, the encoding of the sum coefficients will be modified accordingly, as the sum coefficients will also be signed values (rather than unsigned values as described in the above examples). In addition, it should be noted that if the value is shifted up to make it non-negative or retained as a signed value, the value still represents signed data, and therefore an 'even mode' of sum coefficient encoding may be preferred so that intermediate values (indicating zero) can be accurately represented (as described above).
[0215] The encoding process described above is efficient to implement (e.g., in terms of latency, power consumption, and / or silicon area) and can be easily adapted for use with data of different formats or to achieve different compression ratios, for example, by changing the values of (configurable) system parameters (such as n and N).
[0216] decoding
[0217] We now proceed to describe how to decode the compressed data structure 502 representing the pixel block 402 to determine a decoded value. As described in more detail below, the decoded value may (e.g., where encoding and decoding techniques are used to compress and decompress pixel values) represent one of the pixels of the pixel block. Alternatively, the decoded value may (e.g., where encoding and decoding techniques are used to determine a filtered texture value) represent a filtered value at a location within the region represented by the pixel block.
[0218] Figure 6An example computer system 600 for decoding a compressed data structure is shown. The computer system 600 includes a decoding unit 602 and a memory 604. The memory 604 can be connected to Figure 2 6 and described above. The decoding unit 602 includes an unpacking unit 606, a coefficient decoding module 608, and a decoded value determination module 610. The unpacking unit 606 includes an exponent unpacking logic 612, a bit width calculation logic 614, and a sign, sum, and mantissa unpacking logic 616. The coefficient decoding module 608 includes a sign decoding logic 618, a sum decoding logic 620, a mantissa decoding logic 622, and an exponent decoding logic 624. The decoded value determination module 610 includes a coefficient assembly logic 626 and an inverse Haar transform logic 628. Figure 6 The components of the decoding unit 602 shown in FIG. 6 may be implemented in hardware (eg, fixed function circuits), software, or a combination thereof.
[0219] Figure 7 Flowchart of a method for decoding a compressed data structure 502 to determine a decoded value based on (configurable and / or dependent) system parameters in a computer system 600. The decoding unit 602 uses the same (configurable and therefore dependent) system parameters as the encoding unit 202 used to encode a pixel block into the compressed data structure 502. The (configurable) system parameters are set before receiving the compressed data structure. As described above, the (configurable) system parameters accessible (i.e., read) by the decoding unit 602 (and the encoding unit 202) may be stored (e.g., in registers). Alternatively, the system parameters may be hard-coded into the hardware (e.g., fixed function circuits) of the decoding unit 602 (and the encoding unit 202) during manufacturing. As described above, the system parameters may be changed on the fly, for example, due to changes in formats, and there may be a "time stamp" or other "tag" stored with the system parameters (e.g., encoding a specific input data format) so that the decoding unit can determine which system parameters are the correct system parameters for decoding a given compressed data structure.
[0220] In step S702, a compressed data structure is received at a decoding unit 602. Specifically, a compressed data structure 502 is received from a memory 604 at an unpacking unit 606 of the decoding unit 602. As described above, the compressed data structure 502 encodes a set of Haar coefficients for a pixel block, wherein the set of Haar coefficients includes a plurality of differential coefficients and a sum coefficient. Also as described above, a first portion of the compressed data structure 502 includes a set of exponent bits 504 representing an exponent for a differential coefficient, a second portion of the compressed data structure 502 includes a set of sign bits 506 representing a sign for the differential coefficient, a third portion of the compressed data structure 502 includes a set of sum bits 508 representing a sum coefficient, and a fourth portion of the compressed data structure 502 includes a set of mantissa bits 510 representing a mantissa for the differential coefficient, wherein the number of bits in the first portion, the second portion, the third portion, and the fourth portion of the compressed data structure 502 is consistent with a (configurable and dependent) system parameter. In the example described above, to encode the pixel block, the compressed data structure 502 includes only the group of exponent bits 504 in the first part, the group of sign bits 506 in the second part, the group of sum bits 508 in the third part, and the group of mantissa bits 510 in the fourth part, so that the number of bits N in the compressed data structure is equal to the sum of the number of exponent bits in the group of exponent bits, the number of sign bits in the group of sign bits, the number of sum bits in the group of sum bits, and the number of mantissa bits in the group of mantissa bits. However, in some alternative examples, if the compressed data structure cannot be continuously packed and / or store additional data (e.g., flag bits), the number of bits (N) in the compressed data structure can be padded to, for example, a power of two, and in these alternative examples, the number of bits N in the compressed data structure can be greater than the sum of the number of exponent bits in the group of exponent bits, the number of sign bits in the group of sign bits, the number of sum bits in the group of sum bits, and the number of mantissa bits in the group of mantissa bits. In the examples described below, some mantissa bits are included in the compressed data structure, but as noted above, in some cases there are no mantissa bits in the compressed data structure (i.e., M=0), and for constant pixel quads (i.e., S=0), there may be no sign bit in the compressed data structure.
[0221] In steps S704 , S706 and S708 , the unpacking unit 606 unpacks the compressed data structure 502 to identify the set of exponent bits 504 , the set of sign bits 506 , the set of sum bits 508 and the set of mantissa bits 510 according to (configurable and dependent) system parameters.
[0222] Specifically, in step S704, the exponent unpacking logic 612 begins unpacking the compressed data structure 502 to identify the set of exponent bits 504, and if the set of exponent bits is compressed during the encoding process (i.e., when the dependent system parameter ΔE>0), then the set of exponent bits is decompressed. One or more of the (dependent) system parameters define the number of exponent bits in the set of exponent bits 504. More specifically, the (dependent) system parameters (e.g., E, E', and ΔE) directly indicate the number of exponent bits in the compressed data structure, so the decoding unit 602 does not need to perform any calculations to determine the number of exponent bits in the compressed data structure. If ΔE=0, then exponent compression is not used during the encoding process, so the three exponents (Exponent) are not compressed. x ,Exp y and Exp xy ) is simply read from the first portion of the compressed data structure 502 and passed to the exponent decoding logic 624. If ΔE>0, then the exponent unpacking logic 612 performs exponent decompression. In other words, if the number of exponent bits in the set of exponent bits 504 is less than the sum of the number of bits in the encoded representation of the exponent value for the differential coefficient, then for the differential coefficient δ i For each differential coefficient in (i∈x,y,xy), the exponent unpacking logic 612 determines the exponent value Exp by unpacking the set of exponent bits Exp into an encoded representation of the exponent value i For example, exponential decompression can be performed according to the following equation:
[0223]
[0224]
[0225] Exp xy =Exp(mod(e y,max -e y,min +2))
[0226] It should be noted that the equations given above are only for clarity of the present disclosure, and in practice, when the system parameters are predetermined (configurable), some functionally equivalent lookup table or logic array may be used to determine the result according to the equation (rather than having to perform the calculations as specified in the equation). When the system parameters are dynamically determined (configurable), then the division and / or modulo operations may be fully implemented. When the exponent (Exp x ,Exp y and Exp xy ) is represented, the representation is passed to the exponent decoding logic 624.
[0227] In step S706 , the bit width calculation logic 614 determines: (i) the number S of sign bits in the set of sign bits 506 , (ii) the number D of sum bits in the set of sum bits 508 , and (iii) the number M of mantissa bits in the set of mantissa bits 510 .
[0228] Specifically, in step S706, the bit width calculation logic 614 uses three exponents (Exp x ,Exp y and Exp xy ) to determine the number of sign bits S in the set of sign bits 506. Specifically, the unpacking unit 606 (e.g., the bit width calculation logic 614) determines how many differential coefficients are non-zero (i.e., Exp x ,Exp y and Exp xy is non-zero), and the number of sign bits S in the set of sign bits 506 is determined to be equal to the number of non-zero differential coefficients. As mentioned above, the number of sign bits S in the set of sign bits is consistent with the system parameters, that is, the number is consistent with E (or E'), F (or F'), D min and the value of N, that is, S ≤ F (or F' when exponential compression is applied), where N = E (or E') + F (or F') + D min .
[0229] In step S706, the bit width calculation logic 614 also determines the number of sum bits D in the set of sum bits 508 using: (i) one or more of the (configurable and / or dependent) system parameters, and (ii) the determined number of sign bits S in the set of sign bits 506. The decoding unit 602 may determine the number of sum bits D in the same manner as the encoding unit 202 determines the number of sum bits as described above. Specifically, this determination may involve assigning as many free bits (F or F') as are left after the number of sign bits has been determined to D2 without the number of sum bits D exceeding the system parameter D. max , which is a system parameter indicating the maximum number of summed bits to be included in the compressed data structure. Figure 5 As shown in min +D2, where D min is one of the (configurable) system parameters, so step S706 may involve determining D2. If S>0, then if no exponential compression is applied, then D2=min(FS, D max -D min ), and if exponential compression is applied, then D2 = min(F′-S,D max -D min). If S = 0 (which occurs for a constant quaternion), then the differential coefficient (δ x ,δ y and δ xy ) are zero, and thus no bits need to be assigned as mantissa bits for the differential coefficients, i.e. M=0. Therefore, any remaining bits of the free bits (F or F') can be allocated to the sum bits, even if this remaining bit exceeds the maximum parameter D max (Otherwise these bits would be wasted.) The maximum number of digits in the sum is n+2, so this maximum number of digits can be substituted for D in the expression for D2. max That is, if S = 0, then if no exponential compression is applied, then D2 = min(F,n+2-D min ), and if exponential compression is applied, then D2 = min(F′,n+2-D min ). When D2 is determined, the number of summation bits D in the set of summation bits can be determined as D=D min +D2.
[0230] In addition, the bit width calculation logic 614 can determine the number of mantissa bits M in the set of mantissa bits 510 using: (i) one or more of the (configurable and / or dependent) system parameters, (ii) a determined number of sign bits in the set of sign bits, and (iii) a determined number of sum bits in the set of sum bits. Specifically, any remaining free bits (F or F') left after the number of sign bits and the number of sum bits have been determined are used to represent the three differential coefficients δ x ,δ y and δ xy If no exponent compression is applied, the number of mantissa bits M is given by M=FS-D2; and if exponent compression is applied, the number of mantissa bits M is given by M=F'-S-D2.
[0231] When step S706 has been completed, all of the bit widths have been determined, i.e., the values of E (or E'), S, M, and D have been determined in a manner that is based on (configurable and dependent) system parameters. In step S708, the sign, sum, and mantissa unpacking logic 616 completes unpacking the compressed data structure to identify the set of sign bits 506, the set of sum bits 508, and the set of mantissa bits 510. Specifically, using the values of E (or E'), S, M, and D, the unpacking unit 606 (particularly the sign, sum, and mantissa unpacking logic 616) can read an appropriate set of bits from the compressed data structure 502 and (i) pass the set of sign bits 506 to the sign decoding logic 618, (ii) pass the set of sum bits 508 to the sum decoding logic 620, and (iii) pass the set of mantissa bits 510 to the mantissa decoding logic 622. Subsequently, Figure 6 The four branches of the pipeline of the coefficient decoding module 608 shown in FIG. 6 can determine (in steps S710 to S716) the differential coefficients (δ x , δ y and δ xy ) and the sign, exponent, and mantissa of the summation coefficient (Σ).
[0232] In step S710, the exponent decoding logic 624 of the coefficient decoding module 608 uses the identified set of exponent bits 504 to determine the exponent for the differential coefficient. i For each differential coefficient in, the exponent decoding logic 624 may use the exponent value Exp as received from the exponent unpacking logic 612 i The code representation, and the exponential value e can be converted to each differential coefficient in the differential coefficient i Set equal to Exp i -1+e i,min As described above, e i,min is one of the system parameters and indicates the derivative coefficient δ i Therefore, in this example, the differential coefficient (e) is determined according to the following formula: x 、e y and e xy ) index (δ x , δ y and δ xy ):
[0233] e x =Exp x -1+e x,min ∈[e x,min -1,e x,max ]
[0234] e y =Exp y -1+e y,min ∈[e y,min -1,e y,max ]
[0235] e xy =Exp xy -1+e xy,min ∈[e xy,min -1,e xy,max ]
[0236] In step S712, the sign decoding logic 618 of the coefficient decoding module 608 uses the identified set of sign bits 506 to determine the sign for one or more of the differential coefficients. As described above, the number of sign bits in the set of sign bits 506 is equal to the number of non-zero differential coefficients. Step S712 includes: for each non-zero differential coefficient in the differential coefficients, if the corresponding sign bit is set to a first value (e.g., '0'), determining that the sign of the differential coefficient is positive, and if the corresponding sign bit is set to a second value (e.g., '1'), determining that the sign of the differential coefficient is negative. If S=0 (i.e., a constant pixel quad), step S712 can be skipped.
[0237] In step S714, the mantissa decoding logic 622 of the coefficient decoding module 608 uses the identified set of mantissa bits to determine the mantissa for one or more of the differential coefficients. If S=0 (ie, constant pixel quad) or M=0, step S714 may be skipped.
[0238] As described above, typically, M will not be large enough to store enough mantissa bits for the differential coefficients to be encoded with full precision, and the most significant of the mantissa bits (e.g., the most significant mantissa bits) are retained. The same rules are used in the encoding process (as described above) and the decoding process to determine which mantissa bits to retain. For example, the differential coefficients (|δ) are obtained according to the following rules x |、|δ y | and |δ xy |) (excluding the initial 1) and select the reserved M mantissa bits.
[0239] 1. Select the MSB of the differential coefficient among the more significant bits.
[0240] 2. If the bits are equal according to rule (1), the MSB of the differential coefficient with the smaller exponent is selected.
[0241] 3. If these bits are equal according to rules (1) and (2), a tie-breaking condition is used, for example to select the MSB of the differential coefficient given by a predetermined priority order, for example δ x , followed by δ y , followed by δ xy .
[0242] In the example encoding process described above, five mantissa bits (m4, m3, m2, m1, and m0) are stored. In this example, the finite number of M mantissa bits is used to store three differential coefficients (|δ x |、|δ y | and |δ xy An example assignment of the magnitude of |) is shown below, where M=5, so that M x =2,My =2, and M xy =1, giving their corresponding exponential values:
[0243] |δ x |:
[0244] 1 <![CDATA[m4]]> <![CDATA[m3]]> 0
[0245] |δ y |:
[0246] 1 <![CDATA[m2]]> <![CDATA[m1]]> 0 0
[0247] |δ xy |:
[0248] 1 <![CDATA[m0]]> 0 0
[0249] It should be noted that in the examples shown above, the bits appended to the mantissa bits for each of the differential coefficients are all zero (0000...), but in other examples, the mantissa bits may not all be zero, for example, the mantissa bits may all be ones (1111...) or a mixture of ones and zeros, such as values close to half, for example, one is followed by zeros (1000...) or zeros are followed by ones (0111...).
[0250] In step S716, the sum decoding logic 620 of the coefficient decoding module 608 uses the identified set of sum bits 508 to determine the sum coefficient. As described above, the sum bits can be encoded in an odd mode, where there are an odd number of steps between consecutive representable sum values from the minimum representable sum value in the sequence to the maximum representable sum value (and therefore there are an even number of encodings in total), or the sum bits can be encoded in an even mode, where there are an even number of steps between consecutive representable sum values from the minimum representable sum value in the sequence to the maximum representable sum value (and therefore there are an odd number of encodings in total). As mentioned above, when the pixel values of the pixels of the block are in an unsigned format, the odd mode may be more appropriate than the even mode, and when the pixel values of the pixels of the block are in a signed format, the even mode may be more appropriate than the odd mode. When the sum decoding logic 620 operates in an odd mode, the decoded sum coefficient Σ′ can be determined based on the value represented by the set of sum bits (Σ), such that The brackets represents the (integer) floor function, and it should be noted that, is the reciprocal of the fraction given in the above example for encoding the sum coefficient in odd mode. This expression is given for illustration only, and it should be noted that the numerator of the second expression ((2 n+3 -8)Σ+2 D-1) can be calculated using simple fixed-point operations (such as a combination of shift operations, addition operations, and multiplication operations). The numerator is divided by the denominator (2 D+1 -2) can be implemented using a lookup table (e.g., when implementing statically configurable system parameters) or by performing a full division operation (e.g., when implementing dynamically configurable system parameters). When the sum decoding logic 620 operates in even mode, the decoded sum coefficient Σ′ can be determined based on the value represented by the set of sum bits (Σ), such that It should be noted that is the reciprocal of the fraction given in the above example for encoding the sum coefficient in even mode. Again, this expression is given for illustration only, and it should be noted that the numerator of the second expression ((2 n+2 )Σ+2 D-1 -1) can be calculated using simple fixed-point operations (such as a combination of shift operations, addition operations, and multiplication operations). The numerator is divided by the denominator (2 D -2) can be implemented using a lookup table (eg when implementing statically configurable system parameters) or by performing a full division operation (eg when implementing dynamically configurable system parameters).
[0251] It should be noted that steps S710 to S716 are independent of each other and may be performed in any order or (at least partially) in parallel / simultaneously. The decoded exponent, decoded sign and decoded mantissa of the differential coefficients and the decoded sum coefficients are passed to the decoded value determination module 610 .
[0252] In step S718, the decoded value determination module 610 determines the decoded value by using the following items to determine the weighted sum of the differential coefficients and the sum coefficients for the pixel block: (i) the determined exponent for the differential coefficient, (ii) the determined sign for the one or more differential coefficients in the differential coefficients, (iii) the determined mantissa for the one or more differential coefficients in the differential coefficients, (iv) the determined sum coefficient, and (v) the corresponding weights for the differential coefficients and the sum coefficients. As mentioned above, in some cases, there may not be any mantissa bits (i.e., M can be equal to zero), but in the main examples described in this article, there are some mantissa bits (i.e., M>0). The differential coefficients are determined using the determined exponents, signs, and mantissas for the differential coefficients. In some examples, the coefficient assembly logic 626 can be configured to generate only differential coefficients with non-zero weights (by avoiding the generation and use of differential coefficients that will not contribute to the result of the weighted sum because the weight of the differential coefficient is zero), thereby reducing power consumption.
[0253] Specifically, in step S718, the coefficient assembly logic 626 assembles the exponent, sign, and mantissa to determine the decoded differential coefficient (δ x ′,δy ′ and δ x ' y ). If for the differential coefficient δ i The exponential value Exp (for i∈x,y,xy) i The coded representation of is zero, then the differential coefficient is determined to be zero. However, if for the differential coefficient δ i The exponential value Exp (for i∈x,y,xy) i The encoding representation is not zero, then by changing the exponent value (e i ), symbol (Sgn i ) and the mantissa (Mnt i ) is assembled to determine the differential coefficient as if the value were in floating point format. However, the differential coefficient is originally in signed integer format, so the coefficient assembly logic 626 can be viewed as converting the floating point representation of the differential coefficient into a signed integer format. For example, the decoded differential coefficient (δ) can be determined according to the following equation x ′,δ y ′ and δ x ' y ):
[0254]
[0255]
[0256]
[0257] Among them, M i is included in the differential coefficient δ i The number of mantissa bits in the compressed data structure (for i∈x,y,xy).
[0258] The output of the coefficient assembly logic 626 is a set of Haar coefficients for a pixel block. As described above, a pixel block may be a continuous pixel block and may include four pixels. In the main example described herein, a pixel block is a 2x2 pixel quad (e.g. Figure 4 ). In these examples, as described above, the set of Haar coefficients includes a sum coefficient (Σ′) and three directional differential coefficients, which respectively indicate the horizontal differentials (δ x ′), vertical differential (δ y ′) and the diagonal differential (δ x ' y ).
[0259] The inverse Haar transform logic 628 uses the set of Haar coefficients to determine a decoded value. Specifically, the inverse Haar transform logic 628 determines a decoded value by determining a result of a weighted sum of the differential coefficients and the sum coefficients for the pixel block.
[0260] In some examples, the decoding unit 602 may operate as a decompression unit such that the decompression unit is intended to recover the pixel value of one (or more) of the pixels of the pixel block. In this case, the corresponding weights for the differential coefficients are predetermined, for example, all of the weights for the differential coefficients may have a magnitude of 1 (but the weights may not all have the same sign) to determine the decoded value representing the pixel of the pixel block 402.
[0261] For example, the sum coefficients and δ can be used x ' y The weight of the differential coefficient is +1 and the x ′ and δ y The weight of the differential coefficient of ' is -1 to determine the decoded value (a') representing the pixel a in the pixel block 402, so that according to To determine a′. Clamping restricts the decoded pixel value to the allowed range for n-bit values: [0,2 n -1]. The "+2" is used in the sum to implement a round-to-nearest mode (ie, round half away from zero), but it should be noted that in other examples, different rounding modes (eg, round away from zero or round towards zero) may be used.
[0262] Similarly, the sum coefficient and δ can be calculated using x ′The weight of the differential coefficient +1 and the weight of the differential coefficient for δ y ′ and δ x ' y The weight of the differential coefficient -1 determines the decoded value (b') representing the pixel b in the pixel block 402, so that according to to determine b′.
[0263] Similarly, the sum coefficient and δ can be calculated using y ′The weight of the differential coefficient +1 and the weight of the differential coefficient for δ x ′ and δ x ' y The weight of the differential coefficient -1 determines the decoded value (c') representing the pixel c in the pixel block 402, so that according to to determine c′.
[0264] Similarly, the sum coefficient and the three differential coefficients δ can be used x ′、δ y ′ and δ x 'y The weight of +1 is used to determine the decoded value (d′) representing pixel d in pixel block 402, so that according to to determine d′.
[0265] The divide-by-4 operation may be implemented by the inverse Haar transform logic 628 by performing a binary right shift of 2 binary bits on the result of the weighted sum.
[0266] In step S720, the determined decoded value is output. Specifically, the decoded value determination module 610 outputs a decoded value, which can be used in any suitable manner, such as being processed by a processing unit, transmitted to another device, or stored in a memory (e.g., in the memory 604), to give just a few examples of how the decoded value can be used.
[0267] In some examples, where the pixel block is a 2x2 pixel quad (e.g., pixel quad 402), four decoded values can be determined for corresponding four pixels of the 2x2 pixel quad by determining the results of four weighted sums of the differential coefficients and the sum coefficients for the pixel block. Each of the four weighted sums uses a corresponding set of weights for the differential coefficients, where the set of weights is set so that the four decoded values represent values at four pixel positions of the 2x2 pixel quad (e.g., as shown in the above four equations).
[0268] In some examples, the compressed data structure 502 may be decoded to determine four decoded values in parallel. For example, there may be four instances of the inverse Haar transform logic 628 that operate in parallel to determine corresponding decoded values (a, b, c, and d, respectively) as described above. Each of the instances may operate in the same manner as the inverse Haar transform logic 628 described above, but only produces a single value (rather than four values). In step S718, each of the inverse Haar transform logic instances may use a different set of weights in the weighted sum so that different pixel values may be determined. In this example, the weights do not need to be changed during operation, so the weights are predetermined for use by different instances of the inverse Haar transform logic 628. For example, the weights may be pre-stored in an instance of the inverse Haar transform logic 628 and / or configured into the hardware (e.g., fixed function circuitry) of the instance of the inverse Haar transform logic 628. Specifically, the first inverse Haar transform logic instance may use a weighted sum for the sum coefficients and δ x ' y The weight of the differential coefficient is +1 and the x ′ and δ y The second Haar inverse transform logic example can use the sum coefficients and δ x′The weight of the differential coefficient +1 and the weight of the differential coefficient for δ y ′ and δ x ' y The weight of the differential coefficient is -1 to determine the decoded value (b') representing pixel b in pixel block 402. The third inverse Haar transform logic example can use the sum of the coefficients and δ y ′The weight of the differential coefficient +1 and the weight of the differential coefficient for δ x ′ and δ x ' y The weight of the differential coefficient is -1 to determine the decoded value (c') representing pixel c in pixel block 402. The fourth inverse Haar transform logic example can use the sum coefficient and the three differential coefficients δ x ′、δ y ′ and δ x ' y The decoded value (d′) representing pixel d in pixel block 402 is determined by using the weight of +1.
[0269] The decoding unit may not be intended to apply filtering to the values, but may be intended to provide representations of the original pixel values. These representations (for pixel quads compressed in a lossless manner) may be exactly the same as the original pixel values, or the representations (for pixel quads compressed in a lossy manner) may be approximations of the original pixel values. This approach is very useful for the frame buffer decompression process.
[0270] In the decoding example described above, the pixel value is associated with a single data channel, and if the pixel value has channel values in multiple channels, the different channels can be encoded separately, i.e., independently. However, in some other examples, each pixel in the pixel block may have channel values in multiple channels (e.g., a red channel, a green channel, a blue channel, and sometimes an alpha channel), where channel reassociation may be performed on the decoded value before outputting the decoded value (between steps S718 and S720). For example, as described above with respect to channel decorrelation during encoding, the green channel may be used as a reference channel. Color reassociation may be performed on the red channel by replacing the decoded pixel value R'(x) for pixel position x in the red channel with the reassociation value R(x), where R(x)=R'(x)+G(x). In addition, color reassociation may be performed on the blue channel by replacing the decoded pixel value B'(x) for pixel position x in the blue channel with the reassociation value B(x), where B(x)=B'(x)+G(x). The re-associated values (R(x) and B(x)) may be clamped to the original pixel value range to avoid wrapping around overflow or underflow when reducing to the original pixel value bit number.
[0271] As described above, color decorrelation and re-correlation can improve the quality of encoding and decoding (ie, reduce the amount of information lost during encoding and decoding), especially when different channels are highly correlated, such as for (near) grayscale images.
[0272] In the example described above, the decoding unit 602 operates as a decompression unit such that the decompression unit is intended to restore the pixel value of one (or more) pixels of the pixel block. In other examples, the decoding unit 602 can be used for texture filtering. In this example, the weights are not predetermined. This allows the weights to be changed at runtime to provide different types of filtering, such as isotropic filtering or anisotropic filtering with different detail levels, different anisotropy ratios, and different anisotropy directions. The weights can be determined based on one or more of the following: (i) the position of the decoded value relative to the 2x2 pixel quad (e.g., as indicated by the u and v coordinates); (ii) an indication of the level of detail to be provided by the decoded value; and (iii) an indication of the amount and / or direction of the anisotropy to be provided by the decoded value. Indications (i), (ii), and (iii) can together determine the differential coefficient (δ x , δ y and δ xy ) is the corresponding weight (w x 、w y and w xy ). Specifically, the weighted sum is given by:
[0273]
[0274] Wherein, when determining the result of the weighted sum, certain scaling, rounding and / or clamping may be included. In these examples, if there is no mantissa bit, the result of the weighted sum of the differential coefficients for the pixel block may be determined by the following operations in step S718: performing a weighting (w ) according to the determined exponents for the corresponding one or more differential coefficients in the non-zero differential coefficients. x 、w y and w xy ), and summing the determined sum coefficient and the shifted weight according to the determined signs of the corresponding one or more differential coefficients in the non-zero differential coefficients. If there are mantissa bits, each mantissa bit can be represented by a new term in the weighted sum, which is obtained by assigning an appropriate weight (w) according to the significant mantissa bits in the mantissa bits. x 、w y or xy) is determined by performing a binary shift of an appropriate number of binary bits. Performing the weighted sum as a sum of shifted versions of the weights and sum coefficients is efficient to implement (in terms of latency, power consumption, and / or silicon area) in hardware (e.g., fixed function circuits) compared to performing multiplication and division operations.
[0275] The precise details of how the weights may be determined during runtime may vary in different examples. Figure 8 shows how the u-coordinate and v-coordinate can be defined by (in Figure 8 Indicated as 802 a ,802 b ,802 c and 802 d A position within a 2x2 pixel quad consisting of pixels a, b, c, and d. Figure 8 As shown in , the coordinates of pixel a are (-1, -1), the coordinates of pixel b are (+1, -1), the coordinates of pixel c are (-1, +1), and the coordinates of pixel d are (+1, +1). Figure 8 The sample position 804 at the coordinates (u, v) within the region of the pixel quad is shown. The region of the pixel quad is Figure 8 8 is shown as a dashed square area 806 having corners defined by the positions of pixels a, b, c, and d.
[0276] As described above, the decoded value (or "sample value") can be determined as w x The weight may be determined as a first function (f1) of u and one or more of: a LOD parameter (p t) indicating the level of detail provided by the decoded value; λ ), anisotropy ratio (p α ) and anisotropy direction Right now w y The weight may be determined as a second function (f2) of v and one or more of: a LOD parameter (p t) indicating the level of detail provided by the decoded value; λ ), anisotropy ratio (p α ) and anisotropy direction Right now w xy The weight may be determined as a third function (f3) of u and v and one or more of: a LOD parameter (p ) indicating the level of detail provided by the decoded value; λ ), anisotropy ratio (p α ) and anisotropy direction Right now A person skilled in the art will know how to implement the functions f1 , f2 and f3 in order to obtain the desired behavior of the filtering process.
[0277] For example, to implement LOD0 filtering (which does not apply blur to pixel quads) without anisotropy (ie, with isotropic filtering), the weights may be determined as w x =u、w y = v and w xy = uv. In this way, as described above: at pixel a, w x =-1,w y = -1, and w xy = +1, and the decoded value is Given; at pixel b, w x =+1,w y = -1, and w xy = -1, and the decoded value is Given; at pixel c, w x =-1,w y = +1, and w xy = -1, and the decoded value is Given; and at pixel d, w x =+1,w y = +1, and w xy = +1, and the decoded value is In addition, at the center of the pixel quad, w x =w y =w xy = 0, and the decoded value is Given. At a general sample position 804 with coordinates uv, w x =u,w y =v, and w xy = uv, and the decoded value is given by Given.
[0278] If the LOD parameter indicates that LOD1 filtering is to be applied (i.e., the pixel quad is to be blurred by halving the resolution), then for any value of u and v (i.e., the value given by Given), w x =w y =w xy = 0, and to avoid discontinuous sampling, the result may be further interpolated (e.g., according to bilinear interpolation) with sample values from three neighboring pixel quads (one horizontally neighboring pixel quad, one vertically neighboring pixel quad, and one diagonally neighboring pixel quad). The neighboring pixel quad to be used for further interpolation may be selected based on which quadrant of the region within the pixel quad (based on the u and v coordinates) the sampled position is located. For example, referring to Figure 8 , if u is positive, the horizontal neighboring pixel quadruplet to the right may be selected for further interpolation, and if u is negative, the horizontal neighboring pixel quadruplet to the left may be selected for further interpolation. Similarly, if v is positive, the vertical neighboring pixel quadruplet below may be selected for further interpolation, and if v is negative, the vertical neighboring pixel quadruplet above may be selected for further interpolation. Similarly, if u and v are both positive, the diagonal neighboring pixels to the lower right may be selected for further interpolation, if u is positive and v is negative, the diagonal neighboring pixels to the upper right may be selected for further interpolation, if u is negative and v is positive, the diagonal neighboring pixels to the lower left may be selected for further interpolation, and if u and v are both negative, the diagonal neighboring pixels to the upper left may be selected for further interpolation. For the zero coordinate (i.e., u=0 or v=0), the choice of the neighboring quadruplet for this dimension is arbitrary, because it does not matter which neighboring pixel quadruplet is selected, the result should still be the same. In a manner similar to LOD0 (as will be apparent to one skilled in the art), the contribution of the sample values from the pixel quad in question and the 3 neighboring pixel quads (i.e., according to some interpolation) at this increasing level of detail may depend on (yielding weights w x 、w y and w xy (i), (ii) and (iii).
[0279] As another example, if anisotropic filtering in the form of horizontal blur is to be applied, then w x =0, w y = v and w xy = 0 and the decoded value is To avoid discontinuous sampling, the result can be further interpolated with sample values from one horizontally adjacent pixel quad (e.g., according to bilinear interpolation). The horizontally adjacent pixel quad to be used for further interpolation can be selected based on which half of the region (left or right) (based on the u coordinate) the sample position is located in within the pixel quad. For example, refer to Figure 8 , if u is positive, the horizontal neighboring pixel quadruplet on the right can be selected for further interpolation, while if u is negative, the horizontal neighboring pixel quadruplet on the left can be selected for further interpolation. If u=0, the choice of the left or right neighboring quadruplet is arbitrary, because it does not matter which neighboring pixel quadruplet is selected, the result should still be the same. In this example, in a manner similar to LOD0 (as is obvious to those skilled in the art), the contributions of the sample values from the pixel quadruplet in question and the neighboring pixel quadruplets (i.e., according to a certain interpolation) at this increasing level of detail depend on (producing the weights w y (i), (ii) and (iii).
[0280] As another example, if anisotropic filtering in the form of vertical blur is to be applied, then w x =u、w y = 0 and w xy = 0 and the decoded value is To avoid discontinuous sampling, the result can be further interpolated with sample values from one vertically adjacent pixel quad (e.g., according to bilinear interpolation). The vertically adjacent pixel quad to be used for further interpolation can be selected based on which half of the region (top or bottom) (based on the v coordinate) the sample position is located within the pixel quad. For example, refer to Figure 8 , if v is positive, the vertically neighboring pixel quad below can be selected for further interpolation, while if v is negative, the vertically neighboring pixel quad above can be selected for further interpolation. If v = 0, the choice of the neighboring quad above or below is arbitrary, because it does not matter which neighboring pixel quad is selected, the result should still be the same. In this example, in a manner similar to LOD0 (as will be apparent to those skilled in the art), the contributions of sample values from the pixel quad in question and the neighboring pixel quads (i.e., according to a certain interpolation) at this increasing level of detail depend on (producing weights w y (i), (ii) and (iii).
[0281] For clarity of this specification, the examples given above are simple examples of how weights may be determined based on one or more of: (i) the position (e.g., as indicated by u and v coordinates) relative to the 2x2 pixel quad for which the decoded value is to be determined; (ii) an indication of the level of detail to be provided by the decoded value; and (iii) an indication of the amount and / or direction of anisotropy to be provided by the decoded value. Those skilled in the art will know how to adjust the weights so that different types of filtering can be applied (e.g., different LODs, different anisotropy ratios, and / or different anisotropy angles).
[0282] Fig. 9A computer system in which the graphics processing system described herein may be implemented is shown. The computer system includes a CPU 902, a GPU 904, a memory 906, a neural network accelerator (NNA) 908, and other devices 914, such as a display 916, a speaker 918, and a camera 922. A processing block 910 (corresponding to the encoding unit 202 and / or the decoding unit 602 or 802) is implemented on the GPU 904. In other examples, one or more of the components depicted may be omitted from the system, and / or the processing block 910 may be implemented on the CPU 902 or within the NNA 908. The components of the computer system may communicate with each other via a communication bus 920. A storage device 912 (corresponding to the memory 204, 604, or 804) is implemented as part of the memory 906.
[0283] Figure 2 , Figure 6 and Figure 8 The encoding unit (202) and / or decoding unit (602, 802) is shown as including multiple functional blocks. This is merely schematic and is not intended to define a strict division between different logical elements of such entities. Each functional block may be provided in any suitable manner. It should be understood that the intermediate values described herein as being formed by the encoding unit or decoding unit do not need to be physically generated by the encoding and / or decoding unit at any point, and may simply represent a logical value that conveniently describes the processing performed by the encoding and / or decoding unit between its input and output.
[0284] The coding and / or decoding unit described herein can be implemented in hardware on an integrated circuit. The coding and / or decoding unit described herein can be configured to perform any of the methods described herein. In general, any of the functions, methods, techniques or components described above can be implemented in software, firmware, hardware (e.g., fixed logic circuitry) or any combination thereof. The terms "module", "functionality", "component", "element", "unit", "block" and "logic" can be used herein to generally represent software, firmware, hardware or any combination thereof. In the case of software implementation, a module, functionality, component, element, unit, block or logic represents a program code, which performs a specified task when executed on a processor. The algorithms and methods described herein can be performed by one or more processors that execute code, and the code prompts the processor to execute the algorithm / method. Examples of computer-readable storage media include random access memory (RAM), read-only memory (ROM), optical disk, flash memory, hard disk storage, and other memory devices that can store instructions or other data using magnetic, optical and other technologies and can be accessed by a machine.
[0285] As used herein, the terms computer program code and computer readable instructions refer to any kind of executable code for a processor, including code expressed in machine language, interpreted language, or scripting language. Executable code includes binary code, machine code, byte code, code that defines an integrated circuit (e.g., a hardware description language or netlist), and code expressed in programming language code such as C, Java, or OpenCL. Executable code can be, for example, any kind of software, firmware, script, module, or library that, when properly executed, processed, interpreted, compiled, run in a virtual machine or other software environment, causes a processor of a computer system supporting the executable code to perform the tasks specified by the code.
[0286] A processor, computer or computer system may be any kind of device, machine or special purpose circuit, or a collection or portion thereof having processing capabilities so that it can execute instructions. A processor may be or include any kind of general or special purpose processor, such as a CPU, GPU, NNA, system on chip, state machine, media processor, application specific integrated circuit (ASIC), programmable logic array, field programmable gate array (FPGA), etc. A computer or computer system may include one or more processors.
[0287] It is also intended to cover software that defines the configuration of hardware as described herein, such as HDL (Hardware Description Language) software, such as for designing integrated circuits or for configuring programmable chips to achieve desired functions. That is, a computer-readable storage medium having computer-readable program code in the form of an integrated circuit definition data set encoded thereon may be provided, which, when processed (i.e., run) in an integrated circuit manufacturing system, configures the system to manufacture encoding and / or decoding units configured to perform any of the methods described herein, or to manufacture encoding and / or decoding units including any of the devices described herein. The integrated circuit definition data set may be, for example, an integrated circuit description.
[0288] Thus, a method of manufacturing the encoding and / or decoding unit described herein at an integrated circuit manufacturing system may be provided. In addition, an integrated circuit definition data set may be provided, which, when processed in an integrated circuit manufacturing system, enables the method of manufacturing the encoding and / or decoding unit to be performed.
[0289] The integrated circuit definition data set may be in the form of computer code, for example as a netlist, code for configuring a programmable chip, as a hardware description language that defines hardware suitable for fabrication at any level in an integrated circuit, including as register transfer level (RTL) code, as a high-level circuit representation such as Verilog or VHDL, and as a low-level circuit representation such as OASIS (RTM) and GDSII. Higher-level representations (e.g., RTL) that logically define hardware suitable for fabrication in an integrated circuit may be processed at a computer system configured to generate a manufacturing definition of the integrated circuit in the context of a software environment that includes definitions of circuit elements and rules for combining those elements to generate a manufacturing definition of the integrated circuit so defined by the representation. As is typically the case with software executed at a computer system to define a machine, one or more intermediate user steps (e.g., providing commands, variables, etc.) may be required to configure the computer system to generate a manufacturing definition of the integrated circuit to execute code that defines the integrated circuit to generate the manufacturing definition of the integrated circuit.
[0290] Now it will target Fig.10 An example of processing an integrated circuit definition data set at an integrated circuit manufacturing system to configure the system to manufacture encoding and / or decoding units is described below.
[0291] Fig.10 An example of an integrated circuit (IC) manufacturing system 1002 is shown, which is configured to manufacture encoding and / or decoding units as described in any of the examples in this document. Specifically, the IC manufacturing system 1002 includes a layout processing system 1004 and an integrated circuit generation system 1006. The IC manufacturing system 1002 is configured to receive an IC definition data set (e.g., defining an encoding and / or decoding unit as described in any of the examples in this document), process the IC definition data set, and generate an IC based on the IC definition data set (e.g., the IC embodies the encoding and / or decoding unit as described in any of the examples in this document). The processing of the IC definition data set configures the IC manufacturing system 1002 to manufacture an integrated circuit that embodies the encoding and / or decoding unit as described in any of the examples in this document.
[0292] The layout processing system 1004 is configured to receive and process an IC definition data set to determine a circuit layout. Methods for determining a circuit layout based on an IC definition data set are known in the art and may, for example, involve synthesizing RTL code to determine a gate-level representation of a circuit to be generated, for example, in terms of logic components (e.g., NAND, NOR, AND, OR, MUX, and FLIP-FLOP components). By determining location information for the logic components, the circuit layout may be determined based on the gate-level representation of the circuit. This may be done automatically or with user involvement in order to optimize the circuit layout. When the layout processing system 1004 has determined the circuit layout, it may output the circuit layout definition to the IC generation system 1006. The circuit layout definition may be, for example, a circuit layout description.
[0293] As is known in the art, IC production system 1006 produces ICs according to the circuit layout definition. For example, IC production system 1006 may implement a semiconductor device manufacturing process to produce ICs, which may involve a multi-step sequence of photolithography and chemical processing steps during which electronic circuits are gradually formed on a wafer made of semiconductor material. The circuit layout definition may be in the form of a mask that may be used in a photolithography process to produce the IC according to the circuit definition. Alternatively, the circuit layout definition provided to IC production system 1006 may be in the form of a computer readable code that IC production system 1006 may use to form a suitable mask for producing the IC.
[0294] The different processes performed by the IC manufacturing system 1002 may all be implemented in one location, such as by one party. Alternatively, the IC manufacturing system 1002 may be a distributed system such that some processes may be performed in different locations and may be performed by different parties. For example, some segments of the following stages may be performed in different locations and / or by different parties: (i) synthesizing RTL code representing an IC definition data set to form a gate-level representation of a circuit to be produced; (ii) generating a circuit layout based on the gate-level representation; (iii) forming a mask based on the circuit layout; and (iv) using the mask to manufacture the integrated circuit.
[0295] In other examples, processing of the integrated circuit definition data set at the integrated circuit manufacturing system may configure the system to manufacture encoding and / or decoding units in which the IC definition data set is not processed to determine the circuit layout. For example, the integrated circuit definition data set may define a configuration of a reconfigurable processor, such as an FPGA, and processing of the data set may configure the IC manufacturing system to generate (e.g., by loading the configuration data into the FPGA) a reconfigurable processor having the defined configuration.
[0296] In some embodiments, when processed in an integrated circuit manufacturing system, the integrated circuit manufacturing definition data set can enable the integrated circuit manufacturing system to generate an apparatus as described herein. For example, through the integrated circuit manufacturing definition data set, the integrated circuit manufacturing system can generate an apparatus as described herein. Fig.10 An integrated circuit manufacturing system may be configured in the manner described to manufacture the apparatus described herein.
[0297] In some examples, the integrated circuit definition data set may include software that runs on, or in combination with, hardware defined at the data set. Fig.10 In the example shown, the IC production system can be further configured by the integrated circuit definition dataset to load firmware onto the integrated circuit according to the program code defined at the integrated circuit definition dataset when manufacturing the integrated circuit, or otherwise provide the integrated circuit with program code for use with the integrated circuit.
[0298] Compared with known implementations, the implementation of the concepts set forth in this application in devices, equipment, modules and / or systems (and in the methods implemented herein) can improve performance. Performance improvements may include one or more of improved computing performance, reduced latency, increased throughput and / or reduced power consumption. During the manufacture of such devices, devices, modules and systems (e.g., in integrated circuits), a trade-off may be made between performance improvements and physical implementations to improve manufacturing methods. For example, a trade-off may be made between performance improvements and layout area to match the performance of known implementations, but using less silicon. For example, this can be accomplished by reusing functional blocks in a serial manner or sharing functional blocks between elements of devices, devices, modules and / or systems. In contrast, the concepts set forth in this application that cause improvements in the physical implementations of devices, devices, modules and systems (such as reduced silicon area) may be weighed against performance improvements. This can be accomplished, for example, by manufacturing multiple instances of a module within a predefined area budget.
[0299] Applicants hereby independently disclose each individual feature described herein and any combination of two or more such features, to the extent that such feature or combination can be implemented based on the specification as a whole in view of the common general knowledge of a person skilled in the art, regardless of whether such feature or combination of features solves any problem disclosed herein. In view of the foregoing description, it will be clear to those skilled in the art that various modifications can be made within the scope of the invention.
Claims
1. A method for decoding a compressed data structure to determine a decoded value based on a system parameter in a computer system, wherein the compressed data structure encodes a set of Haar coefficients for a pixel block, wherein the set of Haar coefficients includes a plurality of differential coefficients and sum coefficients, wherein the first portion of the compressed data structure includes a set of exponent bits representing an exponent for the differential coefficient, the second portion of the compressed data structure includes a set of sign bits representing a sign for the differential coefficient, and the third portion of the compressed data structure includes a set of sum bits representing the sum coefficient, wherein the number of bits in the first portion, the second portion, and the third portion of the compressed data structure is consistent with the system parameter, The method include: unpacking the compressed data structure to identify the set of exponent bits, the set of sign bits, and the set of sum bits; determining an exponent for the differential coefficients using the identified set of exponent bits; determining a sign for one or more of the differential coefficients using the identified set of sign bits; determining the sum coefficient using the identified set of sum bits; determining the decoded value by determining a result of a weighted sum of the differential coefficients and the sum coefficients for the pixel block using: (i) determined exponents for the differential coefficients, (ii) determined signs for the one or more of the differential coefficients, (iii) the determined sum coefficient, and (iv) respective weights for the differential coefficients and the sum coefficient; as well as The determined decoded value is output. 2 . The method of claim 1 , wherein one or more of the system parameters define the number of exponent bits in the set of exponent bits.
3. The method according to claim 1 or 2, wherein the compressed data structure is unpacked include: reading the first portion of the compressed data structure and determining, based on the set of exponent bits, how many of the differential coefficients are non-zero; as well as The number of sign bits in the set of sign bits is determined to be equal to the number of the differential coefficients that are non-zero.
4. The method of claim 3, wherein the unpacking the compressed data structure further comprises determining the number of sum bits in the set of sum bits using: (i) one or more of the system parameters, and (ii) the determined number of sign bits in the set of sign bits.
5. A method as claimed in any preceding claim, wherein the fourth portion of the compressed data structure includes a set of mantissa bits representing a mantissa for the differential coefficient, wherein the number of bits in the fourth portion of the compressed data structure is consistent with the system parameter, and wherein the unpacking of the compressed data structure identifies the set of mantissa bits, wherein the method further comprises determining a mantissa of one or more of the differential coefficients using the identified set of mantissa bits, and wherein the determining of the decoded value by determining the result of a weighted sum of the differential coefficients and the sum coefficients for the pixel block further uses the determined mantissa for the one or more of the differential coefficients.
6. The method of claim 5 when dependent upon claim 4, wherein said unpacking of said compressed data structure further comprises determining the number of mantissa bits in said set of mantissa bits using: (i) one or more of said system parameters, (ii) a determined number of sign bits in said set of sign bits, and (iii) a determined number of sum bits in said set of sum bits.
7. A method as claimed in claim 5 or 6, wherein, in order to encode the pixel block, the compressed data structure only includes the set of exponent bits in the first part, the set of sign bits in the second part, the set of sum bits in the third part, and the set of mantissa bits in the fourth part, so that the number of bits N in the compressed data structure is equal to the sum of the number of exponent bits in the set of exponent bits, the number of sign bits in the set of sign bits, the number of sum bits in the set of sum bits, and the number of mantissa bits in the set of mantissa bits.
8. A method as claimed in any preceding claim, wherein the determining the decoded value by determining the result of a weighted sum of the differential coefficient and the sum coefficient for the pixel block comprises determining the differential coefficient using a determined exponent and sign for the differential coefficient.
9. A method as claimed in claim 8 when dependent on any one of claims 5 to 7, wherein said determining said differential coefficient further uses a determined mantissa for said differential coefficient.
10. A method as claimed in any preceding claim, wherein said determining the decoded value comprises performing a binary right shift of the result of the weighted sum by 2 binary bits, thereby dividing the result of the weighted sum by 4, and wherein rounding is applied to determine the decoded value.
11. A method as claimed in any preceding claim, wherein the result of determining a weighted sum of the differential coefficients and the sum coefficients for the pixel block is include: performing a binary shift of the weights according to the determined exponent for a corresponding one or more of the differential coefficients that are non-zero; as well as The determined sum coefficient and the shifted weight are summed according to the determined signs for the corresponding one or more of the differential coefficients that are non-zero.
12. A method as claimed in any preceding claim, wherein the respective weights for the differential coefficients are predetermined, and wherein the decoded value represents a value at a pixel position of one of the pixels of the pixel block.
13. The method of any one of claims 1 to 11, further comprising determining the corresponding weights for the differential coefficients, wherein the weights are determined based on one or more of the following: the position of the decoded value relative to the pixel block to be determined; an indication of a level of detail provided by the decoded value; as well as An indication of the amount and / or direction of anisotropy to be provided by the decoded value.
14. A method as claimed in any preceding claim, wherein each pixel in the pixel block is represented by an n-bit pixel value, wherein n is one of the system parameters; and The compressed data structure has N bits, wherein N is one of the system parameters.
15. A method as claimed in any preceding claim, wherein the number of sign bits in the set of sign bits is equal to the number of the differential coefficients that are non-zero, and wherein the identified set of sign bits is used to determine the sign of the one or more of the differential coefficients include: For each of the differential coefficients that are non-zero, if a corresponding sign bit is set to a first value, the sign of the differential coefficient is determined to be positive, and if the corresponding sign bit is set to a second value, the sign of the differential coefficient is determined to be negative.
16. A method as claimed in any preceding claim, wherein the pixel values of the pixels of the block are in an unsigned format, and wherein the determining the sum coefficient using the identified set of sum bits comprises mapping the sum bits to sum values from a sequence of representable sum values while operating in an odd mode, in which there are an odd number of steps between consecutive representable sum values from a smallest representable sum value to a largest representable sum value in the sequence.
17. The method of any one of claims 1 to 15, wherein the pixel values of the pixels of the block are in a signed format, and wherein determining the sum coefficient using the identified set of sum bits comprises mapping the sum bits to sum values from a sequence of representable sum values while operating in an even mode, wherein there are an even number of steps between consecutive representable sum values from the minimum representable sum value to the maximum representable sum value in the sequence.
18. A method as claimed in any preceding claim, wherein the use of the identified set of exponent bits to determine an exponent for the differential coefficient include: For the differential coefficient δ i For each differential coefficient in, determine the exponential value Exp i The encoding representation of ; as well as For each of the differential coefficients, the exponent value e i Set equal to Exp i -1+e i,min , where e i,min is one of the system parameters and indicates the differential coefficient δ i The minimum exponent value of .
19. A decoding unit, the decoding unit being configured to decode a compressed data structure according to a system parameter in a computer system to determine a decoded value, wherein the compressed data structure encodes a set of Haar coefficients for a pixel block, wherein the set of Haar coefficients comprises a plurality of differential coefficients and a sum coefficient, wherein the first portion of the compressed data structure includes a set of exponent bits representing an exponent for the differential coefficient, the second portion of the compressed data structure includes a set of sign bits representing a sign for the differential coefficient, and the third portion of the compressed data structure includes a set of sum bits representing the sum coefficient, wherein the number of bits in the first portion, the second portion, and the third portion of the compressed data structure is consistent with the system parameter, The decoding unit include: an unpacking unit configured to unpack the compressed data structure to identify the set of exponent bits, the set of sign bits, and the set of sum bits; A coefficient decoding module, wherein the coefficient decoding module is configured to: determining an exponent for the differential coefficient using the identified set of exponent bits; determining a sign for one or more of the differential coefficients using the identified set of sign bits; as well as determining the sum coefficient using the identified set of sum bits; as well as A decoding value determination module, wherein the decoding value determination module is configured to: determining the decoded value by determining a result of a weighted sum of the differential coefficients and the sum coefficients for the pixel block using: (i) determined exponents for the differential coefficients, (ii) determined signs for the one or more of the differential coefficients, (iii) the determined sum coefficient, and (iv) respective weights for the differential coefficients and the sum coefficient; as well as The determined decoded value is output.
20. A computer readable code configured to cause the method of any one of claims 1 to 18 to be performed when the code is run.
21. An integrated circuit definition data set which, when processed in an integrated circuit manufacturing system, configures the integrated circuit manufacturing system to manufacture the decoding unit of claim 19.
Citation Information
Patent Citations
Coding blocks of pixels
GB2603559A
Encoding a block of pixels
GB2622122A
