Encoding methods and systems
The transform-based data compression method addresses the hardware resource challenges of existing codecs by using a subset-based transformation approach, achieving efficient and cost-effective data compression with reduced hardware complexity.
Patent Information
- Application Number
- JP2025063265
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-08
- Filing Date
- 2025-04-07
- Publication Date
- 2025-10-21
AI Technical Summary
Existing codecs for data compression, such as PNG, T81 Lossless JPEG, and T87 JPEG-LS, require significant hardware resources due to the use of variable-length coding (VLC) and FIFO buffers, leading to increased hardware costs and complexity.
A method involving a transform set with multiple subsets, including both lossless and lossy transformations, is used to map symbols of a first data type to a second data type with a different code length, optimizing hardware requirements by minimizing the need for VLC buffers.
This approach reduces hardware complexity and cost by enabling efficient data compression with simpler hardware, while maintaining data integrity through lossless and lossy transformations.
Smart Images

Figure 2025159719000001_ABST
Abstract
Description
[Technical Field]
[0001] The present disclosure relates to encoding methods for compressing data streams, methods for decoding such encoded data streams, and systems for encoding and / or decoding data using these methods. Although embodiments will be described generally in the context of encoding data streams representing video or audio, the invention should not be limited to such applications. [Background technology]
[0002] Although a large number of different codecs exist for encoding and / or decoding data sequences such as video and audio data, certain requirements may arise that are not adequately addressed by existing codecs. One such requirement is the desire for relatively low compression, preferably feasible with simple hardware.
[0003] These niche needs are addressed by codecs such as PNG, T81 Lossless JPEG, and T87 JPEG-LS, all of which offer light compression with small hardware footprints. All three codecs achieve this by using pixel prediction algorithms, which transmit a pixel as the difference between its neighboring pixel (or a value based on a combination of several neighboring pixels).
[0004] These codecs use variable-length coding (VLC), which achieves data compression by assigning shorter codes to frequently transmitted deltas and longer codes to infrequently transmitted deltas. While the data encoded by these codecs is generally smaller than the source data (the data before compression), most source data (e.g., images) often generates a burst of encoded data that is larger than the source data. This necessitates the use of VLC data buffers, such as First-In First-Out (FIFO) devices, which increases hardware resource requirements and ultimately hardware costs.
[0005] The present inventors have identified the desirability of further simplifying the hardware requirements, or at least providing an alternative to such codecs.
[0006] The systems, devices, methods, and approaches, and components thereof, described in this section are known to the inventors, and therefore, unless expressly stated otherwise, it should not be assumed that these systems, devices, methods, approaches, or components thereof can be cited as prior art or that such systems, devices, methods, approaches, and components are generally known to those skilled in the art merely by virtue of their inclusion in this section. Summary of the Invention
[0007] In a first aspect of the present disclosure, a method for converting an nth symbol of a first data sequence to an mth symbol of a second data sequence is provided, the method including: receiving the nth symbol of the first data sequence; and using a transform from a predetermined transform set to map a first data type including a first group of symbols having a first code length to a second data type including a second group of symbols having a second code length different from the first code length, thereby generating the mth symbol of the second data sequence from the nth symbol of the first data sequence. The predetermined transform set includes a plurality of transform subsets, each transform subset mapping the first data type to the second data type, each transform subset including a group of lossless transforms that losslessly map certain symbols of the first data type to symbols of the second data type and at least one group of lossy transforms between the remaining symbols of the first data type and the second data type. The transform used to generate the mth symbol of the second data string from the nth symbol of the first data string belongs to a transform subset, and in the reversible transform group of the transform subset, the n-1th symbol of the first data string is included in certain symbols of the first data type that are losslessly mapped to symbols of the second data type.
[0008] In some embodiments, in each transformation subset, certain symbols of the first data type that map losslessly to symbols of the second data type represent groups of consecutive data values.
[0009] In some embodiments, in each transformed subset, the (or each) group of remaining symbols of the first data type that are transformed to said second data type by a non-reversible transformation represents a group of consecutive data values.
[0010] In some embodiments, in each transform subset, the second data type includes a first number of symbols onto which the particular symbol of the first data type is losslessly mapped and a second number of symbols onto which other symbols of the first data type are lossily mapped, and the first number of symbols and the second number of symbols in the symbol group of the second data type are equal.
[0011] In some embodiments, the method further includes determining a next transform subset to use to transform the n+1-th symbol of the first data sequence based on the n-th symbol of the first data sequence; and transforming the n+1-th symbol of the first data sequence to the m+1-th symbol of the second data sequence using a transform from the next transform subset.
[0012] In some embodiments, in the next transformation subset, the nth symbol is losslessly mapped to a symbol of the second data type.
[0013] In some embodiments, the method further includes transforming the mth symbol of the second data sequence back to the first data type using an inverse transform corresponding to a transform in the same transform subset used to generate the mth symbol of the second data sequence.
[0014] In a second aspect of the present disclosure, there is provided a method for encoding a first data sequence, encoded in a first data type having codewords of a first code length, into a second data sequence, encoded in a second data type having codewords of a second code length. The method includes: determining a fixed set of transformations that map symbols of the first data type to symbols of the second data type, including lossless and lossy transformations between symbols of each data type; receiving an nth symbol of the first data sequence; and determining a transformation from the fixed set to use for encoding the nth symbol. In this case, the determined transformation is lossless when the nth symbol of the first data sequence is identical to or within a predetermined difference threshold of the n-1th symbol.
[0015] In some embodiments, the fixed set of transformations mapping symbols of a first data type to symbols of a second data type includes a plurality of transformation subsets, where each transformation subset includes a group of lossless transformations that map all symbols of the first data type to the second data type and that losslessly map certain symbols of the first data type to symbols of the second data type, and a group of at least one lossy transformation between the remaining symbols of the first and second data types.
[0016] In some embodiments, the transform determined to be used to encode the nth symbol belongs to a transform subset, and both the n-1th symbol and the nth symbol correspond to a particular symbol within a reversible transform group of the transform subset.
[0017] In a third aspect of the present disclosure, there is provided a method for decoding an mth symbol of a second data sequence having a second data type, the mth symbol having been generated by encoding an nth symbol of a first data sequence having a first data type, to generate an output symbol having the first data type through the decoding, the method including: receiving the mth symbol of the second data sequence; and generating an output symbol using a transform from a predetermined transform set that maps the second data type to the first data type, the predetermined transform set including a plurality of transform subsets, each transform subset mapping the second data type to the first data type, wherein the transform used to generate the output symbol belongs to a transform subset selected based on an output symbol corresponding to the (m-1)th symbol.
[0018] In some embodiments, each transform subset of the predetermined set of transforms corresponds to a predetermined subset of transforms that can be used in encoding the second data stream.
[0019] In some embodiments, each transform subset of a given transform set includes a group of transforms consisting of direct inverse transforms corresponding to a group of lossless transforms that may be used to encode a first data sequence into a second data sequence, and a remaining plurality of transforms corresponding to a plurality of groups of lossy transforms that may similarly be used to convert between the first data type and the second data type.
[0020] In some embodiments, the method further includes establishing a predetermined subset of transformations that maps the second data type to the first data type for use in decoding the m+1-th symbol of the second data sequence.
[0021] A fourth aspect of the present disclosure provides a method for converting an nth symbol of a first data sequence to an mth symbol of a second data sequence, the method comprising: receiving the nth symbol of the first data sequence; and generating an mth symbol of a second data sequence from the nth symbol of the first data sequence using a transform from a predetermined transform set that maps a first data type consisting of a first group of symbols having a first code length to a second data type consisting of a second group of symbols having a second code length different from the first code length. The predetermined transform set includes a plurality of transform subsets, each transform subset including a group of reversible transforms that map the first data type to the second data type and that losslessly map specific symbols of the first data type to symbols of the second data type, and at least one group of non-reversible transforms between the remaining symbols of the first and second data types. The transform used to generate the mth symbol is selected based on the n-1th symbol of the first data sequence.
[0022] In a fifth aspect of the present disclosure, there is provided a method for encoding a first data sequence, encoded in a first data type having codewords of a first code length, into a second data sequence, encoded in a second data type having codewords of a second code length, the method including: determining a fixed transformation set that maps symbols of the first data type to symbols of the second data type, the fixed transformation set including a lossless mapping between at least some symbols of each data type and a lossy mapping between at least some symbols of each data type; receiving an n-th symbol of the first data sequence; and determining, based on the n-1-th symbol of the first data sequence, a transformation from the fixed transformation set to use to encode the n-th symbol.
[0023] A sixth aspect of the present disclosure provides an encoding device including: an input unit for receiving a first data sequence including first symbols of a first data type and having a first code length; an output unit for transmitting a second data sequence including second symbols of a second data type and having a second code length different from the first code length; and a processing system configured to process the received symbols of the first data sequence and output symbols of the second data sequence, wherein the processing system is configured to perform a method according to any of the first, fourth, and fifth aspects of the present disclosure.
[0024] In a seventh aspect of the present disclosure, there is provided a decoding device including an input unit for receiving a second data sequence including second symbols of a second data type and having a second code length, an output unit for transmitting output symbols having a first data type corresponding to the first data type of the first data sequence encoded to generate the second data sequence, and a processing system configured to sequentially process the received symbols of the second data sequence and output symbols of a third data sequence having the same data type as the first data sequence, wherein the processing system is configured to perform the method of the third aspect of the present disclosure.
[0025] In an eighth aspect of the present disclosure, there is provided a decoding device according to the seventh aspect, further adapted to perform the method of the third aspect of the present disclosure.
[0026] While the invention disclosed herein is susceptible to various modifications and alternative forms, specific embodiments have been shown by way of example in the drawings and have been described in detail. However, the drawings and detailed description are not intended to limit the invention to the particular forms disclosed. Moreover, all alternative combinations of two or more individual features expressed or apparent by the specification or drawings constitute a disclosure creating additional aspects or inventions, and may be the subject of claims. [Brief explanation of the drawings]
[0027] [Figure 1] FIG. 1 is a system diagram for implementing an encoding method according to an embodiment of the present disclosure.
[0028] [Figure 2] FIG. 2 illustrates a set of predetermined transforms that can be used for encoding and decoding in one embodiment.
[0029] [Figure 3] FIG. 10 is a schematic diagram illustrating a set of predetermined transformations that can be used for encoding and decoding in another embodiment.
[0030] [Figure 4A] 1 is a flowchart illustrating an encoding process according to an embodiment of the present disclosure.
[0031] [Figure 4B] 1 is a flowchart illustrating an encoding process according to an embodiment of the present disclosure.
[0032] [Figure 5A] 1 is a flowchart illustrating a decoding process according to an embodiment of the present disclosure.
[0033] [Figure 5B] 1 is a flowchart illustrating a decoding process according to an embodiment of the present disclosure.
[0034] [Figure 6] 10 is a flowchart illustrating a "Next Table" process in one embodiment.
[0035] [Figure 7] 10 is a flowchart illustrating an "Encode Sample" process in one embodiment.
[0036] [Figure 8] 10 is a flowchart illustrating a "Decode Sample" process in one embodiment.
[0037] [Figure 9]1 is a flowchart illustrating the "Encode Sequence" process in one embodiment.
[0038] [Figure 10] 1 is a flowchart illustrating a "Decode Sequence" process in one embodiment.
[0039] [Figure 11] FIG. 1 is a schematic block diagram of an encoder in which an embodiment can be implemented;
[0040] [Figure 12] FIG. 2 is a schematic block diagram of a decoder in which an embodiment can be implemented;
[0041] [Figure 13] FIG. 9 is a circuit diagram illustrating a circuit capable of implementing the “Decode Sample” method of FIG. 8.
[0042] [Figure 14A] FIG. 2 illustrates an example of a single image compressed using embodiments of the present disclosure. [Figure 15A] FIG. 2 illustrates an example of a single image compressed using embodiments of the present disclosure.
[0043] [Figure 14B] FIG. 14B shows lossy pixels in the image of FIG. 14A. [Figure 15B] FIG. 15B shows lossy pixels in the image of FIG. 15A. DETAILED DESCRIPTION OF THE INVENTION
[0044] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent that the present invention may be practiced without these specific details. In some instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring important details.
[0045] Embodiments of the present disclosure are applicable to any digital data consisting of a sequence of fixed-size code words that needs to be stored or transmitted with compression, including, for example, one-dimensional digital data such as a sequence of audio samples, two-dimensional digital data such as a sequence of data representing a bitmap image, or three-dimensional data such as a video clip, although the present disclosure should not be limited to these examples.
[0046] 1 illustrates a system capable of implementing an encoding method according to an embodiment of the present disclosure. System 100 includes an input channel 101, which may be a wired or wireless communication channel or bus, over which a first data stream is received by an encoder 102. Encoder 102 may be a standalone encoder device, such as a format converter adapted to convert a received data stream in one format to another format or to compress the data stream (an example is the Blackmagic 2110 IP Converter from Blackmagic Design Pty Ltd). Alternatively, encoder 102 may be configured as a component, subsystem, or part of a device having additional functionality and purpose, such as a personal computer, a computer server, a network storage device, a media processing appliance, a network switch, etc.
[0047] The encoder 102 is configured to receive a first data sequence encoded with a first data type. The first data type includes a group of first symbols having a first code length. The encoder 102 is configured to convert (or encode) each symbol of the first data sequence into data of a second data type to generate a second data sequence. The second data type includes a group of second symbols having a second code length. The second code length is different from the first code length, and when the encoder 102 is used for compression (also called "encoding"), the second code length is shorter than the first code length.
[0048] The second data stream is output directly or indirectly from encoder 102 via output channel 103. Output channel 103 may be a wired or wireless communications channel or bus. Output channel 103 may be connected to any appropriate external device, such as a data storage system for storing the second data stream, or an external device for decoding the second data stream for further processing or for use in a downstream application in its encoded form. Output channel 103 may comprise, be connected to, or form part of a network, such as a LAN, WAN, VPN, or public network (e.g., the Internet), possibly via one or more intermediary networks or devices.
[0049] In use, the encoder 102 performs a transformation on each symbol of a received first data sequence. The transformation performed on each symbol (e.g., the nth symbol of the first data sequence) is one of a set of transformations that map the first data type to a second data type. These transformations may be predetermined. The set of transformations is determined by the relative code lengths of the first and second data types.
[0050] The set of transforms can be considered to include multiple transform subsets, each defining a different mapping of symbols of a first data type to symbols of a second data type. All of these transform subsets include both lossless and lossy transforms between the first and second data types. In each transform subset, there is a specific group of symbols of the first data type that map losslessly to symbols of the second data type. The remaining symbols of the first data type map lossily to the second data type, i.e., multiple symbols of the remaining symbols of the first data type map to the same symbol of the second data type. The specific symbols included in a group of reversible transforms within a transform subset may represent a corresponding group of consecutive values in the data represented by the first data sequence. Thus, symbols represented by a group of values are losslessly encoded, while remaining values outside that group are lossily encoded. Which group of symbols of the first data type are losslessly transformed in each transform subset varies from subset to subset, and there is always at least one transform subset in which a given symbol of the first data type maps losslessly to a symbol of the second data type.
[0051] For each symbol to be coded, it is necessary to determine the transform to be used. Generally, in embodiments of the present disclosure, the criteria for this determination depend on the previous symbol (n-1) received immediately before the n symbol currently being coded. In this regard, the previous symbol (n-1) is used to determine which transform subset in the transform set contains the required transform for the n symbol.
[0052] To maximize accuracy during decoding, it is advantageous to determine a predicted decoded value for the (encoded) n-1 symbol and base the decision on the subset of transforms to use when encoding the n symbol on this predicted decoded value. This is because the decoder does not have direct knowledge of the n-1 symbol, but rather has knowledge of its decoded value (herein referred to as "n *This takes into account that only the n-1th symbol (referred to as the "m-1th symbol") of a second data stream is known. If the n-1th symbol of a first data stream is losslessly encoded, then the m-1th symbol of a second data stream will be reconstructed into the n-1th symbol upon decoding, but if it was lossily encoded, the n-1th symbol cannot be reconstructed exactly the same upon decoding. Therefore, using a predicted decoded value rather than the n-1th symbol itself allows both the decoder and the encoder to use the same subset of transforms for decoding and encoding. For example, when the n-1th symbol of a first data stream is encoded, it becomes the m-1th symbol of the second data stream. This m-1th symbol may then be decoded (e.g., also at the encoder side) to determine a predicted decoded value for the decoded value that the decoder will generate from this m-1th symbol. This predicted decoded value can then be used as a basis for selecting the transform to use to encode the nth symbol.
[0053] Returning to Figure 1, from the perspective of decoder 104, channel 103 is an input channel. Decoder 104 is configured to receive a second data stream encoded in a second data type. Decoder 104 is configured to convert (i.e., decode) each symbol of the second data stream into data of the first data type to generate a third data stream, where the mth symbol of the second data stream is the nth symbol of the third data stream. * th symbol. Similar to encoder 102, decoder 104 may be a stand-alone decoder device, such as a Blackmagic 2110 IP Converter from Blackmagic Design Pty Ltd, that converts a data stream received in one format to another format or decompresses a compressed data stream. Alternatively, decoder 104 may form a component, subsystem, or function of a device with additional functionality or purpose (e.g., a personal computer, a computer server, a network storage device, a network switch, etc.).
[0054] Decoding is performed in a similar manner to encoding: the mth symbol of the second data sequence is converted to the nth symbol of the third data sequence according to one transformation of a predetermined set of transformations that convert the second data type back to the first data type. * The first symbol is decoded to the second symbol. That is, a given transform set used for encoding has a corresponding inverse transform that is used for decoding. The transform set for decoding is also composed of a subset similar to the transform subset used for encoding. Furthermore, within each transform subset, the decoding transform for a group of lossless mappings used for encoding may simply be a direct inverse of the mapping used for encoding. The remaining inverse transforms within each transform subset, i.e., the inverse transforms corresponding to the remaining lossy transforms used for encoding, map each symbol of the second data type to one of the symbols of the first data type to which it was mapped by the encoding transform. In some embodiments, the inverse transform (i.e., decoding) maps a symbol of the second data type to a symbol of the first data type that corresponds to the median value of the symbols in the group of lossy transforms that were mapped to the symbol of the second data type by the encoding transform. This symbol selection minimizes the maximum error in decoding a lossy encoded value. This maximum error is half the variation (range) of the values represented by symbols of the first data type that are lossy transformed to the same symbol of the second data type.
[0055] Each transform subset may contain a unique mapping, both for encoding and decoding, between the first data type and the second data type that is different from the other subsets.
[0056] As previously mentioned, the decoder 104 is configured to convert (or decode) each symbol of the second data sequence into data of the first data type to generate a third data sequence. The decoding process proceeds similarly to the encoding process, in that the decoder must determine the transform to use to decode the mth symbol of the second data sequence. This transform belongs to the same transform subset as the transform subset used to encode the nth symbol of the first data sequence into the mth symbol of the second data sequence.
[0057] In practice, the correct transformation subset may be determined based on the value of the immediately preceding symbol (the m-1th symbol). In particular, the determination is based on the decoded value (n-1) of the symbol (the m-1th symbol) received immediately before the symbol to be decoded (the mth symbol). * It depends on the (th symbol).
[0058] The decoded values generated by the decoder 104 are output, directly or indirectly, to an output channel 105. The output channel 105 is a wired or wireless communication channel or bus through which the third data stream is output by the decoder 104.
[0059] Once the transformation subset is determined, the correct transformation is applied based on the value of the mth symbol, and the nth * The th symbol is generated.
[0060] An example code table defining a set of transformations usable in one embodiment of the present disclosure, where a first data string encoded with 4-bit code words in a first data type is compressed to a second data string encoded with 3-bit code words in a second data type, is shown in detail in FIG. 2.
[0061] 2 illustrates an example of mapping a first data type containing 4-bit symbols to a second data type containing 3-bit symbols in one embodiment. The 4-bit symbol set (library) of the first data type consists of 16 symbol values from 0000 to 1111 and is shown in a green box in the code table. The 3-bit symbol set of the second data type consists of 8 symbol values from 000 to 111 and is shown in a blue and red box in the code table.
[0062] The five code tables (Table 0 to Table 4) shown in Figure 2 constitute a predetermined set of transformations that can be used in the encoding and decoding processes. Each table (Table 0 to Table 4) constitutes a subset of the predetermined transformations. As can be seen from the tables, each table defines a complete mapping of symbols of a first data type to a second data type, and each mapping is unique. That is, no two transformation subsets (code tables) are the same.
[0063] Each table (Table 0 to Table 4) is configured as follows: a) The top row of symbols (210.0-210.4) represents the code words of the first data type; b) The symbol string in the second row (220.0 to 220.4) represents the code word of the second data type; c) The symbol string in the third row (230.0 to 230.4) represents the code words of the first data type obtained as a result of decoding.
[0064] The code tables (Tables 0 to 4) represent lookup tables for encoding any received symbol of the first data type. When a symbol of the first data type is received, its conversion is determined by searching for that symbol in the top row (210.0 to 210.4) of Code Tables 0 to 4 and reading the corresponding value listed in the second row (220.0 to 220.4) immediately below it, and this value becomes the encoded value in the second data type. Decoding is similar: when a symbol of the second data type is received, its conversion is determined by searching for that symbol in the second row (220.0 to 220.4) of Code Tables 0 to 4 and reading the corresponding value listed in the third row (230.0 to 230.4) immediately below it, and this value becomes the decoded symbol of the first data type.
[0065] Each code table (Table 0 through Table 4) contains a group (240.0 through 240.4) of symbols in a first data type that map losslessly to symbols in a second data type. The remaining symbols in the first data type map lossily to symbols in the second data type. These are organized as lossy conversion groups (e.g., 242.0, 244.0, 246.0, and 248.0 in Code Table 0) so that the remaining symbols in the first data type map to the same symbols in the second data type (e.g., all symbols in the first data type belonging to group 242.0 in Table 0 map to symbol 100 in the second data type; all symbols in group 244.0 in Table 0 map to symbol 101 in the second data type; and so on, with symbols in group 246.0 mapped to symbol 110, symbols in group 248.0 mapped to symbol 111, and so on. Similar groups are labeled in the code tables of the other conversion subsets). Figure 2 also includes a legend explaining the color coding of the various symbols / symbol groups used in Figures 2 and 3. The yellow boxes indicate the most recently decoded symbols (n * The green box represents the current symbol (nth symbol) of the first data string represented by the first data type. The blue box represents the current symbol (mth symbol) of the second data type losslessly encoded from the first data type into the second data string using a lossless transformation. The red box represents the current symbol (mth symbol) of the second data type lossily encoded from the first data type into the second data string using a lossy transformation. The purple box represents the current symbol (nth symbol) of the first data type decoded and included in the third data string. * The white or black bar that appears below part of the purple decoded symbol frame indicates the current decoded symbol (n * The symbol (th symbol) indicates whether it is lighter (white bar) or darker (black bar) than the original symbol value.
[0066] During decoding, each symbol of the second data type is converted to a corresponding symbol of the first data type listed in the bottom row 230.0, 230.1, 230.2, 230.3, 230.4 of the code table. As can be seen, in each code table, the reversible conversion group (240.0-240.4) is losslessly mapped back to the original value of the first data type. In each conversion table, the remaining symbols of the second data type (shown in red) are mapped to the symbols in the bottom row 230.0, 230.1, 230.2, 230.3, 230.4 as symbols of the first data type (shown in purple). This mapping is performed so that the first data type codewords (shown in purple) in the bottom rows 230.0, 230.1, 230.2, 230.3, and 230.4 that match a second data type codeword are the codewords corresponding to the median values of the group of first data type codewords that were mapped to the second data type during encoding. For example, taking Table 1 as an example, during encoding, the codewords 0000, 0001, and 0010 are configured as group 242.1, and are lossily mapped to the second data type codeword 100. During decoding, the second data type symbol 100 must be mapped to one of the codewords 0000, 0001, or 0010 that belong to the first data type group 242.1. In an embodiment of the present disclosure, this mapping is selected so that the median value of the first data type values contained in group 242.1 is used. Thus, the second data type codeword 100 is decoded to the first data type symbol 0001. This selection minimizes the maximum error introduced by lossy lossy encoding. In this example, the maximum error is only one codeword. This is illustrated by the bars below the symbol values 230.0, 230.1, 230.2, 230.3, and 230.4 in the bottom row of the code table in Figure 2. Black bars indicate that if the encoded data represents pixel luminance values, the decoded values of the lossy encoded symbols will be darker than the original values. White bars indicate that if the encoded data represents pixel luminance values, the decoded values of the lossy encoded symbols will be lighter than the original values.The purple bars indicate that, despite lossy decoding, by chance a decoded result was obtained that perfectly matched the original input value, suggesting that lossless decoding was achieved as a result.
[0067] The code table of Figure 2 illustrates an advantageous property of the predetermined set of transforms used in some embodiments of the present disclosure. Because each transform subset contains an equal number of reversible (lossless) and non-reversible (lossy) transforms, only one bit of the encoded symbol (i.e., the symbol of the second data type) can be used as a flag to classify the codeword of the second data type as a lossy or lossless value (i.e., a lossy or lossless transform value). In the illustrated embodiment, the leading bit of the encoded symbol value can be used during decoding to determine whether the symbol is lossy or lossless. Specifically, a leading bit of the encoded symbol indicates a lossy transform if it is 1, and a leading bit of the encoded symbol indicates a lossy transform if it is 0. In this way, utilizing a single bit as a "lossy flag" can computationally simplify the decoding process. However, this process may not be necessary depending on the embodiment.
[0068] In the preceding description of Figure 2, it should be noted that when any symbol in the first data sequence is received, there are five possible transformations that can be applied to it. That is, the symbol may be coded according to any of five code tables. Therefore, it is necessary to determine which transformation subset (i.e., which code table 200.0, 200.1, 200.2, 200.3, 200.4) should be used for any symbol in the first data sequence.
[0069] As noted above, the selection of which transform subset to use generally depends on the symbol received immediately prior to the current symbol in the first data sequence. However, as will be explained below, this dependence is based on the corresponding decoded values, not the symbols themselves. This relationship is visually illustrated in Figure 2, where it is represented by the yellow symbols in the subrows 250.0, 250.1, 250.2, 250.3, and 250.4 at the top of each code table 200.0, 200.1, 200.2, 200.3, and 200.4.
[0070] If the previous symbol corresponds to one of the values in sub-row 250.0, then the current symbol is encoded and decoded using the transformations defined in code table 200.0. Conversely, if the previous symbol corresponds to one of the values in sub-row 250.1, then the current symbol is encoded and decoded using the transformations defined in code table 200.1. Similarly, if the previous symbol corresponds to one of the values in sub-row 250.2, 250.3, or 250.4, then the transformations in code tables 200.2, 200.3, and 200.4, respectively, are used.
[0071] To maximize accuracy during decoding, the decoder uses the predicted decoded value of the previous symbol, rather than its original value, to determine the transform subset to use for the current pixel. This is because the decoder does not have direct knowledge of the original value of the previous symbol, but only its decoded value. Note that the encoder also determines the transform subset (i.e., code table) of a given transform set to use when encoding the next symbol based on the predicted decoded value of the current symbol. To obtain this predicted decoded value, the encoder simply decodes the encoded value of the previous symbol.
[0072] FIG. 3 is a schematic diagram of a predetermined transformation set 300 that may be used in one embodiment. In this embodiment, the first data type is a 5-bit binary value and the second data type is a 4-bit binary value, resulting in a 5:4 encoding compression ratio. This predetermined transformation set is divided into subsets 300.0, 300.1, 300.2, 300.3, 300.4, 300.5, 300.6, 300.7, and 300.8, each of which is illustrated as a unique code table. Each code table has a different content. In each code table, green boxes represent the 5-bit code values of the first data type, from left to right, ranging from 00000 to 11111. The second row lists the 4-bit code values of the second data type, 0000-1111. Blue boxes represent values that are losslessly mapped from the first data type, and red boxes represent values that are lossily mapped from the first data type. The specific mapping values depend on the selected implementation. However, in this example, the blue boxes represent the sequential values 0000-0111 of the second data type, from left to right, to which the values of the first data type are losslessly mapped. Meanwhile, the red boxes represent the range of values 1000-1111 of the second data type, from left to right, to which the remaining values of the first data type are losslessly mapped, which is common to all code tables. As shown, the lossy transformation groups the remaining data values of the first data type into groups of three, each of which is mapped to a single value of the second data type. The bottom row shows the corresponding decoded values in the first data type. Groups of losslessly transformed values are converted back to the same value as originally received in the first data type upon decoding. Meanwhile, lossily transformed values are decoded to the center value of the corresponding group. The yellow boxes are used to determine which predetermined transformation subset (code table) to use when encoding a particular symbol (the nth symbol) of the first data sequence. That is, after the previous symbol (the n-1th symbol) is encoded, the encoder uses its predicted decoded value (n-1 *The decoder determines (e.g., decodes) the nth symbol (the n-1th symbol) and encodes the nth symbol using the code table whose value is contained in the yellow box. The decoder similarly decodes the mth symbol using that same code table. For example, if the n-1th symbol is 01100, 01101, or 01110, then code table 3 (300.3) is used to encode the nth symbol. * If the th symbol is 11011, 11100, 11101, 11110, or 11111, code table 8 (300.8) is used.
[0073] The following table shows examples of further possible embodiments and their associated specific parameters, although the present disclosure is not limited to such examples. [Table 1]
[0074] It will be appreciated that diagrams corresponding to Figures 2 and 3 illustrating predetermined transformation sets that can be used in the above-described embodiments of the present disclosure (and in other embodiments not described herein in which the code lengths of the first and second data types are different) can be created. However, as the code lengths of the first and second data types increase, the size of the subsets in each predetermined transformation set increases, and the number of predetermined transformation subsets also increases, making such a diagram unwieldy and therefore not illustrated. For example, in the aforementioned example of a compression ratio of 10:9, each code table contains transformations for the 1,024 symbols that make up the symbol string of the first data type, resulting in 257 code tables (i.e., 257 predetermined transformation subsets).
[0075] FIG. 4A is a flowchart illustrating an overview of an encoding process according to one embodiment of the present disclosure. The method of FIG. 4A can be used to encode a data sequence comprising symbols of a first data type to generate a second data sequence comprising symbols of a second data type. The process begins by determining a transform subset from a predetermined transform set defined based on the first and second data types to be used to encode the next received symbol of the first data sequence (step 402). In some embodiments of the present disclosure, each transform subset in the predetermined transform set includes both lossless and lossy transforms between the first and second data types. For every received symbol (except the first symbol), the transform subset used to encode the target symbol (the nth symbol) is determined based on the most recently received symbol (the n-1th symbol).
[0076] In step 404, the nth symbol of the first data sequence is received. This may include receiving the symbol data over a serial data connection, such as a network link or data bus, that provides data from a sensor, transducer, memory, or any other source. The nth symbol is then encoded in step 406 according to an appropriate transform from the subset of transforms identified in step 402. The encoded symbol, represented in the second data type, is then output in step 408 as the mth symbol of the second data sequence.
[0077] FIG. 4B illustrates an embodiment of an extension of the method of FIG. 4A, including a mechanism for starting the encoding process. In some embodiments, the encoding process may need to be tailored to a particular type of data sequence rather than a fixed encoding scheme. Accordingly, the method of FIG. 4B begins in step 409 by configuring the parameters of the encoding process by determining the encoder settings, i.e., the data type of the first data sequence and the data type of the second data sequence. These parameters essentially define the predetermined transforms available for encoding and decoding. Next, in step 410, a predetermined transform subset to be used to encode the first symbol of the first data sequence is determined. This determination is typically based on a predetermined rule. In some embodiments, the predetermined transform subsets (also called code tables) are numbered from 0 to i based on the position of the reversible transform. In some embodiments, the zeroth code table is selected as the first code table, and in other embodiments, the last transform subset is selected. In the exemplary embodiment described herein, a central code table is selected to encode the first symbol of the first data sequence. A first symbol is then received in step 412 and coded in step 414 according to the corresponding transform defined in the transform subset determined in step 410 and output as the first symbol of the second data sequence in step 415. This first symbol is also used in step 402 to determine an appropriate transform subset from the predetermined set that is used to select the transform to apply to the next symbol (the nth symbol) received in step 404. This process continues until all symbols of the first data sequence have been coded in step 406 and output in step 408. Also, as mentioned above, step 402 optionally includes the coding of a predicted decoded value n corresponding to the n-1th symbol. *The process may include the substep of decoding the n-1th symbol using the same process as the decoder to determine -1, and this prediction can be used to select an appropriate subset of transforms from a predetermined set to use in encoding the next symbol (the nth symbol). The process ends at step 420.
[0078] FIG. 5A is a flowchart outlining a decoding process consistent with the present disclosure. The process can be used to decode a data sequence comprising symbols of a second data type to generate a third data sequence comprising symbols of a first data type. The process begins by determining 502 a transform subset to be used to decode the next received symbol of the second data sequence from a predetermined set of transforms defined based on the first and second data types. For all received symbols (except the first symbol), the transform subset used to decode the current symbol (the mth symbol) is determined from the nth transform subset corresponding to the most recently decoded symbol (the m-1th symbol). * -1st symbol).
[0079] In step 504, the mth symbol of the second data stream is received. This may include receiving the symbol over a serial data connection, such as a network link or data bus, which may provide data from a network, memory, or any other source. The mth symbol is then decoded in step 506 according to the appropriate transform in the transform subset identified in step 502. The decoded symbol (represented in the first data type) is then decoded in step 508 according to the nth symbol of the third data stream. * It is output as the th symbol.
[0080] FIG. 5B illustrates an embodiment that extends the method of FIG. 5A by including a mechanism for initiating the decoding process. The initiation process of the decoding process must match the process used during encoding, so that it operates in conjunction with the encoding process. Like the encoding process, the decoding process may differ from a fixed encoding scheme and may need to be tailored to suit a particular type of data sequence. Therefore, the method of FIG. 5B begins in step 509 with decoder configuration by determining the parameters of the decoding process, i.e., the data type of the first data sequence and the data type of the second data sequence. These parameters essentially define the predetermined transformations used to encode and decode the data sequences.
[0081] Next, in step 510, a predetermined transform subset is determined to be used to decode the first symbol of the second data stream. This determination is typically based on the same rules as those used to start the encoding. The first symbol is then received (step 512), decoded according to the corresponding transform defined in the transform subset determined in step 510 (step 514), and output as the first symbol of the output data stream (step 515). This decoded symbol is also used in step 502 to determine an appropriate transform subset from the predetermined transform set that is used to select the transform to apply to the next received symbol (the (m+1)th symbol) in step 504. In step 506, the mth symbol is decoded according to the n * th symbol and output at step 508. This process continues until all symbols in the second data string have been decoded, eventually terminating at step 520.
[0082] A more detailed example of an embodiment will be described with reference to Figures 6 to 10, which are flow charts showing steps in an exemplary implementation of parts of the method. Some sections of the following description are expressed in C pseudocode. These sections are shown in bold. Note that the numerical operators used in these sections are C operators. [Table 2]
[0083] In an expression using multiple operators, the precedence of each operator follows the normal rules of the C language.
[0084] For convenience, the code words of the first data type will be referred to below as "samples." This term is particularly appropriate when the data being encoded represents digital samples of an analog process, such as image or audio capture. However, the code words do not necessarily represent samples, and this disclosure is not limited to such usage.
[0085] In many implementations, the encoder or decoder must first be configured for a particular configuration of raw data (first data type) and coded data (second data type), by defining sample_bits equal to the code length of the first data type and coded_bits equal to the code length of the second data type.
[0086] This allows the following values to be determined for a given codec configuration: cfg->sample_states = 1 << sample_bits; cfg->coded_states = 1 << coded_bits; cfg->lossy_code_width = (1 << (sample_bits - coded_bits + 1)) - 1; cfg->lossy_rounding = cfg->lossy_code_width / 2; cfg->lossless_codes = cfg->coded_states / 2; cfg->lossy_codes = cfg->coded_states / 2; cfg->code_tables = 1 + cfg->coded_states / 2; cfg->default_table = cfg->code_tables / 2; cfg->lowest_table_thresh = cfg->lossless_codes / 2; cfg->highest_table_thresh = cfg->sample_states - (cfg->lossless_codes / 2); cfg->lossy_flag = (1 << coded_bits) / 2
[0087] FIG. 6 is a flowchart illustrating the "Next Table" process. This "Next Table" process (e.g., performed in step 402 of FIG. 4A) is necessary because the codec of the present disclosure is context-adaptive. That is, different code tables representing different transformation subsets between a first data type and a second data type are used depending on the situation. The encoder and decoder jointly and unanimously decide which code table to use according to a common rule. That is, the encoder does not need to transmit "which table to use," but rather the encoder and decoder work in sync and know which table to use based on the previously transmitted sample. This common rule, as used in one embodiment, is illustrated in FIG. 6.
[0088] Processing begins at step 450 in either the encoder or decoder with a configuration argument (cfg) and a second argument, the most recently decoded sample (sample). Processing then proceeds to step 451. In step 451, the most recently decoded sample value is compared to a constant cfg->lowest_table_thresh. If this sample value is lower than cfg->lowest_table_thresh, processing branches to step 452; otherwise, processing branches to step 453.
[0089] In step 452, the process ends by returning the value 0, which is the lowest code table identification number.
[0090] In step 453, the most recently decoded sample value is compared to the constant cfg->highest_table_thresh. If this sample value is greater than or equal to cfg->highest_table_thresh, processing branches to step 454, otherwise processing branches to step 455.
[0091] In step 454, the process ends by returning the value of cfg->lossy_codes, which is the highest code table identification number.
[0092] In step 455, the intermediate code table identification number is calculated using the following formula, and the process ends by returning that value: (sample - cfg->lowest_table_thresh + cfg->lossy_rounding) / cfg->lossy_code_width
[0093] Note that in Figure 6, the variable sample represents the decoded value of the previous sample, which is calculated by decoding the value previously coded by the encoder, i.e., obtained as the output of the previous decoder.
[0094] As mentioned before, this process does not work to determine which code table to use to encode the first sample value, since there is no previous sample to base the selection on. Therefore, both the encoder and decoder must be initialized / configured before transmission begins. A common rule is that both the encoder and decoder select a "middle" code table from the available code tables: initial table = (number of tables) / 2
[0095] As mentioned above, different common rules may be chosen, but it is valid as long as the encoder and decoder use the same common rule.
[0096] Figure 7 is a flow chart illustrating the "Encode Sample" process shown in step 406 of Figure 4A. The process begins in step 500 by receiving codec configuration information cfg, a code table number table (which indicates which predefined transform subset is to be used for the next symbol of the first data sequence to be encoded), and the next symbol sample in the first data sequence. The process then proceeds to step 501.
[0097] In step 501, the variable lossless_low is calculated according to the following formula: lossless_low = table * cfg->lossy_code_width
[0098] Next, in step 502, the variable lossless_high is calculated according to the following formula: lossless_high = lossless_low + cfg->lossless_codes
[0099] Next, in step 503, the input symbol sample is compared to lossless_low and lossless_high. If sample is greater than or equal to lossless_low and less than lossless_high, it is transmitted losslessly in step 504.
[0100] In step 504, the process ends, producing an output codeword encoded in the second data type, which is a lossless representation of sample and is calculated according to the following formula: sample - lossless_low
[0101] In step 505, sample is compared to lossless_low. If sample is less than lossless_low, the sample will be transmitted only by the "low lossy" region, i.e., lossy transform groups with values lower than the lowest end of the reversible transform group.
[0102] In step 506, a lossy codeword representing the input image sample of the second data type is returned. This codeword is calculated according to the following formula: cfg->lossy_flag | (sample / cfg->lossy_code_width)
[0103] Alternatively, if sample has a value higher than the group of values to be losslessly transformed, step 507 ends with the return of a lossy codeword representing the input image sample of the second data type, which is calculated according to the following formula: cfg->lossy_flag | ((sample - lossless_high) / cfg->lossy_code_width + table)
[0104] As noted above, the decoding process is similar to the encoding process and may be performed in a decoder or within an encoder to determine input values for the "next table" process described in connection with Figure 6. Figure 8 is a flow chart illustrating the "Decode Sample" process.
[0105] Processing begins at step 600 using the configuration information cfg, the code table number table determined according to Figure 6, and the mth encoded value code_word of the second data string belonging to the second data type. Processing proceeds to step 601, where a variable lossless_low is calculated as follows: lossless_low = table * cfg->lossy_code_width
[0106] Next, in step 602, the variable lossless_high is calculated as follows: lossless_high = lossless_low + cfg->lossless_codes
[0107] Next, in step 603, the variable index is calculated as follows: index = code_word & ~cfg->lossy_flag
[0108] Next, step 604 checks whether the code_word contains a "Lossy" flag. If this flag is found, processing continues to step 607, otherwise processing continues to step 605. The presence or absence of the "Lossy" flag is determined by the following formula: if (code_word & cfg->lossy_flag)
[0109] If the "lossy" flag is not present (i.e., the transform was lossless), step 605 returns the losslessly decoded samples calculated by the following formula: lossless_low + index
[0110] If the "lossy" flag is present, the variable index is compared with table in step 607. If index is less than table, processing continues to step 608;
[0111] In step 608, the process ends and the low range lossy decoded sample is returned, which is calculated according to the following formula: index * cfg->lossy_code_width + cfg->lossy_rounding
[0112] In step 609, the process ends and the high range lossy decoded samples are returned, which are calculated according to the following formula: (index - table) * cfg->lossy_code_width + lossless_high + cfg->lossy_rounding
[0113] FIG. 9 is a flowchart illustrating the “Encode Sequence” process, which illustrates one embodiment of a process performed by an encoder (e.g., 102) to sequentially encode a first data sequence to generate a second data sequence.
[0114] Processing begins in step 700 with the following input arguments: configuration data cfg, sampin indicating the first data string that constitutes the sequence of input image samples, codeout a pointer to a buffer for storing the second data string of encoded codewords, and samples the number of input image samples. Processing then proceeds to step 701.
[0115] In step 701, the variables table and i are initialized as follows: table = cfg->default_table i = 0
[0116] In step 702, the next sample is read from the sequence of input image samples (703): * sampin++
[0117] 7 is executed using the configuration arguments cfg, table, and the image sample obtained in step 702. The return value is stored in the variable code_word, and processing proceeds to step 705.
[0118] In step 705 , the variable code_word is written to a buffer for storing the encoded codeword 706 .
[0119] *codeout++ = code_word To determine the correct code table to use for the next code word in the first code word sequence, the DecodeSample process of Figure 7 is called with cfg, table, and code_word as arguments in step 707. The return value is stored in the variable decoded, and processing continues at step 708.
[0120] 6 is called with cfg and decoded as arguments. The return value is stored in the variable table, and the process proceeds to step 709.
[0121] In step 709, the variable i is incremented and compared with the argument samples. If i is less than samples, the process returns to step 702; otherwise, the process ends in step 710.
[0122] FIG. 10 is a flowchart illustrating the “Decode Sequence” process used by a decoder (e.g., 104) to decode the second data sequence to generate a third data sequence consisting of symbols according to the first data type.
[0123] The process begins at step 800 with input arguments consisting of configuration data cfg, a second data string codein consisting of a sequence of code words of the second data type, a pointer sampout to a buffer storing decoded samples of the first data type, and the number of input image samples samples. The process then proceeds to step 801.
[0124] In step 801, the variables table and i are initialized: table = cfg->default_table i = 0
[0125] Next, in step 802, the next codeword is read from the sequence of input codewords 803: * codein++
[0126] 8 is called with the arguments cfg, table, and the codeword obtained in step 802. The return value is stored in the variable decoded, and processing proceeds to step 805.
[0127] In step 805, the variable decoded is written to a buffer 806 for storing decoded samples: * sampout++ = decoded
[0128] This produces output samples that are again encoded in the first data type.
[0129] The process then proceeds to step 807. In step 807, the predefined process NextTable shown in Figure 6 is called with cfg and decoded as arguments to ensure that the next sample in the second data sequence is correctly decoded using the correct predefined transformation subset. The return value is stored in the variable table, and the process proceeds to step 808.
[0130] In step 808, the variable i is incremented and compared with the argument samples. If i is smaller than samples, the process returns to step 802; otherwise, the process ends in step 809.
[0131] Each of the methods illustrated in Figures 6 through 10 can be implemented by the C code provided in Appendix A.
[0132] FIG. 11 is a schematic block diagram of an encoder 102 capable of implementing an embodiment of the present disclosure. In this example, the encoder 102 is configured to receive video data via an SDI input 201 and output encoded data via an Ethernet network connection 206. The encoder 102 includes a power supply system consisting of a power supply unit (PSU) 203 and a DC input jack 202 to which a DC power supply can be connected. The encoder 102 also includes a data processing system with an FPGA 204 for performing the data processing required by the encoding method described above. A first data stream is received as serial data via an SDI connection to the SDI input port 201. The SDI video may be provided by a video player, camera, or other video source. After encoding, a second data stream is output via an Ethernet connection connected to the Ethernet port 206. Ethernet physical layer (PHY) encoding of the output second data stream is performed by PHY 205.
[0133] FIG. 12 is a schematic block diagram of a decoder 104 capable of implementing an embodiment of the present disclosure. In this example, the decoder 104 is configured to receive video data via an Ethernet connection and output decoded data via an SDI output 301. The decoder 104 includes a power supply system consisting of a DC input jack 302 to which a DC power supply can be connected and a power supply unit (PSU) 303. The decoder 104 also includes a data processing system with an FPGA 304 for performing the data processing required by the decoding method described above. A second data stream is received via the Ethernet connection 306. Encoding of the stream at the Ethernet physical layer is performed by a PHY 305. The second data stream is processed by the FPGA 304 and output as a third data stream represented by the first data type via the SDI output port 301. The SDI output signal can be sent to any video output device, such as a video player, recorder, format converter, or switch.
[0134] 13 is a circuit diagram that may be implemented to perform the "Decode Sample" method as part of the encoding or decoding processes described above. This circuit may be part of a data processor in one embodiment of the present disclosure, and may, for example, form part of the functionality of FPGA 204 or 304 shown in FIG. 11 or 12.
[0135] The circuit is configured to perform a decoding process in a 10:8 compression ratio encoding / decoding embodiment of the present disclosure. The circuit receives as input codeword 901, which is an 8-bit codeword according to a second data type, and outputs 10-bit decoded samples 916 according to a first data type. The circuit is a digital logic circuit comprised of circuit elements including adders, subtractors, comparators, multipliers, dividers, multiplexers, and registers.
[0136] Some circuit elements in this circuit have input terminals connected to constant values, and these constants are labeled k1 through k8. In this example of a 10:8 compression decoder, these constants have the following values: [Table 3]
[0137] Generally, the group of circuit elements represented by block 950 is configured to determine the next code table to be used for the next sample to be decoded. The remaining circuit elements decode the current input sample symbol received at input terminal 901 and output the decoded value at output terminal 916.
[0138] Circuit elements 902 and 907 are multipliers that accept unsigned integers at their respective input ports (to the left of each multiplier), and each multiplier 902 and 907 outputs the product of the two input ports at its output port (to the right of each multiplier).
[0139] Circuit element 902 multiplies the lower 7 bits of input 901 by a constant k1 to generate a 10-bit output. Circuit element 907 multiplies the output of circuit element 905 by a constant k1 to generate a 10-bit output.
[0140] Circuit elements 903, 904, and 908 are adders that accept an unsigned integer at each input port (left side of the adder) and output the sum of the two input values from the output port (right side of the adder). Circuit element 903 adds constant k3 to the output of 902 to generate a 10-bit output. Circuit element 904 adds constant k2 to the output of 902 to generate a 10-bit output. Circuit element 908 adds the lower 7 bits of 901 to the output of 907 to generate a 10-bit output.
[0141] Circuit element 911 is a subtractor that accepts an unsigned integer at each input port (to the left of the subtractor). The subtractor subtracts the value at its lower left input port from the value at its upper left input port and outputs the difference at its output port (to the right of the subtractor). Circuit element 911 subtracts a constant k4 from the value at 916 to generate a 10-bit output.
[0142] Circuit element 912 is a divider that accepts an unsigned integer at each input port (to the left of the divider). The divider divides the value at the top-left input port by the value at the bottom-left input port and outputs the result from its output port (to the right of the divider). Circuit element 912 divides the output of 911 by a constant k1 to generate a 9-bit output.
[0143] Circuit elements 906 and 913 are "less than" comparators. Each has two input terminals labeled "-" and "+". If the value of the "-" input is less than the value of the "+" input, it outputs a high (1 or true) signal. Circuit element 906 compares the output of element 905 with the lower 7 bits of 901. Circuit element 913 compares 916 with a constant k5.
[0144] Circuit element 914 is a "greater than or equal to" comparator. This comparator has two input terminals labeled "-" and "+", and outputs a true (logic 1) signal if the number at the "+" input is greater than or equal to the number at the "-" input. Circuit element 914 compares 916 with a constant k6.
[0145] Circuit elements 909 and 910 are two-input multiplexers. Each multiplexer has two data input terminals labeled "0" and "1," as well as a selection input terminal (not labeled). The data output terminal is located on the right side. When the selection input terminal is in the low / 0 / false state, the multiplexer outputs the value of the "0" input terminal; when the selection input terminal is in the high / 1 / true state, it outputs the value of the "1" input terminal. Circuit element 909 uses the output of comparator 906 as a selection signal, and selects and outputs either the output of 903 or the output of 904. Circuit element 910 uses the most significant bit (MSB: bit 7) of 901 as a selection signal, and selects and outputs either the output of 908 or the output of 909.
[0146] Circuit element 915 is a three-input multiplexer. This multiplexer has three data input terminals labeled "00," "01," and "10." It also has two unlabeled selection input terminals and one data output terminal located on the right side. If the left selection input terminal is low / 0 / false and the right selection input terminal is also low / 0 / false, the value of the "00" input terminal will be output from the data output terminal.
[0147] If the left selection input terminal is low / 0 / false and the right selection input terminal is high / 1 / true, the value of the data input terminal "01" is output to the data output terminal.
[0148] If the left selection input terminal is high / 1 / true and the right selection input terminal is low / 0 / false, the value of the data input terminal "10" is output to the data output terminal.
[0149] Circuit element 915 uses the outputs of 913 and 914 to select either constant k7, constant k8, or the output of 912.
[0150] Circuit element 905 is an unsigned 9-bit register that receives a value from its upper input port and outputs a value from its lower output port. After a sample is decoded, register 905 transfers a copy of the value on its input port to its output port and holds that value constant until the next decoding operation.
[0151] According to embodiments of the present disclosure, encoding is performed using a completely fixed bit rate algorithm, thereby eliminating the need for a variable length coding (VLC) data buffer. In such embodiments, each symbol in a first data stream is compressed (encoded) into a second data stream as a fixed-size symbol that is smaller than the symbols in the first data stream. Because all encoded symbols in the second data stream (compressed data stream) are fixed-size, no data buffer is required to accommodate longer sequences of encoded symbols than are typically encountered in VLC algorithms.
[0152] Embodiments of the present disclosure further have the property that they tend to use lossless compression when the first data sequence is slowly varying (i.e., each data value varies only slightly from the previously encoded value). This can be seen in the example code tables shown herein. That is, if the value of the nth symbol is close to the value of the n-1th symbol, the nth symbol is encoded within a symbol group with a lossless (lossless) transformation. However, if the change between consecutively received symbols is large (e.g., an extreme change in symbol value in the first data sequence that results in an edge in the image), the algorithm switches to lossy (lossy) compression. However, even when lossy compression is necessary, there is a strictly bounded error band defined within the set of transformations used. When considering encoded still or video images, embodiments of the present disclosure have the property of being mathematically lossless for gradual gradients and slightly lossy (but usually visually lossless) for edge regions. Figures 14A / 14B and 15A / 15B show examples of a single image compressed using embodiments of the present disclosure. Figure 14A shows an image (wedding image) encoded with 10-bit codewords in YUV format compressed to 8-bit codewords. Figure 14B is a map of the image showing the location of losslessly encoded pixel values (white pixels) and lossily encoded pixels (shaded pixels). Figure 14B shows a composite representation of all errors in the Y, U, and V channels of this image. As can be seen, using the 10:8 compression version of the present disclosure, the majority of pixels in this image are lossily encoded, with lossy pixels located along the edges in the image.
[0153] FIG. 15A shows an image (CrowdRun image) encoded with 10-bit codewords in YUV format compressed to 8-bit codewords. FIG. 15B shows a map of the image showing the locations of losslessly encoded pixel values (white pixels) and lossily encoded pixels (shaded pixels). Gray pixels indicate pixels transformed with a lossy mapping in the Y channel, yellow pixels indicate pixels transformed with a lossy mapping in the V channel, and magenta pixels indicate pixels transformed with a lossy mapping in the U channel. As can be seen, when using the 10:8 compression version of the present disclosure, even in visually complex images with many edges, the majority of pixels are encoded losslessly, and lossy pixels are located along the edges in the image. It should be noted that even if there are errors in encoding the images of FIGS. 14A and 15A, these errors are bounded; that is, the errors do not exceed a certain threshold set by the predetermined transformation.
[0154] Embodiments of the present disclosure provide a relatively simple way to encode / decode a data sequence. These embodiments may not require signaling of the coding scheme or quantization step applied. In particular, quantization is often essentially fixed (or no quantization is applied at all). The decision as to whether quantization is required for a particular symbol can then be made based on the data sequence, both at encoding and decoding time. This is in contrast to many prior art techniques that require one or more of the following: quantization information needs to be signaled to the decoder (e.g., when using fixed-length adaptive codes); Different quantization must be used for each channel (thus requiring signaling); Use nonlinear quantization.
[0155] For terms expressly defined herein, such definitions shall govern the meaning of such terms in the claims. Any limitation, element, property, feature, advantage, or attribute not expressly recited in a claim shall not limit the scope of the claim in any way.
[0156] As used herein, the words "include" and "comprise" (and variations of these words such as "including," "includes," "comprising," "comprises," and "comprised") are intended to be inclusive and are not intended to exclude additional features, components, factors, or steps.
[0157] When aspects of the present disclosure are described using flowcharts, each flowchart step may be performed by various methods and various devices, systems, or system modules. Certain flowchart steps may be divided into multiple steps and / or multiple flowchart steps may be combined into a single step (unless expressly required otherwise). Furthermore, the order of steps may be changed without departing from the scope of the present disclosure (unless expressly required otherwise).
[0158] [Appendix A] This Appendix contains material that is subject to copyright protection. The copyright owner has no objection to this Appendix being reproduced by facsimile as part of the patent specification or patent office records, but all copyrights are otherwise reserved. An example of C code for "Demoencoder" #include<stdlib.h> #include<stdio.h> typedef signed char s8; typedef unsigned char u8; typedef signed short s16; typedef unsigned short u16; typedef signed int s32; typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; typedef struct { u32 sample_states; u32 coded_states; u32 lossy_code_width; u32 lossy_rounding; u32 lossless_codes; u32 lossy_codes; u32 code_tables; u32 default_table; u32 lowest_table_thresh; u32 highest_table_thresh; u32 lossy_flag; } DemoencoderCfg; / / Calculate constants needed by the specified flavour of Demoencoder void SetupDemoencoder(DemoencoderCfg * cfg, u32 sample_bits, u32 coded_bits) { cfg->sample_states = 1 << sample_bits; cfg->coded_states = 1 << coded_bits; cfg->lossy_code_width = (1 << (sample_bits - coded_bits + 1)) - 1; cfg->lossy_rounding = cfg->lossy_code_width / 2; cfg->lossless_codes = cfg->coded_states / 2; cfg->lossy_codes = cfg->coded_states / 2; cfg->code_tables = 1 + cfg->coded_states / 2; cfg->default_table = cfg->code_tables / 2; cfg->lowest_table_thresh = cfg->lossless_codes / 2; cfg->highest_table_thresh = cfg->sample_states - (cfg->lossless_codes / 2); cfg->lossy_flag = (1 << coded_bits) / 2; } / / Use the decoded sample to select the next table to use s32 NextTable(DemoencoderCfg * cfg, s32 sample) { if (sample < cfg->lowest_table_thresh) return 0; else if (sample >= cfg->highest_table_thresh) return cfg->lossy_codes; else return (sample - cfg->lowest_table_thresh + cfg->lossy_rounding) / cfg->lossy_code_width; } / / For a given sample and code table calculate the code word s32 EncodeSample(DemoencoderCfg *cfg, s32 table, s32 sample) { s32 lossless_low = table * cfg->lossy_code_width; s32 lossless_high = lossless_low + cfg->lossless_codes; if (sample >= lossless_low && sample < lossless_high) return sample - lossless_low; else if (sample < lossless_low) return cfg->lossy_flag | (sample / cfg->lossy_code_width); else return cfg->lossy_flag | ((sample - lossless_high) / cfg->lossy_code_width + table); } / / For a given code word and code table decode the sample s32 DecodeSample(DemoencoderCfg * cfg, s32 table, s32 code_word) { s32 index = code_word & ~cfg->lossy_flag; if (code_word & cfg->lossy_flag) if (index < table) return index * cfg->lossy_code_width + cfg->lossy_rounding; else return index * cfg->lossy_code_width + cfg->lossy_rounding + cfg->lossless_codes; else return table * cfg->lossy_code_width + index; } / / Demoencoder encode a sequence of samples s32 EncodeSequence ( DemoencoderCfg * cfg, s16 * sampin, s16 * codeout, s32 samples ) { s32 i; s32 code_word; s32 decoded; s32 table; s32 table_old; table = cfg->default_table; printf("Encoder started. Table initialised to %3d\n", table); for (i = 0; i < samples; ++i) { code_word = EncodeSample(cfg, table, * sampin++); * codeout++ = code_word; decoded = DecodeSample(cfg, table, code_word); printf("Used table %3d ", table); table_old = table; table = NextTable(cfg, decoded); printf("to encode sample %4d to codeword %3d. Decoder will decode %4d so ", sampin[-1], codeout[-1], decoded); if (table_old == table) printf("sticking with"); else printf("changing to "); printf(" table %3d\n", table); } } / / Demoencoder encode a sequence of samples s32 DecodeSequence ( DemoencoderCfg * cfg, s16 * codein, s16 * sampout, s32 samples ) { s32 i; s32 decoded; s32 table; s32 table_old; table = cfg->default_table; printf("Decoder started. Table initialised to %3d\n", table); for (i = 0; i < samples; ++i) { decoded = DecodeSample(cfg, table, * codein++); * sampout++ = decoded; printf("Used table %3d ", table); table_old = table; table = NextTable(cfg, decoded); printf("to decode codeword %3d to sample %4d so ", codein[-1], sampout[-1]); if (table_old == table) printf("sticking with"); else printf("changing to "); printf(" table %3d\n", table); } } int main(int argc, char * argv[]) { s16 source
[16] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987}; s16 ethernet
[16] ; s16 decoded
[16] ; DemoencoderCfg c; SetupDemoencoder(&c, 10, 8); EncodeSequence(&c, source, ethernet, 16); DecodeSequence(&c, ethernet, decoded, 16); return 0; }
Claims
1. 1. A method of converting an nth symbol of a first data sequence to an mth symbol of a second data sequence, comprising: receiving an nth symbol of a first data sequence; using a transformation from a predetermined transformation set to map a first data type including a first group of symbols having a first code length to a second data type including a second group of symbols having a second code length different from the first code length to generate an mth symbol of a second data sequence from the nth symbol of the first data sequence; the predetermined set of transforms includes a plurality of transform subsets, each transform subset mapping the first data type to the second data type, each transform subset including a group of reversible transforms that losslessly map specific symbols of the first data type to symbols of the second data type, and at least one group of non-reversible transforms between the remaining symbols of the first data type and the second data type; A method in which the transform used to generate the mth symbol of a second data sequence from the nth symbol of a first data sequence belongs to a transform subset, and in a reversible transform group of the transform subset, the n-1th symbol of the first data sequence is included among specific symbols of a first data type that map losslessly to symbols of a second data type.
2. 2. The method of claim 1, wherein in each of the transformation subsets, the particular symbols of the first data type that map losslessly to symbols of the second data type represent a group of consecutive data values.
3. 3. The method of claim 2, wherein in each transformed subset, the group (or each group) of symbols of the first data type that are lossily transformed to the second data type represent a group of consecutive data values.
4. 4. The method of claim 1, wherein in each transformation subset, the second data type comprises a first number of symbols onto which the particular symbol of the first data type is losslessly mapped and a second number of symbols onto which other symbols are lossily mapped, and the first number of symbols and the second number of symbols in the set of symbols of the second data type are equal.
5. 5. The method of claim 1, further comprising: determining a next transform subset to be used to transform the n+1th symbol of the first data sequence based on the nth symbol of the first data sequence; and transforming the n+1th symbol of the first data sequence to the m+1th symbol of the second data sequence using a transform belonging to the next transform subset.
6. 6. The method of claim 5, wherein in the next transformed subset, the nth symbol is losslessly mapped to a symbol of a second data type.
7. 7. The method of claim 6, further comprising: transforming the mth symbol of the second data sequence back to the first data type using an inverse transform corresponding to a transform within the same transform subset as the transform subset used to generate the mth symbol of the second data sequence.
8. 1. A method of encoding a first data sequence encoded in a first data type having code words of a first code length into a second data sequence encoded in a second data type having code words of a second code length, the method comprising: determining a fixed set of transformations that map symbols of a first data type to symbols of a second data type, the transformations including a lossless mapping between symbols of each data type and a lossy mapping between symbols of each data type; receiving an nth symbol of the first data sequence; determining, from the fixed set of transformations, a transformation to be used to encode the nth symbol; The method, wherein the determined transformation is a reversible transformation if the nth symbol of the first data sequence is the same as the n-1th symbol or differs from the n-1th symbol by within a predetermined threshold.
9. 9. The method of claim 8, wherein the fixed set of transformations that map symbols of the first data type to symbols of the second data type includes a plurality of transformation subsets, each transformation subset including a group of lossless transformations that map all symbols of the first data type to the second data type and that losslessly map certain symbols of the first data type to symbols of the second data type, and a group of at least one lossy transformation between the remaining symbols of the first data type and the second data type.
10. 10. The method of claim 9, wherein the transform determined to be used to encode the nth symbol belongs to a transform subset, and both the n-1th symbol and the nth symbol correspond to a particular symbol within a reversible transform group of the transform subset.
11. 1. A method of decoding an mth symbol of a second data sequence having a second data type generated by encoding an nth symbol of a first data sequence having a first data type, said decoding producing an output symbol having said first data type, said method comprising: receiving the mth symbol of the second data sequence; generating the output symbols by mapping the second data type to the first data type using a transformation from a predetermined transformation set; the predetermined set of transformations includes a plurality of transformation subsets, each of which maps the second data type to the first data type; The method, wherein the transform used to generate the output symbol belongs to a transform subset selected based on an output symbol corresponding to the m-1 th symbol.
12. 12. The method of claim 11, wherein each transform subset of the predetermined set of transforms corresponds to a predetermined transform subset usable in encoding the second data stream.
13. Each transformation subset of the predetermined set of transformations:
13. The method of claim 11 or 12, comprising a group of transforms corresponding to a group of lossless transforms usable to encode a first data sequence into a second data sequence, the group of transforms being direct inverses of the lossless transforms, and a plurality of remaining transforms corresponding to a group of lossy transforms between the first data type and the second data type usable to encode the first data sequence into the second data sequence.
14. 14. The method of claim 11, further comprising: determining a predetermined transformation subset that maps the second data type to the first data type; and using the transformation subset to decode the (m+1)th symbol of the second data sequence.
15. 1. A method of converting an nth symbol of a first data sequence to an mth symbol of a second data sequence, comprising: receiving an nth symbol of a first data sequence; generating the mth symbol of the second data sequence from the nth symbol of the first data sequence using a transformation from a predetermined set of transformations that maps a first data type including a first group of symbols having a first code length to a second data type including a second group of symbols having a second code length different from the first code length; the predetermined set of transforms includes a plurality of transform subsets, each transform subset mapping the first data type to the second data type, each transform subset including a group of reversible transforms that losslessly map particular symbols of the first data type to symbols of the second data type, and at least one group of non-reversible transforms between the remaining symbols of the first and second data types; A method wherein the transformation used to generate the mth symbol is selected based on the n-1th symbol of a first data sequence.
16. 1. A method of encoding a first data sequence encoded in a first data type having codewords of a first code length into a second data sequence encoded in a second data type having codewords of a second code length, the method comprising: determining a fixed set of transformations that map symbols of a first data type to symbols of a second data type; the fixed set of transformations including lossless mappings between at least some symbols of each data type and lossy mappings between at least some symbols of each data type; receiving an nth symbol of the first data sequence; determining, based on the (n-1)th symbol of the first data sequence, a transformation from the fixed set of transformations to be used to encode the nth symbol.
17. an input for receiving a first data sequence including first symbols of a first data type having a first code length; an output for transmitting a second data sequence including second symbols of a second data type having a second code length different from the first code length; a processing system for sequentially processing the received symbols of the first data stream and outputting symbols of a second data stream; Encoding device, wherein said processing system executes the method according to any one of claims 1 to 10, 15 and 16.
18. an input for receiving a second data sequence including second symbols of a second data type and having a second code length; an output section for transmitting output symbols having a first data type corresponding to the first data type of the first data sequence encoded to form the second data sequence; a processing system that sequentially processes the received symbols of the second data sequence and outputs symbols of a third data sequence having the same data type as the first data sequence; A decoding device, wherein the processing system executes the method according to any one of claims 11 to 14.
19. Encoding device according to claim 17, further configured to perform the method according to any one of claims 11 to 14.