WO2017056327A1 - 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置 - Google Patents

符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置 Download PDF

Info

Publication number
WO2017056327A1
WO2017056327A1 PCT/JP2015/078120 JP2015078120W WO2017056327A1 WO 2017056327 A1 WO2017056327 A1 WO 2017056327A1 JP 2015078120 W JP2015078120 W JP 2015078120W WO 2017056327 A1 WO2017056327 A1 WO 2017056327A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
numerical value
digits
encoded
encoding
Prior art date
Application number
PCT/JP2015/078120
Other languages
English (en)
French (fr)
Inventor
片岡 正弘
Original Assignee
富士通株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 富士通株式会社 filed Critical 富士通株式会社
Priority to PCT/JP2015/078120 priority Critical patent/WO2017056327A1/ja
Priority to EP15905480.8A priority patent/EP3358748B1/en
Priority to JP2017542666A priority patent/JP6593445B2/ja
Publication of WO2017056327A1 publication Critical patent/WO2017056327A1/ja
Priority to US15/940,081 priority patent/US10447295B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/02Conversion to or from weighted codes, i.e. the weight given to a digit depending on the position of the digit within the block or code word
    • H03M7/12Conversion to or from weighted codes, i.e. the weight given to a digit depending on the position of the digit within the block or code word having two radices, e.g. binary-coded-decimal code
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
    • H03M7/4031Fixed length to variable length coding
    • H03M7/4037Prefix coding
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
    • H03M7/4031Fixed length to variable length coding
    • H03M7/4037Prefix coding
    • H03M7/4043Adaptive prefix coding
    • H03M7/4068Parameterized codes

Definitions

  • the present invention relates to an encoding program, an encoding method, an encoding device, a decoding program, a decoding method, and a decoding device.
  • a technique for representing a numerical value with a variable-length bit representation When a numerical value is represented by a variable-length bit representation, the code length of data representing the numerical value is determined according to the numerical value and the number of significant digits. For example, when the unit of the bit representation of the numerical value is an n-bit unit and the first m bits of the data representing the numerical value is the number of significant digits, the numerical value can be expressed by 2 m ⁇ 1 digits in 2n base numbers. For example, let us consider a case in which a numerical value is expressed using a 3-bit unit (octal number) as the bit representation unit of the numerical value and the first 3 bits of the data representing the numerical value as the number of significant digits.
  • Numerical values from 0 to 7 can be expressed by one octal digit. Therefore, the numerical value of 0 to 7 has a code length of data representing the numerical value of 6 bits in total, that is, the first 3 bits (001) with the number of significant digits being 1 digit and 3 bits of the numerical value part. On the other hand, when the number of significant digits is 7 digits, a 7-digit numerical value can be expressed in octal. For a 7-digit numeric value in octal, the code length of the data representing the numeric value is 24 bits in total, including the first 3 bits (111) with the number of significant digits being 7 digits and the 21 bits of the numeric value portion.
  • numerical values tend to be inversely proportional to the size of the numerical value.
  • the appearance frequency of single-digit numerical values such as “1” is high, and the appearance frequency decreases as the number of numerical values increases. For this reason, if a small numerical value can be expressed by a short code length, data can be compressed small.
  • an object is to provide an encoding program, an encoding method, an encoding device, a decoding program, a decoding method, and a decoding device that can compress data at a high compression rate.
  • the encoding program causes the computer to encode the numerical value to be encoded into a numerical code of 2 n- ary number representation (n is a natural number of 1 or more) and to convert the numerical value to be encoded into 2 n.
  • Code data to which an instantaneous code indicating the number of digits when expressed in decimal is added is generated.
  • FIG. 1 is a diagram schematically showing the flow of encoding numerical values.
  • FIG. 2 is a diagram schematically showing a flow of decoding numerical values.
  • FIG. 3 is a diagram illustrating an example of the configuration of the encoding / decoding device according to the first embodiment.
  • FIG. 4A is a diagram illustrating an example in which a numerical value is encoded in octal representation by the encoding method of the present embodiment.
  • FIG. 4B is a diagram illustrating an example in which a numerical value is encoded by a variable-length bit representation of the related art.
  • FIG. 5 is a diagram schematically showing changes in the appearance frequency of numerical values.
  • FIG. 6 is a diagram illustrating an example of a Huffman tree used for determination of instantaneous codes.
  • FIG. 7 is a diagram illustrating an example of a Huffman tree used for instantaneous code determination.
  • FIG. 8A is a flowchart illustrating an example of the procedure of the encoding process according to the first embodiment.
  • FIG. 8B is a flowchart illustrating an example of the procedure of the decoding process according to the first embodiment.
  • FIG. 9 is a diagram illustrating an example of the configuration of the encoding / decoding device according to the second embodiment.
  • FIG. 10 is a diagram illustrating an example of a Huffman tree used for determination of instantaneous codes.
  • FIG. 11A is a flowchart illustrating an example of the procedure of the encoding process according to the second embodiment.
  • FIG. 11B is a flowchart illustrating an exemplary procedure of a decoding process according to the second embodiment.
  • FIG. 12 is a diagram illustrating an example in which a numerical value is encoded in a quaternary number expression by the encoding method of the present embodiment.
  • FIG. 13 is a diagram illustrating an example in which numerical values are encoded in hexadecimal notation by the encoding method of the present embodiment.
  • FIG. 14 is a diagram illustrating an example of a computer that executes an encoding program.
  • FIG. 15 is a diagram illustrating an example of a computer that executes a decryption program.
  • FIG. 1 is a diagram schematically showing the flow of encoding numerical values.
  • the target file 30 includes a plurality of numerical data.
  • the target file 30 is delimited by a predetermined delimiter and stores a plurality of numerical data.
  • the encoding / decoding device 10 encodes “..., 1, 7, 4096,...” Included in the target file 30 that is the target of compression processing. explain.
  • the numerical values stored in the target file 30 are shown in decimal notation.
  • numerical values “1”, “7”, and “4096” are delimited and stored by a delimiter “,” (comma).
  • the target file 30 shown in FIG. 1 is an example, and the present invention is not limited to this.
  • the encoding unit 40 of the encoding / decoding device 10 sequentially reads numerical values from the target file 30 (FIG. 1 (1)). In the example of FIG. 1, the numerical values “1”, “7”, and “4096” are sequentially read out.
  • the encoding unit 40 converts each read numerical value into a code (FIG. 1 (2)).
  • the encoding unit 40 encodes a numerical value into an octal-represented numerical code in which the unit of the bit representation of the numerical value is a 3-bit unit, and an instantaneous code indicating the number of digits when the numerical value is expressed in octal Convert to added code data.
  • the encoding unit 40 converts a decimal number into an octal number. In the example of FIG.
  • the decimal number “1” is the octal number “1”.
  • the decimal number “7” is the octal number “7”.
  • the decimal number “4096” is the octal number “10000”.
  • the decimal numbers “1” and “7” are one digit even in octal.
  • the decimal number “4096” is five digits in octal.
  • the encoding unit 40 encodes an octal numerical value into bits. For example, the encoding unit 40 encodes the value of each digit of the octal numerical value into 3 bits. In the example of FIG. 1, the octal value “1” is “001”.
  • the octal number “7” is “111”.
  • the octal value “10000” is “001000000000000”.
  • the encoding unit 40 adds an instantaneous code indicating the number of digits in octal to the beginning of the numerical code obtained by encoding the numerical value.
  • the instantaneous code is associated with the number of digits from the first bit to each bit in the order of the number of digits.
  • the instantaneous code is the number of bits corresponding to the number of digits in the octal number, “0” is set to the bit corresponding to the number of digits of the number, and “1” is set to the bit not corresponding to the number of digits of the number.
  • the instantaneous code can identify the number of digits at the timing when “0” appears by counting the number of bits until “0” appears in order from the first bit. For example, in FIG. 1, the decimal numbers “1” and “7” are octal and 1 digit, so the instantaneous code is “0”. On the other hand, since the decimal number “4096” is octal and 5 digits, the instantaneous code is “11110”. In the instantaneous code, the value of the bit is discriminated from the head, and the number of digits can be identified from the number of bits where “0” appears. For example, when “0” appears in the first bit, it can be identified that the numerical value is one digit.
  • the encoding unit 40 adds an instantaneous code of the numerical value before the numerical code obtained by encoding the numerical value.
  • the decimal value “1” is encoded as “0001” by adding an instantaneous code “0” before “001”.
  • the decimal number “7” is encoded as “0111” by adding an instantaneous code “0” before “111”.
  • the decimal number “4096” is encoded as “11110001000000000” by adding the instantaneous code “11110” before “001000000000000”.
  • the decimal number “1” or “7” is encoded into a total of 4 bits, 1 bit of the instantaneous code and 3 bits of the numerical part.
  • the decimal value “4096” is encoded into a total of 20 bits, 5 bits of the instantaneous code and 15 bits of the numerical value part.
  • the encoding unit 40 outputs code data to which an instantaneous code is added before a numerical code obtained by encoding an octal numerical value (FIG. 1 (3)).
  • the encoding unit 40 stores each encoded data in the encoded file 31.
  • the encoding unit 40 can compress a small numerical value into a code with a short code length.
  • the encoding part 40 can compress data with a high compression rate.
  • FIG. 2 is a diagram schematically showing a flow of decoding numerical values.
  • the decoding unit 50 of the encoding / decoding device 10 sequentially reads numerical code data from the encoding file 31 (FIG. 2 (1)). In the example of FIG. 2, “0001”, “0111”, and “11110001000000000” encoded in FIG. 1 are read out.
  • the decoding unit 50 decodes each read code data ((2) in FIG. 2).
  • the decoding unit 50 identifies the number of digits of the instantaneous code by counting the number of bits until “0” appears in order from the first bit of each read code data.
  • “0001” is identified as one digit because the first bit is “0”.
  • “0111” is also identified as one digit because the first bit is “0”.
  • “11110001000000000000000” is identified as five digits because the fifth bit from the top is “0”.
  • the decoding unit 50 separates the instantaneous code from the code data, extracts the code of the numerical part, and decodes the code of the numerical part into a numerical value in bit units according to the number of digits identified from the instantaneous code.
  • FIG. 1 is identified as one digit because the first bit is “0”.
  • “0111” is also identified as one digit because the first bit is “0”.
  • “111100010000000000000000000” is identified as five digits because the fifth bit from the top is “0”.
  • the decoding unit 50 separate
  • the code “001” in the numerical part is separated from “0001” except for the initial instantaneous code “0”, and is decoded into an octal number “1” or a decimal number “1”. Is done.
  • the code “111” in the numerical part is separated from “0111” except for the initial instantaneous code “0”, and is decoded into an octal number “7” or a decimal number “7”.
  • the code “00110000000000” in the numerical part is separated except for the initial instantaneous code “11110”, and is decoded into an octal number “10000” and a decimal number “4096”. In this manner, the decoding unit 50 can restore the code data encoded to a short code length to the original numerical value.
  • FIG. 3 is a diagram illustrating an example of the configuration of the encoding / decoding device according to the first embodiment.
  • the encoding / decoding device 10 is a device that performs encoding such as compression of the target file 30 and decoding of the compressed data.
  • the encoding / decoding device 10 is, for example, a computer such as a personal computer or a server computer, or an information processing device such as a tablet terminal or a smartphone.
  • the encoding / decoding device 10 may be implemented as a single computer or as a cloud of a plurality of computers.
  • the encoding / decoding device 10 includes a storage unit 20 and a control unit 21.
  • the encoding / decoding device 10 may include devices other than the devices included in the computer or the information processing device.
  • the storage unit 20 is a storage device such as a hard disk, an SSD (Solid State Drive), or an optical disk.
  • the storage unit 20 may be a semiconductor memory capable of rewriting data such as RAM (Random Access Memory), flash memory, NVSRAM (Non Volatile Static Random Access Memory).
  • the storage unit 20 stores an OS (Operating System) executed by the control unit 21 and various programs.
  • the storage unit 20 stores a program for performing a compression process described later.
  • the storage unit 20 stores various data used in a program executed by the control unit 21.
  • the storage unit 20 stores the target file 30 and the encoded file 31.
  • the target file 30 is a file in which a numerical value to be encoded is stored.
  • the encoded file 31 is data obtained by encoding the numerical value of the target file 30.
  • the control unit 21 is a device that controls the encoding / decoding device 10.
  • an electronic circuit such as a CPU (Central Processing Unit) or MPU (Micro Processing Unit), or an integrated circuit such as an ASIC (Application Specific Integrated Circuit) or FPGA (Field Programmable Gate Array) can be adopted.
  • the control unit 21 has an internal memory for storing programs defining various processing procedures and control data, and executes various processes using these.
  • the control unit 21 functions as various processing units by operating various programs.
  • the control unit 21 includes an encoding unit 40 and a decoding unit 50.
  • the encoding unit 40 extracts a numerical value from the target file 30, and generates an encoded file 31 in which the numerical value is encoded in the extracted numerical unit.
  • the encoding unit 40 includes an extraction unit 41, a generation unit 42, and an output unit 43.
  • the extraction unit 41 extracts the numerical value of the target file 30.
  • the extraction unit 41 reads data from the target file 30 and extracts numerical values from the read data.
  • the generating unit 42 generates code data corresponding to each numerical value extracted by the extracting unit 41. For example, the generation unit 42 encodes the extracted numerical value into an octal-represented numerical code, and also generates code data to which an instantaneous code indicating the number of digits when the numerical value is expressed in octal is added. For example, the generation unit 42 converts the extracted numerical value into an octal numerical value. The generation unit 42 encodes the value of each digit of the octal number into 3 bits. The generating unit 42 generates code data by adding an instantaneous code indicating the number of digits of an octal number to the beginning of a numeric code obtained by encoding an octal number.
  • the output unit 43 outputs the code data generated by the generation unit 42.
  • the output unit 43 outputs the code data generated by the generation unit 42 to the encoding file 31 and stores it corresponding to each numerical value extracted by the extraction unit 41.
  • the decoding unit 50 decodes the encoded file 31.
  • the decryption unit 50 includes an identification unit 51 and a decryption unit 52.
  • the identification unit 51 reads the code data stored in the encoded file 31 in order.
  • the identification unit 51 identifies the number of digits of the instantaneous code by counting the number of bits until “0” appears in order from the first bit of each read code data. By identifying the number of digits of the instantaneous code in this way, the identification unit 51 can identify the number of digits without confirming subsequent bits at the timing when “0” appears.
  • the decoding unit 52 restores the numerical value of each code data read from the encoded file 31. For example, the decoding unit 52 separates the instantaneous code from the code data and extracts the code of the numerical value part. And the decoding part 52 decodes the code
  • data types such as an integer type in the format for storing numerical values in the storage area.
  • a data type is defined for a numerical value and stored in a storage area such as a memory
  • an area having a size corresponding to the data type is secured in the storage area.
  • a numerical value “1” is stored in a 32-bit integer type
  • a 32-bit storage area is used for each numerical value.
  • a data type is defined for a numerical value
  • only a numerical value in a range corresponding to the data type can be stored.
  • an unsigned 32-bit integer type can only store numerical values in the range of 0 to 4294967295.
  • the numerical value When a numerical value larger than the range of the 32-bit integer type is stored, the numerical value is stored in an integer type having a larger number of bits, and a larger storage area is used for each numerical value.
  • numerical values tend to appear inversely proportional to the magnitude of the numerical value.
  • the storage area used for the numerical value becomes uselessly large. For example, since one of a plurality of numerical values does not fall within the 32-bit integer type range, if the numerical value is a 64-bit integer type, a 64-bit area is secured for each numerical value. The size of the storage area to be secured becomes unnecessarily large.
  • a small numerical value can be encoded into a short code, and the data size can be compressed.
  • decimal numbers “1” to “7” can be stored in 4 bits.
  • the number of digits can be changed by an instantaneous code. For this reason, the numerical value is converted into a code having a code length corresponding to the size of the numerical value. That is, in the encoding method of the present embodiment, a small numerical value is converted into a code with a short code length, and a larger numerical value is converted into a code with a long code length.
  • the encoding method of the present embodiment it is possible to prevent the size of the storage area reserved for numerical values from becoming unnecessarily large. Furthermore, in the encoding method of the present embodiment, there is no upper limit to the number of digits that can be expressed by an instantaneous code. Therefore, in the encoding method of the present embodiment, there is no upper limit to the numerical values that can be encoded. That is, any large numerical value can be encoded and stored.
  • FIG. 4A is a diagram illustrating an example in which a numerical value is encoded in octal representation by the encoding method of the present embodiment.
  • a numerical value is encoded into a numerical code in octal representation in which the unit of bit representation of the numerical value is 3 bits, and an instantaneous code indicating the number of digits when the numerical value is represented in octal is added.
  • the converted code is shown.
  • an octal single digit value is encoded into 4 bits.
  • an octal value “7” is encoded into a total of 4 bits, an instantaneous code “0” and a code “111” in the numerical value part.
  • An octal 2-digit number is encoded into 8 bits.
  • an octal value “77” is encoded into a total of 8 bits, an instantaneous code “10” and a value part code “111111”.
  • An octal 3-digit number is encoded into 12 bits.
  • an octal number “777” is encoded into a total of 12 bits including an instantaneous code “110” and a code “111111111” of the numerical part.
  • An octal 4-digit number is encoded into 16 bits.
  • an octal value “7777” is encoded into a total of 16 bits, an instantaneous code “1110” and a value part code “111111111111”.
  • An octal 5-digit number is encoded into 20 bits.
  • an octal value “77777” is encoded into a total of 20 bits of an instantaneous code “11110” and a code “111111111111111” of the numerical value part.
  • An octal 6-digit number is encoded into 24 bits.
  • an octal value “777777” is encoded into a total of 24 bits including an instantaneous code “111110” and a code “111111111111111111” of the value part.
  • An octal 7 digit number is encoded to 28 bits. For example, an octal value “77777777” is encoded into a total of 28 bits including an instantaneous code “1111110” and a value part code “111111111111111111”.
  • FIG. 4B is a diagram illustrating an example in which a numerical value is encoded by a variable-length bit representation of the prior art.
  • the example of FIG. 4B shows a code obtained by encoding a numerical value into a numerical code expressed in octal, with the first 3 bits as the number of significant digits.
  • an octal one-digit number is encoded into 6 bits.
  • an octal number “7” is encoded into a total of 6 bits, ie, the first 3 bits “001” indicating that the number of significant digits is 1 and the code “111” of the numerical value part.
  • An octal 2-digit number is encoded into 9 bits.
  • an octal value “77” is encoded into a total of 9 bits including the first 3 bits “010” indicating that the number of significant digits is 2 and the code “111111” of the value part.
  • An octal 3-digit number is encoded into 12 bits.
  • an octal value “777” is encoded into a total of 12 bits, ie, the first 3 bits “011” indicating that the number of significant digits is 3 and the code “111111111” of the value part.
  • An octal 4-digit number is encoded into 15 bits.
  • an octal value “7777” is encoded into a total of 15 bits, ie, the first 3 bits “100” indicating that the number of significant digits is 3 and the code “111111111111” of the value part.
  • An octal 5-digit number is encoded into 18 bits.
  • the octal value “77777” is encoded into a total of 18 bits including the first 3 bits “101” indicating that the number of significant digits is 3 and the code “111111111111” of the value part.
  • An octal 6-digit number is encoded to 21 bits.
  • an octal value “777777” is encoded into a total of 21 bits including the first 3 bits “110” indicating that the number of significant digits is 3 and the code “111111111111111” of the value part.
  • a 7-digit number in octal is encoded into 24 bits.
  • an octal number “77777777” is encoded into a total of 24 bits including the first 3 bits “111” indicating that the number of significant digits is 3 and the code “111111111111111111” of the value part.
  • the encoding method of the present embodiment is shorter than the encoding method of the prior art when the number of significant digits in the octal number is 1 or 2 digits.
  • the encoding method of the present embodiment is longer in code than the conventional encoding method when the number of significant digits in the octal number is 4 or more.
  • FIG. 5 is a diagram schematically showing changes in the appearance frequency of numerical values.
  • the appearance frequency of single-digit numerical values such as “1” is high, and the appearance frequency decreases as the number of numerical digits increases.
  • the compression rate increases. Therefore, by converting a small numerical value having a high appearance frequency into a short code by the encoding method of the present embodiment, the data can be compressed as a whole.
  • FIG. 6 is a diagram illustrating an example of a Huffman tree used for determination of instantaneous codes. According to the Huffman tree shown in FIG.
  • the value of each bit is determined in order from the first bit of the instantaneous code to determine the number of digits. For example, when the first bit of the instantaneous code is “0”, in the Huffman tree, the first leaf is reached, so the number of digits is determined as one digit. When the first bit of the instantaneous code is “1”, the Huffman tree reaches the first clause and determines whether the first bit is “0” or “1”. When the second bit of the instantaneous code is “0”, the Huffman tree reaches the second leaf, and the number of digits is determined to be two digits.
  • the number of digits can be determined by determining that the bit corresponding to the number of digits of the numerical value is “1” and the bit not corresponding to the number of digits of the numerical value is “0” in the specific number of bits.
  • FIG. 7 is a diagram illustrating an example of a Huffman tree used for instantaneous code determination.
  • the example of FIG. 7 shows a case where the upper limit of the number of digits that can be expressed is 7 digits.
  • the sixth bit from the top is “0”, and when the number of digits is 7 digits, the sixth bit from the top is “1”. Bits can represent up to 7 digits.
  • an upper limit is set for the number of digits that can be expressed in the instantaneous code, and the upper limit digit number is associated with the upper limit digit number minus 1 digit and the upper limit digit number in correspondence with the upper limit digit number of the instantaneous code minus the first bit. Can be shortened by 1 bit.
  • FIG. 8A is a flowchart illustrating an example of the procedure of the encoding process according to the first embodiment. This encoding process is executed at a predetermined timing, for example, a timing when a predetermined operation for designating the target file 30 and instructing the start of encoding is performed.
  • the extraction unit 41 reads data from the target file 30, and extracts a numerical value from the read data (S10).
  • the generation unit 42 generates code data corresponding to the extracted numerical value (S11). For example, the generation unit 42 encodes the extracted numerical value into a numerical code expressed in octal, and generates code data to which an instantaneous code indicating the number of digits when the numerical value is expressed in octal is added.
  • the output unit 43 outputs the generated code data (S12). For example, the output unit 43 outputs the code data generated corresponding to the numerical value to the encoding file 31 and stores it.
  • the extraction unit 41 determines whether reading of all data from the target file 30 is completed (S13). When the reading is not completed (No at S13), the process proceeds to S10 described above.
  • FIG. 8B is a flowchart illustrating an example of the procedure of the decoding process according to the first embodiment. This decoding process is executed at a predetermined timing, for example, a timing at which a predetermined operation for designating the encoding file 31 and instructing the start of decoding is performed.
  • the identification unit 51 reads the code data stored in the encoded file 31 (S30).
  • the identification unit 51 counts the number of bits of the read code data until “0” appears in order from the first bit, and identifies the number of digits of the instantaneous code (S31).
  • the decoding unit 52 separates the instantaneous code from the code data, and decodes the code of the separated numerical part into a numerical value in units of 3 bits according to the identified number of digits (S32).
  • the identification unit 51 determines whether or not reading of all data from the encoded file 31 is completed (S33). When the reading is not completed (No at S33), the process proceeds to S30 described above.
  • the encoding / decoding device 10 encodes a numerical value to be encoded into a numerical code in octal representation and expresses a numerical value to be encoded in octal number. Code data to which an instantaneous code indicating the number of digits is added is generated. Accordingly, the encoding / decoding device 10 can compress a small numerical value into a code having a short code length. Thereby, the encoding / decoding device 10 can compress data at a high compression rate.
  • the encoding / decoding device 10 associates the number of digits from the first bit to each bit in the order of the number of digits, and calculates the number of digits when the numerical value to be encoded is expressed in octal. Code data to which the indicated instantaneous code is added is generated. Thereby, the encoding / decoding device 10 can generate an instantaneous code with a short code length for a numerical value with a small number of digits in octal representation.
  • the encoding / decoding device 10 identifies the number of digits in octal representation from the instantaneous code of the code data.
  • the encoding / decoding device 10 decodes the numerical code of the code data into a numerical value in units of 3 bits according to the identified number of digits. Thereby, the encoding / decoding device 10 can restore the numerical value encoded as the code data.
  • FIG. 9 is a diagram illustrating an example of the configuration of the encoding / decoding device according to the second embodiment. Note that portions that are the same as those of the encoding / decoding device 10 according to the first embodiment are denoted by the same reference numerals, and different portions are mainly described.
  • the encoding unit 40 further includes a calculation unit 44.
  • the calculation unit 44 calculates the appearance frequency for each number of digits in which the numerical values included in the target file 30 are expressed in octal numbers. For example, the calculation unit 44 converts each numerical value extracted by the extraction unit 41 into an octal number expression, and counts the number of appearances for each number of digits in the octal number. For example, when the target file 30 includes 100 one-digit numerical values in octal representation and 1000 two-digit numerical values in octal representation, the calculation unit 44 sets the number of occurrences of one-digit numerical values to 100 times, The number of occurrences of a 2-digit number is counted as 1000 times.
  • the generating unit 42 encodes the numerical value extracted by the extracting unit 41 into a numerical code expressed in octal. Further, the generation unit 42 indicates the number of digits when the encoding target numerical value is expressed in octal with the number of digits being associated with the first bit in the order of the number of frequently occurring digits calculated by the calculation unit 44. Code data to which the instantaneous code is added is generated. For example, when the number of occurrences of a single-digit numerical value is 100 times and the appearance number of a two-digit numerical value is 1000 times, the generating unit 42 sets the instantaneous code to “0” for two digits and instantaneously for one digit. Code data is generated with a code of “10”.
  • a 2-digit numerical value in octal is encoded into a total of 7 bits including 1 bit of the instantaneous code and 6 bits of the numerical value part.
  • a numerical value of one digit in octal is encoded into a total of 5 bits including 2 bits of the instantaneous code and 3 bits of the numerical value part.
  • the compression rate becomes high. Therefore, by representing the number of digits having a high appearance frequency with a short instantaneous code by the coding method of the present embodiment, the data can be compressed as a whole as a whole.
  • the generation unit 42 generates digit number information indicating the correspondence between each bit of the instantaneous code and the number of digits. For example, the generation unit 42 generates information on the Huffman tree used for determination of the instantaneous code as the digit number information.
  • FIG. 10 is a diagram illustrating an example of a Huffman tree used for determination of instantaneous codes. In the example of FIG. 10, when the first bit of the instantaneous code is “0”, the number of digits is determined to be two digits, and when the first bit of the instantaneous code is “1” and the second bit is “0”, The number of digits is determined to be 1 digit.
  • the output unit 43 outputs the code data generated by the generation unit 42 to the encoding file 31 and stores it corresponding to each numerical value extracted by the extraction unit 41.
  • the output unit 43 outputs the digit number information generated by the generation unit 42 to the encoded file 31 and stores it. For example, the output unit 43 stores the digit number information in the header or footer of the encoded file 31.
  • the number of digits is identified from the instantaneous code based on the number of digits information.
  • the identification unit 51 of the decoding unit 50 identifies the number of digits of the instantaneous code according to the Huffman tree shown in FIG. 10 generated from the number of digits information of the encoded file 31.
  • FIG. 11A is a flowchart illustrating an example of the procedure of the encoding process according to the second embodiment. This encoding process is executed at a predetermined timing, for example, a timing when a predetermined operation for designating the target file 30 and instructing the start of encoding is performed.
  • the extraction unit 41 reads data from the target file 30 and extracts numerical values from the read data (S50).
  • the calculation unit 44 converts each numerical value extracted by the extraction unit 41 into an octal number expression, and counts the number of appearances for each number of digits in the octal number (S51).
  • the extraction unit 41 determines whether all data has been read from the target file 30 (S52). When the reading is not completed (No at S52), the process proceeds to S50 described above.
  • the extraction unit 41 reads the data again from the target file 30, and extracts a numerical value from the read data (S53).
  • the generation unit 42 encodes the extracted numerical value into a numerical code expressed in octal (S54).
  • the generating unit 42 associates the number of digits from the first bit in the order of the number of frequently occurring digits calculated by the calculating unit 44, and indicates the number of digits when the encoding target numerical value is expressed in octal.
  • a code is generated (S55). Then, the generation unit 42 generates code data to which an instantaneous code is added before the code of the encoded numerical value (S56).
  • the output unit 43 outputs the generated code data (S57). For example, the output unit 43 outputs the code data generated corresponding to the numerical value to the encoding file 31 and stores it.
  • the extraction unit 41 determines whether reading of all data from the target file 30 is completed (S58). If the reading has not been completed (No at S58), the process proceeds to S53 described above.
  • the output unit 43 stores the number-of-digits information in the encoded file 31 and ends the process.
  • FIG. 11B is a flowchart illustrating an exemplary procedure of a decoding process according to the second embodiment. This decoding process is executed at a predetermined timing, for example, a timing at which a predetermined operation for designating the encoding file 31 and instructing the start of decoding is performed.
  • the identification unit 51 reads out the number-of-digits information stored in the encoded file 31 (S80).
  • the identification unit 51 reads the code data from the encoded file 31 (S81).
  • the identification unit 51 counts the number of bits until “0” appears in order from the first bit of the read code data, and identifies the number of digits of the instantaneous code based on the number of digits information (S82).
  • the decoding unit 52 separates the instantaneous code from the code data, and decodes the separated numerical value part into a numerical value in units of 3 bits according to the identified number of digits (S83).
  • the identification unit 51 determines whether reading of all data from the encoded file 31 is completed (S84). When the reading is not completed (No at S84), the process proceeds to S81 described above.
  • the encoding / decoding device 10 calculates the appearance frequency for each number of digits in which a plurality of encoding target numerical values are expressed in octal numbers.
  • the encoding / decoding device 10 associates the number of digits from the first bit in the order of the calculated number of frequently occurring digits, and indicates the number of digits when the numerical value to be encoded is expressed in octal. Code data with a code added is generated.
  • the encoding / decoding device 10 can shorten the instantaneous code of a numerical value with a large number of appearance frequencies when expressed in octal, and can compress it to a code with a short code length. Thereby, the encoding / decoding device 10 can compress data at a higher compression rate.
  • FIG. 12 is a diagram illustrating an example in which a numerical value is encoded in a quaternary number expression by the encoding method of the present embodiment. As shown in FIG. 12, a numerical value of one digit in a quaternary number is encoded into 3 bits.
  • a quaternary numerical value “3” is encoded into a total of 3 bits including an instantaneous code “0” and a numerical value part code “11”.
  • a 4-digit numerical value in quaternary format is encoded into 6 bits.
  • a quaternary numerical value “33” is encoded into a total of 6 bits including an instantaneous code “10” and a numerical value part code “1111”.
  • FIG. 13 is a diagram illustrating an example in which numerical values are encoded in hexadecimal notation by the encoding method of the present embodiment.
  • a 1-digit numerical value in hexadecimal is encoded into 5 bits.
  • a hexadecimal value “F” is encoded into a total of 5 bits including an instantaneous code “0” and a code “1111” of the numerical value part.
  • Hexadecimal 2-digit numbers are encoded into 10 bits.
  • a hexadecimal numerical value “AA” is encoded into a total of 10 bits of an instantaneous code “10” and a numerical value part code “11111111”. If a large number of decimal numbers “1” to “15” appears in the target file 30, the data can be compressed to a small size by encoding with hexadecimal representation.
  • the encoding / decoding device 10 may determine the appearance frequency for each numerical value to be encoded, obtain n in 2n- ary representation so that the data becomes smaller in total, and compress the data.
  • the calculation unit 44 calculates the appearance frequency for each numerical value to be encoded.
  • the calculation unit 44 adds the code lengths of the numerical values in the case where each numerical value of the target file 30 is compressed in a 2n- ary number expression by changing n within a predetermined change range such as 1 to 5 in order from 1, for example. Are calculated respectively.
  • the calculation unit 44 multiplies the number of bits in which the numerical value is expressed in 2n- ary numbers and the appearance frequency to obtain the code length of the numerical value when each numerical value is compressed.
  • the calculation unit 44 adds up the code lengths of the numerical values when the numerical values are compressed to obtain the code lengths of all the numerical values.
  • the generation unit 42 may compress the 2n- ary number expression having the smallest sum. Thereby, the production
  • the encoding / decoding device 10 performs data encoding and data decoding.
  • data encoding and data decoding are performed by different devices.
  • the encoding / decoding device 10 is divided into an encoding device that includes an encoding unit 40 and performs encoding of data, and a decoding device that includes a decoding unit 50 and performs decoding of data. Also good.
  • each component of each illustrated apparatus is functionally conceptual and does not necessarily need to be physically configured as illustrated.
  • the specific state of distribution / integration of each device is not limited to the one shown in the figure, and all or a part thereof may be functionally or physically distributed or arbitrarily distributed in arbitrary units according to various loads or usage conditions.
  • each processing unit of the encoding unit 40 extraction unit 41, generation unit 42, output unit 43, calculation unit 44
  • the processing of each processing unit of the encoding / decoding device 10 may be appropriately separated into a plurality of processing units.
  • all or any part of each processing function performed in each processing unit can be realized by a CPU and a program analyzed and executed by the CPU, or can be realized as hardware by wired logic. .
  • FIG. 14 is a diagram illustrating an example of a computer that executes an encoding program.
  • the computer 400 includes a CPU (Central Processing Unit) 410, an HDD (Hard Disk Drive) 420, and a RAM (Random Access Memory) 440. These units 400 to 440 are connected via a bus 500.
  • CPU Central Processing Unit
  • HDD Hard Disk Drive
  • RAM Random Access Memory
  • the HDD 420 stores in advance an encoding program 420 a that performs the same functions as the extraction unit 41, the generation unit 42, the output unit 43, and the calculation unit 44. Note that the encoding program 420a may be separated as appropriate.
  • the HDD 420 stores various information.
  • the HDD 420 stores various data used for the OS and compression.
  • the CPU 410 reads out and executes the encoding program 420a from the HDD 420, thereby executing the same operation as each processing unit of the embodiment. That is, the encoding program 420a performs the same operations as the extraction unit 41, the generation unit 42, the output unit 43, and the calculation unit 44.
  • the encoding program 420a is not necessarily stored in the HDD 420 from the beginning.
  • FIG. 15 is a diagram illustrating an example of a computer that executes a decryption program. Note that the same portions as those in FIG. 14 are denoted by the same reference numerals, and description thereof is omitted.
  • the HDD 420 stores in advance a decryption program 420b that exhibits the same functions as those of the identification unit 51 and the decryption unit 52 described above. Note that the decryption program 420b may be separated as appropriate.
  • the HDD 420 stores various information.
  • the HDD 420 stores the OS and various data used for decryption.
  • the CPU 410 reads out and executes the decryption program 420b from the HDD 420, thereby executing the same operation as each processing unit of the embodiment. That is, the decryption program 420b performs the same operation as the identification unit 51 and the decryption unit 52.
  • decryption program 420b is not necessarily stored in the HDD 420 from the beginning.
  • the compression program 420a and the decryption program 420b are stored in a “portable physical medium” such as a flexible disk (FD), a CD-ROM, a DVD disk, a magneto-optical disk, an IC card or the like inserted into the computer 400. You may let them. Then, the computer 400 may read the program from these and execute it.
  • a “portable physical medium” such as a flexible disk (FD), a CD-ROM, a DVD disk, a magneto-optical disk, an IC card or the like inserted into the computer 400. You may let them. Then, the computer 400 may read the program from these and execute it.
  • the program is stored in “another computer (or server)” connected to the computer 400 via a public line, the Internet, a LAN, a WAN, or the like. Then, the computer 400 may read the program from these and execute it.
  • the program is stored in “another computer (or server)” connected to the computer 400 via a public line, the Internet, a LAN, a WAN, or the like. Then, the computer 400 may read the program from these and execute it.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

符号化・復号化装置(10)の符号化部(40)が有する生成部(42)は、符号化対象の数値を、8進数表現の数値符号に符号化すると共に、符号化対象の数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。

Description

符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置
 本発明は、符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置に関する。
 例えば、可変長のビット表現で数値を表す技術がある。可変長のビット表現で数値を表す場合、数値の大きさと有効桁数に応じて、数値を表すデータの符号長が決まる。例えば、数値のビット表現の単位をnビット単位とし、数値を表すデータの先頭mビットを有効桁数とした場合、2進数による2-1桁で数値を表すことができる。例えば、数値のビット表現の単位を3ビット単位(8進数)とし、数値を表すデータの先頭3ビットを有効桁数として、数値を表す場合を考える。0~7の数値は、8進数の1桁で表現できる。よって、0~7の数値は、数値を表すデータの符号長が、有効桁数を1桁とした先頭の3ビット(001)と数値部分の3ビットの合計6ビットになる。一方、有効桁数を7桁とした場合、8進数で7桁の数値を表現できる。8進数で7桁の数値は、数値を表すデータの符号長が、有効桁数を7桁とした先頭の3ビット(111)と、数値部分の21ビットの合計24ビットになる。
特開平7-273661号公報 特開昭63-269623号公報
 ところで、一般的に、数値は、文書等に出現する出現頻度が数値の大きさに反比例する傾向がある。例えば、数値は、「1」などの1桁の数値の出現頻度が高く、数値の桁数が大きくなるほど出現頻度が低くなる。このため、小さい数値を短い符号長で表現できると、データを小さく圧縮できる。
 しかしながら、上述した従来技術では、数値を圧縮したデータに有効桁数を表すmビットが付加されるため、小さい数値の符号長が長くなり、データを高い圧縮率で圧縮できない場合がある。
 一つの側面では、データを高い圧縮率で圧縮できる符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置を提供することを目的とする。
 第1の案では、符号化プログラムは、コンピュータに、符号化対象の数値を、2進数表現(nは1以上の自然数)の数値符号に符号化すると共に、符号化対象の数値を2進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。
 本発明の1実施態様によれば、データを高い圧縮率で圧縮できるという効果を奏する。
図1は、数値の符号化の流れを概略的に示した図である。 図2は、数値の復号化の流れを概略的に示した図である。 図3は、実施例1に係る符号化・復号化装置の構成の一例を示す図である。 図4Aは、本実施例の符号化の手法により数値を8進数表現で符号化した一例を示す図である。 図4Bは、従来技術の可変長のビット表現により数値を符号化した一例を示す図である。 図5は、数値の出現頻度の変化を概略的に示した図である。 図6は、瞬時符号の判定に用いるハフマン木の一例を示す図である。 図7は、瞬時符号の判定に用いるハフマン木の一例を示す図である。 図8Aは、実施例1に係る符号化処理の手順の一例を示すフローチャートである。 図8Bは、実施例1に係る復号化処理の手順の一例を示すフローチャートである。 図9は、実施例2に係る符号化・復号化装置の構成の一例を示す図である。 図10は、瞬時符号の判定に用いるハフマン木の一例を示す図である。 図11Aは、実施例2に係る符号化処理の手順の一例を示すフローチャートである。 図11Bは、実施例2に係る復号化処理の手順の一例を示すフローチャートである。 図12は、本実施例の符号化の手法により数値を4進数表現で符号化した一例を示す図である。 図13は、本実施例の符号化の手法により数値を16進数表現で符号化した一例を示す図である。 図14は、符号化プログラムを実行するコンピュータの一例を示す図である。 図15は、復号化プログラムを実行するコンピュータの一例を示す図である。
 以下に、本願の開示する符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置の実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの権利範囲が限定されるものではない。各実施例は、処理内容を矛盾させない範囲で適宜組み合わせることが可能である。
[符号化処理]
 最初に、図1を用いて、実施例1に係る符号化・復号化装置10が実施する数値の符号化処理の概要について説明する。図1は、数値の符号化の流れを概略的に示した図である。対象ファイル30は、複数の数値のデータが含まれている。例えば、対象ファイル30は、所定の区切り文字により区切られて複数の数値のデータが記憶されている。図1の例では、符号化・復号化装置10が、圧縮処理の対象である対象ファイル30に含まれる「・・・,1,7,4096,・・・」を符号化する場合を例に説明する。図1の例では、対象ファイル30に記憶された数値を10進数表記で示している。対象ファイル30には、区切り文字「,」(カンマ)により「1」、「7」、「4096」の数値が区切られて記憶されている。なお、図1に示した対象ファイル30は、一例であり、これに限定されるものではない。
 符号化・復号化装置10の符号化部40は、対象ファイル30から数値を順に読み出す(図1(1))。図1の例では、「1」、「7」、「4096」の数値をそれぞれ順に読み出す。符号化部40は、読み出した数値をそれぞれ符号に変換する(図1(2))。例えば、符号化部40は、数値のビット表現の単位を3ビット単位とした8進数表現の数値符号に数値を符号化すると共に、数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データに変換する。例えば、符号化部40は、10進数の数値を8進数の数値に変換する。図1の例では、10進数の数値「1」は、8進数で数値「1」となる。10進数の数値「7」は、8進数で数値「7」となる。10進数の数値「4096」は、8進数で数値「10000」となる。10進数の数値「1」、「7」は、8進数でも1桁となる。一方、10進数の数値「4096」は、8進数で5桁となる。符号化部40は、8進数の数値をビットに符号化する。例えば、符号化部40は、8進数の数値のそれぞれの桁の値を3ビットに符号化する。図1の例では、8進数の数値「1」は、「001」となる。8進数の数値「7」は、「111」となる。8進数の数値「10000」は、「001000000000000」となる。符号化部40は、数値を符号化した数値符号の先頭に、8進数での数値の桁数を示した瞬時符号を付加する。本実施例では、瞬時符号には、桁数の順に、先頭のビットから各ビットに桁数を対応付ける。瞬時符号は、8進数での数値の桁数分のビット数とされ、数値の桁数に対応したビットに「0」がセットされ、数値の桁数に対応しないビットに「1」がセットされる。これにより、瞬時符号は、先頭ビットから順に「0」が出現するまでのビット数をカウントすることにより、「0」が出現したタイミングで桁数を識別できる。例えば、図1では、10進数の数値「1」、「7」は、8進数で1桁であるため、瞬時符号が「0」とされている。一方、10進数の数値「4096」は、8進数で5桁であるため、瞬時符号が「11110」とされている。瞬時符号は、先頭からビットの値を判別し、「0」が出現したビット数から桁数を識別できる。例えば、1ビット目に「0」が出現した場合、数値が1桁であると識別できる。また、先頭から5ビット目に「0」が出現した場合、数値が5桁であると識別できる。符号化部40は、数値を符号化した数値符号の前に、当該数値の瞬時符号を付加する。図1の例では、10進数の数値「1」は、「001」の前に、瞬時符号「0」が付加されて「0001」と符号化される。10進数の数値「7」は、「111」の前に、瞬時符号「0」が付加されて「0111」と符号化される。10進数の数値「4096」は、「001000000000000」の前に、瞬時符号「11110」が付加されて「11110001000000000000」と符号化される。このように、10進数の数値「1」や「7」は、瞬時符号の1ビットと数値部分の3ビットの合計4ビットに符号化される。また、10進数の数値「4096」は、瞬時符号の5ビットと数値部分の15ビットの合計20ビットに符号化される。符号化部40は、8進数の数値を符号化した数値符号の前に、瞬時符号を付加した符号データを出力する(図1(3))。図1の例では、符号化部40は、それぞれの符号データを符号化ファイル31に格納する。このように、符号化部40は、小さい数値を短い符号長の符号に圧縮できる。これにより、符号化部40は、データを高い圧縮率で圧縮できる。
[復号化処理]
 次に、図2を用いて、実施例1に係る符号化・復号化装置10が実施する数値の復号化処理の概要について説明する。図2は、数値の復号化の流れを概略的に示した図である。符号化・復号化装置10の復号化部50は、符号化ファイル31から数値の符号データを順に読み出す(図2(1))。図2の例では、図1にて符号化された「0001」、「0111」、「11110001000000000000」をそれぞれ読み出す。復号化部50は、読み出した各符号データを復号化する(図2(2))。例えば、復号化部50は、読み出した各符号データをそれぞれ先頭のビットから順に「0」が出現するまでのビット数をカウントして、瞬時符号の桁数を識別する。図2の例では、「0001」は、先頭の1ビット目が「0」であることから1桁と識別される。「0111」も、先頭の1ビット目が「0」であることから1桁と識別される。「11110001000000000000」は、先頭から5ビット目が「0」であることから5桁と識別される。復号化部50は、符号データから瞬時符号を分離して数値部分の符号を抽出し、瞬時符号から識別した桁数に応じたビット単位で数値部分の符号を数値に復号化する。図2の例では、「0001」は、先頭の瞬時符号「0」を除いて数値部分の符号「001」が分離され、8進数の数値「1」や10進数の数値「1」に復号化される。「0111」は、先頭の瞬時符号「0」を除いて数値部分の符号「111」が分離され、8進数の数値「7」や10進数の数値「7」に復号化される。「11110001000000000000」は、先頭の瞬時符号「11110」を除いて数値部分の符号「001000000000000」が分離され、8進数の数値「10000」や10進数の数値「4096」に復号化される。このように、復号化部50は、短い符号長に符号化された符号データを元の数値に復元できる。
[装置構成]
 次に、符号化・復号化装置10の構成について説明する。図3は、実施例1に係る符号化・復号化装置の構成の一例を示す図である。符号化・復号化装置10は、対象ファイル30の圧縮などの符号化、および、圧縮されたデータの復号化を行う装置である。符号化・復号化装置10は、例えば、パーソナルコンピュータ、サーバコンピュータなどのコンピュータや、タブレット端末、スマートフォンなどの情報処理装置である。符号化・復号化装置10は、1台のコンピュータとして実装してもよく、また、複数台のコンピュータによるクラウドとして実装することもできる。なお、本実施例では、符号化・復号化装置10を1台のコンピュータとした場合を例として説明する。図3に示すように、符号化・復号化装置10は、記憶部20と、制御部21とを有する。なお、符号化・復号化装置10は、コンピュータや情報処理装置が有する上記の機器以外の他の機器を有してもよい。
 記憶部20は、ハードディスク、SSD(Solid State Drive)、光ディスクなどの記憶装置である。なお、記憶部20は、RAM(Random Access Memory)、フラッシュメモリ、NVSRAM(Non Volatile Static Random Access Memory)などのデータを書き換え可能な半導体メモリであってもよい。
 記憶部20は、制御部21で実行されるOS(Operating System)や各種プログラムを記憶する。例えば、記憶部20は、後述する圧縮処理を行うプログラムを記憶する。さらに、記憶部20は、制御部21で実行されるプログラムで用いられる各種データを記憶する。例えば、記憶部20は、対象ファイル30と、符号化ファイル31とを記憶する。
 対象ファイル30は、符号化対象の数値が記憶されたファイルである。符号化ファイル31は、対象ファイル30の数値を符号化処理したデータである。
 制御部21は、符号化・復号化装置10を制御するデバイスである。制御部21としては、CPU(Central Processing Unit)、MPU(Micro Processing Unit)等の電子回路や、ASIC(Application Specific Integrated Circuit)、FPGA(Field Programmable Gate Array)等の集積回路を採用できる。制御部21は、各種の処理手順を規定したプログラムや制御データを格納するための内部メモリを有し、これらによって種々の処理を実行する。制御部21は、各種のプログラムが動作することにより各種の処理部として機能する。例えば、制御部21は、符号化部40と、復号化部50とを有する。
 符号化部40は、対象ファイル30から数値を抽出し、抽出した数値単位に、数値を符号化した符号化ファイル31を生成する。符号化部40は、抽出部41と、生成部42と、出力部43とを有する。
 抽出部41は、対象ファイル30の数値の抽出を行う。例えば、抽出部41は、対象ファイル30からデータを読み出し、読み出したデータから数値を抽出する。
 生成部42は、抽出部41により抽出された各数値に対応した符号データを生成する。例えば、生成部42は、抽出された数値を8進数表現の数値符号に数値を符号化すると共に、数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。例えば、生成部42は、抽出された数値を8進数の数値に変換する。生成部42は、8進数の数値のそれぞれの桁の値を3ビットに符号化する。生成部42は、8進数の数値を符号化した数値符号の先頭に、8進数での数値の桁数を示した瞬時符号を付加して符号データを生成する。
 出力部43は、生成部42により生成された符号データを出力する。例えば、出力部43は、抽出部41により抽出された各数値に対応して、生成部42により生成された符号データを符号化ファイル31に出力して格納する。
 復号化部50は、符号化ファイル31の復号化を行う。復号化部50は、識別部51と、復号部52とを有する。
 識別部51は、符号化ファイル31に格納された符号データを順に読み出す。識別部51は、読み出した各符号データをそれぞれ先頭のビットから順に「0」が出現するまでのビット数をカウントして、瞬時符号の桁数を識別する。このように瞬時符号の桁数を識別することにより、識別部51は、「0」が出現したタイミングで以降のビットを確認することなく、桁数を識別できる。
 復号部52は、符号化ファイル31から読み出した各符号データの数値を復元する。例えば、復号部52は、符号データから瞬時符号を分離して数値部分の符号を抽出する。そして、復号部52は、瞬時符号から識別した桁数に応じて、数値部分の符号を3ビット単位で数値に復号化する。
 ここで、数値を記憶領域に記憶する形式には、整数型などのデータ型がある。例えば、数値に対してデータ型を定義してメモリなどの記憶領域に記憶させる場合、記憶領域には、データ型に応じたサイズの領域が確保される。例えば、32ビットの整数型で数値「1」を記憶させる場合、数値ごとに32ビットの記憶領域が使用される。また、数値に対してデータ型を定義する場合、データ型に対応した範囲の数値しか記憶できない。例えば、符号なしの32ビットの整数型では、0~4294967295の範囲の数値しか記憶できない。32ビットの整数型の範囲より大きい数値を記憶する場合、よりビット数の多い整数型で数値を記憶させることになり、数値ごとにより多くの記憶領域が使用される。一般的に、数値は、文書等に出現する出現頻度が数値の大きさに反比例する傾向がある。しかし、最大の数値に合わせて数値のデータ型を定めた場合、数値で使用される記憶領域が無駄に大きくなってしまう。例えば、複数出現する数値の1つの数値が32ビットの整数型の範囲に入らないため、数値を64ビットの整数型とした場合、数値ごとに64ビットの領域が確保されるため、数値用に確保される記憶領域のサイズが無駄に大きくなる。
 一方、本実施例の符号化の手法では、小さい数値を短い符号に符号化でき、データサイズを圧縮できる。図1の例では、10進数の数値「1」~「7」を4ビットで記憶できる。また、本実施例の符号化の手法では、瞬時符号により桁数を変えることができる。このため、数値は、数値の大きさに応じた符号長の符号に変換される。すなわち、本実施例の符号化の手法では、小さい数値が短い符号長の符号に変換され、大きい数値ほど長い符号長の符号に変換される。よって、本実施例の符号化の手法では、数値用に確保される記憶領域のサイズが無駄に大きくなることを抑制できる。さらに、本実施例の符号化の手法では、瞬時符号で表現できる桁数に上限が無い。よって、本実施例の符号化の手法では、符号化可能な数値に上限がない。すなわち、どのように大きい数値でも符号化して記憶できる。
 次に、本実施例の符号化の手法と、従来技術の可変長のビット表現で数値を符号化する場合を比較する。図4Aは、本実施例の符号化の手法により数値を8進数表現で符号化した一例を示す図である。図4Aの例は、数値のビット表現の単位を3ビット単位とした8進数表現の数値符号に数値を符号化し、数値を8進数表現した際の桁数を示した瞬時符号を付加して符号化した符号が示されている。図4Aの例は、8進数で1桁の数値は、4ビットに符号化される。例えば、8進数の数値「7」は、瞬時符号「0」と数値部分の符号「111」の合計4ビットに符号化される。8進数で2桁の数値は、8ビットに符号化される。例えば、8進数の数値「77」は、瞬時符号「10」と数値部分の符号「111111」の合計8ビットに符号化される。8進数で3桁の数値は、12ビットに符号化される。例えば、8進数の数値「777」は、瞬時符号「110」と数値部分の符号「111111111」の合計12ビットに符号化される。8進数で4桁の数値は、16ビットに符号化される。例えば、8進数の数値「7777」は、瞬時符号「1110」と数値部分の符号「111111111111」の合計16ビットに符号化される。8進数で5桁の数値は、20ビットに符号化される。例えば、8進数の数値「77777」は、瞬時符号「11110」と数値部分の符号「111111111111111」の合計20ビットに符号化される。8進数で6桁の数値は、24ビットに符号化される。例えば、8進数の数値「777777」は、瞬時符号「111110」と数値部分の符号「111111111111111111」の合計24ビットに符号化される。8進数で7桁の数値は、28ビットに符号化される。例えば、8進数の数値「7777777」は、瞬時符号「1111110」と数値部分の符号「111111111111111111111」の合計28ビットに符号化される。
 一方、図4Bは、従来技術の可変長のビット表現により数値を符号化した一例を示す図である。図4Bの例は、先頭3ビットを有効桁数として、8進数表現の数値符号に数値を符号化した符号が示されている。図4Bの例は、8進数で1桁の数値は、6ビットに符号化される。例えば、8進数の数値「7」は、有効桁数が1桁であることを示した先頭の3ビット「001」と数値部分の符号「111」の合計6ビットに符号化される。8進数で2桁の数値は、9ビットに符号化される。例えば、8進数の数値「77」は、有効桁数が2桁であることを示した先頭の3ビット「010」と数値部分の符号「111111」の合計9ビットに符号化される。8進数で3桁の数値は、12ビットに符号化される。例えば、8進数の数値「777」は、有効桁数が3桁であることを示した先頭の3ビット「011」と数値部分の符号「111111111」の合計12ビットに符号化される。8進数で4桁の数値は、15ビットに符号化される。例えば、8進数の数値「7777」は、有効桁数が3桁であることを示した先頭の3ビット「100」と数値部分の符号「111111111111」の合計15ビットに符号化される。8進数で5桁の数値は、18ビットに符号化される。例えば、8進数の数値「77777」は、有効桁数が3桁であることを示した先頭の3ビット「101」と数値部分の符号「111111111111111」の合計18ビットに符号化される。8進数で6桁の数値は、21ビットに符号化される。例えば、8進数の数値「777777」は、有効桁数が3桁であることを示した先頭の3ビット「110」と数値部分の符号「111111111111111111」の合計21ビットに符号化される。8進数で7桁の数値は、24ビットに符号化される。例えば、8進数の数値「7777777」は、有効桁数が3桁であることを示した先頭の3ビット「111」と数値部分の符号「111111111111111111111」の合計24ビットに符号化される。
 図4A、4Bに示すように、本実施例の符号化の手法は、8進数で数値の有効桁数1桁、2桁の場合、従来技術の符号化の手法よりも符号が短くなる。一方、本実施例の符号化の手法は、8進数で数値の有効桁数4桁以上の場合、従来技術の符号化の手法よりも符号が長くなる。
 ところで、一般的に、数値は、文書等に出現する出現頻度が数値の大きさに反比例する傾向がある。図5は、数値の出現頻度の変化を概略的に示した図である。図5に示すように、数値は、「1」などの1桁の数値の出現頻度が高く、数値の桁数が大きくなるほど出現頻度が低くなる。データの圧縮では、出現頻度の高いデータに短い符号を割当てると、圧縮率が高くなる。よって、本実施例の符号化の手法により、出現頻度の高い、小さい数値を短い符号に変換することにより、全体としてデータを小さく圧縮できる。
 なお、本実施例では、瞬時符号の各ビットについて、数値の桁数に対応したビットに「0」をセットし、数値の桁数に対応しないビットに「1」をセットする場合について説明したが、瞬時符号はこれに限定されるものではない。例えば、特定のビット数において、数値の桁数に対応したビットに「1」をセットし、数値の桁数に対応しないビットに「0」をセットしてもよい。図6は、瞬時符号の判定に用いるハフマン木の一例を示す図である。図6に示すハフマン木に従って、瞬時符号の先頭ビットから順に各ビットの値を判定して桁数を判定する。例えば、瞬時符号の1ビット目が「0」の場合、ハフマン木では、最初の葉に到達するため、桁数が1桁と判定される。瞬時符号の1ビット目が「1」の場合、ハフマン木では、最初の節に到達し、1ビット目が「0」であるか「1」であるかを判定する。瞬時符号の2ビット目が「0」の場合、ハフマン木では、2番目の葉に到達して、桁数が2桁と判定される。このハフマン木において、特定のビット数において、数値の桁数に対応したビットを「1」とし、数値の桁数に対応しないビットに「0」として判定を行うことにより、桁数を判別できる。
 また、瞬時符号は、表現可能な桁数に上限を設け、最上位のビットに2桁を対応付けてもよい。図7は、瞬時符号の判定に用いるハフマン木の一例を示す図である。図7の例は、表現可能な桁数の上限を7桁とした場合を示している。瞬時符号は、数値の桁数が6桁の場合、上位から6ビット目を「0」とし、数値の桁数が7桁の場合、上位から6ビット目を「1」とすることで、6ビットで7桁までを表すことができる。このように、瞬時符号に表現可能な桁数に上限を設け、瞬時符号の上限桁数-1番目のビットに、上限桁数-1桁と、上限桁数とを対応付けることにより、上限桁数に対応する瞬時符号を1ビット短くできる。
[処理の流れ]
 実施例1に係る符号化・復号化装置10が対象ファイル30を符号化して圧縮する符号化処理の流れについて説明する。図8Aは、実施例1に係る符号化処理の手順の一例を示すフローチャートである。この符号化処理は、所定のタイミング、例えば、対象ファイル30を指定して符号化開始を指示する所定操作が行われたタイミングで実行される。
 図8Aに示すように、抽出部41は、対象ファイル30からデータを読み出し、読み出したデータから数値を抽出する(S10)。生成部42は、抽出した数値に対応した符号データを生成する(S11)。例えば、生成部42は、抽出した数値を8進数表現の数値符号に符号化すると共に、数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。出力部43は、生成した符号データを出力する(S12)。例えば、出力部43は、数値に対応して生成された符号データを符号化ファイル31に出力して格納する。
 抽出部41は、対象ファイル30から全データの読み出しが完了したか否かを判定する(S13)。読み出しが完了していない場合(S13否定)、上述のS10へ移行する。
 一方、読み出しが完了した場合(S13肯定)、処理を終了する。
 次に、実施例1に係る符号化・復号化装置10が符号化ファイル31に記憶された符号データを復号化する復号化処理の流れについて説明する。図8Bは、実施例1に係る復号化処理の手順の一例を示すフローチャートである。この復号化処理は、所定のタイミング、例えば、符号化ファイル31を指定して復号化開始を指示する所定操作が行われたタイミングで実行される。
 図8Bに示すように、識別部51は、符号化ファイル31に格納された符号データを読み出す(S30)。識別部51は、読み出した符号データをそれぞれ先頭のビットから順に「0」が出現するまでのビット数をカウントして、瞬時符号の桁数を識別する(S31)。
 復号部52は、符号データから瞬時符号を分離し、分離した数値部分の符号を識別した桁数に応じて3ビット単位で数値に復号化する(S32)。
 識別部51は、符号化ファイル31から全データの読み出しが完了したか否かを判定する(S33)。読み出しが完了していない場合(S33否定)、上述のS30へ移行する。
 一方、読み出しが完了した場合(S33肯定)、処理を終了する。
[効果]
 上述してきたように、本実施例に係る符号化・復号化装置10は、符号化対象の数値を、8進数表現の数値符号に符号化すると共に、符号化対象の数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。これにより、符号化・復号化装置10は、小さい数値を短い符号長の符号に圧縮できる。これにより、符号化・復号化装置10は、データを高い圧縮率で圧縮できる。
 また、本実施例に係る符号化・復号化装置10は、桁数の順に、先頭のビットから各ビットに桁数が対応付けられ、符号化対象の数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。これにより、符号化・復号化装置10は、8進数表現で桁数の小さい数値に対して、短い符号長の瞬時符号を生成できる。
 また、本実施例に係る符号化・復号化装置10は、符号データの瞬時符号から8進数表現での桁数を識別する。符号化・復号化装置10は、識別した桁数に応じて、符号データの数値符号を3ビット単位で数値に復号化する。これにより、符号化・復号化装置10は、符号データとして符号化された数値を復元できる。
 次に、実施例2ついて説明する。図9は、実施例2に係る符号化・復号化装置の構成の一例を示す図である。なお、上述の実施例1に係る符号化・復号化装置10と同一の部分については、同一の符号を付して、主に異なる部分について説明する。
 符号化部40は、算出部44をさらに有する。算出部44は、対象ファイル30に含まれる数値をそれぞれ8進数表現した桁数ごとに出現頻度を算出する。例えば、算出部44は、抽出部41により抽出された各数値を8進数表現に変換して、8進数での数値の桁数ごとに、出現回数をカウントする。例えば、算出部44は、対象ファイル30に、8進数表現で1桁の数値が100個、8進数表現で2桁の数値が1000個含まれる場合、1桁の数値の出現回数を100回、2桁の数値の出現回数を1000回とカウントする。
 生成部42は、抽出部41により抽出された数値を8進数表現の数値符号に符号化する。また、生成部42は、算出部44により算出された出現頻度の多い桁数の順に、先頭のビットから桁数が対応付けられ、符号化対象の数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。例えば、1桁の数値の出現回数が100回、2桁の数値の出現回数が1000回の場合、生成部42は、2桁に対して瞬時符号を「0」とし、1桁に対して瞬時符号を「10」として符号データを生成する。これにより、例えば、8進数で2桁の数値は、瞬時符号の1ビットと数値部分の6ビットの合計7ビットに符号化される。また、8進数で1桁の数値は、瞬時符号の2ビットと数値部分の3ビットの合計5ビットに符号化される。
 このように、出現頻度の多い桁数に短い瞬時符号を割当てると、圧縮率が高くなる。よって、本実施例の符号化の手法により、出現頻度の高い桁数を短い瞬時符号で表すことにより、全体としてデータを小さく圧縮できる。
 生成部42は、瞬時符号の各ビットと桁数との対応を示した桁数情報を生成する。例えば、生成部42は、瞬時符号の判定に用いるハフマン木の情報を桁数情報として生成する。図10は、瞬時符号の判定に用いるハフマン木の一例を示す図である。図10の例では、瞬時符号の1ビット目が「0」の場合、桁数が2桁と判定され、瞬時符号の1ビット目が「1」で、2ビット目が「0」の場合、桁数が1桁と判定される。
 出力部43は、抽出部41により抽出された各数値に対応して、生成部42により生成された符号データを符号化ファイル31に出力して格納する。また、出力部43は、生成部42により生成された桁数情報を符号化ファイル31に出力して格納する。例えば、出力部43は、桁数情報を符号化ファイル31のヘッダやフッダに格納する。
 符号化ファイル31を復元する場合、桁数情報に基づいて、瞬時符号から桁数が識別される。例えば、復号化部50の識別部51は、符号化ファイル31の桁数情報から生成される図10に示すハフマン木に従い、瞬時符号の桁数を識別する。
[処理の流れ]
 次に、実施例2に係る符号化・復号化装置10が対象ファイル30を符号化して圧縮する符号化処理の流れについて説明する。図11Aは、実施例2に係る符号化処理の手順の一例を示すフローチャートである。この符号化処理は、所定のタイミング、例えば、対象ファイル30を指定して符号化開始を指示する所定操作が行われたタイミングで実行される。
 図11Aに示すように、抽出部41は、対象ファイル30からデータを読み出し、読み出したデータから数値を抽出する(S50)。算出部44は、抽出部41により抽出された各数値を8進数表現に変換して、8進数での数値の桁数ごとに、出現回数をカウントする(S51)。抽出部41は、対象ファイル30から全データの読み出しが完了したか否かを判定する(S52)。読み出しが完了していない場合(S52否定)、上述のS50へ移行する。
 一方、読み出しが完了した場合(S52肯定)、抽出部41は、対象ファイル30から再度データを読み出し、読み出したデータから数値を抽出する(S53)。生成部42は、抽出した数値を8進数表現の数値符号に符号化する(S54)。生成部42は、算出部44により算出された出現頻度の多い桁数の順に、先頭のビットから桁数が対応付けられ、符号化対象の数値を8進数表現した際の桁数を示した瞬時符号を生成する(S55)。そして、生成部42は、符号化した数値の符号の前に、瞬時符号を付加した符号データを生成する(S56)。
 出力部43は、生成した符号データを出力する(S57)。例えば、出力部43は、数値に対応して生成された符号データを符号化ファイル31に出力して格納する。
 抽出部41は、対象ファイル30から全データの読み出しが完了したか否かを判定する(S58)。読み出しが完了していない場合(S58否定)、上述のS53へ移行する。
 一方、読み出しが完了した場合(S58肯定)、出力部43は、桁数情報を符号化ファイル31に格納して、処理を終了する。
 次に、実施例2に係る符号化・復号化装置10が符号化ファイル31に記憶された符号データを復号化する復号化処理の流れについて説明する。図11Bは、実施例2に係る復号化処理の手順の一例を示すフローチャートである。この復号化処理は、所定のタイミング、例えば、符号化ファイル31を指定して復号化開始を指示する所定操作が行われたタイミングで実行される。
 図11Bに示すように、識別部51は、符号化ファイル31に格納された桁数情報を読み出す(S80)。識別部51は、符号化ファイル31から符号データを読み出す(S81)。識別部51は、読み出した符号データをそれぞれ先頭のビットから順に「0」が出現するまでのビット数をカウントし、桁数情報に基づき、瞬時符号の桁数を識別する(S82)。
 復号部52は、符号データから瞬時符号を分離し、分離した数値部分の符号を識別した桁数に応じて3ビット単位で数値に復号化する(S83)。
 識別部51は、符号化ファイル31から全データの読み出しが完了したか否かを判定する(S84)。読み出しが完了していない場合(S84否定)、上述のS81へ移行する。
 一方、読み出しが完了した場合(S84肯定)、処理を終了する。
[効果]
 上述してきたように、本実施例に係る符号化・復号化装置10は、複数の前記符号化対象の数値をそれぞれ8進数表現した桁数ごとに出現頻度を算出する。符号化・復号化装置10は、算出された出現頻度の多い桁数の順に、先頭のビットから桁数が対応付けられ、符号化対象の数値を8進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する。これにより、符号化・復号化装置10は、8進数表現した際の出現頻度の多い桁数の数値の瞬時符号を短くでき、短い符号長の符号に圧縮できる。これにより、符号化・復号化装置10は、データをより高い圧縮率で圧縮できる。
 さて、これまで開示の装置に関する実施例について説明したが、開示の技術は上述した実施例以外にも、種々の異なる形態にて実施されてよいものである。そこで、以下では、本発明に含まれる他の実施例を説明する。
 例えば、上記の実施例では、符号化対象の数値を、8(=2)進数表現の数値符号に符号化する場合について説明したが、これに限定されない。符号化対象の数値を、2進数表現(nは1以上の自然数)の何れの数値符号に符号化してもよい。例えば、符号化対象の数値を、4(=2)進数表現の数値符号に符号化してもよい。図12は、本実施例の符号化の手法により数値を4進数表現で符号化した一例を示す図である。図12に示すように、4進数で1桁の数値は、3ビットに符号化される。例えば、4進数の数値「3」は、瞬時符号「0」と数値部分の符号「11」の合計3ビットに符号化される。4進数で2桁の数値は、6ビットに符号化される。例えば、4進数の数値「33」は、瞬時符号「10」と数値部分の符号「1111」の合計6ビットに符号化される。対象ファイル30に10進数で「1」~「3」の数値が多く出現する場合は、4進数表現で符号化をすることにより、データを小さく圧縮できる。また、例えば、符号化対象の数値を、16(=2)進数表現の数値符号に符号化してもよい。図13は、本実施例の符号化の手法により数値を16進数表現で符号化した一例を示す図である。図13に示すように、16進数で1桁の数値は、5ビットに符号化される。例えば、16進数の数値「F」は、瞬時符号「0」と数値部分の符号「1111」の合計5ビットに符号化される。16進数で2桁の数値は、10ビットに符号化される。例えば、16進数の数値「AA」は、瞬時符号「10」と数値部分の符号「11111111」の合計10ビットに符号化される。対象ファイル30に10進数で「1」~「15」の数値が多く出現する場合は、16進数表現で符号化をすることにより、データを小さく圧縮できる。
 また、符号化・復号化装置10は、符号化対象の数値ごとの出現頻度を求め、データがトータルで小さくなるように2進数表現のnを求めて、データを圧縮してもよい。例えば、算出部44は、符号化対象の数値ごとの出現頻度を算出する。そして、算出部44は、nを1から順に、例えば、1~5など、所定の変更範囲で変えて2進数表現で、対象ファイル30の各数値を圧縮した場合の数値の符号長の合計をそれぞれ算出する。例えば、算出部44は、数値ごとに、数値を2進数表現したビット数に出現頻度を乗算して、各数値を圧縮した場合の数値の符号長を求める。そして、算出部44は、各数値を圧縮した場合の数値の符号長を合計して全数値の符号長を求める。生成部42は、合計が最も小さい2進数表現で圧縮してもよい。これにより、生成部42は、対象ファイル30をより小さく圧縮できる。この場合、符号化ファイル31には、使用した2進数表現のnを記録する。
 符号化ファイル31を復元する場合、復号化部50の復号部52は、符号化ファイル31からnの値に基づいて、nビット単位に数値部分の符号を数値に復号化する。例えば、復号化部50の復号部52は、n=2の場合、4進数表現として、2ビット単位に数値部分の符号を復元する。
 例えば、上記の実施例では、符号化・復号化装置10によりデータの符号化およびデータの復号化を行う場合について説明するが、データの符号化とデータの復号化は、別な装置で行ってもよい。例えば、符号化・復号化装置10は、符号化部40を有し、データの符号化を行う符号化装置と、復号化部50を有し、データの復号化を行う復号化装置に分けてもよい。
 また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的状態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。例えば、符号化・復号化装置10の符号化部40(抽出部41、生成部42、出力部43、算出部44)や、復号化部50(識別部51、復号部52)の各処理部が適宜統合されてもよい。また、符号化・復号化装置10の上記各処理部の処理が適宜複数の処理部の処理に分離されてもよい。さらに、各処理部にて行なわれる各処理機能は、その全部または任意の一部が、CPUおよび当該CPUにて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。
[符号化プログラム]
 また、上記の実施例で説明した各種の処理は、あらかじめ用意されたプログラムをパーソナルコンピュータやワークステーションなどのコンピュータシステムで実行することによって実現することもできる。そこで、以下では、上記の実施例と同様の機能を有するプログラムを実行するコンピュータシステムの一例を説明する。最初に、圧縮処理を行う符号化プログラムについて説明する。図14は、符号化プログラムを実行するコンピュータの一例を示す図である。
 図14に示すように、コンピュータ400は、CPU(Central Processing Unit)410、HDD(Hard Disk Drive)420、RAM(Random Access Memory)440を有する。これら400~440の各部は、バス500を介して接続される。
 HDD420には上記の抽出部41、生成部42、出力部43および算出部44と同様の機能を発揮する符号化プログラム420aが予め記憶される。尚、符号化プログラム420aについては、適宜分離しても良い。
 また、HDD420は、各種情報を記憶する。例えば、HDD420は、OSや圧縮に用いる各種データを記憶する。
 そして、CPU410が、符号化プログラム420aをHDD420から読み出して実行することで、実施例の各処理部と同様の動作を実行する。すなわち、符号化プログラム420aは、抽出部41、生成部42、出力部43および算出部44と同様の動作を実行する。
 尚、上記した符号化プログラム420aについては、必ずしも最初からHDD420に記憶させることを要しない。
[復号化プログラム]
 次に、復号化を行う復号化プログラムについて説明する。図15は、復号化プログラムを実行するコンピュータの一例を示す図である。なお、図14と同一の部分については同一の符号を付して、説明を省略する。
 図15に示すように、HDD420には上記の識別部51および復号部52と同様の機能を発揮する復号化プログラム420bが予め記憶される。尚、復号化プログラム420bについては、適宜分離しても良い。
 また、HDD420は、各種情報を記憶する。例えば、HDD420は、OSや復号化に用いる各種データを記憶する。
 そして、CPU410が、復号化プログラム420bをHDD420から読み出して実行することで、実施例の各処理部と同様の動作を実行する。すなわち、復号化プログラム420bは、識別部51および復号部52と同様の動作を実行する。
 尚、上記した復号化プログラム420bについても、必ずしも最初からHDD420に記憶させることを要しない。
 また、例えば、圧縮プログラム420aおよび復号化プログラム420bは、コンピュータ400に挿入されるフレキシブルディスク(FD)、CD-ROM、DVDディスク、光磁気ディスク、ICカードなどの「可搬用の物理媒体」に記憶させても良い。そして、コンピュータ400がこれらからプログラムを読み出して実行するようにしても良い。
 さらには、公衆回線、インターネット、LAN、WANなどを介してコンピュータ400に接続される「他のコンピュータ(又はサーバ)」などにプログラムを記憶させておく。そして、コンピュータ400がこれらからプログラムを読み出して実行するようにしても良い。
 さらには、公衆回線、インターネット、LAN、WANなどを介してコンピュータ400に接続される「他のコンピュータ(又はサーバ)」などにプログラムを記憶させておく。そして、コンピュータ400がこれらからプログラムを読み出して実行するようにしても良い。
 10 符号化・復号化装置
 20 記憶部
 21 制御部
 30 対象ファイル
 31 符号化ファイル
 40 符号化部
 41 抽出部
 42 生成部
 43 出力部
 44 算出部
 50 復号化部
 51 識別部
 52 復号部

Claims (8)

  1.  コンピュータに、
     符号化対象の数値を、2進数表現(nは1以上の自然数)の数値符号に符号化すると共に、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する
     処理を実行させることを特徴とする符号化プログラム。
  2.  前記生成する処理は、桁数の順に、先頭のビットから各ビットに桁数が対応付けられ、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する
     ことを特徴とする請求項1に記載の符号化プログラム。
  3.  前記コンピュータに、
     複数の前記符号化対象の数値をそれぞれ2進数表現した桁数ごとに出現頻度を算出する処理をさらに実行させ、
     前記生成する処理は、前記算出された出現頻度の多い桁数の順に、先頭のビットから桁数が対応付けられ、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する
     ことを特徴とする請求項1に記載の符号化プログラム。
  4.  コンピュータが、
     符号化対象の数値を、2進数表現(nは1以上の自然数)の数値符号に符号化すると共に、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する
     処理を実行することを特徴とする符号化方法。
  5.  符号化対象の数値を、2進数表現(nは1以上の自然数)の数値符号に符号化すると共に、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号を付加した符号データを生成する生成部
     を有することを特徴とする符号化装置。
  6.  コンピュータに、
     符号化対象の数値を、2進数表現(nは1以上の自然数)で符号化した数値符号と共に、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号が付加された符号データの前記瞬時符号から2進数表現での桁数を識別し、
     識別した桁数に応じて、前記数値符号をnビット単位で数値に復号化する
     処理を実行させることを特徴とする復号化プログラム。
  7.  コンピュータが、
     符号化対象の数値を、2進数表現(nは1以上の自然数)で符号化した数値符号と共に、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号が付加された符号データの前記瞬時符号から2進数表現での桁数を識別し、
     識別した桁数に応じて、前記数値符号をnビット単位で数値に復号化する
     処理を実行させることを特徴とする復号化方法。
  8.  符号化対象の数値を、2進数表現(nは1以上の自然数)で符号化した数値符号と共に、前記符号化対象の数値を2進数表現した際の桁数を示した瞬時符号が付加された符号データの前記瞬時符号から2進数表現での桁数を識別する識別部と、
     前記識別部により識別された桁数に応じて、前記数値符号をnビット単位で数値に復号化する復号部と、
     を有することを特徴とする復号化装置。
PCT/JP2015/078120 2015-10-02 2015-10-02 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置 WO2017056327A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
PCT/JP2015/078120 WO2017056327A1 (ja) 2015-10-02 2015-10-02 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置
EP15905480.8A EP3358748B1 (en) 2015-10-02 2015-10-02 Coding program, coding method, coding device, decoding program, decoding method and decoding device
JP2017542666A JP6593445B2 (ja) 2015-10-02 2015-10-02 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置
US15/940,081 US10447295B2 (en) 2015-10-02 2018-03-29 Coding method, coding device, decoding method, and decoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2015/078120 WO2017056327A1 (ja) 2015-10-02 2015-10-02 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/940,081 Continuation US10447295B2 (en) 2015-10-02 2018-03-29 Coding method, coding device, decoding method, and decoding device

Publications (1)

Publication Number Publication Date
WO2017056327A1 true WO2017056327A1 (ja) 2017-04-06

Family

ID=58422984

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2015/078120 WO2017056327A1 (ja) 2015-10-02 2015-10-02 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置

Country Status (4)

Country Link
US (1) US10447295B2 (ja)
EP (1) EP3358748B1 (ja)
JP (1) JP6593445B2 (ja)
WO (1) WO2017056327A1 (ja)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS54156446A (en) * 1978-05-30 1979-12-10 Ricoh Co Ltd Code conversion system
JPS62298280A (ja) * 1986-06-18 1987-12-25 Ricoh Co Ltd 画像符号化方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2389278A1 (fr) * 1977-04-29 1978-11-24 Thomson Csf Systeme de stockage magnetique d'informations numeriques codees avec transcodage reversible en code bipolaire a haute densite d'ordre n
US5548110A (en) * 1986-04-18 1996-08-20 Cias, Inc. Optical error-detecting, error-correcting and other coding and processing, particularly for bar codes, and applications therefor such as counterfeit detection
JPS63269623A (ja) 1987-04-28 1988-11-07 Fujitsu Ltd 圧縮デ−タデコ−ド装置
US5287490A (en) * 1991-03-07 1994-02-15 Digital Equipment Corporation Identifying plausible variable length machine code of selecting address in numerical sequence, decoding code strings, and following execution transfer paths
JPH07273661A (ja) 1994-03-28 1995-10-20 Toshiba Corp 圧縮符号化復号化装置
US6959412B2 (en) * 2002-03-04 2005-10-25 Seagate Technology Llc Error correction coding utilizing numerical base conversion for modulation coding

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS54156446A (en) * 1978-05-30 1979-12-10 Ricoh Co Ltd Code conversion system
JPS62298280A (ja) * 1986-06-18 1987-12-25 Ricoh Co Ltd 画像符号化方法

Also Published As

Publication number Publication date
US10447295B2 (en) 2019-10-15
EP3358748B1 (en) 2022-05-11
JPWO2017056327A1 (ja) 2018-07-19
US20180226986A1 (en) 2018-08-09
EP3358748A1 (en) 2018-08-08
JP6593445B2 (ja) 2019-10-23
EP3358748A4 (en) 2018-09-26

Similar Documents

Publication Publication Date Title
US9077368B2 (en) Efficient techniques for aligned fixed-length compression
JP6616877B2 (ja) Vlsiでの効率的なハフマン符号化を行う装置および方法
WO2019153700A1 (zh) 编解码方法、装置及编解码设备
JP6681313B2 (ja) データを符号化するための方法、コンピュータ・プログラムおよびシステム
JP3778087B2 (ja) データ符号化装置及びデータ復号装置
KR20150092585A (ko) 이진 영상에 기반한 유전체 데이터 압축 방법 및 장치
KR20170040343A (ko) 적응형 레이트 압축 해시 프로세싱 디바이스
CN105791832B (zh) 数据编码方法和数据解码方法及其系统
JP5472610B2 (ja) 数値データ列の符号化/復号化の方法および装置
JP6613669B2 (ja) 圧縮プログラム、圧縮方法、情報処理装置、置換プログラムおよび置換方法
TWI643061B (zh) 用於熵編碼之系統層級測試之電腦實施方法、系統及電腦程式產品
JP6593445B2 (ja) 符号化プログラム、符号化方法、符号化装置、復号化プログラム、復号化方法および復号化装置
JP6645013B2 (ja) 符号化プログラム、符号化方法、符号化装置および伸長方法
WO2007108395A1 (ja) 可変長符号の復号装置および復号方法
JP2016170750A (ja) データ管理プログラム、情報処理装置およびデータ管理方法
CN103312338B (zh) 用于解码的设备和方法
JP2016052046A (ja) 圧縮装置、伸長装置およびストレージ装置
JP5626440B2 (ja) 数値データ列の符号化/復号化の方法および装置
JP2010258532A (ja) ビット長を符号に変換する回路及び方法
Nguyen et al. A proposed approach to compound file fragment identification
JP6512294B2 (ja) 圧縮プログラム、圧縮方法および圧縮装置
CN113659992B (zh) 数据压缩方法及装置、存储介质
JP6903892B2 (ja) 検証プログラム、検証装置、検証方法、符号化プログラム、符号化装置および符号化方法
JP2003273746A (ja) 可変長符号復号装置
JP2016139958A (ja) 情報処理装置及びプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15905480

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2017542666

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2015905480

Country of ref document: EP