The technology described herein relates to a method of and apparatus for encoding an array of data elements. It also relates to the corresponding decoding method and apparatus.
It is common to encode arrays of data elements, such as arrays of graphics data values (e.g. frames for display or graphics textures), so as to compress the data in order to reduce bandwidth and memory consumption. This is particularly desirable in data processing apparatus, e.g. of portable devices, where processing resources and processing power may be limited.
Arrays of data elements are often divided into smaller blocks of data elements and then encoded or decoded on a block by block basis. This can allow partial updating of, or random access to, data elements of the encoded array without needing to encode or decode the entire array each time a data element needs to be updated or accessed. This is particularly the case, for example, in graphics processing apparatus where partial updating of a frame or random access into a texture may be desired.
Some encoding schemes are lossy. For example, the encoding process leads to a reduction in the precision of the data elements of the array being encoded that cannot be recovered when decoding the encoded data. The degree to which these lossy encoding schemes compress the data may be independent of the content of the array and so the size of the resultant encoded blocks may be fixed for these schemes. For example, in encoding schemes that comprise reducing the number bits used to represent each data element in the block, the amount of compression will be fixed by the number of bits that are removed. However, the resultant loss of precision when using these “fixed” encoding schemes is often undesirable in that it can adversely affect the quality of a desired output. For example, with graphics data, a loss of precision can adversely affect the appearance of the graphics output.
For the purposes of the present disclosure, an encoding scheme that provides encoded blocks of fixed data size (a “fixed” encoding scheme) may be an encoding scheme for which, for plural blocks having the same array size (e.g. in terms of number of data elements) but having different data content (e.g. in terms of data values for the data elements), the data size of the encoded versions of those blocks (e.g. in terms of bits or bytes) that are provided when using that encoding scheme is the same.
Other encoding schemes are substantially lossless. For example, the original precision of the data elements of the array being encoded can be substantially recovered when decoding the encoded data. However, in lossless encoding schemes, the degree to which an array of data elements can be compressed may be dependent on the content of the array and so the size of the resultant encoded blocks may not be fixed for these schemes. For example, blocks of substantially uniform data values tend to compress well, whereas blocks of highly varied data values tend not to compress so well. Thus, in the case of graphics data, blocks of substantially uniform appearance (e.g. substantially uniform colour) tend to compress well, whereas blocks of highly varied appearance tend not to compress so well.
Therefore, for some blocks of data, a large amount of compression can be achieved when using these “non-fixed” encoding schemes. However, for other blocks of data, little or no compression can be achieved when using non-fixed encoding schemes. Indeed, in some extreme cases, non-fixed encoding schemes may even increase the amount of data that needs to be stored for a given block. This can increase memory and bandwidth consumption and waste processing power. Non-fixed encoding schemes can also lead to unpredictable memory use, which can require relatively more complex bandwidth and memory management schemes.
For the purposes of the present disclosure, an encoding scheme that provides encoded blocks of non-fixed data size (a “non-fixed” encoding scheme) may be an encoding scheme for which, for plural blocks having the same array size (e.g. in terms of number of data elements) but having different data content (e.g. in terms of data values for the data elements), the data size of the encoded versions of those blocks (e.g. in terms of bits or bytes) that are provided when using that encoding scheme is not the same.
The Applicants believe that there remains scope for improved arrangements for encoding and decoding arrays of data elements.
The drawings show elements of a data processing apparatus and system that are relevant to embodiments of the technology described herein. As will be appreciated by those skilled in the art there may be other elements of the data processing apparatus and system that are not illustrated in the drawings. It should also be noted here that the drawings are only schematic, and that, for example, in practice the shown elements may share significant hardware circuits, even though they are shown schematically as separate elements in the drawings.