Encoding device, decoding device, and program
By employing multiple codebooks or code trees with assigned modes that satisfy the word-first condition, the system achieves precise bit assignment and unique decodability, addressing the challenges of existing reversible compression encoding technologies.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- NT T INC
- Filing Date
- 2024-10-28
- Publication Date
- 2026-05-07
AI Technical Summary
Existing reversible compression encoding technologies face challenges in assigning codewords with precision less than 1 bit while maintaining a manageable codebook size and ensuring unique decodability, particularly when using multiple codebooks or code trees.
The encoding and decoding devices utilize a system of multiple codebooks or code trees with assigned modes, ensuring that expanded codewords satisfy the word-first condition and begin with a codeword from the assigned mode, allowing for unique decodability and precise bit assignment.
This approach enables flexible, efficient encoding and decoding with precise bit allocation without exponentially increasing codebook size, ensuring unique decodability and enabling codewords with lengths less than 1 bit per input.
Smart Images

Figure JP2024038307_07052026_PF_FP_ABST
Abstract
Description
Encoding device, decoding device, and program
[0001] This invention relates to a lossless compression coding technique.
[0002] Currently, technologies are being developed to reversibly compress and encode finite-precision digital signals and digital data, such as audio signals, image signals, time-series signals obtained from various sensors such as brightness sensors, acceleration sensors, and seismometers, as well as strings and word sequences. When designing a reversible compression encoding technology, rules that indicate what codeword to output for what input (hereinafter referred to as encoding rules) are represented using a codebook or code tree. Let's assume inputs such as a, b, and c, and consider converting these sequences into codewords composed of 0s and 1s, aiming to minimize the expected code length (hereinafter referred to as expected code length). In this case, it is effective to design the codebook so that the shortest codeword is assigned to the input with the highest probability of occurrence among a, b, and c. For example, if the input with the highest probability of occurrence is a, then the codebook should be designed as (a, 1), (b, 01), (c, 00). However, with this design method, it is not possible to assign a codeword with a precision of less than 1 bit to a single input, so no matter how high the probability of input a occurs, the expected code length cannot be made shorter than the rules exemplified above. Therefore, a method is known in which codewords are assigned to sets of multiple inputs, and codewords of a length more suitable for the distribution of inputs are assigned. If the probability of input a is extremely high, then by assigning codewords to patterns of input length 2 such as (aa, 1), (ab, 011), (ac, 010), (ba, 0011), (ca, 0010), (bb, 00011), (bc, 00010), (cb, 000011), (cc, 000010), a 1-bit codeword can be assigned to input aa, and the length of the codeword per input can be made less than 1 bit.
[0003] However, with this method, the longer the input length prepared in the codebook, the finer the bit length assignment becomes possible, but the size of the codebook increases exponentially. For example, if we assign codewords to patterns with an input length of 7 for inputs a, b, and c, we need to store codeword assignments for approximately 2000 patterns, which is 3 to the power of 7.
[0004] Therefore, in order to enable the allocation of fine bits without increasing the size of the codebook, Non-Patent Document 1 discloses a technique for performing encoding by providing multiple codebooks with an input length of 1 and switching the codebook used to encode the next input according to the context of which input pattern has been encoded.
[0005] R. Sugiura, Y. Kamamoto, N. Harada and T. Moriya, “Optimal Golomb-Rice Code Extension for Lossless Coding of Low-Entropy Exponentially Distributed Sources,” in IEEE Transactions on Information Theory, vol.64, no.4, pp.3153-3161, April 2018.
[0006] However, when coding rules are expressed using simple codebooks or code trees, it is difficult to guarantee that codes using multiple codebooks / code trees can be uniquely decoded (hereinafter referred to as uniquely decodeable). For example, the method described in Non-Patent Document 1 achieves unique decodement of codes by utilizing a special code structure. As a result, the method described in Non-Patent Document 1 has the problem that only a very small number of all uniquely decodeable codes can be expressed as multiple codebooks / code trees.
[0007] Therefore, the present invention aims to express an encoding rule that satisfies the condition that it can be uniquely decoded.
[0008] The encoding device uses the current mode and, according to a decision rule based on the input distribution, generates a candidate for the mth processing step that includes a candidate for the mth codeword corresponding to a candidate for the mth pattern that satisfies specific conditions, and the mth destination mode, which is the mth set of codewords. If the input pattern matches the candidate for the sth pattern, the encoding device uses the candidate for the sth codeword as the output codeword and switches the current mode to the sth destination mode.
[0009] The decoder uses the current mode and, according to a decision rule based on the input distribution, generates a mth processing candidate that includes a mth codeword candidate corresponding to a mth pattern candidate that satisfies specific conditions, and an mth transition mode which is the mth set of codewords. The decoder sets the mth pattern candidate as the output pattern and switches the current mode to the mth transition mode if the beginning of the current codeword matches the sth codeword candidate, and the sth transition mode includes an element that matches the beginning of the codeword obtained by removing the beginning that matches the sth codeword candidate from the current codeword.
[0010] Here, m = 1, ..., M, s ∈ {1, ..., M}, and M is an integer greater than or equal to 2. The specific condition is that the set of expanded codewords, whose elements are all expanded codewords, satisfies the word-first condition, and all of the expanded codewords have one of the codewords included in the mode as their beginning. The expanded codeword is a codeword obtained by concatenating the m-th codeword candidate with the codewords that are elements of the m-th set, and the set of expanded codewords satisfies the word-first condition if any codeword in the set of expanded codewords is not the beginning of any other codeword in the set of expanded codewords.
[0011] This makes it possible to represent coding rules that satisfy the condition of being uniquely decodeable.
[0012] Figure 1 shows an example of a code book. Figure 2 shows an example of a code tree. Figure 3 is a block diagram illustrating the configuration of the encoding device of the first embodiment. Figure 4 is a flowchart illustrating the operation of the encoding device of the first embodiment. Figure 5 is a block diagram illustrating the configuration of the decoding device of the first embodiment. Figure 6 is a flowchart illustrating the operation of the decoding device of the first embodiment. Figure 7 is a block diagram illustrating the configuration of the encoding device of the second embodiment. Figure 8 is a flowchart illustrating the operation of the encoding device of the second embodiment. Figure 9 is a block diagram illustrating the configuration of the decoding device of the second embodiment. Figure 10 is a flowchart illustrating the operation of the decoding device of the second embodiment. Figure 11 shows an example of the functional configuration of a computer that implements each device in each embodiment.
[0013] Embodiments of the present invention will be described below with reference to the drawings. Components having the same function will be numbered identically, and redundant explanations will be omitted.
[0014] Before describing each embodiment, the notation used in this specification will be explained. ^ (caret) represents a superscript. For example, x y^z is y z is a superscript to x, and x y^z is y z This indicates that it is a subscript for x. Also, _ (underscore) represents a subscript. For example, x y_z is y z is a superscript to x, and x y_z is y z This indicates that it is a subscript for x.
[0015] The superscripts "^" and "~" such as ^x and ~x for a given character x should ideally be placed directly above "x", but due to the constraints of notation in the specification, they are written as ^x and ~x.
[0016] [First Embodiment] The first embodiment of the present invention will be described. In the encoding / decoding in this embodiment, a plurality of codebooks having a predetermined structure are used so that any encoding rule that satisfies the condition that it can be uniquely decoded (hereinafter referred to as the unique decodeability condition) can be represented. Note that a code tree may be used instead of a codebook, and there will be no difference in the encoding / decoding process.
[0017] <<1: Code Book / Code Tree>> First, we will explain the concept of modes, which is necessary for describing the code books used in this embodiment. A mode is defined as a set of codewords for a code book. A mode is assigned to each of the multiple code books used for encoding / decoding. Since the modes assigned to a code book are defined as a set of codewords, it is assumed that there are no duplicate codewords included in the mode. It is preferable that the mode satisfies the word-first condition. Here, the word-first condition is the condition that for any codeword included in a set of codewords as elements, that codeword cannot be the word-first of any other codeword included in that set. For example, if there are two code books, code book T0 and code book T1, the modes assigned to code book T0 and code book T1 can be defined as {1, 00} and {10, 11, 01}, respectively.
[0018] The codebook used in this embodiment consists of a triplicate: an input pattern, an output codeword, and the next codebook to be used. Figure 1 shows an example of a codebook. The codebook in Figure 1 is used to encode a pattern sequence, which is a sequence of patterns {a, b}, into a codeword, which is a sequence of codes {0, 1}, and consists of five codebooks: T0, T1, T2, T3, and T4. In Figure 1, λ represents a codeword of length 0. Note that the codeword λ can be the beginning of any codeword. Codebook T0 is assigned the mode {λ}, and codebook T1 is assigned the mode {1, 001}. Furthermore, codebook T0 outputs the codeword λ for pattern a, and the next codebook to be used is T1, and for pattern b, it outputs the codeword 0, and the next codebook to be used is T2.
[0019] Next, we will explain the conditions required for a codebook in order for the encoding / decoding in this embodiment to satisfy the unique decodeability condition. To that end, we define the concept of an expanded codeword. A codeword is an expanded codeword of a codebook if it is obtained by concatenating a codeword included in the codebook with a codeword that is an element of the mode assigned to the next codebook to be used, corresponding to the codeword in question. Here, a codeword included in a codebook refers to a codeword that is a triplet element constituting the codebook. For example, the expanded codewords of codebook T0 in Figure 1 are codewords 1 and 011 obtained by concatenating codeword λ corresponding to pattern a with codewords 1 and 011, which are elements of the mode {1, 011} assigned to the next codebook T1 corresponding to pattern a, and codewords 00 and 010 obtained by concatenating codeword 0 corresponding to pattern b with codewords 0 and 10, which are elements of the mode {0, 10} assigned to the next codebook T2 corresponding to pattern b.
[0020] The following two conditions are required of a codebook for encoding / decoding to satisfy the unique decodeability condition: (1) For any codebook included in multiple codebooks, the set of all expanded codewords in that codebook satisfies the word-first condition. (2) For any codebook included in multiple codebooks, the expanded codewords of that codebook begin with one of the codewords included in the mode assigned to that codebook.
[0021] Furthermore, when encoding / decoding using multiple codebooks is uniquely decodeable, multiple codebooks, including one to which a mode that does not satisfy the initial condition is assigned, can be represented as multiple codebooks to which only modes that satisfy the initial condition are assigned, except for the terminal codeword (i.e., they represent the rule of assigning the same codeword to the same input except for the terminal codeword). Since multiple codebooks to which only modes that satisfy the initial condition are assigned result in a more concise representation, it is preferable, as mentioned above, that the modes satisfy the initial condition. The terminal codeword will be discussed later.
[0022] Also, as described above, the encoding rules can also be expressed using a code tree. FIG. 2 is a diagram showing an example of a code tree, and the code tree in FIG. 2 is equivalent to the codebook in FIG. 1. The description regarding the above codebook is also applicable to the code tree by simply replacing a certain part of the codebook with the code tree. By this replacement, the following description regarding the code tree can be obtained.
[0023] For a code tree, a set of codewords is defined as a mode. A mode is assigned to each of the plurality of code trees used for encoding / decoding.
[0024] A code tree is composed of a triple of an input pattern, an output codeword, and the next code tree to be used.
[0025] A codeword being the expanded codeword of a code tree means a codeword obtained by concatenating the codeword included in the code tree and the codeword which is an element of the mode assigned to the next code tree corresponding to the codeword. Here, the codeword included in the code tree means the codeword which is an element of the triple constituting the code tree.
[0026] The conditions required for the code tree for the encoding / decoding to satisfy the unique decodability condition are the following two conditions. (1) For any code tree included in a plurality of code trees, the set consisting of all the expanded codewords of the code tree satisfies the prefix condition. (2) For any code tree included in a plurality of code trees, the expanded codeword of the code tree has as its prefix any codeword included in the mode assigned to the code tree.
[0027] <<2: Encoding Process / Decoding Process>> First, the encoding process in the present embodiment will be described. In the encoding process in the present embodiment, a pattern sequence x0x1…x L-1 (where x i (i = 0, 1,..., L - 1) is a pattern) is input, and a codeword w k} k=0 K-1 (where K is an integer of 2 or more) is used to obtain a codeword w i corresponding to the pattern x i , and codewords w0, w1,..., w L-1The codeword obtained by concatenating them is w0w1…w L (However, w L Outputs a terminal codeword. Multiple codebooks {T k} k=0 K-1 Using pattern x i Corresponding code word w i In the process of obtaining the pattern sequence x0x1...x L-1 The pattern x that constitutes the structure i For each of (i=0, 1, ..., L-1), the current codebook is used to sequentially determine pattern x i Corresponding code word w i Obtaining pattern x i The process of setting the next codebook to be used corresponding to the current codebook is repeated.
[0028] More specifically, the encoding process in this embodiment includes, for example, the following three processes: (1) A predetermined code book T k (2) Start encoding using the current codebook. However, k is any integer between 0 and K-1, for example, k=0. (2) For i=0, 1, ..., L-1, use the current codebook to encode pattern x i Corresponding code word w i Obtaining pattern x i The next codebook to be used corresponding to this is designated as the current codebook. (3) After the processing in (2) for i=L-1 is completed, one element of the mode assigned to the current codebook is selected and designated as the terminal codeword w L Obtained as, the code word w0w1…w L The output is generated, and the encoding process is terminated. Note that the terminal codeword is w L This can be any element of the modes assigned to the current codebook; for example, it can be the shortest codeword among the elements of the modes assigned to the current codebook.
[0029] Next, the decoding process in this embodiment will be described. The decoding process in this embodiment takes the codeword to be decoded (hereinafter referred to as the input codeword) and the length L of the pattern sequence to be output as input, and multiple codebooks {T k} k=0 K-1 (However, multiple codebooks {Tk} k=0 K-1 The codebook used in the encoding process is used to obtain patterns corresponding to the codewords that make up the input codeword, and the obtained patterns are concatenated to output a pattern sequence of length L. k} k=0 K-1 In the process of obtaining a pattern corresponding to the codewords that make up the input codeword using the method, if there exists a codeword included in the current codebook (hereinafter referred to as codeword w) that matches the beginning of the current codeword, and there exists a codeword included in the mode assigned to the next codebook to be used that corresponds to codeword w, that matches the beginning of the codeword obtained by deleting the beginning of the codeword that matches codeword w from the current codeword, then the process of obtaining a pattern corresponding to codeword w, setting the next codebook to be used that corresponds to codeword w as the current codebook, and setting the codeword obtained by deleting the beginning of the codeword that matches codeword w as the current codeword is repeated until a pattern sequence of length L is obtained. Here, the current codeword is the codeword that is the target of the decoding process at the present time, and the current codeword at the time decoding starts is the input codeword.
[0030] More specifically, the decoding process in this embodiment includes, for example, the following three processes: (1) a predetermined code book T k(1) The current codebook is used to start decoding. Here, k is the codebook number used when the encoding process of the input codeword was started. The input codeword is also used as the current codeword. (2) The current codeword is compared with the codewords contained in the current codebook using the current codebook. If there is a codeword in the current codebook (hereinafter referred to as codeword w) that matches the beginning of the current codeword, and there is a codeword in the mode assigned to the next codebook to be used that corresponds to codeword w that matches the beginning of the codeword obtained by removing the beginning of the codeword that matches codeword w from the current codeword, then a pattern corresponding to codeword w is obtained, the next codebook to be used that corresponds to codeword w is set as the current codebook, and the codeword obtained by removing the beginning of the codeword that matches codeword w from the current codeword is set as the current codeword. (3) If the length of the pattern sequence obtained by concatenating the patterns obtained in the process of (2) is L, the pattern sequence of length L is output and the decoding process is terminated. Otherwise, the process returns to (2).
[0031] The above coding / decoding process using a code book can also be changed to coding / decoding using a code tree simply by replacing "code book" with "code tree".
[0032] <<3: Example of Encoding / Decoding>> Here, as an example of encoding / decoding, we will explain the encoding / decoding of the pattern sequence abbaa using the codebook shown in Figure 1. First, we will explain encoding. Here, at the start of the encoding process, codebook T0 will be used as the current codebook. The input is the pattern sequence abbaa to be encoded.
[0033] (1) For the first pattern a in the pattern sequence abbaa, the codeword λ is obtained using the current codebook T0 as the codeword corresponding to pattern a, and the next codebook to be used corresponding to pattern a, T1, is set as the current codebook.
[0034] (2) For the first pattern b in the pattern sequence bbaa, the codeword λ is obtained using the current codebook T1 as the codeword corresponding to pattern b, and the next codebook to be used corresponding to pattern b, T3, is set as the current codebook.
[0035] (3) For the first pattern b in pattern sequence baa, codeword 100 is obtained as the codeword corresponding to pattern b using the current codebook T3, and the next codebook to be used corresponding to pattern b, T0, is set as the current codebook.
[0036] (4) For the first pattern a in pattern sequence aa, a codeword λ is obtained using the current codebook T0 as the codeword corresponding to pattern a, and the next codebook to be used corresponding to pattern a, T1, is set as the current codebook.
[0037] (5) For the first pattern a in pattern sequence a, codeword 1 is obtained as the codeword corresponding to pattern a using the current codebook T1, and the next codebook to be used corresponding to pattern a, T4, is set as the current codebook.
[0038] (6) Obtain 1, which is an element of the mode currently assigned to codebook T4, as the terminating codeword, and output the codeword λλ100λ11, i.e., codeword 10011.
[0039] Here, it should be noted that in encoding, the mode assigned to the codebook is only used when obtaining the terminal codeword.
[0040] Next, we will explain decoding. To begin the decoding process, the codebook T0 used at the start of the encoding process will be used as the current codebook. The input will consist of the codeword 10011 to be decoded and the output pattern sequence of length 5.
[0041] (1) Using the current codebook T0, compare the current codeword 10011 with the codewords included in the codebook T0. There is a codeword λ included in the current codebook T0 that matches the beginning of the current codeword 10011, and there is a codeword 1 included in the mode assigned to the next codebook T1 to be used that corresponds to codeword λ, which matches the beginning of codeword 10011 obtained by removing the beginning of codeword λ that matches the current codeword 10011. Therefore, we obtain a pattern a corresponding to codeword λ, and the next codebook T1 to be used that corresponds to codeword λ is set as the current codebook, and the codeword 10011 obtained by removing the beginning of codeword λ that matches the current codeword 10011 is set as the current codeword. The pattern sequence obtained so far is a, and its length is 1, so we continue processing.
[0042] (2) Using the current codebook T1, the current codeword 10011 is compared with the codewords included in the codebook T1. Codeword 1 is included in the current codebook T1 and matches the beginning of the current codeword 10011. However, there are no codewords included in the mode assigned to the next codebook T4 to be used that matches the beginning of codeword 0011, which is obtained by deleting the beginning of codeword 1 that matches codeword 1. Therefore, pattern a corresponding to codeword 1 is not obtained as a correct pattern. Next, there is a codeword λ included in the current codebook T1 that matches the beginning of the current codeword 10011, and there is a codeword 100 included in the mode assigned to the next codebook T3 to be used, which corresponds to codeword λ and matches the beginning of codeword 10011 obtained by removing the beginning of codeword λ that matches the current codeword 10011. Therefore, we obtain a pattern b corresponding to codeword λ, and the next codebook T3 to be used corresponding to codeword λ is set as the current codebook, and the codeword 10011 obtained by removing the beginning of codeword λ that matches the current codeword 10011 is set as the current codeword. The pattern sequence obtained so far is ab, and its length is 2, so we continue processing.
[0043] (3) Using the current codebook T3, compare the current codeword 10011 with the codewords included in the codebook T3. There is a codeword 100 included in the current codebook T3 that matches the beginning of the current codeword 10011, and there is a codeword λ included in the mode assigned to the next codebook T0 to be used corresponding to codeword 100 that matches the beginning of codeword 11 obtained by removing the beginning that matches codeword 100 from the current codeword 10011. Therefore, we obtain a pattern b corresponding to codeword 100, set the next codebook T0 to be used corresponding to codeword 100 as the current codebook, and set the codeword 11 obtained by removing the beginning that matches codeword 100 from the current codeword 10011 as the current codeword. The pattern sequence obtained so far is abb and has a length of 3, so continue processing.
[0044] (4) Using the current codebook T0, compare the current codeword 11 with the codewords included in the codebook T0. There is a codeword λ included in the current codebook T0 that matches the beginning of the current codeword 11, and there is a codeword 1 included in the mode assigned to the next codebook T1 to be used that corresponds to codeword λ, which matches the beginning of the codeword 11 obtained by removing the beginning of codeword λ that matches codeword λ from the current codeword 11. Therefore, we obtain a pattern a corresponding to codeword λ, and the next codebook T1 to be used that corresponds to codeword λ is set as the current codebook, and the codeword 11 obtained by removing the beginning of codeword λ that matches codeword λ from the current codeword 11 is set as the current codeword. The pattern sequence obtained so far is abba, and its length is 4, so continue processing.
[0045] (5) Using the current codebook T1, compare the current codeword 11 with the codewords included in the codebook T1. There is a codeword 1 included in the current codebook T1 that matches the beginning of the current codeword 11, and there is a codeword 1 included in the mode assigned to the next codebook T4 to be used that corresponds to codeword 1, which matches the beginning of codeword 1 obtained by removing the beginning of codeword 1 that matches codeword 1 from the current codeword 11. Therefore, we obtain a pattern a corresponding to codeword 1, and the next codebook T4 to be used that corresponds to codeword 1 is set as the current codebook, and the codeword 1 obtained by removing the beginning of codeword 1 that matches codeword 1 from the current codeword 11 is set as the current codeword. The pattern sequence obtained so far is abbaa, and its length is 5, so the process is terminated. Note that while there is a codeword λ included in the current codebook T1 that matches the beginning of the current codeword 11, there is no codeword included in the mode assigned to the next codebook T3 that matches the beginning of codeword λ, which is obtained by removing the beginning of codeword λ from the current codeword 11.
[0046] <<4: Characteristics of Encoding / Decoding>> In this embodiment, encoding / decoding uses multiple codebooks. Each codebook included in the multiple codebooks consists of a triplicate of an input pattern, an output codeword, and the next codebook to be used. In addition, each codebook included in the multiple codebooks is assigned a mode. In order for encoding / decoding to satisfy the unique decodeability condition, any codebook included in the multiple codebooks satisfies the following two conditions (hereinafter referred to as the unique decodeability condition for codebooks): (1) The set of all expanded codewords of a codebook satisfies the word-first condition. (2) The expanded codeword of a codebook begins with one of the codewords included in the mode assigned to that codebook. As mentioned above, a code tree may be used instead of a codebook.
[0047] Based on the above, the encoding / decoding in this embodiment has the following characteristics.
[0048] (1) The triplet element that constitutes the codebook, "the next codebook to be used," represents a rule for using multiple codebooks. By establishing a rule for using multiple codebooks in a codebook, even if the set of codewords included in the codebook does not satisfy the initial condition, it becomes possible to construct a code that can be uniquely decoded as long as the codebook satisfies the unique decodeability condition for the codebook. Furthermore, by introducing the assignment of modes to codebooks, the unique decodeability condition can be easily guaranteed.
[0049] (2) If the set of codewords contained in one codebook does not satisfy the initial condition, there may be multiple candidate codewords that can be used for decoding during the decoding process. For example, when considering decoding a codeword that starts with 0 using codebook T0 in Figure 1, it is possible that either codeword λ is the correct codeword to use for decoding, or codeword 0 is the correct codeword to use for decoding. Because all of the multiple codebooks satisfy the unique decodeability condition for the codebook, the mode assigned to the codebook acts as a query during decoding to determine which codeword was actually encoded and which next codebook was designated as the current codebook. In other words, it is possible to confirm which of the multiple candidate codewords is correct to use for decoding by comparing the codewords that follow these candidate codewords with their modes.
[0050] (3) For example, it is also possible to assign codeword 000 to pattern sequence aa, so that each input does not have an integer bit count of 1.5 bits. In this way, in order to assign the length of a codeword per input with a precision of less than 1 bit, at least one of the multiple codebooks must be assigned a mode that contains two or more codewords. The codebooks in this embodiment can be of this nature.
[0051] (4) From the perspective of the decoding side, any codebook included in multiple codebooks can be said to be a data structure containing the following data.
[0052] (1) A codeword that can be used as input. (2) An output pattern that corresponds to the codeword. (3) A codebook that corresponds to the codeword and is used for the next decryption. (4) A mode, which is a set of codewords assigned to the codebook to verify whether the codebook is correct as the codebook to be used for the next decryption.
[0053] <Specific Examples of This Embodiment> Specific examples of this embodiment will be described with reference to the drawings. The encoding device 110 in this embodiment uses a pattern sequence x0x1…x of length L (where L is an integer of 2 or more). L-1 (However, x i (i=0, 1, ..., L-1) is the input, and the sequence of patterns x0x1...x L-1 The device outputs a codeword corresponding to the input codeword (hereinafter referred to as the output codeword). In addition, the decoding device 120 in this embodiment takes the codeword to be decoded (hereinafter referred to as the input codeword) and the length L of the pattern sequence to be output as input, and outputs a pattern sequence of length L corresponding to the input codeword (hereinafter referred to as the output pattern sequence).
[0054] Here, a codeword is a sequence of two codes {0, 1} arranged in a line. As explained in <Technical Background>, a code sequence with length 0 is represented as λ. A pattern is an element of a set consisting of a finite number of elements, such as the letters a, b, c of the set of letters {a, b, c}, or a word. A pattern sequence is a sequence of patterns arranged in a line; for example, abbaa is a pattern sequence with length 5 for two patterns {a, b}. Examples of pattern sequences include the following sequences which are quantized and have finite precision.
[0055] (1) Time-series signals obtained from audio signals, image signals, and various sensors such as brightness sensors, acceleration sensors, and seismometers. (2) A series of spectral values obtained by performing discrete Fourier transforms, discrete cosine transforms, and modified discrete cosine transforms on the signals in (1). (3) A series of linear prediction coefficients, line spectral pairs (LSPs), immitance spectral pairs (ISPs), and partial autocorrelation coefficients (PARCOR coefficients) obtained by performing linear predictive analysis on the signals in (1). (4) A series of features obtained by inputting the signals in (1) into a neural network. In other words, a pattern sequence is a series of finite-precision digital signals or a series of digital data.
[0056] Multiple codebooks or code trees {T} used by the encoding device 110 and the decoding device 120 in the encoding and decoding processes. k} k=0 K-1 (where K is an integer greater than or equal to 2) is a data structure with the following characteristics:
[0057] (1) Code book or code tree T k (k=0, 1, ..., K-1) consists of a triplicate of a pattern, a codeword, and the next codebook or code tree to be used, to which a mode, which is a set of codewords, is assigned.
[0058] (2) Code book or code tree T k The set of all expanded codewords (k=0, 1, ..., K-1) satisfies the condition of being the beginning of a word, and the codebook or code tree T k The expanded codewords (k=0, 1, ..., K-1) satisfy the condition that they begin with one of the codewords included in the mode assigned to the codebook or code tree.
[0059] <<Encoding Device 110>> The encoding device 110 will be described below with reference to Figures 3 and 4. Figure 3 is a block diagram showing the configuration of the encoding device 110. Figure 4 is a flowchart showing the operation of the encoding device 110. As shown in Figure 3, the encoding device 110 includes an encoding unit 111 and a recording unit 119. The recording unit 119 is a component that appropriately records information necessary for processing by the encoding device 110. The recording unit 119 can record, for example, multiple codebooks or code trees {T k} k=0K-1 Record this.
[0060] The operation of the encoding device 110 will be explained with reference to Figure 4. In S111, the encoding unit 111 encodes a plurality of codebooks or code trees {T k} k=0 K-1 Using pattern x i Corresponding code word w i Obtaining the codewords w0, w1, …, w L-1 The codeword obtained by concatenating them is w0w1…w L (However, w L The terminating codeword ( is output as the output codeword.) The encoding unit 111 performs encoding processing which includes the following three processes: (1) Code book or code tree T k (where k is an integer between 0 and K-1) The process of making this the current codebook or code tree (2) For i=0, 1, ..., L-1, the pattern x is created using the current codebook or code tree i Corresponding code word w i Obtaining pattern x i (3) After the process in (2) for i=L-1 is completed, select one element of the mode assigned to the current codebook or code tree and set that element as the terminal codeword w L Obtained as, the code word w0w1…w L This process outputs the codeword as the output codeword and terminates the encoding process. Here, the mode can be said to be the set assigned in the encoding process to obtain the termination codeword.
[0061] <<Decoding Device 120>> The decoding device 120 will be illustrated below with reference to Figures 5 and 6. Figure 5 is a block diagram showing the configuration of the decoding device 120. Figure 6 is a flowchart showing the operation of the decoding device 120. As shown in Figure 5, the decoding device 120 includes a decoding unit 121 and a recording unit 129. The recording unit 129 is a component that appropriately records information necessary for processing by the decoding device 120. The recording unit 129 can record, for example, multiple codebooks or code trees {T k} k=0 K-1 (However, {T k} k=0K-1 This records the multiple codebooks or code trees used in the encoding process of the input codeword.
[0062] The operation of the decoding device 120 is illustrated in Figure 6. In S121, the decoding unit 121 processes a plurality of codebooks or code trees {T k} k=0 K-1 The decoding unit 121 uses this to obtain patterns corresponding to the codewords that make up the input codeword, and outputs a pattern sequence of length L obtained by concatenating the obtained patterns as the output pattern sequence. The decoding unit 121 performs a decoding process that includes the following three processes.
[0063] (1) Code book or code tree T k (1) Using the current codebook or code tree, the current codeword is defined as the codebook or code tree number used when the encoding process of the input codeword was started. (2) Using the current codebook or code tree, the current codeword is compared with the codewords contained in the codebook or code tree. If there is a codeword (hereinafter referred to as codeword w) contained in the current codebook or code tree that matches the beginning of the current codeword, and there is a codeword included in the mode assigned to the next codebook or code tree corresponding to codeword w that matches the beginning of the codeword obtained by deleting the beginning of the codeword that matches codeword w from the current codeword, a pattern corresponding to codeword w is obtained, the next codebook or code tree corresponding to codeword w is defined as the current codebook or code tree, and the codeword obtained by deleting the beginning of the codeword that matches codeword w from the current codeword is defined as the current codeword. (3) If the length of the pattern sequence obtained by concatenating the patterns obtained in (2) is L, the pattern sequence of length L is output as the output pattern sequence and the decoding process is terminated; otherwise, the process returns to (2). Here, the mode can be said to be a set assigned in the decoding process to confirm whether it is correct to use the current codebook or code tree to decode the next codeword that corresponds to the codeword contained in the codebook or code tree.
[0064] According to this embodiment, by using multiple codebooks or code trees having a predetermined structure, it becomes possible to represent any coding rule that satisfies the condition of being uniquely decodeable. Therefore, it becomes possible to flexibly design codes using multiple codebooks or code trees that are relatively small in size.
[0065] [Second Embodiment] A second embodiment of the present invention will now be described. In the first embodiment, encoding / decoding using multiple codebooks with introduced modes was shown. Here, in order to perform efficient encoding, it is necessary to use a codebook or code tree (hereinafter referred to as "codebook, etc.") that corresponds to the distribution of patterns that serve as input to the encoding process (hereinafter referred to as "input patterns") (hereinafter referred to as "input distribution"). Therefore, in an environment where the input distribution is variable and the appropriate codebook, etc. may change depending on the input pattern, it is necessary to store all combinations of multiple codebooks, etc. that correspond to the expected input distribution. However, storing all such codebooks, etc. would require a large amount of storage capacity. In the second embodiment, an encoding rule that satisfies the unique decodeability condition according to the input distribution is expressed without storing all the codebooks, etc.
[0066] <<1: Encoding Rules>> First, we will explain the concept of modes, which is necessary for explaining the encoding rules of this embodiment. In this embodiment, a set of codewords is defined as a mode. In this embodiment, a mode represents the state of the encoding / decoding process. In this embodiment as well, since a mode is defined as a set of codewords, it is assumed that there are no duplicate codewords included in a mode. It is preferable that a mode satisfies the word-first condition. The word-first condition in this embodiment is the condition that any codeword included in a certain set cannot be the beginning of any other codeword included in that set. For example, a mode like {1, 00}, {10, 11, 01} satisfies the word-first condition.
[0067] Next, the conditions required for the encoding / decoding in this embodiment to satisfy the unique decodeability condition will be explained. To that end, the expanded codewords in this embodiment are defined. The expanded codewords in this embodiment are codewords obtained by concatenating a codeword candidate (hereinafter referred to as a codeword candidate) with a codeword that is an element of the next mode to be used (hereinafter referred to as the transition mode). Here, a codeword candidate is a candidate codeword (hereinafter referred to as an output codeword) that is output for a candidate pattern (hereinafter referred to as a pattern candidate) that is assumed to be the input in the encoding process. In other words, a codeword candidate is a candidate codeword (hereinafter referred to as an input codeword) that is assumed to be the input in the decoding process. For example, expanded codewords are codewords 1 and 011 obtained by concatenating a codeword candidate codeword λ with codewords 1 and 011 that are elements of the transition mode {1, 011}, and codewords 00 and 010 obtained by concatenating a codeword candidate codeword 0 with codewords 0 and 10 that are elements of the transition mode {0, 10}.
[0068] The following two conditions are required for encoding / decoding in this embodiment to satisfy the unique decodeability condition: (1) The set of all expanded codewords as elements (hereinafter referred to as the expanded codeword set) satisfies the word-first condition. (2) All expanded codewords begin with one of the codewords included in the current mode.
[0069] <<2: Encoding / Decoding Process>> First, the encoding process in this embodiment will be described. The encoding process in this embodiment uses the input distribution and the current mode to generate a candidate generation step that generates a first processing candidate including a first codeword candidate corresponding to a first pattern candidate and a first transition mode which is a first set of codewords, and a second processing candidate including a second codeword candidate corresponding to a second pattern candidate and a second transition mode which is a second set of codewords, satisfying the specific conditions (1) and (2) described above; and a processing step that (a) if the input pattern matches the first pattern candidate, sets the first codeword candidate as the output codeword and switches the current mode to the first transition mode; and (b) if the input pattern matches the second pattern candidate, sets the second codeword candidate as the output codeword and switches the current mode to the second transition mode.
[0070] As described above, the specific conditions (1) and (2) are that (1) the set of expanded codewords, whose elements are all expanded codewords, satisfies the word-first condition, and (2) all expanded codewords begin with one of the codewords included in the current mode. Expanded codewords are obtained from the first processing candidate and the second processing candidate. That is, the expanded codeword is a codeword obtained by concatenating the first codeword candidate with a codeword that is an element of the first set (first transition mode), and a codeword obtained by concatenating the second codeword candidate with a codeword that is an element of the second set (second transition mode). Furthermore, for an expanded codeword set to satisfy the word-first condition, it means that for any codeword included in the expanded codeword set, that codeword does not begin with any other codeword included in the expanded codeword set.
[0071] The initial current mode can be any set, as long as it is the same for both the encoding and decoding processes. For example, the initial current mode may be predetermined or it may be sent from the encoding device performing the encoding process to the decoding device performing the decoding process. An example of an initial current mode is {λ}.
[0072] The first pattern candidate and the second pattern candidate are different pattern candidates. The first codeword candidate and the second codeword candidate are different codeword candidates. The first set and the second set are different sets, and the first destination mode and the second destination mode are different destination modes. Some elements of the first destination mode and the second destination mode may or may not overlap. Furthermore, the rules for determining the first processing candidate and the second processing candidate (hereinafter referred to as the processing candidate determination rules) may be any rules as long as they satisfy the specific conditions (1) and (2) described above and are appropriate to the input distribution. However, the same processing candidate determination rules must be used for both the encoding and decoding processes. For example, the processing candidate determination rules may be predetermined or sent from the encoding device to the decoding device.
[0073] In this embodiment, the input pattern is each pattern included in a sequence of one or more patterns (hereinafter referred to as the pattern sequence). The input pattern in this embodiment is binary (for example, binary data of 0 and 1). When the pattern is binary, the first and second processing candidates can be obtained with less computation. Details of this will be described later.
[0074] The input distribution may be a known distribution of input patterns, or it may be a distribution of input patterns estimated from a sequence of patterns of a certain length. The input distribution may be input to the encoding device, or it may be estimated from the sequence of patterns input to the encoding device. However, it is assumed that the same distribution can be reproduced in the decoding device.
[0075] The output codeword is the codeword corresponding to the input pattern. By sequentially executing the candidate generation step and processing step for each input pattern in the pattern sequence, a codeword corresponding to the pattern sequence is obtained.
[0076] More specifically, the encoding process in this embodiment includes, for example, the following four processes: (1) A pattern sequence x0x1…x of length L L-1 (However, x i (i=0, 1, ..., L-1) is input to the encoding device. Note that in the second embodiment, L is an integer of 1 or more, but L may also be an integer of 2 or more. The initial current mode is set and i is set to 0. (2) The encoding device receives pattern x i Using the input distribution of (input pattern) and the current mode, a first processing candidate is generated that satisfies the specific conditions (1) and (2) described above, including a first codeword candidate corresponding to the first pattern candidate and a first transition mode which is the first set of codewords, and a second processing candidate that includes a second codeword candidate corresponding to the second pattern candidate and a second transition mode which is the second set of codewords. (3) Pattern x i If it matches the first pattern candidate, the encoding device converts the first codeword candidate to pattern x i The corresponding output codeword w i The current mode is then switched to the first target mode. Pattern x iIf it matches the second pattern candidate, the encoding device sets the second codeword candidate as the output codeword w corresponding to pattern x i and switches the current mode to the second transition destination mode. (4) If i ≠ L - 1, set i + 1 as the new i and return to (2). If i = L - 1, the encoding device concatenates the output codewords w0, w1, …, w L-1 to obtain the codeword w0w1…w L-1 and outputs it, ending the encoding process.
[0077] Next, the decoding process in this embodiment will be described. The decoding process in this embodiment uses the input distribution and the current mode that satisfy the above specific conditions (1) and (2), and includes a first processing candidate including a first codeword candidate corresponding to the first pattern candidate and a first transition destination mode that is a first set of codewords, and a second processing candidate including a second codeword candidate corresponding to the second pattern candidate and a second transition destination mode that is a second set of codewords. The candidate generation step for generating the second processing candidate, and (a) when the head of the current codeword matches the first codeword candidate and the first transition destination mode includes an element (codeword) that matches the head of the codeword obtained by deleting the head that matches the first codeword candidate from the current codeword, the first pattern candidate is set as the output pattern, and the current mode is switched to the first transition destination mode. (b) When the head of the current codeword matches the second codeword candidate and the second transition destination mode includes an element (codeword) that matches the head of the codeword obtained by deleting the head that matches the second codeword candidate from the current codeword, the second pattern candidate is set as the output pattern, and the current mode is switched to the second transition destination mode.
[0078] The specific conditions (1) and (2) are the same as those for the encoding process: (1) the set of expanded codewords, whose elements are all expanded codewords, satisfies the beginning condition, and (2) all expanded codewords begin with one of the codewords included in the current mode. Note that if the beginning of the current codeword matches the first codeword candidate, but the first destination mode does not contain any elements that match the beginning of the codeword obtained by removing the beginning of the codeword that matches the first codeword candidate from the current codeword, then if the first pattern candidate is used as the output pattern and the current mode is switched to the first destination mode, then condition (2) will not be satisfied in the next decoding. Similarly, if the beginning of the current codeword matches the second codeword candidate, but the second destination mode does not contain any elements that match the beginning of the codeword obtained by removing the beginning of the codeword that matches the second codeword candidate from the current codeword, then if the second pattern candidate is used as the output pattern and the current mode is switched to the second destination mode, then condition (2) will not be satisfied in the next decoding. In other words, by using coding rules that satisfy conditions (1) and (2), it is possible to determine which codeword is correct to use for decoding by making judgments in (a) and (b). That is, it is possible to confirm whether the first codeword candidate or the second codeword candidate is correct to use for decoding by comparing these candidates with the codewords that follow them and the first and second transition modes.
[0079] The input distribution in the decoding process is the same as that in the encoding process, and is the distribution of input patterns corresponding to the input codeword. In other words, the input distribution is the distribution of output patterns. The initial current mode in the decoding process is also the same as that in the encoding process. The rules for determining processing candidates in the decoding process are also the same as those for the encoding process. The input codeword is the codeword obtained in the encoding process. The output pattern is the pattern corresponding to the beginning of the current codeword, and a sequence of output patterns (hereinafter referred to as the output pattern sequence) is obtained by sequentially executing the candidate generation step and processing step for the codewords contained in the input codeword. Note that the current codeword is the codeword that is the target of the decoding process at the present time, and the current codeword at the time decoding starts is the input codeword.
[0080] More specifically, the decoding process in this embodiment includes, for example, the following four processes. (1) The codeword w0w1... w L-1 (where w i (i = 0, 1,..., L - 1) is the codeword) and the length L of the codeword w0w1... w L-1 are input to the decoder. The initial current mode is set, and the initial current codeword is set to w0w1... w L-1 . (2) The decoder uses the input distribution and the current mode to generate a first processing candidate including a first codeword candidate corresponding to the first pattern candidate and a first destination mode which is the first set of codewords that satisfy the above specific conditions (1) and (2), and a second processing candidate including a second codeword candidate corresponding to the second pattern candidate and a second destination mode which is the second set of codewords. The input distribution corresponds to the codeword w at the head of the current codeword. Note that the codeword w may be λ. (3) If the codeword w at the head of the current codeword matches the first codeword candidate and the first destination mode includes an element that matches the head of the codeword obtained by deleting the head of the current codeword that matches the first codeword candidate, the decoder sets the first pattern candidate as the output pattern x i corresponding to the codeword w, and switches the current mode to the first destination mode. If the codeword w at the head of the current codeword matches the second codeword candidate and the second destination mode includes an element that matches the head of the codeword obtained by deleting the head of the current codeword that matches the second codeword candidate, the decoder sets the second pattern candidate as the output pattern x i corresponding to the codeword w, and switches the current mode to the second destination mode. Also, in any case, the decoder sets the codeword obtained by deleting the head of the current codeword that matches the codeword w as the new current codeword. (4) If the length of the output pattern sequence x0x1... x i obtained by concatenating the obtained output patterns x0, x1,..., x i is not L, it returns to (2). If the length of the output pattern sequence x0x1... x i is L, the decoder outputs the output pattern sequence x0x1... x i = x0x1... x L-1 and terminates the decoding process.
[0081] <<3: Examples of Encoding / Decoding>> First, we show an example of encoding the pattern sequence 010, which is a binary integer sequence of 0s and 1s, with the initial current mode being {λ} and L=3. Here, we show an example where the first pattern candidate is 0 and the second pattern candidate is 1. However, it goes without saying that the same can be achieved by swapping the 0s and 1s in the pattern. This point will also be the case in the following explanation.
[0082] (1) Pattern sequence 010 is input to the encoding device. The initial current mode is set to {λ} and i=0.
[0083] (2) The encoding device uses the input distribution of the first pattern x0=0 in the pattern sequence x0x1x2=010 and the current mode {λ} to determine the processing candidate, and generates a first processing candidate corresponding to 0 (first pattern candidate) = (first codeword candidate, first transition mode) = (λ, {0, 10, 1100}), and a second processing candidate corresponding to 1 (second pattern candidate) = (second codeword candidate, second transition mode) = (11, {01, 1}). Here, the expanded codewords corresponding to 0 (first pattern candidate) are 0, 10, 1100, and the expanded codewords corresponding to 1 (second pattern candidate) are 1101, 111, and the set of expanded codewords is {0, 10, 1100, 1101, 111}, satisfying conditions (1) and (2).
[0084] (3) In reality, the first pattern in pattern sequence 010 is 0 (first pattern candidate), so the encoding device sets λ (first codeword candidate) as the output codeword w0=λ and switches the current mode to {0, 10, 1100} (first transition mode).
[0085] (4) Since i=2 is not the case, the encoding device sets i=1 and uses the input distribution x1=1 for the second pattern x0x1x2=010 and the current mode {0, 10, 1100} to generate the first processing candidate corresponding to 0 (first pattern candidate) = (first codeword candidate, first transition mode) = (λ, {0, 100}), and the second processing candidate corresponding to 1 (second pattern candidate) = (second codeword candidate, second transition mode) = (1, {01, 100}). Here, the expanded codewords corresponding to 0 (first pattern candidate) are 0, 100, and the expanded codewords corresponding to 1 (second pattern candidate) are 101, 1100, and the expanded codeword set is {0, 100, 101, 1100}, satisfying conditions (1) and (2).
[0086] (5) In reality, the second pattern in pattern sequence 010 is 1 (second pattern candidate), so the encoding device sets 1 (second codeword candidate) as the output codeword w1=1 and switches the current mode to {01, 100} (second transition mode).
[0087] (6) Since i is not 2, the encoding device sets i to 2 and uses the input distribution x1=0 for the third pattern x0x1x2=010 and the current mode {01, 100} to generate a first processing candidate corresponding to 0 (first pattern candidate) = (first codeword candidate, first transition mode) = (01, {λ}), and a second processing candidate corresponding to 1 (second pattern candidate) = (second codeword candidate, second transition mode) = (100, {λ}). Here, the expanded codeword corresponding to 0 (first pattern candidate) is 01, the expanded codeword corresponding to 1 (second pattern candidate) is 100, the expanded codeword set is {01, 100}, and conditions (1) and (2) are satisfied.
[0088] (7) In reality, the third pattern in pattern sequence 010 is 0 (first pattern candidate), so the encoding device sets 01 (first codeword candidate) as the output codeword w2=01 and switches the current mode to {λ} (first transition mode).
[0089] (8) Since i=2, the encoding device concatenates the output codewords w0, w1, and w2 to obtain the codeword w0w1w2=λ101, i.e., codeword 101, and outputs the codeword 101, and terminates the encoding process.
[0090] Next, we show an example of decoding codeword 101 when the initial current mode is {λ} and L=3. The rules for determining the processing candidate are the same as in the coding example above.
[0091] (1) Codeword 101 is input to the decoder. The initial current mode is set to {λ} and the initial current codeword is set to 101.
[0092] (2) The decoder uses the input distribution and the current mode {λ} to generate a first processing candidate corresponding to 0 (first pattern candidate) = (first codeword candidate, first transition mode) = (λ, {0, 10, 1100}) and a second processing candidate corresponding to 1 (second pattern candidate) = (second codeword candidate, second transition mode) = (11, {01, 1}). The input distribution corresponds to the first codeword w0 of the current codeword w0w1w2 = 101. In other words, the input distribution is the input distribution of the first pattern in the pattern sequence corresponding to codeword 101.
[0093] (3) In reality, the codeword w at the beginning of the current codeword 101 is λ (first codeword candidate), and {0, 10, 1100} (first transition mode) contains element 10 that matches the beginning of codeword 101 obtained by deleting the beginning of codeword 101 that matches λ (first codeword candidate). Therefore, the decoder sets 0 (first pattern candidate) as the output pattern x0=0 corresponding to codeword w, and switches the current mode to {0, 10, 1100} (first transition mode). The decoder also sets the codeword 101 obtained by deleting the beginning of codeword w=λ from the current codeword 101 as the new current codeword.
[0094] (4) Since the length of the output pattern sequence 0 obtained by concatenating the obtained output patterns is not 3, the decoder uses the input distribution and the current mode {0, 10, 1100} and, in accordance with the rules for determining processing candidates, generates a first processing candidate corresponding to 0 (first pattern candidate) = (first codeword candidate, first transition mode) = (λ, {0, 100}), and a second processing candidate corresponding to 1 (second pattern candidate) = (second codeword candidate, second transition mode) = (1, {01, 100}). The input distribution corresponds to the first codeword w1 of the current codeword w1w2 = 101. In other words, the input distribution is the input distribution of the second pattern in the pattern sequence corresponding to the first codeword 101.
[0095] (5) In reality, the codeword w at the beginning of the current codeword 101 is 1 (second codeword candidate), and {01, 100} (second transition mode) contains element 01 that matches the beginning of codeword 01 obtained by deleting the beginning of the current codeword 101 that matches 1 (second codeword candidate). Note that there is λ (first codeword candidate) that matches the beginning of the current codeword 101, but {0, 100} (first transition mode) does not contain the element that matches the beginning of codeword 101 obtained by deleting the beginning of the current codeword 101 that is λ (first codeword candidate). For this reason, the decoder sets 1 (second pattern candidate) as the output pattern x1=1 corresponding to codeword w, and switches the current mode to {01, 100} (second transition mode). The decoder also sets codeword 01 obtained by deleting the beginning of the current codeword 101 that matches codeword w=1 as the new current codeword.
[0096] (6) Since the length of the output pattern sequence 01 obtained by concatenating the obtained output patterns is not 3, the decoder uses the input distribution and the current mode {01, 100} and, in accordance with the rules for determining processing candidates, generates a first processing candidate = (first codeword candidate, first transition mode) = (01, {λ}) corresponding to 0 (first pattern candidate), and a second processing candidate = (second codeword candidate, second transition mode) = (100, {λ}) corresponding to 1 (second pattern candidate). The input distribution corresponds to the first codeword w2 of the current codeword w2 = 01. In other words, the input distribution is the input distribution of the third pattern in the pattern sequence corresponding to the first codeword 01.
[0097] (7) In reality, the codeword w at the beginning of the current codeword 01 is 01 (first codeword candidate), and {λ} (first transition mode) contains an element λ that matches the beginning of the codeword λ obtained by deleting the beginning of the codeword λ that matches 01 (first codeword candidate) from the current codeword 01. Therefore, the decoder sets 0 (first pattern candidate) as the output pattern x2=0 corresponding to the codeword w, and switches the current mode to {λ} (first transition mode). The decoder also sets the codeword λ obtained by deleting the beginning of the codeword λ that matches the codeword w=01 from the current codeword 01 as the new current codeword.
[0098] Since the length of the output pattern sequence 010 obtained by concatenating the obtained output patterns is 3, the decoding device outputs the output pattern sequence 010 and terminates the decoding process.
[0099] <<4: Example of a rule for determining processing candidates based on the input distribution>> Next, we will illustrate a rule for determining processing candidates based on the input distribution. Example of a rule for determining processing candidates 1: Based on the input distribution and the expected value of the output codeword length based on the first codeword candidate and the second codeword candidate, the first and second processing candidates may be generated. For example, the first and second processing candidates may be generated such that the expected value is small (for example, so that the expected value is minimized). This expected value can be calculated, for example, as follows: P i =p i (0)*|w i (0)|+p i (1)*|w i(1) Here, P i The output codeword is w i This represents the expected value of the length. i (0), p i (1) Input pattern x i This represents the input distribution of p i (0) is input pattern x i This represents the probability that p is 0. i (1) Input pattern x i This represents the probability that w is 1. i (0) represents the first codeword candidate, |w i (0)| is w i (0) represents the length, w i (1) represents the second codeword candidate, |w i (1)| is w i (1) Represents the length. In the candidate generation step of this example, for example, input pattern x i Input distribution p i (0), p i (1) Using the current mode, the expected value P i To minimize (according to the decision rule according to the input distribution), the first processing candidate that satisfies conditions (1) and (2) = (first codeword candidate, first transition mode) = (w i (0), mode0) and second processing candidate = (second codeword candidate, second transition mode) = (w i (1), mode1) is generated.
[0100] Example 2 of the rule for determining processing candidates: The cost of the transition mode may be defined, and the first and second processing candidates may be generated based on the input distribution, the first codeword candidate, the second codeword candidate, the cost of the first transition mode, and the cost of the second transition mode, in accordance with the expected values. That is, the first and second processing candidates may be generated such that the expected values of the output codeword length and the cost of the transition mode are small (for example, so that these expected values are minimized), based on the input distribution. This can further improve compression efficiency.
[0101] The cost of the transition mode is an approximate value representing how much the code length increases when encoding with that mode as the current mode compared to when encoding with mode {λ} as the current mode. For example, when the current mode is {01, 1}, it is not possible to encode with a codeword that starts with 00. This is because setting a codeword candidate that starts with 00 results in an expanded codeword that also starts with 00, and such an expanded codeword does not begin with any of the codewords included in the current mode {01, 1}, thus failing to satisfy condition (2) mentioned above. On the other hand, when the current mode is {λ}, there are no such constraints. That is, when the current mode is {01, 1}, the code length becomes longer because there are more constraints on the settable codeword candidates compared to when the current mode is {λ}. Also, for example, when the current mode is {011, 1}, it is not possible to encode with a codeword that starts with 00 or a codeword that starts with 010. Therefore, when the current mode is {011, 1}, the code length becomes longer not only when the current mode is {λ}, but also when it is {01, 1}. The cost of the destination mode is a numerical representation of this difference in code length. For example, the cost of the destination mode is a real number, and a cost can be assigned in advance to each mode that can be used as the destination mode. For example, since the longer the codeword included in the destination mode, there tends to be more constraints on the codeword candidates, a cost can be assigned according to the length of the codeword included in the destination mode. For example, the first cost, which is the cost of the destination mode when the length of the codeword included in the destination mode is the first value, should be smaller than the second cost, which is the cost of the destination mode when the length of the codeword included in the destination mode is the second value. However, the first value is smaller than the second value. For example, the cost C(mode) of the destination mode can be assigned as follows. Here, J is a positive integer representing the number of codewords included in the destination mode, and Q j(j=1,...,J) represents the length of the j-th codeword in the destination mode. In this case, the cost C(λ) of the destination mode {λ} is 0, the cost C({01, 1}) of the destination mode {01, 1} is approximately 0.42, and the cost C({011, 1}) of the destination mode {011, 1} is approximately 0.68. In this example as well, the length of the codewords in the destination mode is reflected in the cost.
[0102] The expected value based on the input distribution, the first codeword candidate, the second codeword candidate, the cost of the first transition mode, and the cost of the second transition mode can be calculated, for example, as follows: R i =p i (0)*(|w i (0)|+C(mode0))+p i (1)*(|w i (1)|+C(mode1)) Here, R i is input pattern x i The corresponding input distribution p i (0), p i (1) and the first codeword candidate w i (0) and second codeword candidate w i (1) represents the expected value based on the cost C(mode0) of the first transition mode mode0 and the cost C(mode1) of the second transition mode mode1. In the candidate generation step of this example, for example, input pattern x i Input distribution p i (0), p i (1) Using the current mode, the expected value R i To minimize (according to the decision rule according to the input distribution), the first processing candidate that satisfies conditions (1) and (2) = (first codeword candidate, first transition mode) = (w i (0), mode0) and second processing candidate = (second codeword candidate, second transition mode) = (w i (1), mode1) is generated.
[0103] <<5: Characteristics of Encoding / Decoding>> In this embodiment, encoding / decoding is performed by generating a first processing candidate, which includes a first codeword candidate corresponding to a first pattern candidate and a first transition mode, which is a first set of codewords, and a second processing candidate, which includes a second codeword candidate corresponding to a second pattern candidate and a second transition mode, which is a second set of codewords, using the input distribution and the current mode, satisfying specific conditions (1) and (2). As described above, the specific conditions (1) and (2) (hereinafter referred to as the unique decoding conditions for processing candidates) are as follows: (1) The expanded codeword set, whose elements are all expanded codewords, satisfies the word-first condition. (2) All expanded codewords begin with one of the codewords included in the current mode.
[0104] As a result, in this embodiment, coding rules that satisfy the unique decodeability condition according to the input distribution can be represented without having to store all the codebooks, etc. Consequently, in this embodiment, the memory capacity required to store the codebooks, etc. can be saved. This effect is particularly significant in environments where the appropriate codebook, etc. may change depending on the input pattern.
[0105] Furthermore, similar to the first embodiment, the second embodiment also makes it easy to ensure the unique decryption condition by assigning modes to the processing candidates. If the set of the first codeword candidate and the second codeword candidate does not satisfy the word-head condition, there may be multiple candidate codewords that can be used for decoding in the decoding process. For example, as illustrated in the above-mentioned <<3: Example of encoding / decoding>>, if the first processing candidate is (first codeword candidate, first transition mode) = (λ, {0, 100}) and the second processing candidate = (second codeword candidate, second transition mode) = (1, {01, 100}), then the set of the first codeword candidate and the second codeword candidate {λ, 1} does not satisfy the word-head condition. Therefore, in the decoding process, the candidate codewords that match the word-head of the codeword 101 to be decoded are λ and 1. However, because the unique decryption condition for the processing candidate is satisfied, the mode of the processing candidate plays a role as a query to know which codeword was actually encoded and which mode was transitioned to during decoding. In other words, it is possible to determine whether the first or second codeword candidate is correct to use for decoding by comparing these candidates with the codewords that follow them and the first and second transition modes.
[0106] Furthermore, by using a binary input pattern, the combinations of processing candidates that satisfy the aforementioned specific conditions (1) and (2) can be significantly limited. That is, when the input pattern is binary, once one processing candidate is determined in the current mode, the other processing candidate can be uniquely determined from other processing candidates that satisfy conditions (1) and (2), excluding those that are inefficient in terms of compression, depending on the input distribution. Therefore, a first and second processing candidate corresponding to a variable input distribution can be generated with less computation.
[0107] For the sake of simplicity, we will assume that there is a maximum length for the codewords that are elements of a mode, and that the number of elements of modes other than {λ} is 2 or more. Even with these assumptions, the generality of the effects described above is not lost. Below, the maximum length of the codewords that are elements of a mode is N bits (where N is a positive integer), and W is the set whose elements are all N-bit codewords that begin with the codeword of the current mode. When a first processing candidate is determined, an expanded codeword is obtained from that first processing candidate. Let W0 be the set whose elements are all N-bit codewords that begin with the expanded codeword obtained from the first processing candidate. Similarly, when a second processing candidate is determined, an expanded codeword is obtained from that second processing candidate. Let W1 be the set whose elements are all N-bit codewords that begin with the expanded codeword obtained from the second processing candidate. In order to set first and second processing candidates that satisfy the above conditions (1) and (2) and do not waste in compression efficiency, it is sufficient to make set W1 the set obtained by subtracting set W0 from set W. The pair of such codeword and destination mode is uniquely determined. For example, if N=3, and the current mode is {01, 1}, then if the first codeword candidate for the first processing candidate is λ and the first destination mode is {011, 1}, then W={010, 011, 100, 101, 110, 111} and W0={011, 100, 101, 110, 111}. In this case, the second processing candidate is determined such that W1 is the set {010} obtained by removing W0 from W. Then, the second codeword candidate for the second processing candidate is uniquely determined to be 010 and the second destination mode is uniquely determined to be {λ}. The reason for this is explained below.
[0108] First, if there is a codeword common to W0 and W1, then the first codeword candidate and the second processing candidate will violate the aforementioned condition (1). That is, W0 is an extension of the expanded codeword determined from the first codeword candidate and the first transition mode for the first pattern candidate 0 to N bits. W1 is an extension of the expanded codeword determined from the second codeword candidate and the second transition mode for the second pattern candidate 1 to N bits. If there is a codeword ω common to W0 and W1, then there will be a codeword ω0 with codeword ω as its beginning in the expanded codewords corresponding to the first pattern candidate 0, and a codeword ω1 with codeword ω as its beginning in the expanded codewords corresponding to the second pattern candidate 1. In that case, either codeword ω0 or codeword ω1 will be the beginning of the other, which violates the condition (1).
[0109] Furthermore, if the union of W0 and W1 contains an element not included in W, then it violates condition (2) above. That is, W0 contains all N-bit codewords whose first element is the expanded codeword ρ0 determined from the first codeword candidate for the first pattern candidate 0 and the first transition mode. W1 contains all N-bit codewords whose first element is the expanded codeword ρ1 determined from the second codeword candidate for the second pattern candidate 1 and the second transition mode. W contains all N-bit codewords whose first element is the codeword of the current mode. If condition (2) is satisfied, then the expanded codewords ρ0 and ρ1 that are the first elements of the codewords included in W0 and W1 must each have one of the codewords ρ included in the current mode as its first element. An N-bit codeword whose first element is the codeword ρ included in the current mode must be included in W. Therefore, if condition (2) is satisfied, the union of W0 and W1 does not contain an element not included in W. Thus, the contrapositive also holds.
[0110] Furthermore, if W has a codeword that is not in the union of W0 and W1, it imposes constraints on the expanded codewords ρ0 and ρ1 that exceed the limits necessary to satisfy condition (2). That is, in order to satisfy condition (2), the expanded codewords ρ0 and ρ1 that are the beginnings of codewords included in W0 and W1 must begin with any codeword ρ included in the current mode. Here, if W has a codeword that is not in the union of W0 and W1, the current mode will include a codeword that is not the beginning of the expanded codewords ρ0 and ρ1. This restricts the expanded codewords ρ0 and ρ1 beyond the limits necessary to satisfy condition (2). That is, it imposes excessive constraints on the first codeword candidate and first destination mode, as well as the second codeword candidate and second destination mode, which are the origins of the expanded codewords ρ0 and ρ1, in order to satisfy condition (2). The more constraints there are, the worse the compression efficiency becomes. Therefore, under the conditions (1) and (2) above, if W contains a codeword that is not in the union of W0 and W1, there will be inefficiencies in the compression efficiency.
[0111] In this way, when the input pattern is binary, a first processing candidate is determined in the current mode according to the input distribution, and a second processing candidate is determined such that set W1 is set W minus set W0. This allows us to set first and second processing candidates that satisfy conditions (1) and (2) and do not waste any compression efficiency.
[0112] <Specific Examples of This Embodiment> Specific examples of this embodiment will be described with reference to the drawings. <<Encoding Device 210>> Hereinafter, the encoding device 210 will be illustrated with reference to Figures 7 to 8. Figure 7 is a block diagram illustrating the configuration of the encoding device 210. Figure 8 is a flowchart illustrating the operation of the encoding device 210. As illustrated in Figure 7, the encoding device 210 includes a candidate generation unit 211, a processing unit 212, a control unit 218, and a storage unit 219. The storage unit 219 is a component that appropriately records information necessary for processing by the encoding device 210.
[0113] The operation of the encoding device 210 is illustrated in Figure 8. In S210, a pattern sequence x0x1…x of length L is generated. L-1The following is input to the processing unit 212: pattern sequence x0x1...x L-1 The distribution of each pattern x is input to the candidate generation unit 211. i This represents the input distribution (i=0, 1, ..., L-1) (input pattern). The candidate generation unit 211 sets the initial current mode. The initial current mode is, for example, {λ}. The control unit 218 sets i=0.
[0114] In S211, the candidate generation unit 211 generates pattern x i Using the input distribution and the current mode, and according to the rules for determining processing candidates, a first processing candidate is generated that satisfies the specific conditions (1) and (2) described above, including a first codeword candidate corresponding to a first pattern candidate and a first transition mode which is a first set of codewords, and a second processing candidate that includes a second codeword candidate corresponding to a second pattern candidate and a second transition mode which is a second set of codewords. The first processing candidate and the second processing candidate are sent to the processing unit 212.
[0115] In S212, the processing unit 212 processes pattern x i If it matches the first pattern candidate, the first codeword candidate is set to pattern x i The corresponding output codeword w i The current mode is then switched to the first destination mode. The switched current mode (first destination mode) is sent to the candidate generation unit 211. Meanwhile, pattern x i If it matches the second pattern candidate, the processing unit 212 selects the second codeword candidate as pattern x i The corresponding output codeword w i The current mode is then switched to the second destination mode. The switched current mode (second destination mode) is sent to the candidate generation unit 211.
[0116] In S213, the control unit 218 determines whether i=L-1 (i.e., whether encoding is complete). If i=L-1, the control unit 218 sets i+1 as the new i and returns to processing S211. On the other hand, if i=L-1, the control unit 218 proceeds to the next step, S214.
[0117] In S214, the processing unit 212 outputs the codewords w0, w1, ..., wL-1 The codeword obtained by concatenating them is w0w1…w L-1 Output and terminate the encoding process.
[0118] <<Decoding Device 220>> The decoding device 220 will be illustrated below with reference to Figures 9 to 10. Figure 9 is a block diagram illustrating the configuration of the decoding device 220. Figure 10 is a flowchart illustrating the operation of the decoding device 220. As illustrated in Figure 9, the decoding device 220 includes a candidate generation unit 221, a processing unit 222, a control unit 228, and a storage unit 229. The storage unit 229 is a component that appropriately records information necessary for processing by the decoding device 220.
[0119] The operation of the decoding device 220 is illustrated in Figure 10. In S220, the codeword w0w1…w L-1 And length L is input to processing unit 222, pattern sequence x0x1...x L-1 The distribution of each pattern x is input to the candidate generation unit 221. i This represents the input distribution (i=0, 1, ..., L-1) (i.e., the input distribution from the 1st to the Lthth). The candidate generation unit 221 sets the initial current mode. The initial current mode is, for example, {λ}. The control unit 228 sets i=0. The processing unit 222 sets the initial current codeword to w0w1...w L-1 Set to this.
[0120] In S221, the candidate generation unit 221 generates pattern x i Using the input distribution (i.e., the (i)+1th input distribution) and the current mode, and according to the processing candidate determination rules, a first processing candidate is generated that satisfies the specific conditions (1) and (2) described above, including a first codeword candidate corresponding to the first pattern candidate and a first transition mode which is the first set of codewords, and a second processing candidate that includes a second codeword candidate corresponding to the second pattern candidate and a second transition mode which is the second set of codewords. i The input distribution corresponds to the codeword w at the beginning of the current codeword. The first processing candidate and the second processing candidate are sent to the processing unit 222.
[0121] In S222, if the codeword w at the beginning of the current codeword matches the first codeword candidate, and the first transition mode includes an element that matches the beginning of the codeword obtained by deleting the beginning of the codeword that matches the first codeword candidate from the current codeword, the processing unit 222 outputs the first pattern candidate to the output pattern x corresponding to the codeword w. i The current mode is then switched to the first destination mode. The switched current mode (first destination mode) is sent to the candidate generation unit 221. Meanwhile, the processing unit 222, if the codeword w at the beginning of the current codeword matches the second codeword candidate, and the second destination mode includes an element that matches the beginning of the codeword obtained by deleting the beginning of the codeword that matches the second codeword candidate from the current codeword, generates a second pattern candidate corresponding to the output pattern x of codeword w. i The current mode is then switched to the second destination mode. The switched current mode (second destination mode) is sent to the candidate generation unit 221. In either case, the processing unit 222 removes the beginning of the word that matches codeword w from the current codeword and makes the resulting codeword the new current codeword.
[0122] In S223, the control unit 228 outputs the obtained output patterns x0, x1, ..., x i The output pattern sequence x0x1…x is obtained by concatenating them. i Determine if the length of the output pattern sequence x0x1…x i If the length is not L, the control unit 228 sets i+1 to the new i and returns to processing S221. Meanwhile, the output pattern sequence x0x1…x i If the length is L, the control unit 228 proceeds to the next step S224.
[0123] In S224, the processing unit 222 outputs the output pattern sequence x0x1...x i =x0x1…x L-1 Output and terminate the decoding process.
[0124] [Modification 1 of the Second Embodiment] A sequence of non-binary integer values and their distribution may be input to the encoding device. In this case, the encoding device converts each input integer value into a binary sequence represented in binary with a predetermined number of digits, and uses the values of each digit of the binary sequence as an input pattern to perform the encoding process described in the second embodiment.
[0125] In this case, the input distribution for each digit of the binary sequence can be calculated from the distribution of the integer values input to the encoding device. For example, suppose a sequence of integer values between 0 and 3 (inclusive) is input to the encoding device, and the distribution of each integer value is p(0)=0.4, p(1)=0.3, p(2)=0.2, and p(3)=0.1. Note that p(0), p(1), p(2), and p(3) represent the probabilities that the integer value is 0, 1, 2, and 3, respectively. For example, when an integer value between 0 and 3 (inclusive) is represented as a two-digit binary number, the probability that the most significant digit (the first digit) of the binary sequence is 0 is p(0)+p(1)=0.7, and the probability that it is 1 is p(2)+p(3)=0.3. That is, the input distribution for the first digit of this binary sequence is a probability distribution where the probability of it being 0 is 0.7 and the probability of it being 1 is 0.3. Furthermore, if the first digit of this binary sequence is 0, the probability that the second digit is 0 is p(0) / (p(0)+p(1))=4 / 7, and the probability that the second digit is 1 is p(1) / (p(0)+p(1))=3 / 7. In other words, if the first digit of this binary sequence is 0, the input distribution for the second digit is a probability distribution where the probability of it being 0 is 4 / 7 and the probability of it being 1 is 3 / 7. On the other hand, if the first digit of this binary sequence is 1, the probability that the second digit is 0 is p(2) / (p(2)+p(3))=2 / 3, and the probability that the second digit is 1 is p(3) / (p(2)+p(3))=1 / 3. In other words, if the first digit of this binary sequence is 1, the input distribution for the second digit is a probability distribution where the probability of it being 0 is 2 / 3 and the probability of it being 1 is 1 / 3.
[0126] In this case, the encoding device processes the binary sequence obtained from each input integer value in 2-bit increments. That is, the encoding device first uses the input distribution of the first digit of each 2-bit binary sequence and performs the encoding process of the second embodiment on the input pattern of the first digit, and then uses the input distribution of the second digit corresponding to the value of the first digit and performs the encoding process of the second embodiment on the input pattern of the second digit. This allows the encoding process of the second embodiment to be applied even if a sequence of non-binary integer values and their distributions are input to the encoding device.
[0127] Similarly, in the decoding process, the decoding device may, for example, first perform the decoding according to the second embodiment using the input distribution of the first digit for every two bits, and then perform the encoding process according to the second embodiment using the input distribution of the second digit corresponding to the value of the first digit. The binary sequence obtained in this way may be converted back into a sequence of non-binary integer values. This allows for correct decoding.
[0128] [Modification 2 of the Second Embodiment] In Modification 1 of the Second Embodiment, each input integer value was converted into a binary sequence represented by a predetermined number of binary digits, and the encoding process described in the Second Embodiment was performed using the values of each digit in the binary sequence as input patterns. However, each input integer value may be converted into a binary sequence by a method other than representing it in binary. For example, each input integer value may be converted into a binary sequence of a unary code, and the encoding process described in the Second Embodiment may be performed using the values of each digit in the binary sequence as input patterns. A unary code is a code that represents a target integer value as a binary sequence by arranging the number of zeros equal to the target integer value and terminating it with a one.
[0129] In this case as well, the input distribution for each digit of the binary sequence can be calculated from the distribution of the integer values input to the encoding device. For example, when converting an integer value between 0 and 3 (inclusive) into a binary sequence of unary codes, the probability that the most significant digit (the first digit) of the binary sequence is 1 is p(0) = 0.4, and the probability that it is 0 is p(1) + p(2) + p(3) = 0.6. That is, the input distribution for the first digit of this binary sequence is a probability distribution where the probability of it being 1 is 0.4 and the probability of it being 1 is 0.6. Also, if the first digit of this binary sequence is 0, the probability that the second digit is 1 is p(1) / (p(1) + p(2) + p(3)) = 0.5, and the probability that the second digit is 0 is (p(2) + p(3)) / (p(1) + p(2) + p(3)) = 0.5. In other words, if the first digit of this binary sequence is 0, the input distribution for the second digit will be a probability distribution where there is a 0.5% chance of it being 1 and a 0.5% chance of it being 0. On the other hand, if the first digit of this binary sequence is 1, the second digit does not exist.
[0130] The encoding device converts each input integer value into a binary sequence of unary codes and processes the binary sequence in 2-bit increments. That is, the encoding device first uses the input distribution of the first digit of each 2-bit binary sequence and performs the encoding process of the second embodiment on the input pattern of the first digit, and then uses the input distribution of the second digit corresponding to the value of the first digit and performs the encoding process of the second embodiment on the input pattern of the second digit. Note that if the first digit of this binary sequence is 1, the second digit does not exist, so the encoding device does not encode the second digit. In this way, even if a sequence of non-binary integer values and their distribution are input to the encoding device, the encoding process of the second embodiment can be applied.
[0131] Similarly, in the decoding process, the decoding device may, for example, first perform the decoding according to the second embodiment using the input distribution of the first digit, and then perform the encoding process according to the second embodiment using the input distribution of the second digit corresponding to the value of the first digit, for every two bits. The binary sequence of the unary code obtained in this way may be converted back into a sequence of non-binary integer values. This allows for correct decoding.
[0132] [Modification 3 of the Second Embodiment] In the second embodiment, the input pattern was binary. However, the input pattern does not have to be binary. In this case, the candidate generation unit of the encoding device and the decoding device generates processing candidates equal to the number of input patterns, and the processing unit uses them. That is, the encoding device and decoding device of the second embodiment can be generalized as follows.
[0133] <Encoding Device> The encoding device includes a candidate generation unit that uses the current mode and generates an mth processing candidate that satisfies specific conditions, according to a decision rule (decision rule for processing candidates) corresponding to the mth pattern candidate, and the mth transition mode which is the mth set of codewords; and a processing unit that, when the input pattern matches the sth pattern candidate, sets the sth codeword candidate as the output codeword and switches the current mode to the sth transition mode.
[0134] <Decoding Device> The decoding device includes a candidate generation unit that uses the current mode and generates an mth processing candidate that includes an mth codeword candidate corresponding to an mth pattern candidate that satisfies specific conditions, and an mth transition mode which is the mth set of codewords, in accordance with a decision rule (decision rule for processing candidates) according to the input distribution; and a processing unit that, when the beginning of the current codeword matches the sth codeword candidate, and the sth transition mode includes an element that matches the beginning of the codeword obtained by deleting the beginning of the codeword that matches the sth codeword candidate from the current codeword, sets the sth pattern candidate as the output pattern and switches the current mode to the sth transition mode.
[0135] Here, m = 1, ..., M, s ∈ {1, ..., M}, and M is an integer greater than or equal to 2. M represents the number of input patterns. For example, the m-th processing candidate includes the m-th pattern candidate, the m-th codeword candidate, and the m-th destination mode. For example, the m-th processing candidate is a triplet of the m-th pattern candidate, the m-th codeword candidate, and the m-th destination mode. The first pattern candidates, ..., the M-th pattern candidates are all distinct from each other. The s-th pattern candidate is one of the first pattern candidates, ..., the M-th pattern candidates, the s-th codeword candidate is one of the first codeword candidates, ..., the M-th codeword candidates, and the s-th destination mode is one of the first destination modes, ..., the M-th destination modes. That is, the s-th processing candidate, which includes the s-th codeword candidate corresponding to the s-th pattern candidate and the s-th destination mode which is the s-th set of codewords, is one of the first processing candidates, ..., the M-th processing candidates.
[0136] The specific condition is that the set of expanded codewords, whose elements are all expanded codewords, satisfies the word-initial condition, and that all expanded codewords begin with one of the codewords included in the current mode. An expanded codeword is a codeword obtained by concatenating a candidate for the mth codeword with a codeword that is an element of the mth set (the mth destination mode). For an expanded codeword set to satisfy the word-initial condition, it means that for any codeword included in the set, that codeword cannot be the beginning of any other codeword included in that set. Note that switching the current mode to the sth destination mode means setting the sth destination mode as the new current mode.
[0137] The second embodiment is an example where M=2 and the input pattern is binary. The matters described in the second embodiment can be generalized to the case where the number of input patterns is M. For example, <<4: Example of a rule for determining processing candidates according to the input distribution>> can be generalized as follows. Example of a rule for determining processing candidates 1: Based on the input distribution and the expected value of the length of the output codeword based on the first codeword candidate to the Mth codeword candidate, the Mth processing candidate (first processing candidate,...,Mth processing candidate) may be generated from the first processing candidate. For example, the Mth processing candidate may be generated from the first processing candidate in such a way that the expected value is small (for example, so that the expected value is minimized). This expected value can be calculated, for example, as follows. P i =p i (1)*|w i (1) | + ... + p i (M)*|w i (M) Here, P i The output codeword is w i This represents the expected value of the length. i (1), ..., p i (M) is input pattern x i This represents the input distribution of p i (m) is the input pattern x i is x i This represents the probability that (m) is true. i (m) represents the pattern. x i (m) can be a number or a symbol. i (m) represents the mth codeword candidate, |w i (m)|is w i Represents the length (m). In the candidate generation step of this example, for example, input pattern x i Input distribution p i (1), ..., p i Using (M) and the current mode, the expected value P i To minimize (according to the decision rule according to the input distribution), the first processing candidate that satisfies conditions (1) and (2) = (first codeword candidate, first transition mode) = (w i (1), mode1), ..., Mth processing candidate = (Mth codeword candidate, Mth transition mode) = (w i (M), mode M) generates.
[0138] Example 2 of the rule for determining processing candidates: As described above, the cost of the destination mode may be defined, and the Mth processing candidate (first processing candidate, ..., Mth processing candidate) may be generated from the first processing candidate based on the input distribution, the Mth codeword candidate from the first codeword candidate, and the cost of the Mth destination mode from the first destination mode. That is, the Mth processing candidate may be generated from the first processing candidate in such a way that the expected value of the output codeword length and the cost of the destination mode, based on the input distribution, is small (for example, so that this expected value is minimized). This can further improve compression efficiency. The expected value based on the input distribution, the Mth codeword candidate from the first codeword candidate, and the cost of the Mth destination mode from the first destination mode can be calculated, for example, as follows: R i =p i (1)*(|w i (1)|+C(mode1))+...+p i (M)*(|w i (M)|+C(mode M )) Here, R i is input pattern x i The corresponding input distribution p i (1), ..., p i (M) and the first codeword candidate w i (1),...,M-th codeword candidate w i (M) and the cost of the first transition mode mode0 C(mode0), ..., the Mth transition mode mode M Cost C(mode M This represents the expected value based on the input pattern x. i Input distribution p i (1), ..., p i Using (M) and the current mode, the expected value R i To minimize (according to the decision rule according to the input distribution), the first processing candidate that satisfies conditions (1) and (2) = (first codeword candidate, first transition mode) = (w i (1), mode1),..., Mth processing candidate = (Mth codeword candidate, Mth transition mode) = (w i (M), modeM ) generates.
[0139] [Modification 4 of the second embodiment] In the encoding process of the second embodiment or its modification, the encoding device encodes the codeword w0w1...w L-1 Terminal codeword w L The codeword w0w1…w has been added. L-1 w L The output codeword w may be generated. L-1 If is a candidate for the sth codeword, then the terminal codeword w L is one of the elements of the s-th transition mode. In this case, which element of the s-th transition mode is the terminal codeword w? L Whether or not to use this is optional, but for example, the shortest codeword among the elements of the s-th transition mode is used as the terminal codeword w. L This is how it should be done. As a result, even if the length of the codeword to be decoded is not given to the decoding device in advance, the decoding device can determine the end of the codeword.
[0140] [Hardware Configuration] The processing of each part of the above-mentioned devices may be implemented by a computer. In this case, the processing content of the functions that each device should have is described by a program. This program is then loaded into the recording unit 2020 of the computer 2000 shown in Figure 7, and the arithmetic processing unit 2010, input unit 2030, output unit 2040, auxiliary recording unit 2025, etc. are operated to realize the processing functions of each of the above-mentioned devices on the computer.
[0141] The device of the present invention, for example, as a single hardware entity, has an input unit that can receive signals from outside the hardware entity, an output unit that can output signals to outside the hardware entity, a communication unit to which a communication device (e.g., a communication cable) can be connected that can communicate with outside the hardware entity, a CPU (Central Processing Unit, which may include cache memory and registers, etc.) which is an arithmetic processing unit, RAM or ROM which is memory, an external storage device such as a hard disk, and a bus that connects these input unit, output unit, communication unit, CPU, RAM, ROM, and external storage device so that data can be exchanged between them. Furthermore, if necessary, the hardware entity may be provided with a device (drive) that can read and write recording media such as CD-ROMs. An example of a physical entity equipped with such hardware resources is a general-purpose computer.
[0142] The external storage device of the hardware entity stores the programs necessary to realize the above-mentioned functions, as well as the data required for processing these programs (this is not limited to external storage; for example, programs may be stored in ROM, a read-only storage device). Furthermore, data obtained through the processing of these programs is appropriately stored in RAM or other external storage devices.
[0143] In hardware entities, each program stored in an external storage device (or ROM, etc.) and the data necessary for processing each program are loaded into memory as needed, and interpreted, executed, and processed by the CPU as appropriate. As a result, the CPU realizes predetermined functions (each component represented as ...part, ...means, etc. above). In other words, each component in the embodiment of the present invention may be composed of a processing circuit.
[0144] As described above, when the processing functions of the hardware entity (device of the present invention) described in the above embodiment are implemented by a computer, the processing content of the functions that the hardware entity should have is described by a program. Then, by executing this program on the computer, the processing functions of the hardware entity are implemented on the computer.
[0145] The program describing this process can be recorded on a computer-readable recording medium. A computer-readable recording medium is, for example, a non-temporary recording medium, specifically a magnetic recording device, an optical disc, etc.
[0146] Furthermore, this program may be distributed, for example, by selling, transferring, or lending portable recording media such as DVDs or CD-ROMs on which the program is recorded. Alternatively, the program may be stored in the storage device of a server computer and distributed by transferring the program from the server computer to other computers via a network.
[0147] A computer executing such a program may, for example, first store a program recorded on a portable recording medium or a program transferred from a server computer in its own non-temporary storage device, the auxiliary recording unit 2025. Then, when processing is to be executed, the computer reads the program stored in the auxiliary recording unit 2025 into the recording unit 2020 and executes the processing according to the loaded program. Alternatively, as another execution form of this program, the computer may directly read the program from the portable recording medium into the recording unit 2020 and execute the processing according to that program. Furthermore, each time a program is transferred to this computer from a server computer, it may sequentially execute the processing according to the received program. Alternatively, the above processing may be executed by a so-called ASP (Application Service Provider) type service, where the server computer does not transfer programs to this computer, but the processing function is realized only by execution instructions and result acquisition. In this embodiment, the program includes information used for processing by an electronic computer that is equivalent to a program (data that is not a direct instruction to the computer but has the property of defining the processing of the computer).
[0148] Furthermore, in this configuration, the device is configured by executing a predetermined program on a computer, but at least a part of these processes may be implemented in hardware.
[0149] [Other Modifications] It should be noted that the present invention is not limited to the embodiments described above. For example, the various processes described above may not only be executed sequentially according to the description, but may also be executed in parallel or individually as needed, depending on the processing capacity of the device performing the processes. It goes without saying that other modifications can be made as appropriate without departing from the spirit of the present invention.
[0150] 110, 210 Encoding device 111 Encoding unit 120, 220 Decoding device 121 Decoding unit 211, 221 Candidate generation unit 212, 222 Processing unit
Claims
1. An encoding device comprising: a candidate generation unit that generates an m-th processing candidate that includes an m-th codeword candidate corresponding to an m-th pattern candidate and an m-th transition mode which is the m-th set of codewords, using the current mode and according to a decision rule corresponding to the input distribution, satisfying specific conditions; and a processing unit that, when s∈{1,...,M} and the input pattern matches the s-th pattern candidate, sets the s-th codeword candidate as the output codeword and switches the current mode to the s-th transition mode, wherein the specific conditions are that the expanded codeword set, whose elements are all expanded codewords, satisfies the word-head condition, and all of the expanded codewords have one of the codewords included in the current mode as their beginning; the expanded codeword is a codeword obtained by concatenating the m-th codeword candidate and the codewords which are elements of the m-th set; and the expanded codeword set satisfying the word-head condition means that for any codeword included in the expanded codeword set, that codeword does not become the beginning of any other codeword included in the expanded codeword set.
2. The encoding device according to claim 1, wherein the candidate generation unit generates the Mth processing candidate from the first processing candidate based on the input distribution, the Mth codeword candidate from the first codeword candidate, and the cost of the Mth transition mode from the first transition mode.
3. An encoding device according to claim 1 or 2, wherein M=2 and the input pattern is binary.
4. A candidate generation unit generates an m-th processing candidate that includes a m-th codeword candidate corresponding to a m-th pattern candidate and an m-th transition mode which is the m-th set of codewords, using the current mode and according to a decision rule corresponding to the input distribution, satisfying specific conditions; and a processing unit that sets the m-th pattern candidate as an output pattern and switches the current mode to the aforementioned s-th transition mode when s∈{1,...,M}, the beginning of the current codeword matches the s-th codeword candidate, and the s-th transition mode includes an element that matches the beginning of a codeword obtained by removing the beginning that matches the s-th codeword candidate from the current codeword, wherein the specific conditions are that the expanded codeword set, whose elements are all expanded codewords, satisfies the beginning condition, and all of the expanded codewords begin with one of the codewords included in the current mode, and the expanded codeword is a codeword obtained by concatenating the m-th codeword candidate and the codewords that are elements of the m-th set. A decoding device in which the expanded codeword set satisfies the word-first condition, meaning that for any codeword included in the expanded codeword set, that codeword does not become the word-first of any other codeword included in the expanded codeword set.
5. A program for causing a computer to function as the encoding device of claim 1 or the decoding device of claim 4.