Method for encoding data elements and method, device and medium for decoding data stream
Through frequency transformation and bit plane encoding technology, image data and texture data are converted into fixed-sized data packets, solving the problem of high storage and bandwidth requirements in the existing technology, and achieving efficient compression and encoding, which is suitable for resource-limited resources. equipment and provide lossless compensation layer.
Patent Information
- Application Number
- CN201980078113.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-12-03
- Filing Date
- 2019-12-03
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2039-12-03
AI Technical Summary
The prior art is difficult to effectively reduce storage and bandwidth requirements when encoding image data and texture data, especially in devices with limited resources, and the lossless compression format cannot guarantee fixed-rate compression.
Through frequency transformation operations, the data element array is converted into a set of frequency domain coefficients and represented as a bit plane array. The bit plane array is encoded into a fixed-size data grouping using recursive segment subdivision and encoding methods, and the bit plane array is encoded into a fixed-size data grouping, using a bit plane sequence The position information of the non-zero bit value in the code is encoded.
Fixed-rate compression is achieved, reducing storage and bandwidth requirements, providing higher compression efficiency and throughput, suitable for resource-limited devices, and in some cases, lossless compensation layers can be provided to ensure the integrity of the raw data.
Smart Images

Figure CN113170140B_ABST
Abstract
Description
Technical Field
[0001] The technology described herein relates to methods and apparatus for encoding data in a data processing system (e.g., for storage in a memory), and in particular to methods for compressing and storing image data such as texture or frame buffer data in a graphics processing system. A corresponding decoding method and apparatus are also described. Background Art
[0002] The data processing system typically stores the generated image data in a frame buffer. The frame buffer typically contains a complete set of data such as a frame (image) to be displayed, including, for example, the color value of each (for example) pixel within the frame. A suitable display driver can then read the contents of the frame buffer and use the image data stored therein to drive the display to display the desired frame (image).
[0003] However, the storage and access of image data in a frame buffer ("frame buffer data") may place relatively high demands on, for example, the storage and / or bandwidth resources of a data processing system (or conversely, result in reduced performance when such demands are not met). In order to reduce the burden placed on the data processing system, it is therefore desirable to be able to store such frame buffer data in a "compressed" format. This is particularly desirable in data processing apparatus such as portable devices (where processing resources and power may be relatively limited) such as digital cameras or mobile devices including such cameras.
[0004] Similar considerations apply to various other situations where it is desirable to reduce the amount of data required to store and / or transmit a piece of information. Again in the context of graphics processing, another example would be when storing texture data, such as in the form of an array of texture elements (or "texels"), each of which represents given texture data (such as color, brightness, etc.), which can then be mapped to corresponding sampling locations (pixels) of the generated rendered output. Again, the storage and access of this texture data can place relatively high storage and / or bandwidth requirements on the data processing system.
[0005] It is therefore common to encode arrays of data elements, such as arrays of image data values, in order to compress the data, thereby reducing bandwidth and memory consumption. To this end, various data compression schemes have been developed.
[0006] However, Applicants believe that there is still room for more efficient arrangements in encoding (compressing) data. Summary of the invention
[0007] In a first aspect, the present disclosure provides a method of encoding an array of data elements representing a spatial distribution of values, the method comprising: performing a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients; representing the set of frequency domain coefficients as a plurality of bit plane arrays, each bit plane array representing a particular bit position of a value of a frequency domain coefficient, wherein each bit plane array comprises a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array; and encoding the set of frequency domain coefficients into a data packet of fixed size by encoding the bit plane arrays in a bit plane sequence, the encoding working downward from the bit plane array representing the most significant bit until the data packet is full; wherein each bit plane array is encoded by: (i) subdividing the corresponding bit plane array being encoded into corresponding segments and, where there is available space in the data packet, including in the data packet data indicating the position of any segment in the bit plane array that first contains one or more coefficients having non-zero bit values in the bit plane sequence, and then (ii) recursively subdividing any such newly active segments in the corresponding bit plane array being encoded and any segments in the previous bit plane array in the bit plane sequence in which the first non-zero bit value occurred, into corresponding sub-segments and including in the data packet data indicating the position of any sub-segment in the bit plane array in which the first non-zero bit value in the bit plane sequence occurred, until the position of the coefficient in the bit plane array in which the first non-zero bit value occurred is indicated.
[0008] In a second aspect, the present disclosure provides a method for decoding a data stream, the data stream comprising fixed-size data packets, the fixed-size data packets encoding a set of frequency domain coefficients as a sequence of bit plane arrays, each bit plane array in the bit plane sequence representing a specific bit position of a value of a frequency domain coefficient, wherein each bit plane array comprises a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array, and wherein each bit plane array is encoded by: (i) subdividing the corresponding bit plane array being encoded into corresponding segments and, if there is available space in the data packet, including in the data packet an indication of the bit position in the bit plane array; wherein the first non-zero bit value in the bit plane array is indicated, and the first non-zero bit value in the bit plane array is indicated, so that the fixed-size data packet comprises: for the first non-zero bit value in the first non-zero bit value in the bit plane array, the first non-zero bit value in ... for each bit plane array in a sequence of bit planes, data indicating the position of any segment in the bit plane array that contains one or more coefficients having non-zero bit values for the first time in the bit plane sequence, and data indicating the position within the bit plane array of any sub-segment of any such newly active segment in the bit plane array, and data indicating any sub-segment of any segment in a previous bit plane array in the bit plane sequence where the first non-zero bit value appeared, for those sub-segments where the first non-zero bit value in the bit plane sequence appeared in the bit plane array, until the position of the frequency domain coefficient in the bit plane array where the first non-zero bit value appeared is indicated, the method comprising: Determine the position of each bit plane array in the bit plane sequence encoded in the fixed-size data group of the frequency domain coefficients according to the grouping, for which a non-zero bit value first appears in the bit plane array; use the identified position of the frequency domain coefficients of each bit plane array to generate a plurality of bit plane arrays, each bit plane array in the bit plane sequence represents a specific bit position of the value of the frequency domain coefficient, wherein each bit plane array includes a bit array corresponding to the bit value of each frequency domain coefficient in the frequency domain coefficients at the bit position represented by the bit plane array; combine the generated bit plane arrays to generate a set of frequency domain coefficients; and use the set of frequency domain coefficients to obtain a decoded output.
[0009] In a third aspect, the present disclosure provides an apparatus for encoding an array of data elements representing a spatial distribution of values, the apparatus comprising an encoder, the encoder comprising: a transform circuit, the transform circuit being used to perform a frequency transform operation on the data element array to generate a corresponding set of frequency domain coefficients; a bit plane encoding circuit, the bit plane encoding circuit being used to represent the set of frequency domain coefficients as a plurality of bit plane arrays, each bit plane array representing a specific bit position of the value of the frequency domain coefficient, wherein each bit plane array comprises a bit array corresponding to the bit value of each frequency domain coefficient in the frequency domain coefficients at the bit position represented by the bit plane array; and an encoding circuit, the encoding circuit being configured to encode the set of bit plane arrays representing the frequency domain coefficients into a data packet of a fixed size by encoding the bit plane arrays in a bit plane sequence, the encoding working downward from the bit plane array representing the most significant bit until The data packet is full; wherein the encoding circuit is configured to encode each bit plane array by: (i) subdividing the corresponding bit plane array being encoded into corresponding segments and, if there is available space in the data packet, including in the data packet data indicating the position of any segment in the bit plane array that first contains one or more coefficients having non-zero bit values in the bit plane sequence, and then (ii) recursively subdividing any such new active segments in the corresponding bit plane array being encoded and any segments in which the first non-zero bit value appears in the previous bit plane array in the bit plane sequence, into corresponding sub-segments and including in the data packet data indicating the position of any sub-segment in the bit plane array in which the first non-zero bit value appears in the bit plane sequence, until the position of the coefficient in the bit plane array in which the first non-zero bit value appears is indicated.
[0010] In a fourth aspect, the present disclosure provides an apparatus for decoding a data stream, the data stream comprising fixed-size data packets, the fixed-size data packets encoding a set of frequency domain coefficients as a sequence of bit plane arrays, each bit plane array in the bit plane sequence representing a specific bit position of a value of a frequency domain coefficient, wherein each bit plane array comprises a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array, and wherein each bit plane array is encoded by: (i) subdividing the corresponding bit plane array being encoded into corresponding segments and, if there is available space in the data packet, including in the data packet an indication of the first bit plane array containing a frequency domain coefficient in the bit plane sequence; data indicating the position of any segment in the bit plane array having one or more coefficients having non-zero bit values, and then (ii) recursively subdividing any such newly active segment in the corresponding bit plane array being encoded and any segment in which the first non-zero bit value occurs in the previous bit plane array in the bit plane sequence into respective sub-segments, and including in the data packet data indicating the position of any sub-segment in the bit plane array in which the first non-zero bit value occurs in the bit plane sequence until the position of the coefficient in the bit plane array in which the first non-zero bit value occurs is indicated, so that the fixed size data packet comprises: for each bit plane array in the bit plane sequence encoded in the fixed size data packet, data indicating the position of any segment in the bit-plane array that contains one or more coefficients having non-zero bit values for the first time in the bit-plane sequence, and data indicating the position within the bit-plane array of any sub-segment of any such newly active segment in the bit-plane array, and data indicating any sub-segment of any segment in a previous bit-plane array in the bit-plane sequence where the first non-zero bit value appeared, for those sub-segments where the first non-zero bit value in the bit-plane sequence appeared in the bit-plane array, until the position of the frequency-domain coefficient in the bit-plane array where the first non-zero bit value appeared is indicated, the apparatus comprising a decoder, the decoder comprising: an input circuit configured to receive a fixed-size a data packet for determining a position of each bit plane array in the sequence of bit planes encoded in the fixed-size data packet of the frequency domain coefficients for which a non-zero bit value first occurs in the bit plane array; a bit plane decoding circuit configured to generate a plurality of bit plane arrays using the identified positions of the frequency domain coefficients of each bit plane array, each bit plane array in the sequence of bit planes representing a particular bit position of the value of the frequency domain coefficient, wherein each bit plane array includes a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array; and for combining the generated bit plane arrays to generate a set of frequency domain coefficients;and an output circuit configured to obtain a decoded output using the set of frequency domain coefficients. ;
[0011] In a fifth aspect, the present disclosure provides a computer readable storage medium storing computer software which, when executed on a data processor, performs a method according to the preceding claim. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Various embodiments of the technology described herein will now be described, by way of example only, and with reference to the accompanying drawings, in which:
[0013] Figure 1 An example of a data processing system is schematically shown in which embodiments of the techniques described herein may be implemented.
[0014] Figure 2 Schematically illustrates a fixed rate encoding process according to an embodiment of the technology described herein;
[0015] Figure 3A shows an example of a typical 4×4 block of data values (e.g., as may be obtained after a frequency domain transform) for encoding according to an embodiment of the techniques described herein, and Figure 3B shows how the block of data values can be decomposed into a set of binary bit planes;
[0016] Figure 4 is a flowchart showing an overview of an encoding process according to an embodiment of the technology described herein;
[0017] Figure 5 is a flowchart illustrating how each bit-plane array in a bit-plane sequence may be encoded according to an embodiment of the techniques described herein;
[0018] Figure 6 shows an encoding according to an embodiment of the technology described herein Figure 3B Examples of data values represented by the bit planes shown;
[0019] Figure 7 schematically illustrates an example of encoding an 8×8 block according to an implementation of the techniques described herein;
[0020] Figure 8 schematically illustrates a multi-plane encoding process according to an embodiment of the technology described herein;
[0021] Fig. 9A and Fig. 9B is a flowchart of an encoding process according to an embodiment of the technology described herein;
[0022] Fig.10schematically illustrates a decoding process according to an embodiment of the technology described herein;
[0023] Fig.11 An example of a decoding process according to an implementation of the techniques described herein is shown;
[0024] Fig.12 schematically illustrates an example of a lossless extension of a coding scheme according to an implementation of the techniques described herein;
[0025] Fig.13 shows an example of a lossy transform; and
[0026] Fig.14 An example of how a lossless transform may be implemented for use with an implementation of the techniques described herein is schematically shown.
[0027] The accompanying drawings illustrate elements of data processing devices and systems associated with 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 device that are not shown in the accompanying drawings. It should also be noted here that the accompanying drawings are only schematic, and for example, in practice, the elements shown may share important hardware circuits, even if they are schematically shown as independent elements in the accompanying drawings (or conversely, when the elements are shown as sharing important hardware circuits, these elements may include independent elements in practice). DETAILED DESCRIPTION
[0028] A first embodiment of the technology described herein includes a method of encoding an array of data elements representing a spatial distribution of values, the method comprising:
[0029] performing a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients;
[0030] representing the set of frequency domain coefficients as a plurality of bit plane arrays, each bit plane array representing a particular bit position of a frequency domain coefficient value, wherein each bit plane array includes an array of bits corresponding to a bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array; and
[0031] encoding a set of frequency domain coefficients into a data packet having a fixed size by encoding the bit plane array in a bit plane sequence, the encoding working downwards from the bit plane array representing the most significant bit until the data packet is full;
[0032] wherein each bit-plane array is encoded by subdividing the bit-plane array into respective segments and, where there is space available in the data packet, including in the data packet data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the bit-plane sequence, and then recursively subdividing any such newly active segment in the bit-plane array and any segment in the previous bit-plane array in the bit-plane sequence in which the first non-zero bit value occurs, into respective sub-segments and including in the data packet data indicating the position of any sub-segment in the bit-plane array in which the first non-zero bit value in the bit-plane sequence occurs, until the position of the coefficient in the bit-plane array in which the first non-zero bit value occurs is indicated.
[0033] A second embodiment of the technology described herein includes an apparatus for encoding an array of data elements representing a spatial distribution of values, the apparatus comprising an encoder, the encoder comprising:
[0034] transform circuitry for performing a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients;
[0035] a bit-plane encoding circuit for representing a set of frequency-domain coefficients as a plurality of bit-plane arrays, each bit-plane array representing a particular bit position of a value of a frequency-domain coefficient, wherein each bit-plane array includes an array of bits corresponding to a bit value of each of the frequency-domain coefficients at the bit position represented by the bit-plane array; and
[0036] an encoding circuit configured to encode a set of bit-plane arrays representing frequency domain coefficients into a data packet having a fixed size by encoding the bit-plane arrays in a sequence of bit-planes, the encoding working downward from the bit-plane arrays representing the most significant bits until the data packet is full;
[0037] wherein the encoding circuit is configured to encode the bit plane array by subdividing each bit plane array into respective segments and, where there is available space in the data packet, include in the data packet data indicating the position of any segment in the bit plane array that first contains one or more coefficients having non-zero bit values in the bit plane sequence, and then recursively subdivide any such newly active segments in the bit plane array and any segments in the previous bit plane array in the bit plane sequence in which the first non-zero bit value appears, into respective sub-segments and include in the data packet data indicating the position of any sub-segment in the bit plane array in which the first non-zero bit value in the bit plane sequence appears, until the position of the coefficient in the bit plane array in which the first non-zero bit value appears is indicated.
[0038] In the techniques described herein, when encoding an array of data elements, such as a block of image data, a frequency transform operation is first applied to the array of data elements to transform the spatial representation of the data array into the frequency domain. The frequency domain coefficients can be stored (and in one embodiment are stored) using a sign-magnitude format, i.e., where a single bit is used to indicate a sign value (e.g., "1" represents positive and "0" represents negative, or vice versa), and where the magnitude is the absolute value of the coefficient (and therefore the most significant bit is also the most non-zero bit). Bit-plane encoding is then performed on the frequency domain coefficients to decompose the (absolute) magnitude of the frequency domain coefficients into a set of bit-plane arrays containing corresponding (binary) bit values at each bit position of each frequency domain coefficient in the frequency domain coefficients. The data represented by the bit-planes is then encoded by packing the bits from the most significant (top) bit-plane downwards into fixed-size data packets until the data packets are full.
[0039] Therefore, when the data packet is full, the encoding stops. In this way, it is ensured that data packets with the required fixed size can be generated.
[0040] Thus, the techniques described herein can provide fixed rate compression (fixed bit rate), wherein arrays of data elements, such as blocks of image data, can be encoded (compressed) into fixed size data packets.
[0041] Naturally, because the techniques described herein encode to a fixed bit rate, compression of fixed-size data packets is inherently "lossy" (because once the fixed-size data packet is full, any remaining bits are not included in the data packet). However, for many applications, some loss of output (image) fidelity is acceptable, and it is more desirable to be able to guarantee a given bandwidth (bit rate) (which the techniques described herein can provide).
[0042] (In contrast, although existing lossless compression formats can reduce average bandwidth, the resulting data packet size is variable, so that lossless compression formats cannot guarantee fixed-rate compression, and thus memory systems using lossless compression must generally provide for "worst-case" bandwidth even if typical bandwidth is lower.)
[0043] In addition, in the techniques described herein, information within each bit plane array is encoded in a context-dependent manner, where the bit plane information is encoded based on information in previous bit planes (layers) in the bit plane sequence. In this way, the information can be encoded in a particularly efficient manner. For example, compared to other lossy compression formats (such as JPEG or MPEG) that typically seek to achieve higher compression quality, the techniques described herein can provide more efficient compression, for example to facilitate higher throughput. This may be particularly desirable for higher bandwidth (e.g., media) applications.
[0044] Specifically, to encode bitplane information, the techniques described herein encode the position of coefficients recursively appearing in each bitplane by subdividing the bitplane array into corresponding segments (e.g., quadrants). The position indicates which segment (quadrant) has a new "active" frequency domain coefficient in that bitplane (i.e., a frequency domain coefficient whose first non-zero bit value in the bitplane sequence appears in that bitplane), and then for any segment that includes a new active frequency domain coefficient in that bitplane, and for any segment or subsegments that were indicated as (newly) active during the encoding of the previous (higher) bitplane in the bitplane sequence, those segments are subdivided into further subsegments and indicate which of these subsegments include any new active coefficients in that bitplane, and so on, as needed, down to the position of each frequency domain coefficient within the bitplane under consideration (i.e., the position of each coefficient in the bitplane array).
[0045] In addition, the encoding of each consecutive bit-plane in one embodiment encodes (indicates) the position of the newly active segment relative to the previous (higher) bit-plane (level) in the bit-plane sequence, so that, for example, if a segment had previously been indicated as including a newly active coefficient in a higher bit-plane, for the next bit-plane downward, the active "sub-segment" indication indicates which (if any) of the remaining (e.g., three, in terms of quadrants) "sub-segments" "newly" includes the active coefficient (i.e., the first non-zero bit value in the bit-plane sequence for the frequency domain coefficients).
[0046] Thus, when encoding a given bitplane, any "newly active" segments in that bitplane are indicated, i.e., those segments in that bitplane where a non-zero bit value for at least one of the frequency-domain coefficients included in the segment occurs for the first time in the sequence of bitplanes. However, once a segment has been made active ("activated") in this manner, it remains "active" during the encoding of the next (lower) bitplane in the sequence of bitplanes (and all subsequent bitplanes in the sequence of bitplanes), in one embodiment. The positions of any newly active sub-segments, and ultimately any newly active coefficients, in each currently active segment (i.e., any segments that are newly active in the current bitplane, and any segments that are newly active in previous bitplanes in the sequence of bitplanes) may be encoded during the encoding of a particular bitplane, in one embodiment using a variable length coding scheme, e.g., as described later.
[0047] Thus, the encoding of each bit-plane is contextually dependent on (and indicates changes relative to) the previous bit-plane (layer) in the sequence of bit-planes.
[0048] As long as there is still available space in the data packet, the techniques described herein, in one embodiment, then add further data to the data packet, such as data indicating the sign value of the newly active coefficient in the bit-plane array being encoded and / or the so-called "refined bit value" of the bit-plane array. ("Refined bit value" means the bit value of any coefficient in the bit-plane under consideration that appeared in the previous bit-plane in the bit-plane sequence for the first non-zero bit value, i.e., the bit value of the less significant bit position after the first non-zero bit position of those coefficients. Thus, the refinement bit value for a given bit-plane array is the bit value of the coefficient in the bit-plane array that was previously "activated" in the higher bit-plane in the bit-plane sequence). In the data packet used to encode the bit-plane array, these signs and refinement bit values are, in one embodiment, encoded originally (including as their actual values).
[0049] In this way, a code may be generated that indicates the bit position (and in one embodiment the sign and refinement bit value) in a bit plane (and in each of the bit planes), at least until a fixed data packet size is reached.
[0050] Applicants believe that the techniques described herein may provide a particularly efficient fixed rate compression scheme. For example, typically, particularly where the array of data elements represents image data, the bit plane representation of the frequency domain coefficients will contain a number of leading "zeros". By encoding the array of bit planes in accordance with the methods of the techniques described herein, wherein for each bit plane (layer) being encoded, any new active segments are signaled and which are changed relative to the previously encoded bit plane or planes (or layers) and then signaled, the techniques described herein are able to compress this information with greater implementation efficiency (e.g., by contrast to relatively dense arithmetic or run length coding schemes, where the bit planes would have to be scanned in a particular order).
[0051] The data element array represents the spatial distribution of values. That is, the data element array represents a set of data values distributed in the spatial domain. Therefore, each data element can represent a data value at a certain position in the spatial distribution. Therefore, in an embodiment, the data element array can (each) correspond to a data position array. In an embodiment, the array of data elements or positions can correspond to all or part of the desired (e.g., image) output, such as a still image or a video frame (e.g., for display). That is, the data element array in the embodiment includes an image data array, i.e., data that can be used to generate an image for display. Therefore, in an embodiment, the data array can correspond to a single still image to be encoded. In other embodiments, the data array can correspond to a video frame of a video frame stream to be encoded.
[0052] Although embodiments relate to data arrays comprising image and / or video data, other examples of data array arrangements are possible if desired, and in general, arrays of data elements may comprise any data array that may be suitably or desirably encoded in accordance with the techniques described herein.
[0053] Indeed, in any of the embodiments described herein, arrays of data elements may take any desired and suitable form.
[0054] For example, generally speaking, there may be any desired and suitable correspondence between data elements or positions and desired outputs. For example, the data elements or positions of an array may each correspond to one or more pixels of a desired output. The data element array may be of any desired and suitable size or shape in terms of data elements or positions, but in one embodiment is rectangular (including square). The data elements may also have any desired and suitable format, such as a format representing image data values (e.g., color values).
[0055] In any of the embodiments described herein, an array of data elements may be provided in any desired and suitable manner. Embodiments may include generating (at least some or all of) the data elements of the array. Embodiments may also include or alternatively include, for example, reading (at least some or all of) the data elements of the array from a memory.
[0056] The data elements of the array can be generated in any desired and suitable manner. In an embodiment, the data elements of the array can be generated by a camera such as a video camera. In other embodiments, the data elements of the array may include a rendering process. The rendering process may include deriving the data values represented by the data elements of the array (e.g., by rasterizing primitives to generate graphics fragments and / or by rendering graphics fragments). A graphics processor (graphics processing pipeline) may be used to generate the data elements of the array. The graphics processing pipeline may include any suitable and desired processing stages that the graphics pipeline and the processor may include, such as vertex shaders, rasterization stages (rasterizers), rendering stages (renderers), etc., to generate the data elements of the array.
[0057] In general, data elements of a data array may be encoded as "blocks" of data elements, such as on a block-by-block basis. For example, an array of data elements may be divided into multiple source blocks to be encoded block-by-block (e.g., using other blocks in the data array, or using blocks in adjacent data arrays in a sequence of data arrays). Therefore, any reference herein to processing or encoding of a data array or data elements of a data array should be considered to include and generally refer to processing or encoding of such blocks of data elements. A "block" may generally include an N×N array of data elements.
[0058] Thus, in one embodiment, when encoding an (overall) array of data elements, e.g., representing an entire frame (image), the (overall) array of data elements is divided into a plurality of blocks, and each block is then encoded according to an encoding scheme of the techniques described herein to provide a corresponding set of data packets, each data packet having a fixed size. That is, in one embodiment, each block of data elements within a larger array of data elements is encoded (compressed) into a fixed-size data packet. Thus, in one embodiment, the data array being encoded into a fixed-size data packet includes a block of data elements from the larger overall array of data (and, in one embodiment, this is repeated for each of the plurality of blocks that make up the overall array of data). The data packets of each block may then be suitably combined in a particular order into an encoded data stream representing the data of the overall array of data elements.
[0059] Thus, the techniques described herein are, in one embodiment, block-based schemes, where each block in one embodiment is independently encoded so that the blocks can then be independently decoded. This can facilitate random access to blocks within a frame that has been encoded using the techniques described herein. For example, it will typically be known how many bytes exist in each data packet (block), so the location of each block within a memory can be easily identified, making them easy to load and randomly access.
[0060] The data elements may comprise, for example, difference values compared to a reference frame or block.More commonly, however, the encoding scheme is used to encode the raw data, and thus the data elements may represent (raw) pixel values.
[0061] Basically, the techniques described herein take an appropriate array of data elements (such as an NxN block) which in its original form would have a given size, and encode that array (block) in a data packet of a desired size, e.g., to meet a desired compression ratio.
[0062] Thus, the techniques described herein are capable of compressing a given data array into data packets of a fixed size. For example, the techniques described herein may compress to a fixed (selected) bit rate, such as half or one-third of the original size. For example, a block that is 64 bytes in its original form may be compressed to a fixed rate of, for example, 32 bytes per block (half rate compression). Similarly, an original block of 96 bytes (e.g., as may be the case for an 8×8 YUV 420 block) may be compressed to 48 bytes (half rate) or 32 bytes (one-third rate).
[0063] When encoding an array of data elements, the techniques described herein perform a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients. Thus, in an embodiment, the techniques described herein may employ a continuous array (block) of data elements from a frame, and then subject them to an appropriate transform in the frequency domain. For example, in an embodiment, a discrete cosine transform (DCT) may be used. However, in general, any suitable spatial to frequency domain transform may be used as desired.
[0064] The frequency transform may be applied to the array of data elements as a whole (as a two-dimensional frequency transform), or the array of data elements may be divided into a plurality of sub-arrays (which may be one-dimensional (e.g., a single row) or multi-dimensional), with each sub-array being transformed individually. For example, each row of the array may be transformed individually using a one-dimensional frequency transform. Alternatively, the array may be divided into a plurality of smaller (e.g., 2×2) sub-arrays, which are then transformed individually. However, other arrangements are of course possible (and modifications to the transform are described further below).
[0065] It should be understood that frequency transform operations can help compress (image) data. For example, for a given image, each data element may carry the same amount of information in the spatial domain, so that removing half the bits will potentially lose half the information from the original image. However, in the frequency domain, lower frequency components are generally more important (carry more information) than higher frequency components. Therefore, more of the higher frequency components can be removed without losing so much information from the original image.
[0066] The (transformed) frequency domain coefficients are then encoded using bit plane coding. That is, the original (transformed) frequency domain coefficient values are then decomposed into a set of binary bit planes, which can then be represented using a plurality of bit plane arrays, each bit plane array representing a specific bit position of the frequency domain coefficient (magnitude) value, wherein each bit plane array includes a bit array corresponding to the bit value of each frequency domain coefficient in the frequency domain coefficients at the bit position represented by the bit plane array.
[0067] For example, for a 6-bit data representation, there will be six bit planes, with the most significant bit (MSB) included in the higher (top) bit planes, so it contains the coarsest but most critical information, and so that moving down the bit planes toward the least significant bit planes, the effective contribution to the final output (image) decreases. For example, a bit on the nth bit plane on an m-bit data set with a value of "1" will contribute a value of 2 to the final output (image). (m-n) That is, a given bitplane can effectively contribute half the value of the previous (higher) bitplane. In other words, working downward through the sequence of bitplanes, adding the next bitplane provides a progressively better approximation of the final output (e.g., image).
[0068] The bit-plane coded representations of the frequency domain coefficients (i.e., the bit-plane array) are then placed into the data packet in order, working from the most significant bit-plane downwards, until the data packet is full (until the desired fixed size is reached). Thus, to generate a fixed-size data packet, the techniques described herein start with the bit-plane array representing the most significant bit, and work downwards towards the least significant bit-plane, successively encoding each bit-plane in the bit-plane sequence until the data packet is full. In this way, it is ensured that the most critical information is placed in the data packet, and (only) the less significant lower bit-plane information is discarded (when the desired fixed size is reached).
[0069] It will therefore be appreciated that the encoding described below is performed until the data packet is full, at which point encoding is stopped (wherein any remaining bits (and bit planes) that have not yet been encoded are then not included in the data packet).
[0070] As mentioned above, typically the bit-plane representation of the frequency domain coefficients will contain a number of leading "zeros" such that the highest bit-plane may be "empty" (i.e., the array of bit-planes contains an array of "zeros"). In the case where the highest bit-plane is empty and contains no active frequency domain coefficients (coefficients having non-zero bit values in that bit-plane), this may be appropriately indicated at the start of encoding, for example, by including a "0" at the beginning of the data packet for each empty bit-plane in the sequence of bit-planes until the first bit-plane that includes non-zero bit values for frequency domain coefficients (the first "active" bit-plane) is reached, for example, such that the data packet will include a leading sequence of zeros.
[0071] However, other suitable arrangements for indicating the first active bit-plane are of course possible.
[0072] Once the first bit-plane array in a sequence of bit-planes that includes one or more non-zero bit values is reached (working downward from the bit-plane representing the most significant bit), that (first) bit-plane array may be encoded according to a particular encoding scheme of the techniques described herein. Each subsequent bit-plane array in the sequence of bit-planes is then encoded in turn according to the encoding scheme of the techniques described herein until the data packet is full (at which point encoding stops).
[0073] Specifically, in order to encode the information of each bit plane, the technology described in this article uses a technique that recursively encodes the position of the coefficient that (newly) appears in the bit plane array by subdividing each bit plane array into corresponding segments, which indicates which segment (segments) have the new active frequency domain coefficient (i.e., the frequency domain coefficient whose first non-zero bit position is represented by the bit plane), and then, for any segment that includes the new active frequency domain coefficient in the bit plane, as well as any segment in the previous (higher) bit plane in the bit plane sequence where the first non-zero bit value appears, the segment is subdivided into multiple segments and indicates which sub-segment includes any new active coefficient as needed, and so on, until the individual frequency domain coefficient positions within the bit plane under consideration.
[0074] In one embodiment, the bit plane array is subdivided into quadrants, for example using a recursive quadtree partitioning data structure. Thus, in an embodiment any subdivision into segments or subsegments includes subdivision into quadrants or subquadrants. Thus, any reference herein to "segments" may be understood in an embodiment to refer to "quadrants." However, other arrangements for subdividing the bit plane array into "segments" are also possible.
[0075] Thus, each bit plane array is encoded by subdividing the bit plane array into corresponding segments and indicating any segment in that bit plane that contains one or more coefficients having non-zero bit values for the first time in the bit plane sequence as newly active, and then recursively subdividing each currently active segment into corresponding sub-segments and indicating any sub-segments that are newly active in that bit plane until the position of the coefficient that is newly active in that bit plane is indicated.
[0076] Therefore, the encoding of each bit plane is performed recursively, wherein each bit plane array is divided and subdivided on a number of different levels, down to the level of the individual coefficients.
[0077] For example, during the first (highest) level of encoding for a given bit plane, the bit plane is divided into a first set of segments (quadrants), and it is determined and indicated whether any of these segments newly contain a non-zero bit value for at least one of the frequency domain coefficients within the segment. At the next level, the encoding then further subdivides those segments into sub-segments, and indicates which of these sub-segments include any newly active coefficients, and so on, down to the level of individual coefficients. In this way, the location of each newly active coefficient in the bit plane is indicated.
[0078] Once one (e.g., first) bit-plane array has been encoded in this manner, the next bit-plane array in the sequence of bit-planes is encoded in the same manner, and so on, until the data packet is full. For the next bit-plane, the first (highest) level of encoding again looks for any newly active segments. However, at the next level, the encoding now considers not only the newly active segments in that bit-plane, but also any segments that were "activated" during the encoding of the previous bit-plane. For all currently active segments, the location of any sub-segments that include newly active coefficients is then indicated downwards, and so on, down to the level of individual coefficients.
[0079] For example, for an N×N array of bit planes, the array is first subdivided into four N / 2×N / 2 quadrants in one embodiment, and then indicates which, if any, of these quadrants are newly active (compared to the previous bit plane or planes). Any of the currently active N / 2×N / 2 quadrants (and therefore any newly active quadrants in the current data plane and any quadrants indicated as newly active in higher bit planes) may then be further subdivided into N / 4×N / 4 quadrants, and indications provided as to which of these quadrants is newly active, and so on, until the position of the coefficient indicating new activity in that bit plane is reached. Thus, it should be appreciated that for a 4×4 array of bit planes, there will be only two levels of subdivision per bit plane array (initial division of the bit plane array into four 2×2 quadrants, followed by division of these quadrants into corresponding 1×1 coefficients). On the other hand, a 2×4 array of bit planes may be further subdivided into four 2×2 quadrants, and then the 1×1 coefficients may be divided into corresponding 1×1 coefficients. n ×2 n The bit-plane array can usually be subdivided n times.
[0080] Thus, each successive bit-plane level encodes (indicates) the position of the active quadrant relative to the previous (higher) bit-plane in the bit-plane sequence, so that, for example, if a quadrant had previously been indicated as including a newly active coefficient in a higher bit-plane, for the next bit-plane down in the bit-plane sequence, the active quadrant indication indicates which (if any) of the remaining three quadrants newly includes an active coefficient (non-zero bit values for frequency domain coefficients). Thus, each bit-plane encoding is contextually dependent on the layer above (and informs you of any changes relative to the layer above).
[0081] It should therefore be appreciated that in the encoding scheme of the techniques described herein, for each bit-plane in a sequence of bit-planes, new active segments are indicated, ie, those that were not previously indicated as active during encoding of higher bit-planes.
[0082] In general, any suitable code may be used to indicate the location of a new active quadrant in a given bit plane (layer). However, it should be appreciated that because the code need only indicate the new active segment, and the location and value of any coefficients within the currently active segment, the code may advantageously be kept relatively simple. For example, the recursive encoding scheme of the techniques described herein may allow relatively complex significant bit dependencies to be encoded using relatively low cost (low complexity) variable length code tables.
[0083] In particular, this has the effect of compressing the leading "zeros" in the bit-plane representation of the frequency domain coefficients in an efficient manner.
[0084] As well as encoding the position of the new active frequency domain coefficient for a given bit plane in the manner described above, provided that sufficient space remains in the data packet, in an embodiment included in the data packet, following the "position" data of the bit plane under consideration, further data also indicates, in one embodiment, a sign bit, which indicates the sign (positive or negative) of the new active coefficient of the bit plane under consideration. In one embodiment, as well as the sign bit of the new active coefficient for the bit plane under consideration, data is also included in the data packet indicating the bit value of any coefficient in that bit plane whose first non-zero bit value appears in a higher bit plane in the sequence (the so-called "refined bit value" for the bit plane under consideration, representing the bit value of any frequency domain coefficient whose first non-zero bit value appears in a higher bit plane and which was previously "activated" during the encoding of the higher bit plane and thus indicates its position. The refined bit value is therefore the bit value of the bit position following the leading non-zero bit position of the given coefficient).
[0085] These sign and refinement bit values are, in one embodiment, encoded in their original form (i.e., indicating the truth value of these bits) (for the sign bit, it can be a specified value, such as "1" for positive values, "0" for negative values, or vice versa).
[0086] In one embodiment, the sign bit is encoded just after any new activity coefficient (position) has been encoded (indicated). That is, the corresponding sign bit of the new activity coefficient is encoded (indicated) in the data packet immediately after the data indicating the position of the new activity coefficient.
[0087] On the other hand, in one embodiment, the refinement bit values for a given bit-plane array are encoded (indicated) only after all new active coefficients (and in one embodiment, along with their corresponding signs) for that bit-plane array have been encoded (indicated). For example, the refinement bit values for a particular bit-plane may be encoded (indicated) as the final section of the code for that bit-plane in a data packet, following the data indicating the position (and in one embodiment, the sign) of the new active coefficients for that bit-plane. This means that if encoding of a bit-plane is stopped due to reaching the end of a data packet before the bit-plane has been completely encoded, the new significant bits for the bit-plane will be encoded preferentially before the refinement bit values.
[0088] Thus, in one embodiment, for each bit-plane (as long as there is available space in the data packet), the encoding first indicates (the location of) any newly active segments in that bit-plane, then indicates that location and, in one embodiment, the signs of any newly active coefficients within any segments (and sub-segments) that are currently active within that bit-plane, and then finally adds the refined bit values of any coefficients that were "activated" in previous bit-planes.
[0089] Thus, in an embodiment, encoding each bit-plane array further comprises including in the data packet data indicating the sign of the new activity coefficient following the data indicating the position of the new activity coefficient, provided there is space available in the data packet.
[0090] Additionally (or alternatively), in an embodiment, encoding each bit-plane array may further include: including in the data packet data indicating the original bit value of any coefficient in which the first non-zero bit value occurred in a previous bit-plane array in the sequence of bit-planes, provided there is available space in the data packet. This data indicating the bit value of any coefficient in which the first non-zero bit value occurred in a previous bit-plane array in the sequence of bit-planes is included in the data packet in one embodiment after the positions of all new active coefficients in that bit-plane have been indicated.
[0091] In the case where the data packet being encoded contains multiple data channels (e.g., YUV or RGB data), each channel is encoded separately in one embodiment, and the encoding in one embodiment is such that the position of the new active coefficient of each data channel (color plane) is encoded first one by one (in an interleaved manner), and then the refinement bit value of each data channel is encoded within the bit plane. This means that if the bit plane encoding stops due to the end of the data packet, the new active bits of each color channel will be encoded first before the refinement bit value.
[0092] Applicants also recognize that this encoding arrangement may not be suitable for certain forms of input data. For example, as described above, the encoding technique may be particularly suitable for effectively encoding image data that has been transformed into the frequency domain and in which a leading sequence of "0" is expected. However, for other forms of input data, such as random input data, the technique may not be very effective.
[0093] In this case, the encoder may identify in an embodiment when a specific coding scheme described in accordance with the technology described herein may not be appropriate. And in this case, in one embodiment, the input data is encoded in a different manner, for example, in its original format (without encoding the input data by performing frequency transform and bit plane encoding), and the completed content is indicated to the decoder. Therefore, the encoder may be able to select between a plurality of different available coding schemes based on the input data. The encoder may select a coding scheme based on the input data in various suitable ways (e.g., based on a suitable metric). For example, in an embodiment, the encoder may perform a frequency transform operation on an array of data elements, for example, as described herein, and then select a coding scheme based on a suitable metric (such as the sum of the absolute values of the transform coefficients) or a similar metric.
[0094] That is, the encoder may perform a frequency transform operation and then analyze the frequency transform coefficients to check whether a coding scheme according to the techniques described herein is suitable (possibly providing an improvement). When the sum of the absolute values of the transform coefficients indicates that a coding scheme according to the techniques described herein is favorable (e.g., the sum is less than the sum of the absolute values of the original input data), the transform coefficients may then be bit-plane encoded, and the data represented by the bit-planes may then be recursively encoded according to a particular coding scheme of the techniques described herein, as described above. On the other hand, in the event that the check indicates that a coding scheme according to the techniques described herein is not (or is less suitable), the input data may be encoded in its original form (e.g.,
[0095] The techniques described herein generate data packets having a fixed size. Thus, once a data packet is full, any remaining bits are effectively discarded. Thus, the encoding of fixed-size data packets is inherently lossy. However, the techniques can also be extended to provide lossless compression by providing lossy-encoded fixed-size data packets, and also (separately) providing another data set in the form of a "lossless compensation" layer that includes information indicating any (and all) remaining bit values required to reconstruct the original input data.
[0096] Thus, the lossless compensation layer contains the information needed to compensate for information lost when encoded into fixed-size data packets.The lossless compensation layer can then be used in conjunction with the fixed-size data packets to reproduce the original (image) data without any losses.
[0097] Therefore, in an embodiment, when the data packet is full, the method also includes (the encoding circuit) generating a lossless compensation layer, which includes information indicating the bit values and positions of any bits (and bit planes) for which the data is not included in the fixed-size data packet, so that the lossless compensation layer together with the fixed-size data packet contains all information required to reproduce the original input data without loss.
[0098] Thus, the lossless compensation layer typically includes information about any (and all) bits that are not included in the fixed-size data packets, and therefore what information is needed in order to be able to fully reproduce the original input data. For example, the lossless compensation layer may include the original bit values of any bits that are not encoded into the fixed-size data packets (so-called "compensation bits"), as well as information indicating the positions of those bits. For example, the bit values of the compensation bits may be packed into the lossless compensation layer in a certain order (starting with the first bit value that is not included in the fixed-size data packets), and / or the lossless compensation layer may explicitly include the position information of the compensation bits (e.g., the lossless compensation layer may store the compensation bits in an array or other appropriately ordered data structure).
[0099] The lossless compensation layer is separate from the fixed-size data packets so that the fixed-size data packets can be provided separately and independently from the lossless compensation layer. Thus, in cases where it is desired to guarantee a fixed bit rate, and where the loss of some original information is acceptable, fixed-size data packets can be provided (without providing a lossless compensation layer). However, in some cases, it may be desirable to also provide a lossless compensation layer (separately) to allow for completely lossless reproduction of the original data.
[0100] This may be desirable, for example, if video frames are being encoded, and some frames that have been erroneously encoded will need to be used as reference frames (in which case they will need to be reconstructed by the encoder in a lossless manner).
[0101] Thus, for reference frames, the encoder may provide an additional layer of lossless compensation to allow lossless reconstruction of those frames. (In this case, the decoder will in one embodiment still simply receive the lossy encoded version of the frame, since it does not need to reproduce the lossless version of the frame).
[0102] In this case, in order to be able to fully accurately reconstruct the frame when losslessly coded (eg, for use as a reference frame in an encoder), the spatial to frequency domain transform may need to be fully reversible.
[0103] However, due to rounding processes, this may not be the case for all forms of frequency domain transforms. For example, a frequency transform operation in one embodiment comprises multiplying an array of data elements (or a subarray thereof) by an integer matrix and then rounding the values, for example by performing a round right shift. However, even in the case where the integer multiplication matrix maps regions to regions of the same volume, errors introduced by the rounding stage may mean that the matrix is generally not invertible.
[0104] Thus, in an embodiment, at least when performing lossless encoding, a modified frequency domain transform process may be used that specifically modifies the rounding operation based on the value being rounded so as to provide a reversible (inverted) transform process to produce the original unique input. Specifically, the rounding operation is configured to avoid two (or more) inputs to the frequency domain transform being mapped to the same transform output (so that when inverse transforming, you then have a unique output that can be reversed back to a corresponding unique input).
[0105] Thus, in an embodiment, the frequency transform operation is configured to transform each data element into a unique frequency domain coefficient output, such that the frequency transform operation is reversible.
[0106] For example, when it is identified that rounding may cause two inputs to transform to the same output value, different rounding values may be used for those inputs in order to force the outputs apart and ensure that each input is uniquely transformed.
[0107] Thus, in implementations where rounding values are chosen such that each input to the transform maps to a unique output the transform is fully reversible, rather than having to round to the nearest value (which would typically be the case, for example when implementing a lossy transform).
[0108] The rounding value may be selected based on the input value. For example, the rounding value may be selected based on the "class" of the value, which may be determined by the least significant bit of the value, for example. The rounding value may be stored, for example, in a suitable lookup table.
[0109] It is also believed that lossless encoding using this lossless frequency transform including a rounding operation configured to select rounding values to ensure that each data element being transformed is uniquely mapped is novel and independently inventive.
[0110] Thus, another embodiment of the technology described herein includes a method of encoding an array of data elements representing a spatial distribution of values, the method comprising:
[0111] performing a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients, the frequency transform operation comprising a rounding operation, wherein the rounding operation is configured to select a rounding value for a rounded value to ensure that each data element being transformed is mapped to a unique frequency domain coefficient output; and
[0112] The set of frequency domain coefficients is encoded to provide an encoded representation of an array of data elements.
[0113] Yet another embodiment of the technology described herein includes an apparatus for encoding an array of data elements representing a spatial distribution of values, the apparatus comprising an encoder, the encoder comprising:
[0114] transform circuitry configured to perform a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients, the frequency transform operation comprising a rounding operation, wherein the rounding operation is configured to select a rounding value for a rounded value to ensure that each data element being transformed is mapped to a unique frequency domain coefficient output; and
[0115] Encoding circuitry is provided for encoding the set of frequency domain coefficients to provide an encoded representation of an array of data elements.
[0116] In this way, it can be ensured that the frequency transform operation is reversible (invertible).Therefore, when the frequency domain coefficients are encoded using lossless compression techniques, the entire encoding process can then be made lossless.
[0117] Any suitable frequency conversion operation may be used. For example, in one embodiment, the frequency conversion operation may include multiplying the array of data elements by an integer matrix and then performing a rounding operation.
[0118] In one embodiment, the set of frequency domain coefficients is encoded in a lossless extension of the techniques described herein, as described above, i.e., where the frequency domain coefficients are encoded as a plurality of bit-plane arrays, and the set of frequency domain coefficients is then encoded into a data packet of fixed size by encoding the bit-plane arrays working downwards from the most significant bit-plane until the data packet is full, and where a "lossless compensation" layer is then generated, e.g., containing the original values of any bits not encoded into the fixed-size data packet. However, other suitable (lossless) compression schemes may of course be used.
[0119] In an embodiment, as described above, depending on the application, e.g., depending on whether a lossless compensation layer needs to be provided, the rounding operation may be selected as a natural "round to nearest" operation or a "reversible" rounding operation. For example, this may be signaled within the bitstream so that a decoder can determine which transform operation has been applied.
[0120] Thus, the encoding of the techniques described herein generates a data stream that, in one embodiment, includes a sequence of fixed-size data packets (e.g., each data packet represents an array (or block) of data elements). The encoded data stream generated by the encoder may be output to a memory for storage (e.g., for subsequent decoding and / or transmission), or may be output to an external device (e.g., for subsequent decoding and optionally display).
[0121] The techniques described herein also extend to corresponding methods and apparatus for decoding a data stream that encodes a data array (eg, encoded according to the techniques described herein).
[0122] Another embodiment of the technology described herein includes a method for decoding a data stream, the data stream including fixed-size data packets, the fixed-size data packets encoding a set of frequency domain coefficients as a sequence of bit-plane arrays, each bit-plane array in the sequence of bit-planes representing a particular bit position of a value of the frequency domain coefficient, wherein each bit-plane array includes a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit-plane array, and wherein the fixed-size data packets include: for each bit-plane array in the sequence of bit-planes encoded in the fixed-size data packets, data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the bit-plane sequence, and data indicating the position of any recursively defined sub-segments of any such newly active segment in the bit-plane array, and any sub-segments of any segment in which the first non-zero bit value appeared in a previous bit-plane array in the sequence of bit-planes, for which sub-segments the first non-zero bit value in the bit-plane sequence appeared in the bit-plane array, and so on, until the position of the frequency domain coefficient at which the first non-zero bit value appeared in the bit-plane array is indicated, the method comprising:
[0123] For each bit plane array in the sequence of bit planes encoded in the fixed size data packet, determining from the fixed size data packet a position of a frequency domain coefficient where a non-zero bit value first occurs in the bit plane array;
[0124] generating a plurality of bit plane arrays using the identified positions, each bit plane array in the sequence of bit planes representing a particular bit position of a frequency domain coefficient value, wherein each bit plane array comprises a bit array corresponding to a bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array;
[0125] combining the generated bit plane arrays to generate a set of frequency domain coefficients; and
[0126] The set of frequency domain coefficients is used to obtain the decoded output.
[0127] Another embodiment of the technology described herein includes an apparatus for decoding a data stream, the data stream including fixed-size data packets, the fixed-size data packets encoding a set of frequency domain coefficients as a sequence of bit-plane arrays, each bit-plane array in the sequence of bit-planes representing a particular bit position of a value of the frequency domain coefficient, wherein each bit-plane array includes a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit-plane array, and wherein the fixed-size data packets include: for each bit-plane array in the sequence of bit-planes encoded in the fixed-size data packets, data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the bit-plane sequence, and data indicating the position of any recursively defined sub-segments of any such newly active segment in the bit-plane array, and any sub-segments of any segment in which the first non-zero bit value appeared in a previous bit-plane array in the sequence of bit-planes, for which the first non-zero bit value in the bit-plane sequence appeared in the bit-plane array, and so on, until the position of the frequency domain coefficient at which the first non-zero bit value appeared in the bit-plane array is indicated, the apparatus including a decoder, the decoder including:
[0128] an input circuit configured to determine, from the fixed-size data packet, a position of each bit-plane array in a sequence of bit-planes encoded in the fixed-size data packet of frequency-domain coefficients for which a non-zero bit value first occurs in the bit-plane array;
[0129] bit-plane decoding circuitry configured to generate a plurality of bit-plane arrays using the identified positions of the frequency-domain coefficients of each bit-plane array, each bit-plane array in the sequence of bit-planes representing a particular bit position of a value of the frequency-domain coefficient, wherein each bit-plane array comprises a bit array corresponding to a bit value of each of the frequency-domain coefficients at the bit position represented by the bit-plane array, and to combine the generated bit-plane arrays to generate a set of frequency-domain coefficients; and
[0130] An output circuit is configured to obtain a decoded output using the set of frequency domain coefficients.
[0131] Thus, the decoding process is essentially the reverse of the encoding scheme of the techniques described herein by first generating a set of bit-plane arrays from a fixed-size data packet by identifying the locations of active coefficients in each bit-plane in a sequence of bit-planes that have been encoded within the fixed-size data packet (i.e., before the fixed data packet size is reached), and then reconstructing a set of coefficients (representing the frequency-variant coefficients of the initially encoded input data) from the plurality of bit-plane arrays, which can then be used to obtain a decoded output. For example, when the coefficients represent a set of frequency-transformed coefficients, the decoding method in one embodiment includes the step of performing an inverse frequency-transform operation on the frequency-transformed coefficients to (re)construct the encoded original data array.
[0132] In one embodiment, the encoded data stream also includes data indicating the sign values of the frequency domain coefficients (new) appearing in each bit plane array, and also includes data for the refined bit values of each bit plane in the bit plane under consideration, as described above. Thus, decoding in one embodiment includes determining the positions of the frequency domain coefficients in a given bit plane array at which non-zero bit values first appear from the fixed-size packets, determining the sign values of these frequency domain coefficients. In one embodiment, decoding also includes determining the refined value of the bit plane under consideration (i.e., the bit value of any frequency domain coefficient that first appears in a previous bit plane in the bit plane sequence) for each bit plane in the bit plane sequence encoded in the fixed-size data packet.
[0133] Since the encoding of the fixed size data packets is lossy, there may be some coefficients where at least some information is not included in the fixed size data packets.
[0134] For any coefficient whose sign is known but whose bit value is unknown (because that information is discarded during encoding), in an embodiment, the decoding scheme introduces a "1" in that position in the next bit-plane down in the sequence of bit-planes (where there is an available lower bit-plane) (which effectively adds a contribution of "1 / 2" for the unknown bit value). That is, in an embodiment, for any bit value in a given bit-plane array that is not included in the fixed-size data packet but whose sign is known, decoding includes (when generating the bit-plane array) including a zero at that position in the bit-plane array and a one at the corresponding position in the next bit-plane down in the sequence of bit-planes.
[0135] It has been found that this provides better quality reproduction (e.g., compared to simply defaulting the value to "0"). This can then be carried by the lower bit planes in the bit plane sequence (where the bit value is also usually unknown, because the encoding of the technology described herein works downward through the bit plane sequence) by, for example, introducing appropriate values of other bit planes in the sequence according to a predetermined decoding mode. For example, decoding can introduce "1" into every other bit plane in the sequence (e.g., so that the value 1XXXX (where X represents an unknown bit value) is decoded as 10101). Alternatively, after the "1" of the unknown bit value is introduced into the corresponding position in the next bit plane, "0" can then be introduced for all lower bit planes (e.g., so that 1XXXX is decoded as 10100). For another example, decoding can introduce "1" into n-1 bit planes, n-2 bit planes, and n-4 bit planes (where present) (e.g., so that 1XXXXXX will be decoded as 10110100), and it has been found that this gives good results. However, it should be understood that various other suitable modes can be used for the decoding.
[0136] On the other hand, for any coefficient whose sign value is unknown, the value of the coefficient is decoded as zero in one embodiment, that is, for each bit plane in the bit plane sequence, the bit value of the coefficient is set to "0" in one embodiment. In this case, it may be better to set the coefficient value to "0" (for example, rather than trying to guess or determine the sign value in some way). That is, in an embodiment, any bit value in a given bit plane that is not included in the fixed-size data packet and whose sign is unknown is decoded as zero. Therefore, for example, a coefficient with a bit value (magnitude) of 1XXXX but an unknown sign value is just decoded as "0".
[0137] Generally speaking, a decoder is operable to decode a data stream in order to recover the original source data (e.g., an image) that was encoded, and then use (e.g., display) the data as desired. Thus, once the data stream has been decoded, the decoder may be configured to display the data obtained using the decoding of the individual segments or to output the data for display.
[0138] The above encoding and decoding apparatus may generally be provided as part of a data processing system. For example, the apparatus may comprise part of an image and / or video processing system, which may comprise a camera, such as a digital camera, a mobile phone or a tablet computer.
[0139] Generally speaking, in any embodiment, the methods described herein may be performed by any desired and suitable device. For example, in any embodiment, the processes described herein may be performed by an image or video processor (codec). Therefore, in any embodiment, the data processing device described herein may include or may be a video processor. Therefore, the processing (encoding / decoding) circuits / circuitry, output circuits / circuitry, header generation circuits / circuitry, header reading circuits / circuitry or input circuits / circuitry described herein, etc. may form part of a video processor. In any embodiment, the data processing device described herein may include a system on chip (SoC), or may be a SoC, or may form part of a SoC.
[0140] As will be appreciated by those skilled in the art, the encoding / decoding device of the technology described herein can be part of an overall data processing system including, for example, a host (e.g., central) processor. The host processor can, for example, execute an application program that requires data processing by the encoding / decoding device. The host processor can send appropriate commands and data to the encoding / decoding device to control the encoding / decoding device to perform data encoding / decoding operations and generate and / or use the output required by the application program executed on the host processor. In order to facilitate this, the host processor can execute a driver for the encoding / decoding device.
[0141] In an embodiment, the apparatus or system may include and / or may communicate with one or more memories and / or memory devices that store data described herein, and / or store software for performing the processes described herein. The apparatus or system may include and / or may communicate with a display for displaying an image based on the data elements of the array. The apparatus or system may include and / or may communicate with a camera that generates the array of data elements.
[0142] The memory mentioned herein may be any desired and suitable memory of or for a data processing device. The memory may be external to the data processing device (e.g., a video processor and / or a system on chip (SoC)). The memory may be, for example, a main system memory.
[0143] The techniques described herein can be used for all forms of data arrays that can be provided and / or used by a data processing device, such as images or frames for display. Thus, as described above, an array of data elements can include image data and / or can correspond to an image or image data frame.
[0144] In one embodiment, the various functions of the techniques described herein are performed on a single data (eg, image) processing platform that provides and / or uses arrays of data elements.
[0145] The techniques described herein may be implemented in any suitable system, such as a suitably configured computer or microprocessor-based system. In one embodiment, the techniques described herein are implemented in a computer and / or microprocessor-based system.
[0146] The various functions of the technology described herein can be performed in any desired and suitable manner. For example, the steps and functions of the technology described herein can be implemented in hardware or software as needed. Therefore, for example, unless otherwise specified, the various circuits / circuits, functional elements, levels and devices of the technology described herein may include one or more suitable processors, one or more controllers, functional units, circuits / circuits, processing logic, microprocessor arrangements, etc. that can be operated to perform various steps or functions, such as suitable dedicated hardware elements (processing circuits) and / or programmable hardware elements (processing circuits) that can be programmed to operate in a desired manner.
[0147] In particular, it is contemplated that the encoder may be implemented in hardware or software as desired. Thus, for example, the encoder may include suitable one or more processors, one or more controllers, functional units, (encoding) circuits / circuits, processing logic, microprocessor arrangements, etc., which are operable to perform various encoding steps or functions, etc., as described herein, for example, suitable dedicated hardware elements (processing circuits / circuits) and / or programmable hardware elements (processing circuits / circuits) that can be programmed to operate in a desired manner.
[0148] Similarly, the decoder may be implemented in hardware or software as desired. Thus, for example, the decoder may include suitable one or more processors, one or more controllers, functional units, (decoding) circuits / circuits, processing logic, microprocessor arrangements, etc., which are operable to perform various encoding steps or functions, etc., as described herein, for example, suitable dedicated hardware elements (processing circuits / circuits) and / or programmable hardware elements (processing circuits / circuits) that can be programmed to operate in a desired manner.
[0149] The various steps or functions of the techniques described herein may be repeated and / or performed in parallel on a given processor. Likewise, if desired, various processing stages may share processing circuits / circuits, etc.
[0150] Depending on any hardware required to perform the above-mentioned specific steps or functions, the system may otherwise include any one or more or all of the common functional units included in the data processing device and / or the system.
[0151] Therefore, various data processing stages can be implemented as needed and in any suitable manner, and can respectively perform any desired and suitable functions. Similarly, various data can be defined and stored in any suitable and desired manner.
[0152] It will also be understood by those skilled in the art that all described embodiments of the technology described herein may optionally include any one, more, or all of the features described herein in one embodiment.
[0153] Methods according to the technology described herein may be implemented at least in part using software, such as a computer program. Therefore, additional embodiments of the technology described herein include: computer software that is particularly suitable for performing the methods described herein when installed on a data processor; a computer program element that includes computer software code portions for performing the methods described herein when the program element is run on a data processor; and a computer program that includes code suitable for performing all steps of one or more methods described herein when the program is run on a data processing system. The data processor may be a microprocessor system, a programmable FPGA (field programmable gate array), or the like.
[0154] The technology described herein also extends to a computer software carrier comprising such software, which, when used to operate a data processing device or system comprising a data processor, causes the device or system to combine with the data processor to perform the steps of the method of the technology described herein. Such a computer software carrier may be a physical storage medium, such as a ROM chip, CD ROM, RAM, flash memory or disk, or may be a signal, such as an electronic signal through a wire, an optical signal or a radio signal, such as a signal to a satellite, etc.
[0155] It should also be understood that not all steps of the methods of the technology described herein need to be performed by computer software. Therefore, in other embodiments, the technology described herein includes computer software and such software installed on a computer software carrier for performing at least one of the steps of the method described herein.
[0156] Therefore, the technology described herein may be appropriately embodied as a computer program product for use with a computer system. Such a specific implementation may include a series of computer-readable instructions fixed on a tangible non-transitory medium, such as a computer-readable medium, for example, a disk, CD, DVD, ROM, RAM, flash memory, or hard disk. It may also include a series of computer-readable instructions that can be invisibly transmitted to a computer system via a modem or other interface device, through a tangible medium (including but not limited to optical communication lines or analog communication lines), or using wireless technology (including but not limited to microwave, infrared or other transmission technology). The series of computer-readable instructions embodies all or part of the functions previously described herein.
[0157] Those skilled in the art will appreciate that such computer readable instructions may be written in a variety of programming languages for use with many computer architectures or operating systems. In addition, such instructions may be stored using any present or future memory technology (including but not limited to semiconductor, magnetic, or optical technology), or transmitted using any present or future communication technology described herein (including but not limited to optical, infrared, or microwave technology). It is contemplated that such computer program products may be distributed as removable media with accompanying printed or electronic documentation (e.g., shrink-wrapped software), may be preloaded on a computer system (e.g., system ROM or fixed disk), or may be distributed over a network (e.g., the Internet or World Wide Web) from a server or electronic bulletin board.
[0158] Figure 1 Schematically illustrates an embodiment of a data processing system 200 that can provide and use data arrays, such as images or video frames, that have been encoded in the manner of the techniques described herein for display. It should be understood that Figure 1 Only one example of a system suitable for use with the techniques described herein is shown, and various other arrangements are possible.
[0159] In this embodiment, system 2000 includes a data processing device in the form of a system on a chip (SoC) 2020. System 2000 also includes off-chip (main) memory 2160, a display device 2180, and a camera 2200.
[0160] The SoC 2020 includes a central processing unit (CPU) 2040 , a graphics processing unit (GPU) 2060 , an image / video processor 2080 , a display controller 2100 , an interconnector 2120 , and a memory controller 2140 .
[0161] like Figure 1 As shown, the CPU 2040, the GPU 2060, the image / video processor 2080, and the display controller 2100 communicate with each other via the interconnect 2120, and communicate with the memory 2160 via the interconnect 2120 and the memory controller 2140. The display controller 2100 also communicates with the display device 2180. The camera 2200 also communicates with the SoC 2020 via the interconnect 2120.
[0162] In an embodiment, the image / video processor 2080 reads image data from the memory 2160, encodes the image data (e.g., in the manner of the techniques described herein), and then outputs the encoded image data, e.g., for storage in the memory 2160 or for streaming to another device. The encoded image data may later be retrieved and decoded, e.g., by the image / video processor 2080, or received and decoded by another device. The decoded image data may then be output, e.g., by the display controller 2100 to the display device 2180 or by another device for display.
[0163] Therefore, within such data processing systems, it may be desirable to be able to compress the image data being processed at various points. In addition, in order to be able to facilitate higher throughput, such as for higher bandwidth media applications, it may be desirable to be able to guarantee a given bandwidth (bit rate).
[0164] Therefore, the technology described herein relates in an embodiment to a coding scheme that can encode image data into data packets with a fixed size, thereby ensuring a desired bit rate. For example, Figure 2 Schematically illustrates a fixed rate coding scheme according to an embodiment of the technology described herein. Figure 2 In the example shown, the input is an 8x8 pixel block 10 (eg 64 bytes) to be encoded. This may represent, for example, a single block of image data, so that the arrangement of the pixels thus represents the spatial distribution of the image data within the block.
[0165] To provide some initial compression, a space-to-frequency transform, such as a discrete cosine transform (DCT) or similar, is applied to the block 10 (step 101) to generate a corresponding 8×8 block of signed frequency transform coefficients 12. The block of frequency transform coefficients 12 is then encoded into a fixed-size data packet 14 (e.g., 32 bytes for half-rate encoding) using bit-plane-based entropy coding (step 102). As will be further explained below, this is performed in such a way that the image data is efficiently compressed while still ensuring the desired fixed size of the data packet 14.
[0166] although Figure 2 An 8×8 pixel block 10 is shown, but it should be understood that the techniques described herein may be applied to any suitable array of data elements. For example, to illustrate the encoding scheme of the techniques described herein, the encoding scheme will now be described with respect to Figure 3A The coefficient blocks shown are 4×4 to describe the working examples. However, although 4×4 coefficient blocks were chosen (eg, for ease of illustration), it should be understood that the techniques described herein are not limited to any particular size or form of data array.
[0167] Figure 3A A typical frequency domain coefficient block (i.e., from Figure 2 ), which includes a 4×4 signed array of values ranging from -63 to +63 (so that 6 bits are used to store absolute values). The techniques described herein can then encode these coefficients into fixed-size data packets.
[0168] To this end, the coefficients are first represented as a series of bit plane arrays, where each bit plane array represents the bit value (i.e., "1" or "0") of each frequency domain coefficient at the corresponding bit position represented by the bit plane array. That is, the absolute value is decomposed into a set of six binary bit planes, such as Figure 3B shown.
[0169] The bit plane array set is then encoded in the order of working from the top bit plane downwards until the desired data packet size is reached. That is, the technology described herein then continues to encode each bit plane in the bit plane so that if there is available space in the data packet, a given bit plane is fully encoded before moving to the next bit plane, and so on. However, when the data packet is full, the encoding is stopped, and any bit (and bit plane) that has not yet been encoded is not included in the data packet. In this way, it is ensured that the data packet does not exceed the desired fixed size. In addition, because the coding scheme works from the top bit plane downwards, this ensures that the higher effective bit planes are preferentially encoded before the bit planes representing the lower effective bits, so that if information is lost (due to the coding being stopped before the information has been included in the data packet), the information in the higher bit planes is still encoded.
[0170] Typically, the highest bit plane can be empty (contain only "0"). For example, for the two highest bit planes, this is Figure 3B This information can be effectively encoded in the data packet by simply including a "0" for each such "inactive" (empty) layer in the sequence of bit planes leading up to the first bit plane containing a non-zero value (the first "active" bit plane). When the first such "active" bit plane is reached, this can be indicated, for example, by including a "1". Once the position of the first active bit plane in the sequence of bit planes is identified in this manner, each of the bit planes starting with the first active bit plane can be encoded according to a particular encoding scheme of the techniques described herein (e.g., as described below).
[0171] Therefore, if Figure 4 As shown, encoding begins by signaling the first active layer (step 401). For example, by working in a bit plane sequence from the highest bit plane downward, a '0' is sent for each inactive layer, and then a '1' is sent for the first active layer. For example, for Figure 3BIn the set of bit planes shown, the first two bit planes ('Bit Plane 5' and 'Bit Plane 4') are empty, and the first active layer is 'Bit Plane 3', which contains the most significant bits of the top left value (whose absolute value is '13', so '001101' in binary representation). Therefore, this information can be encoded by including the value '001' at the beginning of the code (i.e., indicating that the first two bit planes are empty and the third bit plane in the bit plane sequence is the first active bit plane).
[0172] Figure 4 The illustrated encoding scheme then proceeds by encoding each bit plane (layer) in sequence, starting from the first active bit plane downward, until the data packet is full (until the desired fixed data packet size is reached) (step 402). Figure 3B In the example shown, after signaling that 'Bit Plane 3' is the first active bit plane, the encoding scheme then proceeds to encode the bit values of that bit plane and then moves down to the next bit plane ('Bit Plane 2'), and so on, encoding each of the bit planes until the data packet is full (or until all bit planes have been encoded if the desired fixed data packet size has not been reached at this time).
[0173] A particular encoding scheme of the techniques described herein recursively encodes the position of any new "active" coefficient within a bit plane by repeatedly subdividing the bit plane into segments (e.g., quadrants), and identifying any segments that newly contain the most significant bit of a coefficient, and so on, for each position of the coefficient. In addition, the information in each bit plane is encoded relative to the information in the previous bit plane in the sequence. Applicants believe that the encoding scheme is capable of compressing data in a particularly efficient manner while still maintaining a fixed bit rate. In particular, the encoding scheme is capable of effectively compressing the large number of leading "zeros" that are often found when processing image data in the frequency domain.
[0174] Figure 5 A method for including a 4×4 bit plane array (e.g., having Figure 3B The encoding scheme for a specific bit plane of the type shown in FIG. Figure 5 As shown, for each bit-plane array being encoded, the bit-plane array is first divided into four 2×2 quadrants, and then any quadrant that is "newly active" in the bit-plane is signaled (step 501). (A quadrant is "newly active" in a bit-plane if it includes a non-zero bit value for the first time in the bit-plane sequence.) Once a quadrant is activated, it then remains active for encoding subsequent bit-planes in the bit-plane sequence.
[0175] Thus, for each currently active quadrant in the bit-plane array (including any quadrants that are newly active in that bit-plane as well as any quadrants that were previously "activated" during encoding of previous bit-plane arrays in the bit-plane sequence) (step 502), and as long as there is still available space in the data packet (otherwise encoding stops once the desired fixed size is reached), the position of any newly active coefficients in that quadrant is signaled (step 502a), as well as the corresponding sign bit of any such newly active coefficients (step 502b). (The sign bit may be indicated using a suitably assigned value, e.g., by sending a "0" if the sign is ≥ 0, and a "1" if the sign is < 0 (or similar).) Finally, once the position and sign bit of any newly active coefficients have been sent for each active quadrant, so-called "refinement bits" representing the original (absolute) bit values of any coefficients that have been activated in higher bit-planes are sent (step 503).
[0176] Thus, for each bit-plane, data indicating the position of any coefficient that is newly active in the bit-plane (i.e., whose leading bit ("1") appears at the bit position represented by the bit-plane), its sign value, and the original (absolute) bit value of any coefficient whose leading bit appeared in the previous plane (and therefore the value that appeared after the leading bit) is included in the data packet, provided there is space available in the data packet.
[0177] An exemplary variable length code that may be used in an embodiment to signal one or more positions of a newly active quadrant and coefficient is presented in Table 1 below. The code is context dependent, such that for each quadrant (or sub-quadrant or individual data element) containing any newly active coefficient, this information may be signaled based on the number of positions known to contain significant bits in the layer above. Thus, a relatively complex bit dependency may be encoded in a relatively simple manner using a relatively low cost (low complexity) variable length code table (as shown in Table 1 below). Again, this generally has the effect of compressing data values more efficiently.
[0178]
[0179] Table 1 - Example codes for encoding bit positions
[0180] Figure 6 is an illustration of how to use the variable length coding scheme presented in Table 1 Figure 3B A working example of encoding a set of bit-plane arrays is shown in FIG.
[0181] For example, as described above, encoding starts from the first active bit plane, which is 'bit plane 3' in this example. Working clockwise from the top left, it can be seen that the first 2×2 quadrants (top left) of 'bit plane 3' contain non-zero coefficients, while the other quadrants are all empty. Therefore, the first (top left) coefficient is signaled as "active" (step 501), for example by sending "0", as shown in Table 1 above (because there is no active quadrant in the previous layer).
[0182] The encoding scheme then proceeds as described above to subdivide this first active quadrant again into its four separate data elements (each representing a single coefficient). Here, it can be seen that within the first active quadrant, the first (upper left) coefficient is active (while the others are empty), so an additional '0' is added to the code (step 502a).
[0183] The sign of the coefficient is positive, so another '0' is added to indicate the sign value (step 502b).
[0184] However, at this stage there are no refinement bits (because 'bit plane 3' is the first active bit plane, so there are no values from the layers above), so the code at this stage is:
[0185] '001' (signaling that 'bit plane 3' is the first active layer)
[0186] '000' (signaling that in this bit-plane, the first coefficient is active and has a positive sign).
[0187] The coding scheme then moves to the next bit plane ('Bit Plane 2') and continues to encode it in the same way. For example, for 'Bit Plane 2', it can be seen that the second quadrant (lower left) is now active, so this is signaled accordingly, for example '1100'. There are no new coefficients in the first quadrant (which was already active), so a '0' is then sent to indicate this. However, the fourth coefficient of the second quadrant is active, and this can be signaled as '111000'. The sign of this new coefficient is negative, so a '1' is added as the sign value, and finally a refinement bit '1' for the first coefficient is added (step 503). The code at this stage is now:
[0188] '001' '000' (the encoding from 'bit plane 3')
[0189] '1100' '0' '111000' '1' '1' (the encoding from 'bit plane 2').
[0190] The encoding may then be repeated for the last two bit planes (or at least until the data packet is full).
[0191] Therefore, for 'bit plane 1', the new block is active and '10' is added to the code. There are no newly active coefficients in the first quadrant (upper left), so '0' is sent, but the first two coefficients in the second quadrant (upper right) are now active, so '101' is added to the code. The sign values of these coefficients are then added ('00', as these are all positive), and then another '0' is sent, indicating that there are no newly active coefficients in the third quadrant (lower left). The refined bit values ('00') of the two already active coefficients are sent.
[0192] Finally, for 'bit plane 0', the residual block (lower right) is now active, and this is signaled by adding a '1' to the code. The positions and sign values of the two new active coefficients in the first quadrant are then added ('1101' '10'), followed by an indication that there is no change in the second quadrant ('0'), then the positions and sign values of the new coefficients in the third quadrant ('10' '0'), and the positions of the new coefficients in the last quadrant ('11000'). The refinement bits for the four coefficients that were activated in the previous bit planes are then added ('1011').
[0193] Thus, in this way, by encoding the information of each bit plane in a context-dependent manner, where the information of each bit plane is encoded based on information from the previous layer, relatively complex significant bit dependencies can be encoded efficiently and using relatively simple variable length codes. It can also be seen that the codes shown in Table 1 are biased towards new coefficients appearing first in the upper left corner, which is typically the case after a frequency transform. However, other suitable coding schemes may of course be used.
[0194] The above example is for encoding a 4×4 array. However, it should be understood that the encoding scheme can of course also be used for other (larger) arrays. For example, Figure 7 An example of encoding an 8×8 array of data elements is shown. In this case, for each bit plane array to be encoded, the code first signals that a 4×4 block (quadrant) is newly active, and for each 4×4 block, then proceeds to encode the position and sign of the coefficients of the 4×4 block (starting from the top left and working clockwise) (i.e., steps 501 and 502). Finally, the refinement bits are encoded in sequence for each of the 4×4 blocks (step 503). The encoding then moves down to the next bit plane, and so on, until the data packet is full.
[0195] It will also be appreciated that the encoding scheme may be used for multi-plane encoding. For example, this may be the case where each data element is associated with multiple channels (e.g., YUV values). In this case, Figure 8As shown, there may be three sets of bit plane arrays, one for each channel. In this case, the bit plane arrays of the three planes are encoded in an interleaved manner in one embodiment, so that the position of the new active bit of each channel is encoded one after another before encoding the refinement bit of each data channel in one embodiment.
[0196] Fig. 9A and Fig. 9B is a flow chart showing the data flow during the encoding process. The input is a set of n bit planes (numbered (n-1), (n-2), ..., 1, 0) to be compressed into an m-bit data packet. At the top level, the encoding process starts at the top bit plane (n-1) and works downwards, and encodes each bit plane in turn until the data packet is full. The encoding of each bit plane works by subdividing the bit plane into quadrants in the same manner as described above and indicating any new active coefficients along with their sign bits and refinement bits of the previously active coefficients.
[0197] Thus, the encoding of the techniques described herein generates a data stream that, in one embodiment, includes a sequence of fixed-size data packets (e.g., each data packet represents an array (or block) of data elements). The encoded data stream generated by the encoder may be output to a memory for storage (e.g., for subsequent decoding and / or transmission), or may be output to an external device (e.g., for subsequent decoding and optionally display).
[0198] For example, the encoded data stream may then be decoded substantially by the reverse process of the encoding scheme described above. Fig.10 A decoding process according to an implementation of the techniques described herein is schematically illustrated, wherein a fixed size data packet 24 (e.g., 32 bytes) is entropy decoded (step 201), wherein rounding is inserted to (re)construct an 8×8 signed frequency domain coefficient block 22, to which an inverse frequency is then applied (step 202) in order to reconstruct an 8×8 pixel block 20 (i.e., the original input data encoded into the fixed size data packet). Fig.10 Basically it shows Figure 2 The reverse process of the encoding scheme shown. Therefore, although Fig.10 An example of generating decoded output in the form of 8x8 pixel blocks is shown, but it will be appreciated that the decoding scheme may be applied to any other suitably encoded data stream as required.
[0199] Thus, the decoding process begins by reading the fixed-size data packet to identify the location and sign of the newly active coefficient in each bit-plane, and then combining the bit-planes together to generate a set of coefficients that can then be transformed back into the spatial domain to obtain the original input. Of course, because the encoding scheme is lossy (and stops when the desired fixed size is reached), not all of the information for each bit-plane will be present in the fixed-size data packet.
[0200] For example, Fig.11 Shown according to Fig.10 An example of the decoding process for the scheme presented in for 4×4 blocks. Specifically, Fig.11 A set of six bit planes 1100 is shown which have been decoded from a fixed size data packet, for example as described above. However, for 'Bit Plane 1' and 'Bit Plane 0' there is some information which is not encoded in the fixed size data packet. These coefficients are indicated by 'X'.
[0201] To reconstruct the coefficient set 1102, rather than simply setting the unknown value ('X') to zero, at least where the sign value is known, a '1' is inserted into the underlying layer. Thus, for the upper left coefficient encoded as '11XX', this is assigned the value '13' (i.e., '1100' + '0001'). Similarly, the coefficient '1XX' is assigned the absolute value '5' ('101'). The coefficient '1X' is assigned the value '2' ('10') since there is no underlying layer. This has the effect of introducing a "1 / 2" value, and has been found to provide a more accurate reproduction (e.g., compared to setting the unknown value to '0' or '1').
[0202] The above examples generally involve lossy compression, where, in order to guarantee a fixed bit rate, encoding is stopped when a desired fixed size is reached, so that some of the original information is lost (and the original data, e.g., images, cannot be reproduced completely (losslessly)). Lossy frame buffer compression is very important for video and image processing to provide a guaranteed reduced memory bandwidth for high-resolution picture buffers. However, there are some cases where a lossless extension to a lossy coded image may be required. For example, consider the case of a reconstructed video frame in a video decoder, such as Fig.12 1, where information from an image signal processor (ISP) 1200 (e.g., a camera) is provided to a video processor (VPU) 1202 and ultimately to a display processor (DPU) 1204. The VPU 1202 and DPU 1204 may typically benefit from a lossy and fixed bandwidth format for the frame. However, a video decoder may need to use the frame as a reference picture for future decoding. In this case, a lossless (but compressed) version of the frame is required.
[0203] Therefore, according to an embodiment of the technology described herein, an additional "lossless compensation" layer can be used, which allows lossy coding to be parsed into lossless coding. For example, the lossless compensation layer provides bit-plane coding values that do not fit into a fixed-size lossy output packet to ensure that the entropy coding is lossless. Therefore, the lossless compensation layer can be generated together with the fixed-size data packets, and the lossless compensation layer and the fixed-size data packets together contain all the information required to reproduce the original input data without losing it. Therefore, in the case where lossy coding is acceptable (and desired), fixed-size data packets can be provided (separately). However, in the case where lossless coding is required, fixed-size data packets can be provided together with the lossless compensation layer.
[0204] However, in order for the entire encoding to be lossless, it is also required that the frequency transform operation be lossless. A lossless transform can be constructed from a series of "lifting" stages that multiply a triangular 2×2 matrix with unity on the diagonal. However, this iterative approach can be associated with relatively high latency and will introduce rounding errors at multiple stages when used for lossy encoding. It is desirable to have a transform that can be used efficiently for both lossy and lossless encoding.
[0205] Lossy transforms are usually implemented as integer matrix multiplications followed by a rounded right shift, e.g. Fig.13 For example, the four-point DCT can be approximated as the following matrix, followed by a rounded right shift of 5:
[0206]
[0207] Even though the matrix C / 32 has determinant 1 and therefore maps regions to regions of the same volume, it is not invertible due to the errors introduced by the rounding stage.
[0208] Therefore, in an embodiment, a biased rounding scheme may be used to ensure that the transform is lossless. For example, instead of rounding to nearest, the rounding operation may round to a value that may not always be nearest but produces a reversible mapping such that each input to the transform maps to a unique output. An example of this lossless transform is Fig.14 Shown in.
[0209] Rounding is based on the value of the bits discarded by the shift operation. For example, after an integer matrix multiplication, the MSB value may be rounded to the nearest value. However, for the LSB value, a biased rounding table may be used to ensure that there is a one-to-one correspondence. Since the LSB bit is typically available earlier than the MSB bit, this method may be implemented efficiently, for example, in terms of hardware timing.
[0210] For example, given a transformation T(x) = (Cx) / n with determinant ±1 (such that the transformation preserves volume), where C is a k×k integer matrix, x is a vector of k integers, and n is an integer divisor (usually a power of 2), it is desirable to find a function F(x) that approximates the transformation T(x) to give integer-valued output (i.e., by performing appropriate rounding operations) and that is also fully reversible.
[0211] This can be done as follows:
[0212] 1) Define C' = C mod n. C' therefore has a finite range, for example containing R elements: C'(u1), ..., C'(u R );
[0213] 2) Write the reciprocal of T as D / m, where D is an integer matrix and m is an integer;
[0214] 3) Find the minimum rounded vector r1,…,r R , so that:
[0215] a. For each value of i, C(u i )+r i is a multiple of n; and
[0216] bD(v i ) modm is different for each value of i, where v i =(C i +r i ) / n.
[0217] 4) Then, to implement the forward function F(x), the following steps can be performed given the input x:
[0218] a. Calculate integer matrix multiples Cx;
[0219] b. Set i so that Cx mod n = C'(u i ); (if n is a power of 2, this involves looking at the bottom log2(n) bits of Cx); and
[0220] c. Set the output F(x) = (C.x + r i ) / n.
[0221] 5) To implement the corresponding inverse function G(y), you can perform the following steps given the input y:
[0222] a. Calculate the integer matrix multiplication by Dy;
[0223] b. Set i so that Dy mod m = D(v i) mod m; (if m is a power of 2, this involves looking at the bottom log2(m) bits of D.yd); and
[0224] c. Set the output G(y) = (D.y + s i ) / m, where s i =mu i -Dv i , which can be pre-computed. The following code gives an exemplary implementation in C:
[0225]
[0226]
[0227]
[0228] The above specific embodiments are presented for the purpose of illustration and description. It is not intended to be exhaustive or limit the technology described herein to the precise form disclosed. In accordance with the above teachings, many modifications and variations are possible. The embodiments are selected to best explain the principles of the technology described herein and its practical application, so that other technical personnel in the field can best utilize the technology described herein in various embodiments and through various modifications suitable for the specific purpose envisioned. The scope of the present invention is intended to be defined by the appended claims.
Claims
1. A method for encoding an array of data elements representing a spatial distribution of values, the method comprising: include: performing a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients; representing the set of frequency domain coefficients as a plurality of bit plane arrays, each bit plane array representing a particular bit position of a value of a frequency domain coefficient, wherein each bit plane array comprises an array of bits corresponding to a bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array; as well as encoding the set of frequency domain coefficients into a data packet of fixed size by encoding the bit-plane arrays in a bit-plane sequence, the encoding working downwards from the bit-plane arrays representing the most significant bits until the data packet is full; where each bit-plane array is encoded by: (i) subdividing the respective bit-plane array being encoded into respective segments and, where there is space available in the data packet, including in the data packet data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the sequence of bit-planes, and then (ii) recursively subdividing any such new active segment in the corresponding bit-plane array being encoded and any segment in which the first non-zero bit value appears in the previous bit-plane array in the bit-plane sequence into corresponding sub-segments, and including in the data packet data indicating the position of any sub-segment in the bit-plane array in which the first non-zero bit value appears in the bit-plane sequence until the position of the coefficient in the bit-plane array in which the first non-zero bit value appears is indicated.
2. The method of claim 1, wherein the encoding for each bit plane array is include: Provided there is available space in the data packet, data indicating the sign of the coefficient is included in the data packet following the data indicating the position of the coefficient in the bit-plane array at which the first non-zero bit value occurs.
3. The method according to claim 1 or 2, wherein the encoding for each bit plane array is include: Provided there is available space in the data packet, data is included in the data packet indicating the original bit value of any coefficient in a preceding bit-plane array in the sequence of bit-planes in which the first non-zero bit value occurred.
4. A method according to claim 3, wherein the data indicating the bit value of any coefficient in the previous bit plane array in the bit plane sequence in which the first non-zero bit value appears is included in the data packet after indicating the position of all new active coefficients in the bit plane.
5. The method according to claim 1 or 2, wherein include: When the data packet is full, a lossless compensation layer is generated, the lossless compensation layer including information indicating the bit values and the locations of any bits where data is not included in the fixed-size data packet, such that the lossless compensation layer, together with the fixed-size data packet, contains all information required to reproduce the original input data array without loss.
6. A method according to claim 1 or 2, wherein the frequency transform operation is configured to transform each data element into a unique frequency domain coefficient output by using a rounding operation, so that the frequency transform operation is reversible, and the rounding operation depends on the value rounded by the rounding operation used for the frequency transform, so that the input to the frequency transform is mapped to a unique output.
7. The method of claim 1, wherein the encoding for each bit plane array is include: As long as there is available space in the data packet, at least one of the following is performed: (i) causing data indicating the sign of the coefficient to be included in the data packet after data indicating the position of the coefficient in the array of bit planes at which the first non-zero bit value occurs; as well as (ii) causing data indicating the original bit value of any coefficient in a previous bit-plane array in said sequence of bit-planes in which said first non-zero bit value occurred to be included in said data packet after said positions of all newly active coefficients in that bit-plane have been indicated; Wherein, the encoding for each bit plane array further comprises: When the data packet is full, since there is no available space in the data packet, a lossless compensation layer is generated separately from the fixed-size data packet, the lossless compensation layer including information indicating the original bit values and the location of any coefficient whose data is not included in the fixed-size data packet, so that the lossless compensation layer, together with the fixed-size data packet, contains all information required to reproduce the original input data array without loss.
8. A method for decoding a data stream, the data stream comprising fixed-size data packets, the fixed-size data packets encoding a set of frequency domain coefficients as a sequence of bit-plane arrays, each bit-plane array in the sequence of bit-planes representing a particular bit position of a value of a frequency domain coefficient, wherein each bit-plane array comprises a bit array corresponding to a bit value of each of the frequency domain coefficients at the bit position represented by the bit-plane array, and in, Each bit-plane array is encoded by: (i) subdividing the respective bit-plane array being encoded into respective segments and, where there is space available in the data packet, including in the data packet data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the sequence of bit-planes, and then (ii) recursively subdividing any such newly active segment in the respective bit-plane array being encoded and any segment in which the first non-zero bit value occurs in the previous bit-plane array in the bit-plane sequence into respective sub-segments, and including in the data packet data indicating the position of any sub-segment in the bit-plane array in which the first non-zero bit value occurs in the bit-plane sequence until the position of the coefficient in the bit-plane array in which the first non-zero bit value occurs is indicated, Such that the fixed-size data packet comprises, for each bit-plane array in the bit-plane sequence encoded in the fixed-size data packet, data indicating the position of any segment in the bit-plane array that contains one or more coefficients having non-zero bit values for the first time in the bit-plane sequence, and data indicating the position within the bit-plane array of any sub-segment of any such newly active segment and any sub-segment of any segment in a previous bit-plane array in the bit-plane sequence where the first non-zero bit value appeared, for those sub-segments in which the first non-zero bit value in the bit-plane sequence appeared in the bit-plane array, until the position of the frequency-domain coefficient in the bit-plane array where the first non-zero bit value appeared is indicated, the method comprising: determining from the fixed-size data packet the position of each bit-plane array in the sequence of bit-planes encoded in the fixed-size data packet of the frequency domain coefficients for which a non-zero bit value first occurs in the bit-plane array; generating a plurality of bit plane arrays using the identified positions of the frequency domain coefficients of each bit plane array, each bit plane array in the sequence of bit planes representing a particular bit position of a value of the frequency domain coefficient, wherein each bit plane array comprises a bit array corresponding to the bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array; combining the generated bit plane arrays to generate a set of frequency domain coefficients; and The set of frequency domain coefficients is used to obtain a decoded output.
9. A method according to claim 8, wherein for any bit value in a given bit plane array that is not included in the fixed-size data packet but whose sign is known, a zero is included at the position in the bit plane array and a one is included at the corresponding position in the next bit plane down in the bit plane sequence.
10. A method according to claim 8 or 9, wherein for any bit value in a given bit plane that is not included in the fixed-size data packet and whose sign is unknown, a zero is included at the position in the bit plane.
11. A device for encoding an array of data elements representing a spatial distribution of values, the device comprising an encoder, the encoder include: transform circuitry for performing a frequency transform operation on the array of data elements to generate a corresponding set of frequency domain coefficients; a bit plane encoding circuit for representing the set of frequency domain coefficients as a plurality of bit plane arrays, each bit plane array representing a particular bit position of a value of a frequency domain coefficient, wherein each bit plane array includes an array of bits corresponding to a bit value of each of the frequency domain coefficients at the bit position represented by the bit plane array; and encoding circuitry configured to encode a set of bit-plane arrays representing frequency domain coefficients into a data packet having a fixed size by encoding the bit-plane arrays in a sequence of bit-planes, the encoding working downwards from the bit-plane arrays representing the most significant bits until the data packet is full; wherein the encoding circuit is configured to encode each bit plane array by: (i) subdividing the respective bit-plane array being encoded into respective segments and, where there is space available in the data packet, including in the data packet data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the sequence of bit-planes, and then (ii) recursively subdividing any such new active segment in the corresponding bit-plane array being encoded and any segment in which the first non-zero bit value appears in the previous bit-plane array in the bit-plane sequence into corresponding sub-segments, and including in the data packet data indicating the position of any sub-segment in the bit-plane array in which the first non-zero bit value appears in the bit-plane sequence until the position of the coefficient in the bit-plane array in which the first non-zero bit value appears is indicated.
12. The apparatus of claim 11, wherein the encoding for each bit plane array is include: Provided there is available space in the data packet, data indicating the sign of the coefficient is included in the data packet following the data indicating the position of the coefficient in the bit-plane array at which the first non-zero bit value occurs.
13. The apparatus according to claim 11 or 12, wherein the encoding for each bit plane array is include: Provided there is available space in the data packet, data is included in the data packet indicating the original bit value of any coefficient in a preceding bit-plane array in the sequence of bit-planes in which the first non-zero bit value occurred.
14. An apparatus according to claim 13, wherein the data indicating the bit value of any coefficient in the previous bit plane array in the bit plane sequence in which the first non-zero bit value appears is included in the data packet after indicating the position of all new active coefficients in the bit plane.
15. An apparatus according to claim 11 or 12, wherein the encoding circuit is configured to: when the data packet is full, generate a lossless compensation layer, the lossless compensation layer including information indicating the bit value and the location of any bit where data is not included in the fixed-size data packet, so that the lossless compensation layer, together with the fixed-size data packet, contains all information required to reproduce the original input data array without loss.
16. An apparatus according to claim 11 or 12, wherein the frequency transform operation is configured to transform each data element into a unique frequency domain coefficient output by using a rounding operation, so that the frequency transform operation is reversible, and the rounding operation depends on the value rounded by the rounding operation used for the frequency transform, so that the input to the frequency transform is mapped to a unique output.
17. The apparatus of claim 11, wherein the encoding for each bit plane array is include: As long as there is available space in the data packet, at least one of the following is performed: (i) causing data indicating the sign of the coefficient to be included in the data packet after data indicating the position of the coefficient at which the first non-zero bit value occurs in the bit-plane array; as well as (ii) causing data indicating the original bit value of any coefficient in a previous bit-plane array in said sequence of bit-planes in which said first non-zero bit value occurred to be included in said data packet after said positions of all newly active coefficients in that bit-plane have been indicated; Wherein the encoding for each bit plane array further comprises: When the data packet is full, since there is no available space in the data packet, a lossless compensation layer is generated separately from the fixed-size data packet, the lossless compensation layer including information indicating the original bit values and the location of any coefficient whose data is not included in the fixed-size data packet, so that the lossless compensation layer, together with the fixed-size data packet, contains all information required to reproduce the original input data array without loss.
18. An apparatus for decoding a data stream, the data stream comprising fixed-size data packets, the fixed-size data packets encoding a set of frequency domain coefficients as a sequence of bit-plane arrays, each bit-plane array in the sequence of bit-planes representing a particular bit position of a value of a frequency domain coefficient, wherein each bit-plane array comprises a bit array corresponding to a bit value of each of the frequency domain coefficients at the bit position represented by the bit-plane array, and in, Each bit-plane array is encoded by: (i) subdividing the respective bit-plane array being encoded into respective segments and, where there is space available in the data packet, including in the data packet data indicating the position of any segment in the bit-plane array that first contains one or more coefficients having non-zero bit values in the sequence of bit-planes, and then (ii) recursively subdividing any such newly active segment in the respective bit-plane array being encoded and any segment in which the first non-zero bit value occurs in the previous bit-plane array in the bit-plane sequence into respective sub-segments, and including in the data packet data indicating the position of any sub-segment in the bit-plane array in which the first non-zero bit value occurs in the bit-plane sequence until the position of the coefficient in the bit-plane array in which the first non-zero bit value occurs is indicated, The fixed-size data packet is caused to include, for each bit-plane array in the bit-plane sequence encoded in the fixed-size data packet, data indicating the position of any segment in the bit-plane array that contains one or more coefficients having non-zero bit values for the first time in the bit-plane sequence, and data indicating the position within the bit-plane array of any sub-segment of any such newly active segment and any sub-segment of any segment in a previous bit-plane array in the bit-plane sequence where the first non-zero bit value appeared, for those sub-segments in which the first non-zero bit value in the bit-plane sequence appeared in the bit-plane array until the position of the frequency-domain coefficient in the bit-plane array where the first non-zero bit value appeared is indicated, the apparatus comprising a decoder comprising: an input circuit configured to determine, from a fixed-size data packet, a position of each bit-plane array in the sequence of bit-planes encoded in the fixed-size data packet of the frequency-domain coefficients, for which a non-zero bit value first occurs in the bit-plane array; bit-plane decoding circuitry configured to generate a plurality of bit-plane arrays using the identified positions of the frequency-domain coefficients of each bit-plane array, each bit-plane array in the sequence of bit-planes representing a particular bit position of a value of the frequency-domain coefficient, wherein each bit-plane array comprises a bit array corresponding to the bit value of each of the frequency-domain coefficients at the bit position represented by the bit-plane array; and to combine the generated bit-plane arrays to generate a set of frequency-domain coefficients; and An output circuit is configured to obtain a decoded output using the set of frequency domain coefficients.
19. A computer readable storage medium storing computer software which, when executed on a data processor, performs the method according to claim 1 or 2 or 7.
