WO2011150810A1 - Data encoding method, decoding method, encoder and decoder - Google Patents

Data encoding method, decoding method, encoder and decoder Download PDF

Info

Publication number
WO2011150810A1
WO2011150810A1 PCT/CN2011/074930 CN2011074930W WO2011150810A1 WO 2011150810 A1 WO2011150810 A1 WO 2011150810A1 CN 2011074930 W CN2011074930 W CN 2011074930W WO 2011150810 A1 WO2011150810 A1 WO 2011150810A1
Authority
WO
WIPO (PCT)
Prior art keywords
sample
data
entropy
bit
encoded
Prior art date
Application number
PCT/CN2011/074930
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Publication of WO2011150810A1 publication Critical patent/WO2011150810A1/en

Links

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/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a compression encoding method, a decoding decompression method, an apparatus, and a communication system.
  • the signals transmitted in the existing communication network usually include voice, image and video signals, etc. These multimedia signals have high correlation and statistical characteristics, have good mathematical and physical models, and thus have better data encoding methods. .
  • the present invention provides a data encoding method, a decoding method, an encoder, and a decoder that can efficiently compress communication data.
  • a data encoding method including:
  • n-bit high-bit data starting from the most significant bit in each sample of the data block, and performing first-class entropy coding on the high-bit data of each sample, where n is greater than 1 and less than The number of bits of valid data of the sample with the largest absolute value;
  • the low bit data other than the bit data is subjected to the first type of quantization coding or the second type of entropy coding for each of the low bit data of each sample;
  • the coded frame includes the most significant bit, a positive and negative codeword of each sample carrying the data block, and a first type of entropy coding of each sample of the data block.
  • a data decoding method including:
  • the original data block is obtained by assembling the positive and negative polarities of each sample, the high bit data of each sample, and the low bit data according to the most significant bits contained in the received encoded frame.
  • a data encoding method including:
  • the coded frame includes the most significant bit P, a codeword carrying positive and negative polarity of each sample, and a fourth type of entropy coding of each sample of the data block.
  • a data decoding method including:
  • the positive and negative polarities of each sample, the number of left shifts of valid data of each sample, and the valid data after shifting are assembled according to the most significant bit of the sample having the largest absolute value included in the encoded frame.
  • Raw data block The positive and negative polarities of each sample, the number of left shifts of valid data of each sample, and the valid data after shifting are assembled according to the most significant bit of the sample having the largest absolute value included in the encoded frame.
  • an encoder including:
  • a first pre-processing unit configured to obtain positive and negative polarities of each sample in the data block, and a most significant bit of the sample with the largest absolute value among the samples of the data block;
  • a high-bit coding unit configured to acquire n-bit high-bit data from each of the most significant bits in each sample in the data block, and perform first-class entropy coding on each of the high-bit data of each sample
  • the n is greater than 1, and is less than the number of bits of valid data of the sample having the largest absolute value
  • a low bit coding unit configured to acquire low bit data other than the high bit data in data starting from the most significant bit in each sample in the data block, low for each sample
  • the bit data is respectively subjected to the first type of quantization coding or the second type of entropy coding;
  • a first coding output unit configured to output an encoded code frame, where the coded frame includes the most significant bit, a codeword carrying positive and negative polarity of each sample in the data block, and each of the data blocks
  • the first type of entropy encoded high bit data of the sample and the encoded frame composed of the first type of quantized code or the second type of entropy coded low bit data.
  • a decoder including:
  • a first polarity acquiring unit configured to acquire a codeword carrying positive and negative polarities of each sample in the received encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
  • a high bit decoding unit configured to decode the entropy encoded high bit data in the encoded frame to obtain high bit data of each sample
  • a low bit decoding unit configured to decode the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample
  • a first data assembling unit for using the most significant bit included in the received encoded frame
  • the positive and negative polarities, high bit data, and low bit data of each sample are assembled to obtain the original data block.
  • an encoder including:
  • a second pre-processing unit configured to obtain positive and negative polarities of each sample in the data block and a most significant bit p of the sample with the largest absolute value among the samples of the data block;
  • a shifting unit configured to obtain a most significant bit d of each sample in the data block, and shift the valid data bits of each sample to the left by p-d bits;
  • a shift information encoding unit configured to perform a fourth type of entropy encoding on each of the left shift numbers p-d of each sample in the data block;
  • a valid data encoding unit configured to perform a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample in the data block;
  • a second code output unit configured to output the encoded coded frame, where the coded frame includes the most significant bit P, a codeword carrying positive and negative polarity of each sample in the data block, and each of the data blocks.
  • a decoder including:
  • a second polarity acquiring unit configured to acquire a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtaining positive and negative polarities of each sample according to the codeword;
  • a left shift number decoding unit configured to decode the entropy encoded left shift number in the encoded frame, to obtain a left shift number of valid data of each sample point;
  • An effective data decoding unit configured to decode the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
  • a second data assembling unit configured to: positive and negative polarity of each sample, left shift number of valid data of each sample, and shift according to a most significant bit of a sample having the largest absolute value included in the encoded frame The valid data after the bit is assembled to obtain the original data block.
  • the high-bit data of the communication data represents the main information of the communication data, and has the characteristics of non-uniform hook distribution
  • the low-bit data represents the secondary information of the communication data, and is within the entire dynamic range.
  • Non-uniform distribution the division is relatively uniform within the local dynamic range
  • the present invention entropy encodes the high bit data of each sample, entropy encodes or quantizes the low bit data, and fully utilizes different distribution characteristics of the high bit data and the low bit data, by selecting the corresponding code. In this way, it can have higher coding efficiency and higher compression.
  • FIG. 1 is a flowchart of a data encoding method according to Embodiment 1 of the present invention.
  • FIG. 2 is a flowchart of a method for decoding a data according to Embodiment 2 of the present invention
  • FIG. 3 is a schematic structural diagram of original data before encoding in an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a data block before encoding in an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of dividing a data block in a data encoding method according to Embodiment 1 of the present invention.
  • FIG. 7 is a probability distribution diagram of high bit data of original data in the embodiment of the present invention
  • FIG. 8 is a probability distribution diagram of low bit data of original data in the embodiment of the present invention
  • FIG. 9 is a valid bit in the embodiment of the present invention
  • Figure 10 is a probability distribution diagram of low bit data of original data of which the effective bit number Q is 7 in the embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of an encoded frame in Embodiment 1 of the present invention.
  • FIG. 12 is a flowchart of a method for data encoding according to Embodiment 3 of the present invention.
  • FIG. 13 is a flowchart of a method for decoding a data provided by Embodiment 4 of the present invention.
  • FIG. 14 is a schematic diagram of dividing a data block in an improved data encoding method according to Embodiment 3 of the present invention.
  • 15 is a probability distribution diagram of a left shift number of original data in an embodiment of the present invention.
  • 16 is a probability distribution diagram of valid data of original data in an embodiment of the present invention
  • 17 is a probability distribution diagram of valid data of original data with a most significant bit number P of 7 in the embodiment of the present invention
  • FIG. 19 is a schematic structural diagram of an encoded frame according to Embodiment 3 of the present invention.
  • FIG. 21 is a schematic block diagram of an encoder according to Embodiment 5 of the present invention.
  • FIG. 22 is a schematic structural diagram of a decoder according to Embodiment 6 of the present invention.
  • FIG. 23 is a schematic block diagram of a decoder provided in Embodiment 6 of the present invention.
  • FIG. 25 is a schematic block diagram of an encoder provided in Embodiment 7 of the present invention.
  • 26 is a schematic structural diagram of a decoder according to Embodiment 8 of the present invention.
  • FIG. 27 is a schematic block diagram of a decoder provided in Embodiment 8 of the present invention.
  • FIG. 29 is still another application scenario diagram of a decoder and an encoder provided by an embodiment of the present invention.
  • the technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. example. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without the creative work are all within the scope of the present invention.
  • the present invention provides a data encoding method, a decoding method, a decoder and an encoder.
  • FIG. 1 is a flowchart of a data encoding method according to Embodiment 1 of the present invention.
  • the communication data that needs to be encoded may be in units of data blocks.
  • the number of samples included in the data block can be determined according to the compression ratio of the code and the delay requirement. For example, the lower the delay requirement, the larger the number of samples included in the data block, and the higher the compression ratio, the data block. The more samples are included in the sample.
  • the data encoding method provided in the first embodiment of the present invention may include: 101. Obtain the positive and negative polarity of each sample in the data block.
  • the encoder can obtain the positive and negative polarities of each sample in the data block that needs to be encoded.
  • the data block is composed of L samples, and the size of L is adjustable.
  • Each sample in the data block can be represented in the form of a complement.
  • the encoder can obtain the positive and negative polarity of each sample in the data block according to the sign bit of each sample.
  • the encoder can take an absolute value for each of the L samples of the data block, and then obtain the sample with the largest absolute value, and obtain the most significant bit of the sample with the largest absolute value.
  • the highest bit of the bit of the absolute value of the sample is referred to as the most significant bit of the sample.
  • the most significant bit the first non-zero bit from the right to left of the non-sign bit is the most significant bit. It will be appreciated that the most significant bit may also be suitably higher than the non-zero bit.
  • n-bit high-bit data starting from the most significant bit in each sample, and perform first-class entropy coding on the high-bit data of each sample, where n is greater than 1, and is smaller than the absolute maximum. The number of bits of valid data for the point.
  • the encoder divides the right number of bits from the most significant bit into high-bit data, and the remaining bits are divided into low-bit data, where n An integer that is greater than 1, less than the number of significant digits of the valid data for the sample with the largest absolute value.
  • the size of the n value can be determined according to the statistical rule of the high bit data of different communication data.
  • bits other than the sign bit, the sign extension bit, and the padded zero in each sample are referred to as valid data. For example, -5 , expressed in the form of complement, is 10000101, the first digit is a sign bit, with "1" for negative polarity, "000” for filled zero, and "101" for valid data.
  • the encoder performs first-class entropy coding on the high-bit data of each sample, for example, performing Huffman coding or arithmetic coding.
  • the encoder obtains low-bit data other than the high-bit data in the data starting from the most significant bit in each sample, and performs the first-class quantization encoding on the low-bit data of each sample respectively.
  • a second type of entropy coding for example, the second type of entropy coding may be Huffman coding, the first type of quantization coding It can be non-equalized and quantized.
  • the types of the first type of entropy coding, the second type of entropy coding, and the third type of entropy coding are entropy coding, but the specific entropy coding type may be determined according to specific statistical rules of data, such as Huffman coding, arithmetic coding and run length coding.
  • the encoder After encoding the high bit data and the low bit data, the encoder outputs the encoded code frame, where the code frame includes the most significant bit, and the code word carrying the positive and negative polarity of each sample.
  • the high-bit data of the communication data has the characteristics of a non-uniform hook distribution
  • the low-bit data is non-uniformly distributed in the entire dynamic range, and the segments are relatively uniform in the local dynamic range.
  • the first type of entropy coding is performed on the high bit data of each sample
  • the second type entropy coding or the first type of quantization coding is performed on the low bit data, which fully utilizes different distributions of high bit data and low bit data.
  • the feature by selecting the corresponding coding mode, can have higher coding efficiency and higher compression.
  • the code characters carrying the positive and negative polarities of each sample may be the positive and negative polarities of each sample without entropy coding, or the third type of entropy of each sample.
  • Positive and negative polarity after encoding the coded frame outputted after coding includes the most significant bit, the third type of entropy coded positive and negative polarity of each sample, the first type of entropy coded high bit data, and the first type of quantization code. Or a second type of entropy encoded low bit data.
  • the third type of entropy coding for the positive and negative polarities of each sample can further improve the coding efficiency.
  • the encoding method and the encoding parameter when the high-bit data and the low-bit data are encoded, a preset encoding mode and an encoding parameter may be selected, and the encoding mode and the encoding parameter are collectively referred to as encoding information in the embodiment of the present invention.
  • the encoder when the encoder performs the encoding of the high-bit data and the low-bit data, the encoding method and the encoding parameter can be flexibly selected according to different types of communication data.
  • the encoding method provided by the embodiment of the present invention further includes: acquiring The first class of entropy coding for the high bit data of each sample Code information and low bit data The first type of quantized code or the second type of entropy coded coded information.
  • the encoder After obtaining the encoded information, the encoder transmits the encoded information through the encoded frame, so that the decoder performs corresponding decoding according to the encoded information.
  • the encoded frame further includes a first type of entropy encoded coding information and a low bit data second type entropy coding or a first type of quantized coding information of the high bit data of each sample.
  • the encoder by adding coding information to the coded frame, the encoder can select more coding modes by performing entropy coding or quantization coding, without being limited by the preset coding mode, and the adaptation range is wider.
  • Embodiment 2
  • FIG. 2 is a flowchart of a method for decoding a data according to Embodiment 2 of the present invention.
  • the decoder decodes the encoded bit stream in units of frames.
  • the data encoding method provided in the second embodiment of the present invention may include:
  • the decoder obtains the code words carrying the positive and negative polarities of each sample in the encoded frame, and obtains the positive and negative polarities of each sample according to the code words.
  • the code characters carrying the positive and negative polarities of each sample can be the positive and negative polarity of each sample, and the decoder can obtain the positive and negative polarity of each sample without decoding.
  • the decoder can decode the entropy-encoded high-bit data in the encoded frame according to the decoding manner corresponding to the encoding mode according to the number of samples included in the data block, and obtain high-bit data of each sample. .
  • the coding mode used by the encoder and the decoding mode used by the decoder may be preset coding modes and decoding modes.
  • the decoder may decode the quantized or entropy-coded low-bit data in the encoded frame according to the decoding mode corresponding to the encoding mode used by the encoder according to the number of samples included in the data block, thereby obtaining each Low bit data of samples.
  • each sample is stored in the form of a complement, and the number of bits of the sample is, for example, 16 bits, 32 bits, or the like.
  • the decoder After obtaining the positive and negative polarity of each sample, the decoded high bit data, and the decoded low bit data, the decoder will each sample in the order of the sign bit, the high bit data, and the low bit data.
  • the positive and negative polarities of the points, the corresponding high bit data, and the low bit data are assembled to obtain the original data block, and the data decoding process is completed. Wherein, in the process of data assembly, it is necessary to determine the number of zeros in the sign extension bits of each sample according to the most significant bits contained in the received coded frame.
  • the decoding method provided by the embodiment of the present invention provides support for the encoding method provided in the first embodiment. Since the high bit data of the communication data represents the main information of the communication data, it has a non-uniform distribution characteristic, and the low bit data represents The secondary information of the communication data is non-uniformly distributed over the entire dynamic range, and the segments are relatively uniform within the local dynamic range.
  • the high-bit data of each sample is entropy encoded, and the low-bit is used.
  • the bit data is entropy coded or quantized, and the different distribution characteristics of the high bit data and the low bit data are fully utilized. By selecting the corresponding coding mode, the coding efficiency can be high and the data compression is relatively high.
  • the positive and negative polarities of each sample are obtained according to the codeword, and the positive and negative polarity codewords of each sample are separately entropy decoded to obtain each sample point.
  • Positive and negative polarity The decoding method for entropy decoding the positive and negative polarity code words corresponds to the coding method for the third type entropy coding for the positive and negative polarities of each sample.
  • the encoded frame sent by the encoder may further include high bit data entropy encoded coding information and low bit data entropy coding or quantized coding information of each sample, where the coding information includes an encoding mode and an encoding parameter.
  • the coding parameters may include a quantization table used for coding. It can be understood that the encoded information can be carried in the header of the encoded frame.
  • the step of decoding the high-bit-encoded high-bit data in the encoded frame to obtain the high-bit data of each sample is as follows:
  • the high-bit data entropy-encoded coding information of the sample entropy-decodes the entropy-encoded high-bit data in the encoded frame to obtain high-bit data of each sample.
  • the decoding method for entropy decoding the entropy-encoded high-bit data is determined according to the encoding information, that is, the entropy-encoded high-bit data is decoded by using the encoding method and the corresponding decoding method.
  • the step of decoding the low-bit data of the quantized or entropy-encoded data in the encoded frame to obtain the low-bit data of each sample is specifically:
  • the quantized or entropy encoded low bit data in the encoded frame is decoded according to the low bit data entropy encoded or quantized encoded information of each sample to obtain low bit information of each sample.
  • the decoding method for decoding the quantized or entropy encoded low-bit data in the encoded frame is determined according to the encoding information, that is, the encoding and the encoding method and the corresponding decoding manner are low after entropy encoding or quantization encoding.
  • the bit data is decoded.
  • the step of decoding the low-bit data of the quantized or entropy-encoded data in the encoded frame to obtain the low-bit data of each sample may include:
  • FIG. 3 is a schematic structural diagram of original data before encoding in an embodiment of the present invention.
  • S denotes the bit occupied by the sign bit, a total of m bits
  • D denotes the bit occupied by the valid data, a total of n bits.
  • B H represents the highest bit of the data
  • B L represents the lowest bit of the data
  • B M represents the highest bit of the data valid bit.
  • FIG. 4 is a schematic structural diagram of a data block before encoding according to an embodiment of the present invention.
  • the encoder encodes the original data in units of data blocks. According to the distribution characteristics of the original data, the S area and the D area of each sample in the data block are random.
  • FIG. 5 is a schematic diagram of dividing a data block in an embodiment of the present invention.
  • the encoder divides the data block to obtain a sign bit, a high bit, and a low bit, each of which occupies n0, n1, and n2 bits, respectively.
  • the encoder divides the data block, it first extracts the sign bit Ss of each sample point in the data block, and obtains the positive and negative polarity of each sample according to the sign bit.
  • the encoder can take an absolute value for each sample, obtain the sample with the largest absolute value among the L samples, and determine the most significant bit of the sample. After determining the most significant bit, the n1 bits from the most significant bit in each sample are divided into high bit data S h , and the remaining n 2 bits in the valid data are divided into low bit data S .
  • the embodiment of the present invention can use the states 0 and 1 to indicate the positive and negative polarity of each sample in each frame of data. For example, 0 indicates that the sample is negative, 1 indicates that the sample is positive; or 0 indicates a sample. The value is positive and 1 means the sample value is negative. After the sign bit of each sample is processed, a binary code word S s c carrying the positive and negative polarities of each sample is obtained.
  • Figure 6 shows an example of the probability distribution of the original data
  • the probability distribution of the corresponding high-bit data is given by Figure 7. It can be seen that the probability of occurrence of the high bit data S h is unequal, which provides a basis for data compression using entropy coding. Therefore, the embodiment of the present invention uses the entropy coding method to perform high bit data Sh Undistorted entropy coding yields high bit data entropy coding S h e.
  • Entropy coding may employ Huffman coding, arithmetic coding or other unequal length coding algorithms, or a combination thereof.
  • the coding information such as the entropy coding and the coding parameters for entropy coding of the high bit data may be stored in the frame header information, and the frame header information is stored in the coding frame for output.
  • distortion coding quantization coding
  • a simple scalar quantization method can be used.
  • the effective data is non-uniformly distributed over the entire dynamic range, but distributed evenly within the local dynamic range.
  • Figure 6 shows an example of the probability distribution of the original data S.
  • the probability distribution of the low-bit data corresponding to it is given by Figure 8. It can be seen that the low-bit data is non-uniformly distributed as a whole, and the dynamic range is large. .
  • FIG. 9 and FIG. 10 respectively show low bit data of the effective bit number Q of 6 and 7.
  • the probability distribution shows that the distribution is relatively uniform and the dynamic range is small. If the two parts of data are separately quantified, the quantization is more accurate.
  • the compression coding algorithm for low-bit data can use the classified quantization coding algorithm, for example, the Lloyd-Max non-uniform scalar quantization algorithm.
  • the coding information such as the entropy coding or the quantization coding of the low bit data and the coding information such as the coding parameters may be stored in the frame header information, and the frame header information is output through the coding frame.
  • the encoder combines the positive and negative polarity encoded codeword S s c , the high bit code S h c and the low bit code S lC obtained by encoding, and combines the frame header information to form a complete
  • FIG. 11 is a schematic structural diagram of the coded frame in the coded bit stream B1 provided by the embodiment of the present invention.
  • the different coded frames are arranged in chronological order of the output to form an encoded bit stream B1 output by the encoder, as shown in FIG.
  • the frame header information may further include the number of samples in the data block, the most significant bit in the data block, and the like. It should be noted that, if the encoder and the decoder use the preset decoding type and encoding type, and the length of each sample in the data block and the number of samples are preset values, the encoded frame may be No need to carry frame header information.
  • the encoded bit stream is decoded in units of coded frames, the decoder can read the frame header information and save, and then the positive and negative polarities of each sample are determined based on the 0, 1 state of the binary bit stream. Secondly, the decoder performs distortion-free entropy decoding to recover high-bit data and save it.
  • the specific method of entropy decoding corresponds to the encoder. In the case where the encoder obtains the entropy encoding of the low bit data according to the frame header information, the decoder determines the effective bit number of the low bit data through the frame header information, and performs entropy decoding on the entropy encoded low bit data.
  • the decoder performs inverse quantization processing on the encoded low-bit data, and the specific process includes: recovering the quantized subscript value of the low-bit data from the input bit stream, and then determining the low-bit according to the frame header information.
  • the dynamic range of the data is used to determine the scalar quantization code table, perform inverse quantization processing, search for the corresponding quantized value in the quantization table by the subscript index, and realize distortion decoding of the low bit data bits.
  • the decoder assembles the positive and negative polarities, high-bit data and low-bit data of each sample obtained by decoding, obtains the original data block and outputs, completes decoding of one encoded frame, and prepares to proceed to the next frame. Decoding until the end of decoding.
  • FIG. 12 is a flowchart of a method for encoding a data according to Embodiment 3 of the present invention.
  • the data encoding method provided by the embodiment of the present invention may include:
  • the communication data that needs to be encoded may be in units of data blocks.
  • the number of samples included in the data block can be determined according to the compression ratio of the code and the delay requirement, that is, the lower the delay requirement, the more the number of samples included in the data block, the higher the compression ratio, the data block The more samples are included in the sample.
  • the data encoding method provided in Embodiment 3 of the present invention may include:
  • the encoder can obtain the positive and negative polarities of each sample in the data block that needs to be encoded.
  • the data block is composed of L samples, and the size of L is adjustable.
  • Each sample in the data block is represented in the form of a complement.
  • the encoder can obtain the positive and negative polarity of each sample in the data block according to the sign bit of each sample.
  • the encoder can take an absolute value for each of the L samples of the data block, and then obtain the sample with the largest absolute value, and obtain the most significant bit of the sample with the largest absolute value.
  • the most significant bit of the absolute value of the sample is referred to as the most significant bit of the sample.
  • the encoder after obtaining the most significant bit of the data block, the encoder further obtains the most significant bit d of each sample, and shifts the effective data bits of each sample to the left by p-d bits.
  • the valid data bits of the sample point are data bits other than the sign bit in the two's complement of the sample.
  • the encoder performs a fourth type of entropy coding on the left shift number distribution of each sample, for example, performing Huffman coding or arithmetic coding.
  • the encoder performs a fifth type of entropy coding or a second type of quantized coding on the shifted valid data bits in each sample
  • the fifth type of entropy coding may be Huffman coding, etc.
  • the second type of quantization coding It can be non-equalized and quantized.
  • the encoder After encoding the left shift number and the shifted valid data of each sample, the encoder outputs the encoded code frame, where the coded frame includes the most significant bit p, and carries each sample.
  • the frame constitutes an encoded bit stream, and the data encoding process is completed.
  • the left shift number generated after the shift of the communication data and the valid data generated after the shift reflect the distribution law of the original data.
  • the left shift number represents the main information of the communication data, and has a non-uniform distribution characteristic
  • the shifted valid data represents the secondary information of the communication data, which is non-uniformly distributed throughout the dynamic range, in the local In the dynamic range, the segments are relatively uniform.
  • the left shift number of each sample is entropy encoded
  • the shifted valid data is entropy encoded or quantized, and the left shift number and shift are fully utilized. After the different distribution characteristics of the valid data, by selecting the corresponding coding mode, it is possible to have higher coding efficiency and higher compression.
  • the code characters carrying the positive and negative polarities of each sample may be the positive and negative polarities of each sample without entropy coding, or the sixth entropy of each sample.
  • Positive and negative polarity after encoding the coded frame outputted after encoding includes a sixth type of entropy coded positive and negative polarity of each sample, a fourth type of entropy coded left shift number, and a second type of quantized code or a fifth type of entropy. Encoded valid data.
  • entropy coding of the positive and negative polarities of each sample can further improve the coding efficiency.
  • the types of the fourth type of entropy coding, the fifth type of entropy coding, and the sixth type of entropy coding are entropy coding, but the specific entropy coding type may be determined according to specific statistical rules of data.
  • the types of the first type of quantization coding and the second type of quantization coding are both quantization codes, but the specific quantization coding type can be determined according to specific statistical rules of data.
  • a preset encoding mode and an encoding parameter may be selected when encoding the left shift number and the shifted valid data, and the encoding parameter may include a quantization table, an encoding method, and an encoding used in encoding.
  • the parameters are collectively referred to as coding information in the embodiments of the present invention.
  • the encoder performs the encoding of the left shift number and the shifted valid data
  • the encoding method and the encoding parameter may be flexibly selected according to different types of communication data.
  • the encoding method provided by the embodiment of the present invention further includes : Obtaining the left shift number of each sample, the fourth type of entropy coded coding information and the shifted effective data, the second class Quantization coding or coding information of the fifth type of entropy coding. After obtaining the encoded information, the encoder transmits the encoded information through the encoded frame, so that the decoder performs corresponding decoding according to the encoded information.
  • the coded frame further includes a left shift number of each sample, and a fourth type of entropy coded coding information and a shifted effective data, a fifth type of entropy coding or a second type of quantization coded coding. information.
  • the encoder by adding coding information to the coded frame, the encoder can select more coding modes by performing entropy coding or quantization coding, without being limited by the preset coding mode, and the adaptation range is wider.
  • Embodiment 4 by adding coding information to the coded frame, the encoder can select more coding modes by performing entropy coding or quantization coding, without being limited by the preset coding mode, and the adaptation range is wider.
  • FIG. 13 is a flowchart of a method for decoding a data according to Embodiment 4 of the present invention.
  • the decoder decodes the encoded bit stream in units of frames.
  • the data encoding method provided in the fourth embodiment of the present invention may include:
  • the decoder obtains the code words carrying the positive and negative polarities of each sample in the encoded frame, and obtains the positive and negative polarities of each sample according to the code words.
  • the code characters carrying the positive and negative polarities of each sample can be the positive and negative polarity of each sample, and the decoder can obtain the positive and negative polarity of each sample without decoding.
  • the decoder may decode the entropy-encoded left shift number in the encoded frame according to the decoding manner corresponding to the encoding manner according to the number of samples in the data block, and obtain the left shift number of the valid data of each sample point. .
  • the coding mode used by the encoder and the decoding mode used by the decoder may be preset coding modes and decoding modes.
  • the decoder can decode the quantized or entropy-encoded valid data in the encoded frame according to the decoding manner corresponding to the encoding mode used by the encoder according to the number of samples in the data block, thereby obtaining the shift of each sample.
  • Valid data after the bit.
  • each sample is stored in the form of a complement, and the number of bits of the sample is, for example, 16 bits, 32 bits, or the like.
  • the decoder After obtaining the positive and negative polarity of each sample, the number of left shifts of the valid data, and the valid data after shifting, the decoder assembles the positive and negative polarities and the valid data of the sample to obtain the original data block, and completes Data decoding process. In the data assembly, the position of the shifted valid data needs to be shifted to the right by the corresponding number of bits, and the number of bits shifted to the right is equal to the number of left shifts.
  • the decoding method provided in the fourth embodiment of the present invention provides support for the decoding method provided in the third embodiment.
  • the left shift number generated after the shift of the communication data and the valid data generated after the shift reflect the distribution rule of the original data.
  • the left shift number has a non-uniform hook distribution characteristic, and the shifted effective data is non-uniformly distributed in the entire dynamic range, and the partial dynamic range is relatively uniform in the local dynamic range, and the embodiment of the present invention is applicable to each sample point.
  • the left shift number is entropy coded, and the shifted effective data is entropy coded or quantized, and the left shift number and the different distribution characteristics of the shifted effective data are fully utilized, and the corresponding coding mode may be selected. Higher coding efficiency and higher compression.
  • the positive and negative polarities of each sample are obtained according to the codeword, and the positive and negative polarity codewords of each sample are separately entropy decoded to obtain each sample point.
  • Positive and negative polarity corresponds to the coding method for the entropy coding of the positive and negative polarities of each sample at the transmitting end.
  • the encoded frame sent by the encoder may further include encoding information of the left shift number entropy coding of each sample and encoding information of the shifted effective data entropy encoding or quantization encoding, where the encoding information includes an encoding method and Encoding parameters, encoding parameters may include a quantization table used for encoding.
  • the step (402) of obtaining the left shift number of the valid data of each sample is specifically: performing entropy-coded left shift number in the encoded frame according to the encoding information of the left shift number entropy coding of each sample point Entropy decoding, obtaining the number of left shifts of valid data for each sample.
  • the specific decoding mode for entropy decoding the entropy-encoded left shift number is determined according to the coding information, that is, the entropy-encoded left shift number is decoded by using a decoding method corresponding to the coding mode, for example, an encoding method. For entropy coding, the corresponding decoding mode is entropy decoding.
  • the step of decoding the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data for each sample is specifically:
  • the quantized or entropy encoded low bit data in the encoded frame is decoded according to the low bit data entropy encoded or quantized encoded information of each sample to obtain low bit information of each sample.
  • the specific decoding manner for decoding the quantized or entropy encoded low-bit data in the encoded frame is determined according to the encoding information, that is, the entropy encoding or the quantized low-bit encoding by using the encoding method and the corresponding decoding manner.
  • the bit data is decoded.
  • the step of decoding the valid data after the quantization coding or the entropy coding in the coded frame, and obtaining the valid data after the shift of each sample may specifically include:
  • FIG. 14 is a schematic diagram of dividing a data block in an improved data encoding method according to Embodiment 3 of the present invention.
  • the encoder encodes the original data in units of data blocks. According to the distribution characteristics of the original data, the S region and the D region of each sample in the data block have randomness.
  • the encoder divides and shifts the data block to obtain the sign bit, the left shift number, and the shifted valid data, each of which occupies n3, L, and n4 bits, respectively.
  • n3 includes the number of bits of the sign bit and the sign extension bit, and the sign bit indicates The positive and negative polarity of the point
  • the specific number of bits of the left shift number L can be determined according to the number of bits of the sample, for example, the number of bits of the sample is 32, then the number of left shifts L can be represented by 5 bits, the sample point The number of bits is 16, and the number of left shifts L can be represented by 4 bits.
  • the number of bits of the sample is 8, and the number of left shifts L can be represented by 3 bits.
  • the encoder When the encoder divides the data block, it first extracts the sign bit Ss of each sample point in the data block, and obtains the positive and negative polarities of each sample according to the sign bit.
  • the encoder can take an absolute value for each sample, obtain the sample with the largest absolute value among the L samples, and obtain the most significant bit ⁇ of the sample. After determining the most significant bit P of the sample with the largest absolute value, the next most significant bit di of each sample is sequentially determined, and each sample is shifted to the left by the P-di bit, that is, the effective after the shift is obtained. data. Where i takes the value of 11 ⁇ .
  • the state 0 and 1 can be used to indicate the positive and negative polarity of each sample in each frame of data, for example, 0 indicates that the sample is negative, 1 indicates that the sample is positive; or 0 indicates a sample value. Positive, and 1 means the sample value is negative.
  • a binary code word S s c carrying the positive and negative polarity codes of each sample is obtained.
  • Figure 6 shows an example of the probability distribution of the original data.
  • the probability distribution of the corresponding left shift number is given by Figure 15. It can be seen that the probability of occurrence of the left shift number is unequal, which provides a basis for data compression using entropy coding. Therefore, the embodiment of the present invention uses the entropy coding method to perform distortion-free entropy on the left shift number.
  • Encoding gives the shift information code S m c.
  • Entropy coding may employ Huffman coding, arithmetic coding or other unequal length coding algorithms, or a combination thereof.
  • the encoding information such as the encoding method and the encoding parameter for entropy encoding the left shift number may be stored in the frame header information, and the frame header information is stored in the encoded frame for output.
  • distortion coding quantization coding
  • the encoder can obtain the effective number of bits of valid data and directly output the corresponding number of bits to achieve distortion-free coding.
  • a simple scalar quantization method can be used.
  • the effective data is non-uniformly distributed over the entire dynamic range, but distributed evenly within the local dynamic range.
  • the probability distribution of the valid data of the original data S is given by Fig. 16. It can be seen that the effective data is non-uniformly distributed as a whole, and the dynamic range is large. In the case where the most significant bit in the data block is known, the valid data can be classified, Figure 17 and Figure 18, respectively. The probability distribution of the effective data with the most significant bits P of 7 and 8 is given. It can be seen that the distribution is relatively uniform and the dynamic range is small. If the two parts of data are separately quantized, the quantization is more accurate. Therefore, the compression coding algorithm for effective data can use the classified quantization coding algorithm, for example, the Lloyd-Max non-uniform scalar quantization algorithm.
  • the coding information such as the coding mode and the coding parameter for entropy coding or quantization coding of the valid data may be stored in the frame header information, and the frame header information is output through the coding frame.
  • the encoder combines the encoded positive and negative polarity coded word S s c , the shift information code S m c and the shifted effective data code S e c , and combines the frame header information.
  • Figure 19 shows the structure of the coded frame in the coded bitstream.
  • the different coded frames are arranged in chronological order of the output to form an encoded bit stream B1 output by the encoder, as shown in FIG.
  • the frame header information may further include the number of samples in the data block, the most significant bit in the data block, and the like.
  • the encoded frame may be No need to carry frame header information.
  • the encoded bit stream is decoded in units of coded frames, the decoder can read the frame header information and save, and then the positive and negative polarities of each sample are determined based on the 0, 1 state of the binary bit stream. Secondly, the decoder performs distortion-free entropy decoding to recover the left shift number of the valid data and saves it.
  • the specific decoding method used for entropy decoding corresponds to the encoding mode used by the encoder.
  • the decoder determines the effective bit number of the valid data by the most significant bit of the current frame and the shift information, and sequentially reads the corresponding quantity from the input bit stream.
  • the bits are entropy decoded to achieve distortion-free decoding of the valid data.
  • the decoder performs inverse quantization processing on the encoded valid data, and the specific process includes: recovering the quantized subscript value of the valid data from the input bit stream, and then determining the scalar quantization code table according to the most significant bit of the current frame.
  • Embodiment 5 A device corresponding to an embodiment of the method of the present invention. Embodiment 5
  • FIG. 20 is a schematic structural diagram of an encoder according to Embodiment 5 of the present invention.
  • the encoder provided in Embodiment 13 of the present invention includes:
  • a first pre-processing unit 1101 configured to obtain positive and negative polarity of each sample in the data block, and a most significant bit of the sample with the largest absolute value among the samples of the data block;
  • a high-bit coding unit 1102 configured to acquire n-bit high-bit data from each of the most significant bits in each sample, and perform first-class entropy coding on each of the high-bit data of each sample.
  • a low-bit coding unit 1103 configured to acquire low-bit data other than the high-bit data in data starting from the most significant bit in each sample, and low bits for each sample The data is respectively subjected to the first type of quantization coding or the second type of entropy coding;
  • a first code output unit 1104 configured to output a codeword carrying positive and negative polarities of each sample, a first type of entropy coded high bit data of each sample, and a first type of quantized code or a second class Encoded frame composed of entropy encoded low bit data.
  • the encoder provided in the fifth embodiment of the present invention can be used in the data encoding method provided in the foregoing corresponding embodiment.
  • the encoder provided in Embodiment 5 of the present invention further includes:
  • a first polarity encoding unit 1105 configured to respectively perform a third type of entropy encoding on the positive and negative polarities of each sample;
  • the code words carrying the positive and negative polarities of each sample in the coded frame output by the first code output unit 1104 are specifically the third type of entropy coded positive and negative polarities of each sample.
  • FIG. 21 is a schematic block diagram of an encoder according to Embodiment 5 of the present invention.
  • a frame of raw data S m is input to the first pre-processing module 1201 for data analysis and processing.
  • the pre-processing includes extracting the sign bit, detecting the most significant bit of one frame, separating the high bit data and the low bit. data.
  • the basic idea of the first pre-processing module 1201 is that the signal distribution to be encoded has randomness, and the statistical distribution of the high-bit area and the low-bit area in the effective bit area is different, and different encoding methods can be used for processing.
  • the high bit data has a non-homogeneous distribution characteristic
  • the low bit data is distributed in a non-homogeneous distribution within the entire dynamic range, but distributed uniformly in the local dynamic range, which is low bit data.
  • the compression coding process provides the basis.
  • the symbol bit data S s , the high bit data S h and the low bit data obtained by the first preprocessing module 1201 are respectively sent to the sign bit encoding module 1202, the high bit encoding module 1203 and the low bit encoding module 1204, The sign bit code S s c , the high bit code S h c and the low bit code S c .
  • the Sign Bit Encoding Module 1202 uses the states 0, 1 to indicate the positive and negative polarity of each sample, and the final encoding generates a set of binary bit streams. According to the uneven distribution characteristic of the high bit data, the high bit coding module 1203 uses the distortion-free entropy coding.
  • Entropy coding may employ Huffman coding, arithmetic coding, or a combination thereof. According to the distribution characteristics of the low bit data, the low bit coding module 1204 classifies it, and the classification process more closely reflects the distribution characteristics of each frame of data. In the distortionless coding state, the encoder determines the effective number of bits of the low bit data according to the most significant bit of the current frame, and sequentially writes the corresponding number of bits into the output buffer to implement distortionless coding output. In the distortion coding state, the low bit coding module 1204 classifies the low bit data according to the most significant bit of the current frame, and selects a corresponding quantization table to quantize the low bit data to implement distortion compression coding.
  • FIG. 22 is a schematic structural diagram of a decoder according to Embodiment 6 of the present invention.
  • the decoder provided in Embodiment 6 of the present invention includes:
  • the first polarity acquiring unit 1301 is configured to acquire a codeword carrying positive and negative polarities of each sample in the received encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
  • the high bit decoding unit 1302 is configured to decode the entropy encoded high bit data in the encoded frame to obtain high bit data of each sample;
  • a low bit decoding unit 1303, configured to decode the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample;
  • the first data assembling unit 1304 is configured to assemble the positive and negative polarities, the high bit data, and the low bit data of each sample according to the most significant bits included in the received encoded frame to obtain the original data block.
  • the decoder provided in the sixth embodiment of the present invention may be used in the data decoding method provided in the foregoing corresponding embodiment 2. For the detailed process, refer to the foregoing method embodiment, and the description is not repeated here.
  • FIG. 23 is a schematic block diagram of a decoder provided in Embodiment 6 of the present invention.
  • the first frame deblocking module 1401 decomposes the information in the encoded bit stream into frame header information, symbol bit code S s c , high bit code S h e and low.
  • Bit code Sic bit code
  • Combining the frame header information H l sign bit code S s c is decoded by the sign bit decoding module 1402 to obtain the sign bit S s , and the sign bit decoding module 1402 determines the current frame by determining the 0, 1 state of each bit in the input bit stream. Positive and negative polarity of samples.
  • the high bit code S h e is decoded by the high bit decoding module 1403 to obtain high bit data S h corresponding to the encoding end, and the high bit decoding module 1403 performs entropy decoding processing.
  • the low bit code S lC is decoded by the low bit decoding module 1404 to obtain low bit data.
  • the low bit decoding module determines the effective bit number of each low bit data according to the frame header information, and The corresponding number of bits are read from the input bit stream for distortion-free decoding.
  • the low-bit decoding module 1404 classifies the current frame according to the frame header information, and performs inverse quantization processing by using a corresponding method. It recovers low-bit data with distortion and realizes distortion decoding.
  • the first inverse pre-processing module 1405 analyzes the symbol bit data S s , the high bit data S h and the low bit data to determine the symbol and sign extension bit of the original frame of one frame, and the high bit. The bit and the low bit, the reconstructed data Sr is obtained and output.
  • FIG. 24 is a schematic structural diagram of an encoder according to Embodiment 7 of the present invention.
  • the encoder provided in Embodiment 7 of the present invention includes:
  • a second pre-processing unit 1501 configured to obtain positive and negative polarities of each sample in the data block, and a most significant bit p of the sample with the largest absolute value among the samples of the data block;
  • the shifting unit 1502 is configured to obtain the most significant bit d of each sample, and shift the effective data bits of each sample to the left by p-d bits;
  • a shift information encoding unit 1503 configured to perform a fourth type of entropy encoding on each of the left shift numbers pd of each sample;
  • the effective data encoding unit 1504 is configured to respectively perform a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample;
  • the second code output unit 1505 is configured to output the encoded code frame, where the coded frame includes the most significant bit P, the codeword carrying the positive and negative polarity of each sample, and the fourth type of entropy coded left shift A coded frame consisting of a number and a fifth type of entropy coding or a second type of quantized coded valid data.
  • the encoder provided in the seventh embodiment of the present invention can be used in the data encoding method provided in the foregoing corresponding third embodiment.
  • the detailed process refer to the foregoing method embodiment, and the description is not repeated here.
  • the encoder provided by the embodiment of the present invention further includes:
  • a second polarity encoding unit 1506 configured to perform a sixth type of entropy coding on the positive and negative polarities of each sample respectively;
  • the code words carrying the positive and negative polarities of each sample in the coded frame output by the second code output unit 1505 are the sixth type of entropy coded positive and negative polarities of each sample.
  • FIG. 25 is a schematic block diagram of an encoder according to Embodiment 7 of the present invention.
  • a frame of raw data S m is input to a second pre-processing module 1601 for data analysis and processing.
  • the pre-processing includes extracting sign bits, detecting the most significant bits of a frame, and detecting the most significant bits of each sample. Bit, shifts each sample and saves the shift information and the shifted valid data.
  • the basic idea of the second pre-processing module 1601 is that the signal distribution to be encoded has randomness, and the newly generated shift information and the new data generated after shifting respectively reflect the distribution law of the original data, and different encodings can be used. The method is processed.
  • the shift information data has a non-uniform hook distribution characteristic
  • the distribution characteristics of the shifted effective data are: a non-uniform hook distribution within the entire dynamic range, but a uniform distribution within the local dynamic range, which is effective
  • the compression encoding process of the data provides a basis.
  • the symbol bit data S s , the left shift number S m and the valid data S e obtained by the second pre-processing module 1601 are sent to the sign bit encoding module 1602, the shift information encoding module 1603 and the valid data encoding module 1604, respectively, to obtain symbols.
  • the Sign Bit Encoding Module 1602 uses states 0, 1 to indicate the positive and negative polarity of each sample, and the final encoding generates a set of binary bit streams. According to the uneven distribution characteristic of the left shift number, the shift information encoding module 1603 employs distortion-free entropy coding.
  • Entropy coding may employ Huffman coding, arithmetic coding, or a combination thereof.
  • the effective data encoding module 1604 classifies the data, and the classification processing more finely reflects the distribution characteristics of each frame of data.
  • the encoder determines the effective number of valid data according to the most significant bit of the current frame and the shift information, and sequentially writes the corresponding number of bits into the output buffer to implement distortionless coding output.
  • the effective data encoding module 1604 classifies the valid data according to the most significant bit of the current frame, and selects a corresponding quantization table to quantize and encode the valid data to implement distortion compression coding.
  • FIG. 26 is a schematic structural diagram of a decoder according to Embodiment 8 of the present invention.
  • the decoder provided in Embodiment 8 of the present invention includes:
  • the second polarity acquiring unit 1701 is configured to obtain a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
  • the left shift number decoding unit 1702 is configured to decode the entropy encoded left shift number in the encoded frame to obtain a left shift number of valid data of each sample point;
  • the effective data decoding unit 1703 is configured to decode the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
  • the second data assembling unit 1704 is configured to: positive and negative polarity of each sample, left shift number of valid data, and effective after shifting according to the most significant bit of the sample with the largest absolute value included in the encoded frame. The data is assembled to obtain the original data block.
  • Embodiment 8 of the present invention may be used in the data decoding method provided in the foregoing corresponding Embodiment 4.
  • the detailed process refer to the foregoing method embodiment, and the description is not repeated herein.
  • FIG. 27 is a schematic block diagram of a decoder according to Embodiment 8 of the present invention.
  • the second frame deblocking module 1801 decomposes the information in the encoded bit stream into frame header information H 1 sign bit code S s c , and shift information code S m c And valid data encoding S e c.
  • Combining the frame header information H l sign bit code S s c is decoded by the sign bit decoding module 1802 to obtain the sign bit S s , and the sign bit decoding module 1802 determines the current frame by determining the 0, 1 state of each bit in the input bit stream. Positive and negative polarity of samples.
  • the shift information encoding S m c is decoded by the shift information decoding module 1803 to obtain a left shift number S m corresponding to the encoding end, and the shift information decoding module 1803 performs entropy decoding processing.
  • the valid data encoding S e c is decoded by the valid data decoding module 1804 to obtain valid data S e .
  • the effective data decoding module 1804 determines the effective number of bits of each valid data sample, and reads a corresponding number of bits from the input bit stream to perform distortion-free. decoding.
  • the effective data decoding module 1804 classifies the current frame according to the frame header information, performs inverse quantization processing by using a corresponding method, recovers valid data with distortion, and implements distortion decoding.
  • the second inverse pre-processing module 1805 analyzes the symbol bit data S s , the shift information data S m and the valid data S e to determine a symbol and a sign extension bit of the original signal of one frame, The information and the significant bits are shifted, and the reconstructed data Sr is obtained and output.
  • FIG. 28 and FIG. 29, FIG. 28 and FIG. 29 are respectively schematic diagrams of a data transmission system to which a data encoding method and a data decoding method according to an embodiment of the present invention are applicable.
  • the data encoding method provided in Embodiments 1 and 3 of the present invention can be used in the encoder in the figure.
  • the data decoding method provided in Embodiments 2 and 4 of the present invention can be used in the decoder in the figure, and the decoding used in the decoder.
  • the method corresponds to the encoding method.
  • the encoder and the decoder provided by the embodiments of the present invention can be applied to remote data communication (such as data communication, file transmission, voice communication, audio communication, etc.) of various channels and networks, short-range and data communication within the system (for example, general-purpose Data transmission between the IQ data in the public wireless interface, remote access, etc.), in-device or on-board modules (such as data exchange between analog-to-digital/digital-to-analog converters and other components).
  • remote data communication such as data communication, file transmission, voice communication, audio communication, etc.
  • short-range and data communication within the system for example, general-purpose Data transmission between the IQ data in the public wireless interface, remote access, etc.
  • in-device or on-board modules such as data exchange between analog-to-digital/digital-to-analog converters and other components.
  • the encoder and the decoder provided by the embodiments of the present invention can also be applied to a system for storage applications, such as efficient storage of data, digital media storage, digital library, and the like.
  • the storage medium may be a magnetic disk, an optical disk, or a read-only memory (ROM). Or random access to Random Access Memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

A data encoding method, decoding method, encoder and decoder are provided by the present invention. In the encoding method provided by the embodiments of the present invention, high bit data of communication data represent the main information of the communication data and have the characteristic of non-uniform distribution, and low bit data represent the secondary information of the communication data and are non-uniformly distributed in the whole dynamic range and more uniformly distributed in a local dynamic range. The embodiments of the present invention perform entropy encoding to the high bit data of each sampling point, and perform the entropy encoding or quantification encoding to the low bit data, which fully utilize the different distribution characteristics of the high bit data and the low bit data and have the higher encoding efficiency and higher compression ratio by selecting corresponding encoding means.

Description

数据编码方法、 解码方法、 编码器和解码器  Data encoding method, decoding method, encoder and decoder
本申请要求于 2010 年 9 月 30 日提交中国专利局、 申请号为 201010505926.8、 发明名称为 "数据编码方法、 解码方法、 编码器和解码器" 的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。  This application claims priority to Chinese Patent Application No. 201010505926.8, entitled "Data Encoding Method, Decoding Method, Encoder and Decoder", filed on September 30, 2010, the entire contents of which are hereby incorporated by reference. Combined in this application.
技术领域 本发明涉及通信技术领域, 具体涉及压缩编码方法、 解码解压方法、 装置 和通信系统。 背景技术 随着通信业务类型和业务量的日益增长,通信网络中需要进行传输的数据 量急剧增加, 因而需要更多的信道资源和存储空间。 TECHNICAL FIELD The present invention relates to the field of communications technologies, and in particular, to a compression encoding method, a decoding decompression method, an apparatus, and a communication system. BACKGROUND OF THE INVENTION With the increasing types of communication services and traffic, the amount of data that needs to be transmitted in a communication network is drastically increased, and thus more channel resources and storage space are required.
现有的通信网络中传输的信号通常包括语音、 图像和视频信号等, 这些多 媒体信号自身具有高度的相关性和统计特性, 具有较好的数学和物理模型, 因 而具有了较好的数据编码方法。  The signals transmitted in the existing communication network usually include voice, image and video signals, etc. These multimedia signals have high correlation and statistical characteristics, have good mathematical and physical models, and thus have better data encoding methods. .
发明人在研究现有技术的过程中发现,现有的数据压缩算法主要针对多媒 体数据, 由于通信数据一般不具备多媒体数据高度的相关性和统计特性, 该数 据编码方法在直接应用于通信数据的压缩时, 压缩比不够高。 发明内容 本发明提供了数据编码方法、 解码方法、 编码器和解码器, 可以对通信数 据进行高效压缩。  The inventor found in the process of studying the prior art that the existing data compression algorithm is mainly for multimedia data. Since the communication data generally does not have the high correlation and statistical characteristics of the multimedia data, the data encoding method is directly applied to the communication data. When compressed, the compression ratio is not high enough. SUMMARY OF THE INVENTION The present invention provides a data encoding method, a decoding method, an encoder, and a decoder that can efficiently compress communication data.
为解决上述技术问题, 本发明实施例是通过以下技术方案来实现的: 一方面, 提供了一种数据编码方法, 包括:  In order to solve the above technical problem, the embodiment of the present invention is implemented by the following technical solutions: On the one hand, a data encoding method is provided, including:
获取数据块中每个样点的正负极性;  Obtaining the positive and negative polarity of each sample in the data block;
获取数据块的样点中绝对值最大的样点的最高有效比特位;  Obtaining the most significant bit of the sample with the largest absolute value among the samples of the data block;
获取数据块的每个样点中从所述最高有效比特位开始的 n位高比特位数 据, 对每个样点的高比特位数据分别进行第一类熵编码, 所述 n大于 1 , 小于 所述绝对值最大的样点的有效数据的位数;  Obtaining n-bit high-bit data starting from the most significant bit in each sample of the data block, and performing first-class entropy coding on the high-bit data of each sample, where n is greater than 1 and less than The number of bits of valid data of the sample with the largest absolute value;
获取数据块的每个样点中从所述最高有效比特位开始的数据中除所述高 比特位数据之外的低比特位数据 ,对每个样点的低比特位数据分别进行第一类 量化编码或第二类熵编码; Obtaining the data from the most significant bit in each sample of the data block except the high The low bit data other than the bit data is subjected to the first type of quantization coding or the second type of entropy coding for each of the low bit data of each sample;
输出编码后的编码帧, 所述编码帧中包括所述最高有效比特位、携带数据 块的每个样点的正负极性的码字、数据块的每个样点的第一类熵编码后的高比 特位数据以及第一类量化编码或第二类熵编码后的低比特位数据。  And outputting the encoded code frame, where the coded frame includes the most significant bit, a positive and negative codeword of each sample carrying the data block, and a first type of entropy coding of each sample of the data block The subsequent high bit data and the first type of quantized code or the second type of entropy encoded low bit data.
另一方面, 提供了一种数据解码方法, 包括:  In another aspect, a data decoding method is provided, including:
获取接收到的编码帧中携带每个样点的正负极性的码字,根据所述码字获 取每个样点的正负极性;  Obtaining a codeword carrying positive and negative polarities of each sample in the received coded frame, and obtaining positive and negative polarities of each sample according to the codeword;
对所述编码帧中熵编码后的高比特位数据进行解码 ,获得每个样点的高比 特位数据;  Decoding high-bit data of the entropy-encoded data in the encoded frame to obtain high-specificity data of each sample;
对所述编码帧中量化编码或熵编码后的低比特位数据进行解码,获得每个 样点的低比特位数据;  Decoding the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample;
根据接收到的编码帧中包含的最高有效比特位对每个样点的正负极性、每 个样点的高比特位数据和低比特位数据进行组装获得原始数据块。  The original data block is obtained by assembling the positive and negative polarities of each sample, the high bit data of each sample, and the low bit data according to the most significant bits contained in the received encoded frame.
另一方面, 还提供了一种数据编码方法, 包括:  In another aspect, a data encoding method is provided, including:
获取数据块中每个样点的正负极性;  Obtaining the positive and negative polarity of each sample in the data block;
获取所述数据块的样点中绝对值最大的样点的最高有效比特位 p;  Obtaining the most significant bit p of the sample with the largest absolute value among the samples of the data block;
获取数据块的每个样点的最高有效比特位 d, 对每个样点的有效数据位分 别向左移 p-d位;  Obtaining the most significant bit d of each sample of the data block, and shifting the effective data bits of each sample to the left by p-d bits;
对数据块的每个样点的左移位数 p-d分别进行第四类熵编码;  Performing a fourth type of entropy coding on the left shift number p-d of each sample of the data block;
对数据块的每个样点中移位后的有效数据位分别进行第五类熵编码或第 二类量化编码;  Performing a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample of the data block;
输出编码后的编码帧, 所述编码帧中包含所述最高有效比特位 P、 携带每 个样点的正负极性的码字、数据块的的每个样点的第四类熵编码后的左移位数 以及第五类熵编码或第二类量化编码后的有效数据。  And outputting the encoded code frame, wherein the coded frame includes the most significant bit P, a codeword carrying positive and negative polarity of each sample, and a fourth type of entropy coding of each sample of the data block. The left shift number and the fifth type of entropy coding or the second type of quantized coded valid data.
另一方面, 还提供了一种数据解码方法, 包括:  In another aspect, a data decoding method is provided, including:
获取编码帧中携带每个样点的正负极性的码字 ,根据所述码字获取每个样 点的正负极性; 对所述编码帧中熵编码后的左移位数进行解码,获得每个样点的有效数据 的左移位数; Obtaining a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtaining positive and negative polarities of each sample according to the codeword; Decoding an entropy-encoded left shift number in the encoded frame to obtain a left shift number of valid data of each sample point;
对所述编码帧中量化编码或熵编码后的有效数据进行解码,获得每个样点 的移位后的有效数据;  Decoding the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
根据编码帧中包含的绝对值最大的样点的最高有效比特位对每个样点的 正负极性、每个样点的有效数据的左移位数以及移位后的有效数据进行组装获 得原始数据块。  The positive and negative polarities of each sample, the number of left shifts of valid data of each sample, and the valid data after shifting are assembled according to the most significant bit of the sample having the largest absolute value included in the encoded frame. Raw data block.
另一方面, 还提供了一种编码器, 包括:  In another aspect, an encoder is provided, including:
第一预处理单元, 用于获取数据块中每个样点的正负极性, 以及数据块的 样点中绝对值最大的样点的最高有效比特位;  a first pre-processing unit, configured to obtain positive and negative polarities of each sample in the data block, and a most significant bit of the sample with the largest absolute value among the samples of the data block;
高比特位编码单元,用于获取数据块中每个样点中从所述最高有效比特位 开始的 n位高比特位数据, 对每个样点的高比特位数据分别进行第一类熵编 码, 所述 n大于 1 , 小于所述绝对值最大的样点的有效数据的位数;  a high-bit coding unit, configured to acquire n-bit high-bit data from each of the most significant bits in each sample in the data block, and perform first-class entropy coding on each of the high-bit data of each sample The n is greater than 1, and is less than the number of bits of valid data of the sample having the largest absolute value;
低比特位编码单元,用于获取数据块中每个样点中从所述最高有效比特位 开始的数据中除所述高比特位数据之外的低比特位数据,对每个样点的低比特 位数据分别进行第一类量化编码或第二类熵编码;  a low bit coding unit, configured to acquire low bit data other than the high bit data in data starting from the most significant bit in each sample in the data block, low for each sample The bit data is respectively subjected to the first type of quantization coding or the second type of entropy coding;
第一编码输出单元, 用于输出编码后的编码帧, 所述编码帧中包括所述最 高有效比特位、携带数据块中每个样点的正负极性的码字、数据块中每个样点 的第一类熵编码后的高比特位数据以及第一类量化编码或第二类熵编码后的 低比特位数据组成的编码帧。  a first coding output unit, configured to output an encoded code frame, where the coded frame includes the most significant bit, a codeword carrying positive and negative polarity of each sample in the data block, and each of the data blocks The first type of entropy encoded high bit data of the sample and the encoded frame composed of the first type of quantized code or the second type of entropy coded low bit data.
另一方面, 还提供了一种解码器, 包括:  In another aspect, a decoder is provided, including:
第一极性获取单元,用于获取接收到的编码帧中携带每个样点的正负极性 的码字, 根据所述码字获取每个样点的正负极性;  a first polarity acquiring unit, configured to acquire a codeword carrying positive and negative polarities of each sample in the received encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
高比特位解码单元,用于对所述编码帧中熵编码后的高比特位数据进行解 码, 获得每个样点的高比特位数据;  a high bit decoding unit, configured to decode the entropy encoded high bit data in the encoded frame to obtain high bit data of each sample;
低比特位解码单元,用于对所述编码帧中量化编码或熵编码后的低比特位 数据进行解码, 获得每个样点的低比特位数据;  a low bit decoding unit, configured to decode the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample;
第一数据组装单元,用于根据接收到的编码帧中包含的最高有效比特位将 每个样点的正负极性、 高比特位数据和低比特位数据进行组装获得原始数据 块。 a first data assembling unit for using the most significant bit included in the received encoded frame The positive and negative polarities, high bit data, and low bit data of each sample are assembled to obtain the original data block.
另一方面, 还提供了一种编码器, 包括:  In another aspect, an encoder is provided, including:
第二预处理单元,用于获取数据块中每个样点的正负极性以及所述数据块 的样点中绝对值最大的样点的最高有效比特位 p;  a second pre-processing unit, configured to obtain positive and negative polarities of each sample in the data block and a most significant bit p of the sample with the largest absolute value among the samples of the data block;
移位单元, 用于获取数据块中每个样点的最高有效比特位 d , 对每个样点 的有效数据位分别向左移 p-d位;  a shifting unit, configured to obtain a most significant bit d of each sample in the data block, and shift the valid data bits of each sample to the left by p-d bits;
移位信息编码单元,用于对数据块中每个样点的左移位数 p-d分别进行第 四类熵编码;  a shift information encoding unit, configured to perform a fourth type of entropy encoding on each of the left shift numbers p-d of each sample in the data block;
有效数据编码单元,用于对数据块中每个样点中移位后的有效数据位分别 进行第五类熵编码或第二类量化编码;  a valid data encoding unit, configured to perform a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample in the data block;
第二编码输出单元, 用于输出编码后的编码帧, 所述编码帧中包含所述最 高有效比特位 P、 携带数据块中每个样点的正负极性的码字、 数据块的每个样 点的第四类熵编码后的左移位数以及第五类熵编码或第二类量化编码后的有 效数据。  a second code output unit, configured to output the encoded coded frame, where the coded frame includes the most significant bit P, a codeword carrying positive and negative polarity of each sample in the data block, and each of the data blocks The fourth type of entropy-coded left shift number of the samples and the fifth type of entropy coding or the second type of quantized coded valid data.
另一方面, 还提供了一种解码器, 包括:  In another aspect, a decoder is provided, including:
第二极性获取单元, 用于获取编码帧中携带每个样点的正负极性的码字, 根据所述码字获取每个样点的正负极性;  a second polarity acquiring unit, configured to acquire a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtaining positive and negative polarities of each sample according to the codeword;
左移位数解码单元, 用于对所述编码帧中熵编码后的左移位数进行解码, 获得每个样点的有效数据的左移位数;  a left shift number decoding unit, configured to decode the entropy encoded left shift number in the encoded frame, to obtain a left shift number of valid data of each sample point;
有效数据解码单元,用于对所述编码帧中量化编码或熵编码后的有效数据 进行解码, 获得每个样点的移位后的有效数据;  An effective data decoding unit, configured to decode the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
第二数据组装单元,用于根据编码帧中包含的绝对值最大的样点的最高有 效比特位对每个样点的正负极性、每个样点的有效数据的左移位数以及移位后 的有效数据进行组装获得原始数据块。  a second data assembling unit, configured to: positive and negative polarity of each sample, left shift number of valid data of each sample, and shift according to a most significant bit of a sample having the largest absolute value included in the encoded frame The valid data after the bit is assembled to obtain the original data block.
在上述的技术方案中,通信数据的高比特位数据表示的是通信数据的主要 信息, 具有非均勾分布的特性, 低比特位数据表示的是通信数据的次要信息, 在整个动态范围内呈非均匀分布,在局部动态范围内分部较为均匀, 本发明实 施例对每个样点的高比特位数据进行熵编码,对低比特位数据进行熵编码或量 化编码, 充分利用了高比特位数据和低比特位数据的不同分布特性,通过选择 对应的编码方式, 可以具有较高的编码效率, 压缩比较高。 附图说明 为了更清楚地说明本发明实施例中的技术方案,下面将对现有技术和实施 例中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是 本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的 前提下, 还可以根据这些附图获得其他的附图。 In the above technical solution, the high-bit data of the communication data represents the main information of the communication data, and has the characteristics of non-uniform hook distribution, and the low-bit data represents the secondary information of the communication data, and is within the entire dynamic range. Non-uniform distribution, the division is relatively uniform within the local dynamic range, the present invention The embodiment entropy encodes the high bit data of each sample, entropy encodes or quantizes the low bit data, and fully utilizes different distribution characteristics of the high bit data and the low bit data, by selecting the corresponding code. In this way, it can have higher coding efficiency and higher compression. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the prior art and the embodiments will be briefly described below. Obviously, the drawings in the following description are only Some embodiments of the invention may also be used to obtain other figures from these figures without departing from the art.
图 1是本发明实施例一提供的数据编码方法的流程图;  1 is a flowchart of a data encoding method according to Embodiment 1 of the present invention;
图 2是本发明实施例二提供的数据解码方法的方法流程图;  2 is a flowchart of a method for decoding a data according to Embodiment 2 of the present invention;
图 3是本发明实施例中编码前的原始数据的结构示意图;  3 is a schematic structural diagram of original data before encoding in an embodiment of the present invention;
图 4是本发明实施例中编码前的数据块的结构示意图;  4 is a schematic structural diagram of a data block before encoding in an embodiment of the present invention;
图 5 是本发明实施例一提供的数据编码方法中对数据块进行划分的示意 图;  FIG. 5 is a schematic diagram of dividing a data block in a data encoding method according to Embodiment 1 of the present invention; FIG.
图 6是本发明实施例中原始数据的概率分布图;  6 is a probability distribution diagram of original data in an embodiment of the present invention;
图 7是本发明实施例中原始数据的高比特位数据的概率分布图; 图 8是本发明实施例中原始数据的低比特位数据的概率分布图; 图 9是本发明实施例中有效比特位数 Q为 6的原始数据的低比特位数据 的概率分布图;  7 is a probability distribution diagram of high bit data of original data in the embodiment of the present invention; FIG. 8 is a probability distribution diagram of low bit data of original data in the embodiment of the present invention; FIG. 9 is a valid bit in the embodiment of the present invention; a probability distribution map of low bit data of raw data having a bit number Q of 6;
图 10是本发明实施例中有效比特位数 Q为 7的原始数据的低比特位数据 的概率分布图;  Figure 10 is a probability distribution diagram of low bit data of original data of which the effective bit number Q is 7 in the embodiment of the present invention;
图 11是本发明实施例一中的编码帧的结构示意图;  11 is a schematic structural diagram of an encoded frame in Embodiment 1 of the present invention;
图 12是本发明实施例三提供的数据编码方法的方法流程图;  FIG. 12 is a flowchart of a method for data encoding according to Embodiment 3 of the present invention; FIG.
图 13是本发明实施例四提供的数据解码方法的方法流程图;  13 is a flowchart of a method for decoding a data provided by Embodiment 4 of the present invention;
图 14是本发明实施例三提高的数据编码方法中对数据块进行划分的示意 图;  14 is a schematic diagram of dividing a data block in an improved data encoding method according to Embodiment 3 of the present invention;
图 15是本发明实施例中原始数据的左移位数的概率分布图;  15 is a probability distribution diagram of a left shift number of original data in an embodiment of the present invention;
图 16是本发明实施例中原始数据的有效数据的概率分布图; 图 17是本发明实施例中最高有效比特位数 P为 7的原始数据的有效数据 的概率分布图; 16 is a probability distribution diagram of valid data of original data in an embodiment of the present invention; 17 is a probability distribution diagram of valid data of original data with a most significant bit number P of 7 in the embodiment of the present invention;
图 18是本发明实施例中最高有效比特位数 P为 8的原始数据的有效数据 的概率分布图;  18 is a probability distribution diagram of valid data of original data with a most significant bit number P of 8 in the embodiment of the present invention;
图 19是本发明实施例三提供的编码帧的结构示意图;  19 is a schematic structural diagram of an encoded frame according to Embodiment 3 of the present invention;
图 20是本发明实施例五提供的编码器的结构示意图;  20 is a schematic structural diagram of an encoder according to Embodiment 5 of the present invention;
图 21是本发明实施例五提供的编码器的原理框图;  21 is a schematic block diagram of an encoder according to Embodiment 5 of the present invention;
图 22是本发明实施例六提供的解码器的结构示意图;  FIG. 22 is a schematic structural diagram of a decoder according to Embodiment 6 of the present invention; FIG.
图 23是本发明实施例六提供的解码器的原理框图;  23 is a schematic block diagram of a decoder provided in Embodiment 6 of the present invention;
图 24是本发明实施例七提供的编码器的结构示意图;  24 is a schematic structural diagram of an encoder according to Embodiment 7 of the present invention;
图 25是本发明实施例七提供的编码器的原理框图;  25 is a schematic block diagram of an encoder provided in Embodiment 7 of the present invention;
图 26是本发明实施例八提供的解码器的结构示意图;  26 is a schematic structural diagram of a decoder according to Embodiment 8 of the present invention;
图 27是本发明实施例八提供的解码器的原理框图;  27 is a schematic block diagram of a decoder provided in Embodiment 8 of the present invention;
图 28是本发明实施例提供的解码器和编码器的应用场景图;  28 is an application scenario diagram of a decoder and an encoder according to an embodiment of the present invention;
图 29是本发明实施例提供的解码器和编码器的又一应用场景图。 具体实施方式 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例, 本领域普通技术人员在没有做出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。  FIG. 29 is still another application scenario diagram of a decoder and an encoder provided by an embodiment of the present invention. The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. example. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without the creative work are all within the scope of the present invention.
本发明提供了一种数据编码方法、 解码方法, 解码器和编码器。 为了更好 的理解本发明的技术方案,下面结合附图对本发明提供的实施例进行详细地描 述。  The present invention provides a data encoding method, a decoding method, a decoder and an encoder. In order to better understand the technical solutions of the present invention, the embodiments provided by the present invention will be described in detail below with reference to the accompanying drawings.
参见图 1 , 图 1是本发明实施例一提供的数据编码方法的流程图。  Referring to FIG. 1, FIG. 1 is a flowchart of a data encoding method according to Embodiment 1 of the present invention.
在本发明实施例中, 需要编码的通信数据可以以数据块为单位。 其中, 数 据块中包含的样点个数可以根据编码的压缩比以及延时要求来确定,如延时要 求越低, 数据块中包含的样点的数量越多, 压缩比越高, 数据块中包含的样点 的数量越多。 本发明实施例一提供的数据编码方法可以包括: 101、 获取数据块中每个样点的正负极性。 In the embodiment of the present invention, the communication data that needs to be encoded may be in units of data blocks. The number of samples included in the data block can be determined according to the compression ratio of the code and the delay requirement. For example, the lower the delay requirement, the larger the number of samples included in the data block, and the higher the compression ratio, the data block. The more samples are included in the sample. The data encoding method provided in the first embodiment of the present invention may include: 101. Obtain the positive and negative polarity of each sample in the data block.
具体的,编码器可以获取需要编码的数据块中每个样点的正负极性。其中, 数据块由 L个样点组成, L的大小是可调的。数据块中每个样点可以补码的形 式表示。  Specifically, the encoder can obtain the positive and negative polarities of each sample in the data block that needs to be encoded. Among them, the data block is composed of L samples, and the size of L is adjustable. Each sample in the data block can be represented in the form of a complement.
编码器可以根据每个样点的符号位来获取数据块中每个样点的正负极性。 The encoder can obtain the positive and negative polarity of each sample in the data block according to the sign bit of each sample.
102、 获取数据块的样点中绝对值最大的样点的最高有效比特位。 102. Acquire a most significant bit of the sample with the largest absolute value among the samples of the data block.
具体的,编码器可以对数据块的 L个样点分别取绝对值,然后获得绝对值 最大的样点,获取该绝对值最大的样点的最高有效比特位。在本发明实施例中, 样点的绝对值的比特位的最高位称为样点的最高有效比特位。或者说, 最高有 效比特位,从非符号位从右往左数的第一个非零比特位为最高有效比特位。可 以理解的是, 最高有效比特位也可以适当的高于该非零比特位。  Specifically, the encoder can take an absolute value for each of the L samples of the data block, and then obtain the sample with the largest absolute value, and obtain the most significant bit of the sample with the largest absolute value. In the embodiment of the present invention, the highest bit of the bit of the absolute value of the sample is referred to as the most significant bit of the sample. In other words, the most significant bit, the first non-zero bit from the right to left of the non-sign bit is the most significant bit. It will be appreciated that the most significant bit may also be suitably higher than the non-zero bit.
103、 获取每个样点中从最高有效比特位开始的 n位高比特位数据, 对每 个样点的高比特位数据分别进行第一类熵编码, n大于 1 , 小于绝对值最大的 样点的有效数据的位数。  103. Obtain n-bit high-bit data starting from the most significant bit in each sample, and perform first-class entropy coding on the high-bit data of each sample, where n is greater than 1, and is smaller than the absolute maximum. The number of bits of valid data for the point.
在本发明实施例中, 编码器在获得数据块的最高有效比特位之后,将从最 高有效比特开始向右数 n个比特划分为高比特位数据,剩余比特划分为低比特 位数据, 其中 n为大于 1 , 小于绝对值最大的样点的有效数据的位数的整数。 其中, n值的大小可以根据不同的通信数据的高比特位数据的统计规律来进行 确定。 在本发明实施例中, 每个样点中除符号位、 符号扩展位、 填充的零之后 的比特称为有效数据。 例如, -5 , 用补码的形式表示, 为 10000101 , 第一位为 符号位, 用 "1" 表示负极性, "000" 为填充的零, "101 " 为有效数据。  In the embodiment of the present invention, after obtaining the most significant bit of the data block, the encoder divides the right number of bits from the most significant bit into high-bit data, and the remaining bits are divided into low-bit data, where n An integer that is greater than 1, less than the number of significant digits of the valid data for the sample with the largest absolute value. Wherein, the size of the n value can be determined according to the statistical rule of the high bit data of different communication data. In the embodiment of the present invention, bits other than the sign bit, the sign extension bit, and the padded zero in each sample are referred to as valid data. For example, -5 , expressed in the form of complement, is 10000101, the first digit is a sign bit, with "1" for negative polarity, "000" for filled zero, and "101" for valid data.
具体的, 编码器对每个样点的高比特位数据分别进行第一类熵编码, 例如 进行霍夫曼编码或算术编码等。  Specifically, the encoder performs first-class entropy coding on the high-bit data of each sample, for example, performing Huffman coding or arithmetic coding.
104、 获取每个样点中从最高有效比特位开始的数据中除高比特位数据之 外的低比特位数据,对每个样点的低比特位数据分别进行第一类量化编码或第 二类熵编码。  104. Obtain low-bit data other than the high-bit data in the data starting from the most significant bit in each sample, and perform first-class quantization coding or second on each low-bit data of each sample. Class entropy coding.
具体的,编码器获取每个样点中从最高有效比特位开始的数据中除高比特 位数据之外的低比特位数据 ,对每个样点的低比特位数据分别进行第一类量化 编码或第二类熵编码, 例如第二类熵编码可以为霍夫曼编码, 第一类量化编码 可以为非均勾量化编码等。 Specifically, the encoder obtains low-bit data other than the high-bit data in the data starting from the most significant bit in each sample, and performs the first-class quantization encoding on the low-bit data of each sample respectively. Or a second type of entropy coding, for example, the second type of entropy coding may be Huffman coding, the first type of quantization coding It can be non-equalized and quantized.
在本发明实施例中, 第一类熵编码、第二类熵编码以及第三类熵编码的类 型均是熵编码, 但具体釆用的熵编码类型可以根据具体的数据统计规律来确 定, 比如 Huffman编码, 算术编码和游程长度编码等。  In the embodiment of the present invention, the types of the first type of entropy coding, the second type of entropy coding, and the third type of entropy coding are entropy coding, but the specific entropy coding type may be determined according to specific statistical rules of data, such as Huffman coding, arithmetic coding and run length coding.
105、 输出编码后的编码帧, 编码帧中包括最高有效比特位、 携带每个样 点的正负极性的码字、每个样点的第一类熵编码后的高比特位数据以及第一类 量化编码或第二类熵编码后的低比特位数据。  105. Output an encoded code frame, where the coded frame includes a most significant bit, a codeword carrying positive and negative polarity of each sample, a first type of entropy coded high bit data of each sample, and a first A type of quantized coding or a second type of entropy encoded low bit data.
具体的, 编码器在对高比特位数据和低比特位数据编码完成后, 输出编码 后的编码帧, 该编码帧中包括最高有效比特位、携带每个样点的正负极性的码 字、每个样点的第一类熵编码后的高比特位数据以及第一类量化编码或第二类 熵编码后的低比特位数据组成的编码帧, 多个编码帧构成编码比特流, 完成数 据编码过程。 可以理解的是, 最高有效比特位可以携带在编码帧的帧头中。  Specifically, after encoding the high bit data and the low bit data, the encoder outputs the encoded code frame, where the code frame includes the most significant bit, and the code word carrying the positive and negative polarity of each sample. a first type of entropy encoded high bit data of each sample and a coded frame composed of a first type of quantized code or a second type of entropy coded low bit data, wherein the plurality of coded frames constitute an encoded bit stream, Data encoding process. It will be appreciated that the most significant bit can be carried in the header of the encoded frame.
在本发明实施例中,通信数据的高比特位数据具有非均勾分布的特性,低 比特位数据在整个动态范围内呈非均匀分布, 在局部动态范围内分部较为均 匀, 本发明实施例对每个样点的高比特位数据进行第一类熵编码,对低比特位 数据进行第二类熵编码或第一类量化编码,充分利用了高比特位数据和低比特 位数据的不同分布特性,通过选择对应的编码方式,可以具有较高的编码效率, 压缩比较高。  In the embodiment of the present invention, the high-bit data of the communication data has the characteristics of a non-uniform hook distribution, and the low-bit data is non-uniformly distributed in the entire dynamic range, and the segments are relatively uniform in the local dynamic range. The first type of entropy coding is performed on the high bit data of each sample, and the second type entropy coding or the first type of quantization coding is performed on the low bit data, which fully utilizes different distributions of high bit data and low bit data. The feature, by selecting the corresponding coding mode, can have higher coding efficiency and higher compression.
进一步的, 在本发明实施例中,携带每个样点的正负极性的码字可以为不 经过熵编码的每个样点的正负极性,或者每个样点的第三类熵编码后的正负极 性。 对应的, 编码后输出的编码帧中包括最高有效比特位、 每个样点的第三类 熵编码后的正负极性、第一类熵编码后的高比特位数据以及第一类量化编码或 第二类熵编码后的低比特位数据。在本发明实施例中,对每个样点的正负极性 进行第三类熵编码可以进一步提高编码效率。  Further, in the embodiment of the present invention, the code characters carrying the positive and negative polarities of each sample may be the positive and negative polarities of each sample without entropy coding, or the third type of entropy of each sample. Positive and negative polarity after encoding. Correspondingly, the coded frame outputted after coding includes the most significant bit, the third type of entropy coded positive and negative polarity of each sample, the first type of entropy coded high bit data, and the first type of quantization code. Or a second type of entropy encoded low bit data. In the embodiment of the present invention, the third type of entropy coding for the positive and negative polarities of each sample can further improve the coding efficiency.
在本发明实施例中,在对高比特位数据和低比特位数据进行编码时可以选 择预设的编码方式和编码参数,编码方式和编码参数在本发明实施例中统称为 编码信息。 另外, 编码器在进行对高比特位数据和低比特位数据进行编码时, 还可以根据不同类型的通信数据灵活选择编码方式和编码参数,此时本发明实 施例提供的编码方法还包括:获取每个样点的高比特位数据第一类熵编码的编 码信息和低比特位数据第一类量化编码或第二类熵编码的编码信息。编码器在 获得编码信息后, 将编码信息通过编码帧发送, 以便于解码器根据编码信息进 行对应的解码。在本发明实施例中, 编码帧中还进一步包括每个样点的高比特 位数据第一类熵编码的编码信息和低比特位数据第二类熵编码或第一类量化 编码的编码信息。 In the embodiment of the present invention, when the high-bit data and the low-bit data are encoded, a preset encoding mode and an encoding parameter may be selected, and the encoding mode and the encoding parameter are collectively referred to as encoding information in the embodiment of the present invention. In addition, when the encoder performs the encoding of the high-bit data and the low-bit data, the encoding method and the encoding parameter can be flexibly selected according to different types of communication data. The encoding method provided by the embodiment of the present invention further includes: acquiring The first class of entropy coding for the high bit data of each sample Code information and low bit data The first type of quantized code or the second type of entropy coded coded information. After obtaining the encoded information, the encoder transmits the encoded information through the encoded frame, so that the decoder performs corresponding decoding according to the encoded information. In the embodiment of the present invention, the encoded frame further includes a first type of entropy encoded coding information and a low bit data second type entropy coding or a first type of quantized coding information of the high bit data of each sample.
在本发明实施例中,通过在编码帧中增加编码信息, 可以使得编码器在进 行熵编码或量化编码可以选择更多的编码方式, 而不受预设的编码方式的限 制, 适应范围更广。 实施例二  In the embodiment of the present invention, by adding coding information to the coded frame, the encoder can select more coding modes by performing entropy coding or quantization coding, without being limited by the preset coding mode, and the adaptation range is wider. . Embodiment 2
参见图 2, 图 2是本发明实施例二提供的数据解码方法的方法流程图。 在本发明实施例中,解码器在接收到编码器发送的编码比特流之后,解码 器以帧为单位对编码比特流进行解码,在本发明实施例二提供的数据编码方法 可以包括:  Referring to FIG. 2, FIG. 2 is a flowchart of a method for decoding a data according to Embodiment 2 of the present invention. In the embodiment of the present invention, after the decoder receives the encoded bit stream sent by the encoder, the decoder decodes the encoded bit stream in units of frames. The data encoding method provided in the second embodiment of the present invention may include:
201、 获取接收到的编码帧中携带每个样点的正负极性的码字, 根据码字 获取每个样点的正负极性。  201. Acquire a codeword carrying positive and negative polarity of each sample in the received coded frame, and obtain positive and negative polarity of each sample according to the codeword.
具体的,解码器获取编码帧中携带每个样点的正负极性的码字,根据该码 字来获取每个样点的正负极性。 其中,携带每个样点的正负极性的码字可以为 每个样点的正负极性, 解码器不需要解码即可获得每个样点的正负极性。  Specifically, the decoder obtains the code words carrying the positive and negative polarities of each sample in the encoded frame, and obtains the positive and negative polarities of each sample according to the code words. Among them, the code characters carrying the positive and negative polarities of each sample can be the positive and negative polarity of each sample, and the decoder can obtain the positive and negative polarity of each sample without decoding.
202、 对编码帧中熵编码后的高比特位数据进行解码, 获得每个样点的高 比特位数据。  202. Decode the high-bit data after entropy coding in the encoded frame to obtain high-bit data of each sample.
具体的,解码器可以根据数据块中包含的样点的个数对编码帧中熵编码后 的高比特位数据按照与编码方式对应的解码方式进行解码 ,获得每个样点的高 比特位数据。  Specifically, the decoder can decode the entropy-encoded high-bit data in the encoded frame according to the decoding manner corresponding to the encoding mode according to the number of samples included in the data block, and obtain high-bit data of each sample. .
其中,编码器使用的编码方式和解码器使用的解码方式可以为预设的编码 方式和解码方式。  The coding mode used by the encoder and the decoding mode used by the decoder may be preset coding modes and decoding modes.
203、 对编码帧中量化编码或熵编码后的低比特位数据进行解码, 获得每 个样点的低比特位数据。 具体的,解码器可以根据数据块中包含的样点的个数对编码帧中量化编码 或熵编码后的低比特位数据按照与编码器使用的编码方式对应的解码方式进 行解码, 进而获得每个样点的低比特位数据。 203. Decode low-bit data after quantization coding or entropy coding in the encoded frame to obtain low-bit data of each sample. Specifically, the decoder may decode the quantized or entropy-coded low-bit data in the encoded frame according to the decoding mode corresponding to the encoding mode used by the encoder according to the number of samples included in the data block, thereby obtaining each Low bit data of samples.
204、 根据接收到的编码帧中包含的最高有效比特位将每个样点的正负极 性、 高比特位数据和低比特位数据进行组装获得原始数据块。  204. Assemble the positive and negative polarities, the high bit data, and the low bit data of each sample according to the most significant bits included in the received encoded frame to obtain the original data block.
在本发明实施例中,每个样点以补码的形式进行存储,样点的位数例如为 16位、 32位等。 解码器在获得每个样点的正负极性、 解码后的高比特位数据 和解码后的低比特位数据之后, 按照符号位、 高比特位数据、 低比特位数据的 顺序将每个样点的正负极性、对应的高比特位数据和低比特位数据进行组装获 得原始数据块, 完成数据解码过程。 其中, 在进行数据组装的过程中需要根据 接收到的编码帧中包含的最高有效比特位来确定每个样点的符号扩展位中零 的个数。  In the embodiment of the present invention, each sample is stored in the form of a complement, and the number of bits of the sample is, for example, 16 bits, 32 bits, or the like. After obtaining the positive and negative polarity of each sample, the decoded high bit data, and the decoded low bit data, the decoder will each sample in the order of the sign bit, the high bit data, and the low bit data. The positive and negative polarities of the points, the corresponding high bit data, and the low bit data are assembled to obtain the original data block, and the data decoding process is completed. Wherein, in the process of data assembly, it is necessary to determine the number of zeros in the sign extension bits of each sample according to the most significant bits contained in the received coded frame.
在本发明实施例提供的解码方法为实施例一中提供的编码方法提供支持, 由于通信数据的高比特位数据表示的是通信数据的主要信息,具有非均匀分布 的特性,低比特位数据表示的是通信数据的次要信息,在整个动态范围内呈非 均匀分布, 在局部动态范围内分部较为均匀, 本发明实施例对每个样点的高比 特位数据进行熵编码,对低比特位数据进行熵编码或量化编码, 充分利用了高 比特位数据和低比特位数据的不同分布特性,通过选择对应的编码方式, 可以 具有较高的编码效率, 数据压缩比较高。  The decoding method provided by the embodiment of the present invention provides support for the encoding method provided in the first embodiment. Since the high bit data of the communication data represents the main information of the communication data, it has a non-uniform distribution characteristic, and the low bit data represents The secondary information of the communication data is non-uniformly distributed over the entire dynamic range, and the segments are relatively uniform within the local dynamic range. In the embodiment of the present invention, the high-bit data of each sample is entropy encoded, and the low-bit is used. The bit data is entropy coded or quantized, and the different distribution characteristics of the high bit data and the low bit data are fully utilized. By selecting the corresponding coding mode, the coding efficiency can be high and the data compression is relatively high.
进一步的 ,在本发明实施例中根据码字获取每个样点的正负极性具体可以 为:对每个样点的正负极性的码字分别进行熵解码,获得每个样点的正负极性。 其中,对正负极性的码字进行熵解码的解码方式和发送端对每个样点的正负极 性进行第三类熵编码的编码方式对应。  Further, in the embodiment of the present invention, the positive and negative polarities of each sample are obtained according to the codeword, and the positive and negative polarity codewords of each sample are separately entropy decoded to obtain each sample point. Positive and negative polarity. The decoding method for entropy decoding the positive and negative polarity code words corresponds to the coding method for the third type entropy coding for the positive and negative polarities of each sample.
进一步的 ,编码器发送的编码帧中还可以包括每个样点的高比特位数据熵 编码的编码信息和低比特位数据熵编码或量化编码的编码信息,其中编码信息 包括编码方式和编码参数, 编码参数中可以包括编码使用的量化表格。 可以理 解的是, 编码信息可以携带在编码帧的帧头中。  Further, the encoded frame sent by the encoder may further include high bit data entropy encoded coding information and low bit data entropy coding or quantized coding information of each sample, where the coding information includes an encoding mode and an encoding parameter. The coding parameters may include a quantization table used for coding. It can be understood that the encoded information can be carried in the header of the encoded frame.
在编码帧中携带编码信息的情况下 ,对编码帧中熵编码后的高比特位数据 进行解码, 获得每个样点的高比特位数据的步骤(202 ) , 具体为: 根据每个 样点的高比特位数据熵编码的编码信息对编码帧中熵编码后的高比特位数据 进行熵解码, 获得每个样点的高比特位数据。 其中, 对该熵编码后的高比特位 数据进行熵解码的解码方式根据编码信息来确定,即釆用和编码方式和对应的 解码方式对熵编码后的高比特位数据进行解码。 In the case that the encoded frame carries the encoded information, the step of decoding the high-bit-encoded high-bit data in the encoded frame to obtain the high-bit data of each sample is as follows: The high-bit data entropy-encoded coding information of the sample entropy-decodes the entropy-encoded high-bit data in the encoded frame to obtain high-bit data of each sample. The decoding method for entropy decoding the entropy-encoded high-bit data is determined according to the encoding information, that is, the entropy-encoded high-bit data is decoded by using the encoding method and the corresponding decoding method.
另外,在编码帧中携带编码信息的情况下, 上述对编码帧中量化编码或熵 编码后的低比特位数据进行解码, 获得每个样点的低比特位数据的步骤(203 ) 具体为:根据每个样点的低比特位数据熵编码或量化编码的编码信息对编码帧 中量化编码或熵编码后的低比特位数据进行解码,获得每个样点的低比特位信 息。其中,对编码帧中量化编码或熵编码后的低比特位数据进行解码的解码方 式才艮据编码信息来确定,即釆用和编码方式和对应的解码方式对熵编码或量化 编码后的低比特位数据进行解码。  In addition, in the case that the encoded information is carried in the encoded frame, the step of decoding the low-bit data of the quantized or entropy-encoded data in the encoded frame to obtain the low-bit data of each sample is specifically: The quantized or entropy encoded low bit data in the encoded frame is decoded according to the low bit data entropy encoded or quantized encoded information of each sample to obtain low bit information of each sample. The decoding method for decoding the quantized or entropy encoded low-bit data in the encoded frame is determined according to the encoding information, that is, the encoding and the encoding method and the corresponding decoding manner are low after entropy encoding or quantization encoding. The bit data is decoded.
进一步的, 在本发明实施例中, 上述对编码帧中量化编码或熵编码后的低 比特位数据进行解码, 获得每个样点的低比特位数据的步骤(203 )具体可以 包括:  Further, in the embodiment of the present invention, the step of decoding the low-bit data of the quantized or entropy-encoded data in the encoded frame to obtain the low-bit data of each sample may include:
1 )对编码帧中熵编码后的低比特数据进行熵解码, 获得每个样点的低比 特位数据。  1) Entropy decoding the entropy-encoded low-bit data in the encoded frame to obtain low-bit data of each sample.
2 )对编码帧中量化编码后的低比特位数据进行反量化处理, 获得每个样 点的低比特位数据, 从而有失真的恢复低比特位数据。 为更详细的理解本发明实施例一提供的数据编码方法、实施例二提供的数 据解码方法, 下面再给出本发明实施例的具体应用场景。  2) Perform inverse quantization processing on the quantized low-bit data in the encoded frame to obtain low-bit data of each sample, thereby recovering the low-bit data with distortion. For a more detailed understanding of the data encoding method provided in Embodiment 1 of the present invention and the data decoding method provided in Embodiment 2, a specific application scenario of the embodiment of the present invention is further given below.
参见图 3 , 图 3是本发明实施例中编码前的原始数据的结构示意图。  Referring to FIG. 3, FIG. 3 is a schematic structural diagram of original data before encoding in an embodiment of the present invention.
其中, S表示符号位所占据的比特位, 共 m比特, D表示有效数据占据的 比特位, 共 n比特。 图中 BH表示数据的最高比特位、 BL表示数据的最低比特 位、 BM表示数据有效位的最高比特位。 Where S denotes the bit occupied by the sign bit, a total of m bits, and D denotes the bit occupied by the valid data, a total of n bits. In the figure, B H represents the highest bit of the data, B L represents the lowest bit of the data, and B M represents the highest bit of the data valid bit.
参见图 4, 图 4是本发明实施例中编码前的数据块的结构示意图。  Referring to FIG. 4, FIG. 4 is a schematic structural diagram of a data block before encoding according to an embodiment of the present invention.
其中, 编码器以数据块为单位对原始数据进行编码,根据原始数据的分布 特点, 数据块中每个样点的 S区域和 D区域具有随机性。  The encoder encodes the original data in units of data blocks. According to the distribution characteristics of the original data, the S area and the D area of each sample in the data block are random.
参见图 5 , 图 5是本发明实施例中对数据块进行划分的示意图。 编码器对数据块进行划分, 得到符号位、 高比特位和低比特位, 每个部分 分别占 n0、 nl和 n2比特。 编码器在对数据块进行划分时, 首先提取数据块中 各个样点的符号位 Ss, 根据符号位获取每个样点的正负极性。 编码器可以对 每个样点取绝对值,获取 L个样点中绝对值最大的样点,确定该样点的最高有 效比特位。在确定最高有效比特位后, 将每个样点中从最高有效比特位开始向 右数 nl个比特划分为高比特位数据 Sh, 将有效数据中的剩余 n2比特划分为 低比特位数据 S。 Referring to FIG. 5, FIG. 5 is a schematic diagram of dividing a data block in an embodiment of the present invention. The encoder divides the data block to obtain a sign bit, a high bit, and a low bit, each of which occupies n0, n1, and n2 bits, respectively. When the encoder divides the data block, it first extracts the sign bit Ss of each sample point in the data block, and obtains the positive and negative polarity of each sample according to the sign bit. The encoder can take an absolute value for each sample, obtain the sample with the largest absolute value among the L samples, and determine the most significant bit of the sample. After determining the most significant bit, the n1 bits from the most significant bit in each sample are divided into high bit data S h , and the remaining n 2 bits in the valid data are divided into low bit data S .
其中, 本发明实施例可以使用状态 0、 1来表示每帧数据中各个样点的正负 极性, 例如, 0标识该样点为负, 1标识该样点为正; 或者 0表示样点值为正, 而 1表示样点值为负。 每个样点的符号位在进行处理后, 获得二进制的携带每 个样点的正负极性的码字 Ssc。 The embodiment of the present invention can use the states 0 and 1 to indicate the positive and negative polarity of each sample in each frame of data. For example, 0 indicates that the sample is negative, 1 indicates that the sample is positive; or 0 indicates a sample. The value is positive and 1 means the sample value is negative. After the sign bit of each sample is processed, a binary code word S s c carrying the positive and negative polarities of each sample is obtained.
图 6所示是一个原始数据的概率分布实例, 它所对应的高比特位数据的概 率分布由图 7给出。 可以看出, 高比特位数据 Sh出现的概率是不均等的, 这就 为釆用熵编码进行数据压缩提供了依据 ,因此本发明实施例釆用熵编码方法对 高比特位数据 Sh进行无失真的熵编码, 得到高比特位数据熵编码 She。 熵编码 可以釆用 Huffman编码、算术编码或其它不等长编码算法、或它们的组合算法。 其中,对高比特位数据进行熵编码的编码方式和编码参数等编码信息可以保存 在帧头信息中, 帧头信息保存在编码帧中进行输出。 和有失真编码(量化编码)两种方法。 在有失真编码模式下, 为了使编码器保 持比较低的算法复杂度, 可以釆用算法简单的标量量化方法。在进行量化编码 时需要获取低比特位数据的动态范围,根据该动态范围确定标量量化表, 然后 根据标量量化表进行编码。 Figure 6 shows an example of the probability distribution of the original data, and the probability distribution of the corresponding high-bit data is given by Figure 7. It can be seen that the probability of occurrence of the high bit data S h is unequal, which provides a basis for data compression using entropy coding. Therefore, the embodiment of the present invention uses the entropy coding method to perform high bit data Sh Undistorted entropy coding yields high bit data entropy coding S h e. Entropy coding may employ Huffman coding, arithmetic coding or other unequal length coding algorithms, or a combination thereof. The coding information such as the entropy coding and the coding parameters for entropy coding of the high bit data may be stored in the frame header information, and the frame header information is stored in the coding frame for output. And there are two methods of distortion coding (quantization coding). In the distortion coding mode, in order to keep the encoder low algorithm complexity, a simple scalar quantization method can be used. When performing quantization coding, it is necessary to acquire the dynamic range of the low bit data, determine the scalar quantization table based on the dynamic range, and then perform encoding according to the scalar quantization table.
在实际应用中,有效数据在整个动态范围之内呈非均匀分布,但在局部动 态范围内分布较为均匀。 图 6所示是一个原始数据 S的概率分布实例, 它所对应 的低比特位数据的概率分布由图 8给出, 可以看出, 低比特位数据整体上为非 均匀分布, 动态范围较大。 在低比特位数据的有效比特数 Q已知的情况下, 可 以将进行分类, 图 9和图 10分别给出了有效比特位数 Q为 6和 7的低比特位数据 的概率分布, 可以看出其分布较为均勾, 动态范围较小, 如果对两部分数据分 开量化, 量化更加精确。 因此对低比特位数据的压缩编码算法可以釆用分类的 量化编码算法, 例如釆用 Lloyd-Max非均匀标量量化算法。 其中, 对低比特位 数据进行熵编码或量化编码的编码方式和编码参数等编码信息可以保存在帧 头信息中, 帧头信息通过编码帧进行输出。 In practical applications, the effective data is non-uniformly distributed over the entire dynamic range, but distributed evenly within the local dynamic range. Figure 6 shows an example of the probability distribution of the original data S. The probability distribution of the low-bit data corresponding to it is given by Figure 8. It can be seen that the low-bit data is non-uniformly distributed as a whole, and the dynamic range is large. . In the case where the effective bit number Q of the low bit data is known, classification can be performed, and FIG. 9 and FIG. 10 respectively show low bit data of the effective bit number Q of 6 and 7. The probability distribution shows that the distribution is relatively uniform and the dynamic range is small. If the two parts of data are separately quantified, the quantization is more accurate. Therefore, the compression coding algorithm for low-bit data can use the classified quantization coding algorithm, for example, the Lloyd-Max non-uniform scalar quantization algorithm. The coding information such as the entropy coding or the quantization coding of the low bit data and the coding information such as the coding parameters may be stored in the frame header information, and the frame header information is output through the coding frame.
在本发明实施例中, 编码器将编码后得到的正负极性编码的码字 Ssc、 高 比特位编码 Shc和低比特位编码 SlC组合, 结合帧头信息, 组成一个完整的编码 帧, 图 11给出了本发明实施例提供的编码比特流 B1中编码帧的结构示意图。 不同编码帧按照输出的时间顺序排列, 便形成了编码器输出的编码比特流 B1 , 如图 11所示。 其中, 帧头信息中还可以包括数据块中样点的个数, 数据块中的 最高有效比特位等。 需要说明的是,如果编码器和解码器使用预设的解码类型 和编码类型,并且数据块中每个样点的长度、样点的个数均是预设值的情况下, 编码帧中可以不需要携带帧头信息。 In the embodiment of the present invention, the encoder combines the positive and negative polarity encoded codeword S s c , the high bit code S h c and the low bit code S lC obtained by encoding, and combines the frame header information to form a complete The coded frame, FIG. 11 is a schematic structural diagram of the coded frame in the coded bit stream B1 provided by the embodiment of the present invention. The different coded frames are arranged in chronological order of the output to form an encoded bit stream B1 output by the encoder, as shown in FIG. The frame header information may further include the number of samples in the data block, the most significant bit in the data block, and the like. It should be noted that, if the encoder and the decoder use the preset decoding type and encoding type, and the length of each sample in the data block and the number of samples are preset values, the encoded frame may be No need to carry frame header information.
在解码器, 以编码帧为单位对编码比特流进行解码,解码器可以读取帧头 信息并保存, 接下来根据二进制比特流的 0、 1状态来确定每个样点的正负极 性。 其次, 解码器进行无失真的熵解码恢复高比特位数据并保存, 熵解码釆用 的具体方法要和编码器相对应。在根据帧头信息获得编码器对低比特位数据进 行熵编码的情况下,解码器通过帧头信息确定低比特位数据的有效比特数, 并 对熵编码后的低比特位数据进行熵解码,进而实现对低比特位数据的无失真解 码。 而有失真编码时, 解码器对编码后的低比特数据进行反量化处理, 具体过 程包括: 从输入比特流中恢复低比特位数据的量化下标值, 然后根据帧头信息 确定了低比特位数据的动态范围, 以此确定标量量化码表, 进行反量化处理, 通过下标索引在量化表中搜索对应的量化值, 实现低比特数据位的有失真解 码。 最后, 解码器根据解码得到的每个样点的正负极性、 高比特位数据和低比 特位数据进行组装, 得到原始数据块并输出, 完成一个编码帧的解码, 并准备 进行下一帧的解码, 直到解码结束。 实施例三  At the decoder, the encoded bit stream is decoded in units of coded frames, the decoder can read the frame header information and save, and then the positive and negative polarities of each sample are determined based on the 0, 1 state of the binary bit stream. Secondly, the decoder performs distortion-free entropy decoding to recover high-bit data and save it. The specific method of entropy decoding corresponds to the encoder. In the case where the encoder obtains the entropy encoding of the low bit data according to the frame header information, the decoder determines the effective bit number of the low bit data through the frame header information, and performs entropy decoding on the entropy encoded low bit data. Further, distortion-free decoding of low-bit data is achieved. When there is distortion coding, the decoder performs inverse quantization processing on the encoded low-bit data, and the specific process includes: recovering the quantized subscript value of the low-bit data from the input bit stream, and then determining the low-bit according to the frame header information. The dynamic range of the data is used to determine the scalar quantization code table, perform inverse quantization processing, search for the corresponding quantized value in the quantization table by the subscript index, and realize distortion decoding of the low bit data bits. Finally, the decoder assembles the positive and negative polarities, high-bit data and low-bit data of each sample obtained by decoding, obtains the original data block and outputs, completes decoding of one encoded frame, and prepares to proceed to the next frame. Decoding until the end of decoding. Embodiment 3
参见图 12, 图 12是本发明实施例三提供的数据编码方法的方法流程图。 在本发明实施例提供的数据编码方法可以包括: Referring to FIG. 12, FIG. 12 is a flowchart of a method for encoding a data according to Embodiment 3 of the present invention. The data encoding method provided by the embodiment of the present invention may include:
在本发明实施例中, 需要编码的通信数据可以以数据块为单位。 其中, 数 据块中包含的样点个数可以根据编码的压缩比以及延时要求来确定,即延时要 求越低, 数据块中包含的样点的数量越多, 压缩比越高, 数据块中包含的样点 的数量越多。 本发明实施例三提供的数据编码方法可以包括:  In the embodiment of the present invention, the communication data that needs to be encoded may be in units of data blocks. The number of samples included in the data block can be determined according to the compression ratio of the code and the delay requirement, that is, the lower the delay requirement, the more the number of samples included in the data block, the higher the compression ratio, the data block The more samples are included in the sample. The data encoding method provided in Embodiment 3 of the present invention may include:
301、 获取数据块中每个样点的正负极性。  301. Obtain the positive and negative polarity of each sample in the data block.
具体的,编码器可以获取需要编码的数据块中每个样点的正负极性。其中, 数据块由 L个样点组成, L的大小是可调的。数据块中每个样点以补码的形式 表示。  Specifically, the encoder can obtain the positive and negative polarities of each sample in the data block that needs to be encoded. Among them, the data block is composed of L samples, and the size of L is adjustable. Each sample in the data block is represented in the form of a complement.
编码器可以根据每个样点的符号位来获取数据块中每个样点的正负极性。 The encoder can obtain the positive and negative polarity of each sample in the data block according to the sign bit of each sample.
302、 获取数据块的样点中绝对值最大的样点的最高有效比特位 p。 302. Acquire a most significant bit p of the sample with the largest absolute value among the samples of the data block.
具体的,编码器可以对数据块的 L个样点分别取绝对值,然后获得绝对值 最大的样点, 获取该绝对值最大的样点的最高有效比特位 。 在本发明实施例 中, 样点的绝对值的最高位称为样点的最高有效比特位。  Specifically, the encoder can take an absolute value for each of the L samples of the data block, and then obtain the sample with the largest absolute value, and obtain the most significant bit of the sample with the largest absolute value. In the embodiment of the invention, the most significant bit of the absolute value of the sample is referred to as the most significant bit of the sample.
303、 获取每个样点的最高有效比特位 d, 对每个样点的有效数据位分别 向左移 p-d位。  303. Obtain the most significant bit d of each sample, and shift the valid data bits of each sample to the left by p-d bits.
在本发明实施例中, 编码器在获得数据块的最高有效比特位之后, 进一步 获取每个样点的最高有效比特位 d,对每个样点的有效数据位分别进行左移 p-d 位。 其中, 样点的有效数据位为样点的二进制补码中除符号位以外的数据位。  In the embodiment of the present invention, after obtaining the most significant bit of the data block, the encoder further obtains the most significant bit d of each sample, and shifts the effective data bits of each sample to the left by p-d bits. Wherein, the valid data bits of the sample point are data bits other than the sign bit in the two's complement of the sample.
304、 对每个样点的左移位数 p-d分别进行第四类熵编码。  304. Perform a fourth type of entropy coding on the left shift number p-d of each sample.
具体的, 编码器对每个样点的左移位数分布进行第四类熵编码, 例如进行 霍夫曼编码或算术编码等。  Specifically, the encoder performs a fourth type of entropy coding on the left shift number distribution of each sample, for example, performing Huffman coding or arithmetic coding.
305、 对每个样点中移位后的有效数据位分别进行第五类熵编码或第二类 量化编码。  305. Perform a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample.
具体的,编码器对每个样点中移位后的有效数据位分别进行第五类熵编码 或第二类量化编码, 第五类熵编码可以为霍夫曼编码等, 第二类量化编码可以 为非均勾量化编码等。  Specifically, the encoder performs a fifth type of entropy coding or a second type of quantized coding on the shifted valid data bits in each sample, and the fifth type of entropy coding may be Huffman coding, etc., and the second type of quantization coding It can be non-equalized and quantized.
306、 输出编码后的编码帧, 编码帧中包含最高有效比特位 p、 携带每个 样点的正负极性的码字、第四类熵编码后的左移位数以及第二类量化编码或第 五类熵编码后的有效数据。 306. Output an encoded code frame, where the coded frame includes a most significant bit p, a codeword carrying positive and negative polarities of each sample, a fourth type of entropy coded left shift number, and a second type of quantization code. Or Five types of valid data after entropy coding.
具体的,编码器在对每个样点的左移位数和移位后的有效数据进行编码完 成后, 输出编码后的编码帧, 该编码帧中包含最高有效比特位 p、 携带每个样 点的正负极性的码字、每个样点的第四类熵编码后的左移位数以及第二类量化 编码或第五类熵编码后的有效数据, 编码器输出的多个编码帧构成编码比特 流, 完成数据编码过程。  Specifically, after encoding the left shift number and the shifted valid data of each sample, the encoder outputs the encoded code frame, where the coded frame includes the most significant bit p, and carries each sample. The positive and negative polarity of the code word, the fourth type of entropy coded left shift number of each sample, and the second type of quantized code or the fifth type of entropy coded valid data, multiple codes output by the encoder The frame constitutes an encoded bit stream, and the data encoding process is completed.
在本发明实施例中 ,通信数据在移位后生成的左移位数和移位后产生的有 效数据反映了原始数据的分布规律。其中, 左移位数表示的是通信数据的主要 信息, 具有非均匀分布特性, 而移位后的有效数据表示的是通信数据的次要信 息, 在整个动态范围内呈非均匀分布, 在局部动态范围内分部较为均匀, 本发 明实施例对每个样点的左移位数进行熵编码,对移位后的有效数据进行熵编码 或量化编码, 充分利用了左移位数和移位后的有效数据的不同分布特性,通过 选择对应的编码方式, 可以具有较高的编码效率, 压缩比较高。  In the embodiment of the present invention, the left shift number generated after the shift of the communication data and the valid data generated after the shift reflect the distribution law of the original data. Wherein, the left shift number represents the main information of the communication data, and has a non-uniform distribution characteristic, and the shifted valid data represents the secondary information of the communication data, which is non-uniformly distributed throughout the dynamic range, in the local In the dynamic range, the segments are relatively uniform. In the embodiment of the present invention, the left shift number of each sample is entropy encoded, and the shifted valid data is entropy encoded or quantized, and the left shift number and shift are fully utilized. After the different distribution characteristics of the valid data, by selecting the corresponding coding mode, it is possible to have higher coding efficiency and higher compression.
进一步的, 在本发明实施例中,携带每个样点的正负极性的码字可以为不 经过熵编码的每个样点的正负极性,或者每个样点的第六类熵编码后的正负极 性。对应的, 编码后输出的编码帧中包括每个样点的第六类熵编码后的正负极 性、第四类熵编码后的左移位数以及第二类量化编码或第五类熵编码后的有效 数据。在本发明实施例中,对每个样点的正负极性进行熵编码可以进一步提高 编码效率。  Further, in the embodiment of the present invention, the code characters carrying the positive and negative polarities of each sample may be the positive and negative polarities of each sample without entropy coding, or the sixth entropy of each sample. Positive and negative polarity after encoding. Correspondingly, the coded frame outputted after encoding includes a sixth type of entropy coded positive and negative polarity of each sample, a fourth type of entropy coded left shift number, and a second type of quantized code or a fifth type of entropy. Encoded valid data. In the embodiment of the present invention, entropy coding of the positive and negative polarities of each sample can further improve the coding efficiency.
在本发明实施例中, 第四类熵编码、第五类熵编码以及第六类熵编码的类 型均是熵编码, 但具体釆用的熵编码类型可以根据具体的数据统计规律来确 定。 第一类量化编码和第二类量化编码的类型均是量化编码,但具体釆用的量 化编码类型可以根据具体的数据统计规律来确定。  In the embodiment of the present invention, the types of the fourth type of entropy coding, the fifth type of entropy coding, and the sixth type of entropy coding are entropy coding, but the specific entropy coding type may be determined according to specific statistical rules of data. The types of the first type of quantization coding and the second type of quantization coding are both quantization codes, but the specific quantization coding type can be determined according to specific statistical rules of data.
在本发明实施例中 ,在对左移位数和移位后的有效数据进行编码时可以选 择预设的编码方式和编码参数, 编码参数中可以包括编码时使用的量化表格, 编码方式和编码参数在本发明实施例中统称为编码信息。 另外, 编码器在进行 对左移位数和移位后的有效数据进行编码时,还可以根据不同类型的通信数据 灵活选择编码方式和编码参数, 此时本发明实施例提供的编码方法还包括: 获 取每个样点的左移位数第四类熵编码的编码信息和移位后的有效数据第二类 量化编码或第五类熵编码的编码信息。 编码器在获得编码信息后,将编码信息 通过编码帧发送, 以便于解码器根据编码信息进行对应的解码。在本发明实施 例中,编码帧中还进一步包括每个样点的左移位数第四类熵编码的编码信息和 移位后的有效数据第五类熵编码或第二类量化编码的编码信息。 In the embodiment of the present invention, a preset encoding mode and an encoding parameter may be selected when encoding the left shift number and the shifted valid data, and the encoding parameter may include a quantization table, an encoding method, and an encoding used in encoding. The parameters are collectively referred to as coding information in the embodiments of the present invention. In addition, when the encoder performs the encoding of the left shift number and the shifted valid data, the encoding method and the encoding parameter may be flexibly selected according to different types of communication data. The encoding method provided by the embodiment of the present invention further includes : Obtaining the left shift number of each sample, the fourth type of entropy coded coding information and the shifted effective data, the second class Quantization coding or coding information of the fifth type of entropy coding. After obtaining the encoded information, the encoder transmits the encoded information through the encoded frame, so that the decoder performs corresponding decoding according to the encoded information. In the embodiment of the present invention, the coded frame further includes a left shift number of each sample, and a fourth type of entropy coded coding information and a shifted effective data, a fifth type of entropy coding or a second type of quantization coded coding. information.
在本发明实施例中,通过在编码帧中增加编码信息, 可以使得编码器在进 行熵编码或量化编码可以选择更多的编码方式, 而不受预设的编码方式的限 制, 适应范围更广。 实施例四  In the embodiment of the present invention, by adding coding information to the coded frame, the encoder can select more coding modes by performing entropy coding or quantization coding, without being limited by the preset coding mode, and the adaptation range is wider. . Embodiment 4
参见图 13 , 图 13是本发明实施例四提供的数据解码方法的方法流程图。 在本发明实施例中,解码器在接收到编码器发送的编码比特流之后,解码 器以帧为单位对编码比特流进行解码,在本发明实施例四提供的数据编码方法 可以包括:  Referring to FIG. 13, FIG. 13 is a flowchart of a method for decoding a data according to Embodiment 4 of the present invention. In the embodiment of the present invention, after the decoder receives the encoded bit stream sent by the encoder, the decoder decodes the encoded bit stream in units of frames. The data encoding method provided in the fourth embodiment of the present invention may include:
401、 获取编码帧中携带每个样点的正负极性的码字, 根据码字获取每个 样点的正负极性。  401. Obtain a codeword carrying a positive and negative polarity of each sample in the encoded frame, and obtain positive and negative polarities of each sample according to the codeword.
具体的,解码器获取编码帧中携带每个样点的正负极性的码字,根据该码 字来获取每个样点的正负极性。 其中,携带每个样点的正负极性的码字可以为 每个样点的正负极性, 解码器不需要解码即可获得每个样点的正负极性。  Specifically, the decoder obtains the code words carrying the positive and negative polarities of each sample in the encoded frame, and obtains the positive and negative polarities of each sample according to the code words. Among them, the code characters carrying the positive and negative polarities of each sample can be the positive and negative polarity of each sample, and the decoder can obtain the positive and negative polarity of each sample without decoding.
402、 对编码帧中熵编码后的左移位数进行解码, 获得每个样点的有效数 据的左移位数。  402. Decode the entropy-encoded left shift number in the encoded frame to obtain a left shift number of the valid data of each sample.
具体的,解码器可以根据数据块中样点的数量对编码帧中熵编码后的左移 位数按照与编码方式对应的解码方式进行解码,获得每个样点的有效数据的左 移位数。  Specifically, the decoder may decode the entropy-encoded left shift number in the encoded frame according to the decoding manner corresponding to the encoding manner according to the number of samples in the data block, and obtain the left shift number of the valid data of each sample point. .
其中,编码器使用的编码方式和解码器使用的解码方式可以为预设的编码 方式和解码方式。  The coding mode used by the encoder and the decoding mode used by the decoder may be preset coding modes and decoding modes.
403、 对编码帧中量化编码或熵编码后的有效数据进行解码, 获得每个样 点的移位后的有效数据。 具体的,解码器可以根据数据块中样点的数量对编码帧中量化编码或熵编 码后的有效数据按照与编码器使用的编码方式对应的解码方式进行解码,进而 获得每个样点的移位后的有效数据。 403. Decode the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample. Specifically, the decoder can decode the quantized or entropy-encoded valid data in the encoded frame according to the decoding manner corresponding to the encoding mode used by the encoder according to the number of samples in the data block, thereby obtaining the shift of each sample. Valid data after the bit.
404、 根据编码帧中包含的绝对值最大的样点的最高有效比特位对每个样 点的正负极性、有效数据的左移位数以及移位后的有效数据进行组装获得原始 数据块。  404. Accomplish the positive and negative polarity of each sample, the left shift number of the valid data, and the valid data after the shift according to the most significant bit of the sample with the largest absolute value included in the encoded frame to obtain the original data block. .
在本发明实施例中,每个样点以补码的形式进行存储,样点的位数例如为 16位、 32位等。 解码器在获得每个样点的正负极性、 有效数据的左移位数以 及移位后的有效数据后,对样点的正负极性和有效数据进行组装, 获得原始数 据块, 完成数据解码过程。 其中, 在进行数据组装时, 需要将移位后的有效数 据的位置向右移动相应的位数, 右移的位数和左移位数相等。在进行数据组装 的过程中需要根据接收到的编码帧中包含的绝对值最大的样点的最高有效比 特位来确定每个样点的符号扩展位中零的个数。 在本发明实施例四提供的解码方法为实施例三中提供的解码方法提供支 持,通信数据在移位后生成的左移位数和移位后产生的有效数据反映了原始数 据的分布规律。 其中, 左移位数具有非均勾分布特性, 而移位后的有效数据在 整个动态范围内呈非均匀分布, 在局部动态范围内分部较为均匀, 本发明实施 例对每个样点的左移位数进行熵编码,对移位后的有效数据进行熵编码或量化 编码, 充分利用了左移位数和移位后的有效数据的不同分布特性,通过选择对 应的编码方式, 可以具有较高的编码效率, 压缩比较高。  In the embodiment of the present invention, each sample is stored in the form of a complement, and the number of bits of the sample is, for example, 16 bits, 32 bits, or the like. After obtaining the positive and negative polarity of each sample, the number of left shifts of the valid data, and the valid data after shifting, the decoder assembles the positive and negative polarities and the valid data of the sample to obtain the original data block, and completes Data decoding process. In the data assembly, the position of the shifted valid data needs to be shifted to the right by the corresponding number of bits, and the number of bits shifted to the right is equal to the number of left shifts. In the process of data assembly, it is necessary to determine the number of zeros in the sign extension bits of each sample according to the highest significant ratio of the sample having the largest absolute value contained in the received coded frame. The decoding method provided in the fourth embodiment of the present invention provides support for the decoding method provided in the third embodiment. The left shift number generated after the shift of the communication data and the valid data generated after the shift reflect the distribution rule of the original data. Wherein, the left shift number has a non-uniform hook distribution characteristic, and the shifted effective data is non-uniformly distributed in the entire dynamic range, and the partial dynamic range is relatively uniform in the local dynamic range, and the embodiment of the present invention is applicable to each sample point. The left shift number is entropy coded, and the shifted effective data is entropy coded or quantized, and the left shift number and the different distribution characteristics of the shifted effective data are fully utilized, and the corresponding coding mode may be selected. Higher coding efficiency and higher compression.
进一步的 ,在本发明实施例中根据码字获取每个样点的正负极性具体可以 为:对每个样点的正负极性的码字分别进行熵解码,获得每个样点的正负极性。 其中,对正负极性的码字进行熵解码的解码方式和发送端对每个样点的正负极 性进行熵编码的编码方式对应。  Further, in the embodiment of the present invention, the positive and negative polarities of each sample are obtained according to the codeword, and the positive and negative polarity codewords of each sample are separately entropy decoded to obtain each sample point. Positive and negative polarity. Among them, the decoding method for entropy decoding the positive and negative polarity code words corresponds to the coding method for the entropy coding of the positive and negative polarities of each sample at the transmitting end.
进一步的,编码器发送的编码帧中还可以包括每个样点的左移位数熵编码 的编码信息和移位后的有效数据熵编码或量化编码的编码信息 ,其中编码信息 包括编码方式和编码参数, 编码参数可以中可以包括编码使用的量化表格。在 编码帧中携带编码信息的情况下, 对编码帧中熵编码后的左移位数进行解码, 获得每个样点的有效数据的左移位数的步骤(402 ) , 具体为: 根据每个样点 的左移位数熵编码的编码信息对编码帧中熵编码后的左移位数进行熵解码,获 得每个样点的有效数据的左移位数。其中,对该熵编码后的左移位数进行熵解 码的具体解码方式根据编码信息来确定,即釆用和编码方式对应的解码方式对 熵编码后的左移位数进行解码, 例如编码方式为熵编码, 则对应的解码方式为 熵解码。 Further, the encoded frame sent by the encoder may further include encoding information of the left shift number entropy coding of each sample and encoding information of the shifted effective data entropy encoding or quantization encoding, where the encoding information includes an encoding method and Encoding parameters, encoding parameters may include a quantization table used for encoding. When the encoded information is carried in the encoded frame, the entropy encoded left shift number in the encoded frame is decoded, The step (402) of obtaining the left shift number of the valid data of each sample is specifically: performing entropy-coded left shift number in the encoded frame according to the encoding information of the left shift number entropy coding of each sample point Entropy decoding, obtaining the number of left shifts of valid data for each sample. The specific decoding mode for entropy decoding the entropy-encoded left shift number is determined according to the coding information, that is, the entropy-encoded left shift number is decoded by using a decoding method corresponding to the coding mode, for example, an encoding method. For entropy coding, the corresponding decoding mode is entropy decoding.
另外,在编码帧中携带编码信息的情况下, 上述对编码帧中量化编码或熵 编码后的有效数据进行解码, 获得每个样点的移位后的有效数据的步骤(403 ) 具体为:根据每个样点的低比特位数据熵编码或量化编码的编码信息对编码帧 中量化编码或熵编码后的低比特位数据进行解码,获得每个样点的低比特位信 息。其中,对编码帧中量化编码或熵编码后的低比特位数据进行解码的具体解 码方式根据编码信息来确定,即釆用和编码方式和对应的解码方式对熵编码或 量化编码后的低比特位数据进行解码。  In addition, when the encoded information is carried in the encoded frame, the step of decoding the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data for each sample is specifically: The quantized or entropy encoded low bit data in the encoded frame is decoded according to the low bit data entropy encoded or quantized encoded information of each sample to obtain low bit information of each sample. The specific decoding manner for decoding the quantized or entropy encoded low-bit data in the encoded frame is determined according to the encoding information, that is, the entropy encoding or the quantized low-bit encoding by using the encoding method and the corresponding decoding manner. The bit data is decoded.
进一步的, 在本发明实施例中, 上述对编码帧中量化编码或熵编码后的有 效数据进行解码, 获得每个样点的移位后的有效数据的步骤(403 )具体可以 包括:  Further, in the embodiment of the present invention, the step of decoding the valid data after the quantization coding or the entropy coding in the coded frame, and obtaining the valid data after the shift of each sample, may specifically include:
1 )对编码帧中熵编码后的有效数据进行熵解码, 获得每个样点的低比特 位数据。  1) Entropy decoding the effective data after entropy coding in the encoded frame to obtain low bit data of each sample.
2 )对编码帧中量化编码后的有效数据进行反量化处理, 获得每个样点的 移位后的有效数据, 从而有失真的恢复移位后的有效数据。 为更详细的理解本发明实施例三提供的数据编码方法、实施例四提供的数 据解码方法, 下面再给出本发明实施例的具体应用场景。  2) Perform inverse quantization processing on the quantized and validated data in the encoded frame to obtain the shifted valid data of each sample, thereby recovering the shifted valid data with distortion. For a more detailed understanding of the data encoding method provided in Embodiment 3 of the present invention and the data decoding method provided in Embodiment 4, a specific application scenario of the embodiment of the present invention is further given below.
参见图 14, 图 14是本发明实施例三提高的数据编码方法中对数据块进行 划分的示意图。  Referring to FIG. 14, FIG. 14 is a schematic diagram of dividing a data block in an improved data encoding method according to Embodiment 3 of the present invention.
其中, 编码器以数据块为单位对原始数据进行编码,根据原始数据的分布 特点, 数据块中每个样点的 S区域和 D区域具有随机性。 编码器对数据块进 行划分并移位, 得到符号位、 左移位数和移位后的有效数据, 每个部分分别占 n3、 L和 n4比特。 其中, n3包括符号位和符号扩展位的位数, 符号位表示样 点的正负极性,左移位数 L的具体位数可以根据样点的位数来确定,例如样点 的位数为 32, 则左移位数 L可以用 5位来表示, 样点的位数为 16, 则左移位 数 L可以用 4位来表示, 样点的位数为 8, 则左移位数 L可以用 3位来表示。 The encoder encodes the original data in units of data blocks. According to the distribution characteristics of the original data, the S region and the D region of each sample in the data block have randomness. The encoder divides and shifts the data block to obtain the sign bit, the left shift number, and the shifted valid data, each of which occupies n3, L, and n4 bits, respectively. Where n3 includes the number of bits of the sign bit and the sign extension bit, and the sign bit indicates The positive and negative polarity of the point, the specific number of bits of the left shift number L can be determined according to the number of bits of the sample, for example, the number of bits of the sample is 32, then the number of left shifts L can be represented by 5 bits, the sample point The number of bits is 16, and the number of left shifts L can be represented by 4 bits. The number of bits of the sample is 8, and the number of left shifts L can be represented by 3 bits.
编码器在对数据块进行划分时, 首先提取数据块中各个样点的符号位 Ss, 根据符号位获取每个样点的正负极性。 编码器可以对每个样点取绝对值, 获取 L个样点中绝对值最大的样点, 获取该样点的最高有效比特位卩。 在确定绝对 值最大的样点的最高有效比特位 P后,接下来依次确定每个样点的最高有效比 特位 di, 将每个样点左移 P-di位, 即得到移位后的有效数据。 其中, i取值 11丄。  When the encoder divides the data block, it first extracts the sign bit Ss of each sample point in the data block, and obtains the positive and negative polarities of each sample according to the sign bit. The encoder can take an absolute value for each sample, obtain the sample with the largest absolute value among the L samples, and obtain the most significant bit 卩 of the sample. After determining the most significant bit P of the sample with the largest absolute value, the next most significant bit di of each sample is sequentially determined, and each sample is shifted to the left by the P-di bit, that is, the effective after the shift is obtained. data. Where i takes the value of 11丄.
其中, 本发明实施例可以使用状态 0、 1来表示每帧数据中各个样点的正负 极性, 例如 0标识该样点为负, 1标识该样点为正; 或者 0表示样点值为正, 而 1 表示样点值为负。每个样点的符号位在进行处理后, 获得二进制的携带每个样 点的正负极性编码的码字 Ssc。 In the embodiment of the present invention, the state 0 and 1 can be used to indicate the positive and negative polarity of each sample in each frame of data, for example, 0 indicates that the sample is negative, 1 indicates that the sample is positive; or 0 indicates a sample value. Positive, and 1 means the sample value is negative. After the sign bit of each sample is processed, a binary code word S s c carrying the positive and negative polarity codes of each sample is obtained.
图 6所示是一个原始数据的概率分布实例, 它所对应的左移位数的概率分 布由图 15给出。 可以看出, 左移位数出现的概率是不均等的, 这就为釆用熵编 码进行数据压缩提供了依据,因此本发明实施例釆用熵编码方法对左移位数进 行无失真的熵编码, 得到移位信息编码 Smc。 熵编码可以釆用 Huffman编码、 算 术编码或其它不等长编码算法、 或它们的组合算法。 在本发明实施例中, 对左 移位数进行熵编码的编码方式和编码参数等编码信息可以保存在帧头信息中, 帧头信息保存在编码帧中进行输出。 有失真编码(量化编码)两种方法。 在无失真编码模式下, 编码器可以得到有 效数据的有效比特数, 并直接输出相应数量的比特, 实现无失真编码。 在有失 真编码模式下, 为了使编码器保持比较低的算法复杂度, 可以釆用算法简单的 标量量化方法。 在实际应用中, 有效数据在整个动态范围之内呈非均匀分布, 但在局部动态范围内分布较为均匀。 原始数据 S的有效数据的概率分布由图 16 给出, 可以看出, 有效数据整体上为非均匀分布, 动态范围较大。 在数据块中 的最高有效比特位已知的情况下, 可以将有效数据进行分类, 图 17和图 18分别 给出了最高有效比特位 P为 7和 8的有效数据的概率分布, 可以看出其分布较为 均匀, 动态范围较小, 如果对两部分数据分开量化, 量化更加精确。 因此对有 效数据的压缩编码算法可以釆用分类的量化编码算法, 例如釆用 Lloyd-Max非 均匀标量量化算法。其中,对有效数据进行熵编码或量化编码的编码方式和编 码参数等编码信息可以保存在帧头信息中, 帧头信息通过编码帧进行输出。 Figure 6 shows an example of the probability distribution of the original data. The probability distribution of the corresponding left shift number is given by Figure 15. It can be seen that the probability of occurrence of the left shift number is unequal, which provides a basis for data compression using entropy coding. Therefore, the embodiment of the present invention uses the entropy coding method to perform distortion-free entropy on the left shift number. Encoding gives the shift information code S m c. Entropy coding may employ Huffman coding, arithmetic coding or other unequal length coding algorithms, or a combination thereof. In the embodiment of the present invention, the encoding information such as the encoding method and the encoding parameter for entropy encoding the left shift number may be stored in the frame header information, and the frame header information is stored in the encoded frame for output. There are two methods of distortion coding (quantization coding). In the distortionless coding mode, the encoder can obtain the effective number of bits of valid data and directly output the corresponding number of bits to achieve distortion-free coding. In the distortion coding mode, in order to keep the encoder low algorithm complexity, a simple scalar quantization method can be used. In practical applications, the effective data is non-uniformly distributed over the entire dynamic range, but distributed evenly within the local dynamic range. The probability distribution of the valid data of the original data S is given by Fig. 16. It can be seen that the effective data is non-uniformly distributed as a whole, and the dynamic range is large. In the case where the most significant bit in the data block is known, the valid data can be classified, Figure 17 and Figure 18, respectively. The probability distribution of the effective data with the most significant bits P of 7 and 8 is given. It can be seen that the distribution is relatively uniform and the dynamic range is small. If the two parts of data are separately quantized, the quantization is more accurate. Therefore, the compression coding algorithm for effective data can use the classified quantization coding algorithm, for example, the Lloyd-Max non-uniform scalar quantization algorithm. The coding information such as the coding mode and the coding parameter for entropy coding or quantization coding of the valid data may be stored in the frame header information, and the frame header information is output through the coding frame.
在本发明实施例中, 编码器将编码后得到的正负极性编码的码字 Ssc、 移 位信息编码 Smc和移位后的有效数据编码 Sec组合, 结合帧头信息, 组成一个完 整的编码帧, 图 19给出了编码比特流中编码帧的结构示意图。 不同编码帧按照 输出的时间顺序排列, 便形成了编码器输出的编码比特流 B1 , 如图 19所示。 其中, 帧头信息中还可以包括数据块中样点的个数,数据块中的最高有效比特 位等。 需要说明的是, 如果编码器和解码器使用预设的解码类型和编码类型, 并且数据块中每个样点的长度、样点的个数均是预设值的情况下, 编码帧中可 以不需要携带帧头信息。 In the embodiment of the present invention, the encoder combines the encoded positive and negative polarity coded word S s c , the shift information code S m c and the shifted effective data code S e c , and combines the frame header information. , to form a complete coded frame, Figure 19 shows the structure of the coded frame in the coded bitstream. The different coded frames are arranged in chronological order of the output to form an encoded bit stream B1 output by the encoder, as shown in FIG. The frame header information may further include the number of samples in the data block, the most significant bit in the data block, and the like. It should be noted that, if the encoder and the decoder use the preset decoding type and the encoding type, and the length of each sample in the data block and the number of samples are preset values, the encoded frame may be No need to carry frame header information.
在解码器, 以编码帧为单位对编码比特流进行解码,解码器可以读取帧头 信息并保存, 接下来根据二进制比特流的 0、 1状态来确定每个样点的正负极 性。 其次, 解码器进行无失真的熵解码恢复有效数据的左移位数并保存, 熵解 码釆用的具体解码方式和编码器使用的编码方式相对应。  At the decoder, the encoded bit stream is decoded in units of coded frames, the decoder can read the frame header information and save, and then the positive and negative polarities of each sample are determined based on the 0, 1 state of the binary bit stream. Secondly, the decoder performs distortion-free entropy decoding to recover the left shift number of the valid data and saves it. The specific decoding method used for entropy decoding corresponds to the encoding mode used by the encoder.
在根据帧头信息获得编码器对有效数据进行熵编码的情况下,解码器通过 当前帧最高有效比特位和移位信息确定有效数据的有效比特数,并依次从输入 比特流中读取相应数量的比特进行熵解码, 进而实现有效数据的无失真解码。 而有失真编码时,解码器对编码后的有效数据进行反量化处理,具体过程包括: 从输入比特流中恢复有效数据的量化下标值,然后根据当前帧最高有效比特位 确定标量量化码表, 进行反量化处理, 通过下标索引在量化表中搜索对应的量 化值, 实现有效数据的有失真解码。 最后, 解码器根据解码得到的每个样点的 正负极性、 移位后的有效数据进行组装, 得到原始数据块并输出, 完成一个编 码帧的解码, 并准备进行下一帧的解码, 直到解码结束。 本发明方法实施例对应的装置。 实施例五 In the case where the encoder obtains the entropy encoding of the valid data according to the frame header information, the decoder determines the effective bit number of the valid data by the most significant bit of the current frame and the shift information, and sequentially reads the corresponding quantity from the input bit stream. The bits are entropy decoded to achieve distortion-free decoding of the valid data. When there is distortion coding, the decoder performs inverse quantization processing on the encoded valid data, and the specific process includes: recovering the quantized subscript value of the valid data from the input bit stream, and then determining the scalar quantization code table according to the most significant bit of the current frame. Performing an inverse quantization process, searching for a corresponding quantized value in the quantization table by using a subscript index, and implementing distortion decoding of the valid data. Finally, the decoder assembles the positive and negative polarities and the shifted valid data of each sample obtained by decoding, obtains the original data block and outputs, completes decoding of one encoded frame, and prepares to decode the next frame. Until the end of the decoding. A device corresponding to an embodiment of the method of the present invention. Embodiment 5
参见图 20, 图 20是本发明实施例五提供的编码器的结构示意图。  Referring to FIG. 20, FIG. 20 is a schematic structural diagram of an encoder according to Embodiment 5 of the present invention.
本发明实施例十三提供的编码器包括:  The encoder provided in Embodiment 13 of the present invention includes:
第一预处理单元 1101 , 用于获取数据块中每个样点的正负极性, 数据块 的样点中绝对值最大的样点的最高有效比特位;  a first pre-processing unit 1101, configured to obtain positive and negative polarity of each sample in the data block, and a most significant bit of the sample with the largest absolute value among the samples of the data block;
高比特位编码单元 1102 , 用于获取每个样点中从所述最高有效比特位开 始的 n位高比特位数据, 对每个样点的高比特位数据分别进行第一类熵编码, 所述 n大于 1 , 小于绝对值最大的样点的有效数据的位数;  a high-bit coding unit 1102, configured to acquire n-bit high-bit data from each of the most significant bits in each sample, and perform first-class entropy coding on each of the high-bit data of each sample. The number of bits of valid data where n is greater than 1 and less than the absolute maximum value;
低比特位编码单元 1103 , 用于获取每个样点中从所述最高有效比特位开 始的数据中除所述高比特位数据之外的低比特位数据,对每个样点的低比特位 数据分别进行第一类量化编码或第二类熵编码;  a low-bit coding unit 1103, configured to acquire low-bit data other than the high-bit data in data starting from the most significant bit in each sample, and low bits for each sample The data is respectively subjected to the first type of quantization coding or the second type of entropy coding;
第一编码输出单元 1104 , 用于输出携带每个样点的正负极性的码字、 每 个样点的第一类熵编码后的高比特位数据以及第一类量化编码或第二类熵编 码后的低比特位数据组成的编码帧。  a first code output unit 1104, configured to output a codeword carrying positive and negative polarities of each sample, a first type of entropy coded high bit data of each sample, and a first type of quantized code or a second class Encoded frame composed of entropy encoded low bit data.
本发明实施例五提供的编码器可以使用在前述对应的实施例一提供的数 据编码方法中, 详细执行过程参见上述方法实施例, 在此不再重复描述。  The encoder provided in the fifth embodiment of the present invention can be used in the data encoding method provided in the foregoing corresponding embodiment. For the detailed execution process, refer to the foregoing method embodiment, and the description is not repeated here.
在本发明实施例五提供的编码器进一步包括:  The encoder provided in Embodiment 5 of the present invention further includes:
第一极性编码单元 1105 , 用于对每个样点的正负极性分别进行第三类熵 编码;  a first polarity encoding unit 1105, configured to respectively perform a third type of entropy encoding on the positive and negative polarities of each sample;
上述第一编码输出单元 1104输出的编码帧中的携带每个样点的正负极性 的码字具体为每个样点的第三类熵编码后的正负极性。  The code words carrying the positive and negative polarities of each sample in the coded frame output by the first code output unit 1104 are specifically the third type of entropy coded positive and negative polarities of each sample.
参见图 21、 图 21是本发明实施例五提供的编码器的原理框图。  Referring to FIG. 21, FIG. 21 is a schematic block diagram of an encoder according to Embodiment 5 of the present invention.
如图所示,一帧原始数据 Sm输入到第一预处理模块 1201进行数据分析与 处理, 预处理包括提取符号位、检测一帧的最高有效比特位、 分离高比特位数 据和低比特位数据。 第一预处理模块 1201的基本思想是待编码的信号分布具 有随机性, 其有效比特区域中的高比特位区域和低比特位区域的统计分布不 同, 可釆用不同的编码方法进行处理。 其中, 高比特位数据具有非均勾分布特 性, 而低比特位数据的分布特点是: 在整个动态范围之内呈非均勾分布, 但在 局部动态范围内分布较为均匀, 这为低比特数据的压缩编码处理提供了依据。 经过第一预处理模块 1201得到的符号位数据 Ss、 高比特位数据 Sh和低比 特位数据 分别送给符号位编码模块 1202, 高比特位编码模块 1203和低比特 位编码模块 1204,得到符号位编码 Ssc、高比特位编码 Shc和低比特位编码 S c。 符号位编码模块 1202使用状态 0、 1来表示每个样点的正负极性, 最终编码生 成一组二进制比特流。根据高比特位数据的不均勾分布特性, 高比特位编码模 块 1203釆用了无失真的熵编码。 熵编码可以釆用 Huffman编码、 算术编码或 它们的组合算法。 根据低比特位数据的分布特点, 低比特位编码模块 1204对 其进行了分类, 分类处理更加精细的反映出每一帧数据的分布特点。在无失真 编码状态下,编码器根据当前帧最高有效比特位确定低比特位数据的有效比特 数, 并将相应数量的比特依次写入输出緩存中, 实现无失真编码输出。 在有失 真编码状态下, 低比特位编码模块 1204根据当前帧的最高有效比特位对低比 特位数据进行分类, 并选择相应的量化表格对低比特位数据进行量化编码, 实 现有失真压缩编码。 As shown, a frame of raw data S m is input to the first pre-processing module 1201 for data analysis and processing. The pre-processing includes extracting the sign bit, detecting the most significant bit of one frame, separating the high bit data and the low bit. data. The basic idea of the first pre-processing module 1201 is that the signal distribution to be encoded has randomness, and the statistical distribution of the high-bit area and the low-bit area in the effective bit area is different, and different encoding methods can be used for processing. Among them, the high bit data has a non-homogeneous distribution characteristic, and the low bit data is distributed in a non-homogeneous distribution within the entire dynamic range, but distributed uniformly in the local dynamic range, which is low bit data. The compression coding process provides the basis. The symbol bit data S s , the high bit data S h and the low bit data obtained by the first preprocessing module 1201 are respectively sent to the sign bit encoding module 1202, the high bit encoding module 1203 and the low bit encoding module 1204, The sign bit code S s c , the high bit code S h c and the low bit code S c . The Sign Bit Encoding Module 1202 uses the states 0, 1 to indicate the positive and negative polarity of each sample, and the final encoding generates a set of binary bit streams. According to the uneven distribution characteristic of the high bit data, the high bit coding module 1203 uses the distortion-free entropy coding. Entropy coding may employ Huffman coding, arithmetic coding, or a combination thereof. According to the distribution characteristics of the low bit data, the low bit coding module 1204 classifies it, and the classification process more closely reflects the distribution characteristics of each frame of data. In the distortionless coding state, the encoder determines the effective number of bits of the low bit data according to the most significant bit of the current frame, and sequentially writes the corresponding number of bits into the output buffer to implement distortionless coding output. In the distortion coding state, the low bit coding module 1204 classifies the low bit data according to the most significant bit of the current frame, and selects a corresponding quantization table to quantize the low bit data to implement distortion compression coding.
最后, 第一帧封装模块 1205将符号位编码 Ssc、 高比特位编码 She和低比 特位编码 SlC组合, 再结合帧头信息 Hl 得到完整的编码帧输出, 形成编码比 特流:^。 参见图 22, 图 22是本发明实施例六提供的解码器的结构示意图。 Finally, the first frame encapsulating module 1205 combines the sign bit code S s c , the high bit code S h e and the low bit code S lC , and combines the frame header information H l to obtain a complete coded frame output to form an encoded bit stream. :^. Referring to FIG. 22, FIG. 22 is a schematic structural diagram of a decoder according to Embodiment 6 of the present invention.
本发明实施例六提供的解码器包括:  The decoder provided in Embodiment 6 of the present invention includes:
第一极性获取单元 1301 , 用于获取接收到的编码帧中携带每个样点的正 负极性的码字, 根据所述码字获取每个样点的正负极性;  The first polarity acquiring unit 1301 is configured to acquire a codeword carrying positive and negative polarities of each sample in the received encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
高比特位解码单元 1302 , 用于对所述编码帧中熵编码后的高比特位数据 进行解码, 获得每个样点的高比特位数据;  The high bit decoding unit 1302 is configured to decode the entropy encoded high bit data in the encoded frame to obtain high bit data of each sample;
低比特位解码单元 1303 , 用于对所述编码帧中量化编码或熵编码后的低 比特位数据进行解码, 获得每个样点的低比特位数据;  a low bit decoding unit 1303, configured to decode the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample;
第一数据组装单元 1304 , 用于根据接收到的编码帧中包含的最高有效比 特位将每个样点的正负极性、高比特位数据和低比特位数据进行组装获得原始 数据块。 本发明实施例六提供的解码器可以使用在前述对应的实施例二提供的数 据解码方法中, 详细过程参见上述方法实施例, 在此不再重复描述。 The first data assembling unit 1304 is configured to assemble the positive and negative polarities, the high bit data, and the low bit data of each sample according to the most significant bits included in the received encoded frame to obtain the original data block. The decoder provided in the sixth embodiment of the present invention may be used in the data decoding method provided in the foregoing corresponding embodiment 2. For the detailed process, refer to the foregoing method embodiment, and the description is not repeated here.
参见图 23、 图 23是本发明实施例六提供的解码器的原理框图。  Referring to FIG. 23 and FIG. 23, FIG. 23 is a schematic block diagram of a decoder provided in Embodiment 6 of the present invention.
如果所示, 解码器在接收到编码比特流后, 第一帧解封模块 1401将编码 比特流中的信息分解成帧头信息 、 符号位编码 Ssc、 高比特位编码 She和低 比特位编码 Sic„ If shown, after receiving the encoded bit stream, the first frame deblocking module 1401 decomposes the information in the encoded bit stream into frame header information, symbol bit code S s c , high bit code S h e and low. Bit code Sic
结合帧头信息 Hl 符号位编码 Ssc经过符号位解码模块 1402解码得到符 号位 Ss,符号位解码模块 1402通过判断输入比特流中每个比特的 0、 1状态来 确定当前帧中每个样点的正负极性。 Combining the frame header information H l sign bit code S s c is decoded by the sign bit decoding module 1402 to obtain the sign bit S s , and the sign bit decoding module 1402 determines the current frame by determining the 0, 1 state of each bit in the input bit stream. Positive and negative polarity of samples.
高比特位编码 She经过高比特位解码模块 1403解码得到高比特位数据 Sh, 对应于编码端, 高比特位解码模块 1403进行熵解码处理。 The high bit code S h e is decoded by the high bit decoding module 1403 to obtain high bit data S h corresponding to the encoding end, and the high bit decoding module 1403 performs entropy decoding processing.
低比特位编码 SlC经过低比特位解码模块 1404解码得到低比特位数据 Si„ 无失真解码状态下,根据帧头信息,低比特解码模块确定了每个低比特位数据 的有效比特数, 并从输入比特流中读入相应个数的比特, 进行无失真解码。 有 失真解码状态下, 低比特位解码模块 1404根据帧头信息对当前帧进行分类, 釆用相对应的方法进行反量化处理,有失真的恢复低比特位数据, 实现有失真 解码。 The low bit code S lC is decoded by the low bit decoding module 1404 to obtain low bit data. In the distortionless decoding state, the low bit decoding module determines the effective bit number of each low bit data according to the frame header information, and The corresponding number of bits are read from the input bit stream for distortion-free decoding. In the distortion-decoded state, the low-bit decoding module 1404 classifies the current frame according to the frame header information, and performs inverse quantization processing by using a corresponding method. It recovers low-bit data with distortion and realizes distortion decoding.
最后, 结合帧头信息, 第一反预处理模块 1405对符号位数据 Ss、 高比特 位数据 Sh和低比特位数据 进行分析处理, 确定了一帧原始信号的符号及符 号扩展位、 高比特位和低比特位, 得到重构数据 Sr并输出。 参见图 24, 图 24是本发明实施例七提供的编码器的结构示意图。 Finally, in combination with the frame header information, the first inverse pre-processing module 1405 analyzes the symbol bit data S s , the high bit data S h and the low bit data to determine the symbol and sign extension bit of the original frame of one frame, and the high bit. The bit and the low bit, the reconstructed data Sr is obtained and output. Referring to FIG. 24, FIG. 24 is a schematic structural diagram of an encoder according to Embodiment 7 of the present invention.
本发明实施例七提供的编码器包括:  The encoder provided in Embodiment 7 of the present invention includes:
第二预处理单元 1501 , 用于获取数据块中每个样点的正负极性, 以及数 据块的样点中绝对值最大的样点的最高有效比特位 p;  a second pre-processing unit 1501, configured to obtain positive and negative polarities of each sample in the data block, and a most significant bit p of the sample with the largest absolute value among the samples of the data block;
移位单元 1502, 用于获取每个样点的最高有效比特位 d,对每个样点的有 效数据位分别向左移 p-d位;  The shifting unit 1502 is configured to obtain the most significant bit d of each sample, and shift the effective data bits of each sample to the left by p-d bits;
移位信息编码单元 1503 ,用于对每个样点的左移位数 p-d分别进行第四类 熵编码; 有效数据编码单元 1504 , 用于对每个样点中移位后的有效数据位分别进 行第五类熵编码或第二类量化编码; a shift information encoding unit 1503, configured to perform a fourth type of entropy encoding on each of the left shift numbers pd of each sample; The effective data encoding unit 1504 is configured to respectively perform a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample;
第二编码输出单元 1505 , 用于输出编码后的编码帧, 编码帧中包含最高 有效比特位 P、 携带每个样点的正负极性的码字、 第四类熵编码后的左移位数 以及第五类熵编码或第二类量化编码后的有效数据组成的编码帧。  The second code output unit 1505 is configured to output the encoded code frame, where the coded frame includes the most significant bit P, the codeword carrying the positive and negative polarity of each sample, and the fourth type of entropy coded left shift A coded frame consisting of a number and a fifth type of entropy coding or a second type of quantized coded valid data.
本发明实施例七提供的编码器可以使用在前述对应的实施例三提供的数 据编码方法中, 详细过程参见上述方法实施例, 在此不再重复描述。  The encoder provided in the seventh embodiment of the present invention can be used in the data encoding method provided in the foregoing corresponding third embodiment. For the detailed process, refer to the foregoing method embodiment, and the description is not repeated here.
进一步的, 本发明实施例提供的编码器进一步包括;  Further, the encoder provided by the embodiment of the present invention further includes:
第二极性编码单元 1506 , 用于对每个样点的正负极性分别进行第六类熵 编码;  a second polarity encoding unit 1506, configured to perform a sixth type of entropy coding on the positive and negative polarities of each sample respectively;
上述第二编码输出单元 1505输出的编码帧中的携带每个样点的正负极性 的码字为每个样点的第六类熵编码后的正负极性。  The code words carrying the positive and negative polarities of each sample in the coded frame output by the second code output unit 1505 are the sixth type of entropy coded positive and negative polarities of each sample.
参见图 25、 图 25是本发明实施例七提供的编码器的原理框图。  Referring to FIG. 25 and FIG. 25, FIG. 25 is a schematic block diagram of an encoder according to Embodiment 7 of the present invention.
如图所示,一帧原始数据 Sm输入到第二预处理模块 1601进行数据分析与 处理, 预处理包括提取符号位、检测一帧的最高有效比特位、检测每个样点的 最高有效比特位、 对每个样点进行移位并保存移位信息和移位后的有效数据。 第二预处理模块 1601的基本思想是待编码的信号分布具有随机性, 新生成的 移位信息和移位后产生的新的数据分别反映出了原始数据的分布规律,可釆用 不同的编码方法进行处理。 其中, 移位信息数据具有非均勾分布特性, 而移位 后的有效数据的分布特点是: 在整个动态范围之内呈非均勾分布,但在局部动 态范围内分布较为均匀, 这为有效数据的压缩编码处理提供了依据。 As shown, a frame of raw data S m is input to a second pre-processing module 1601 for data analysis and processing. The pre-processing includes extracting sign bits, detecting the most significant bits of a frame, and detecting the most significant bits of each sample. Bit, shifts each sample and saves the shift information and the shifted valid data. The basic idea of the second pre-processing module 1601 is that the signal distribution to be encoded has randomness, and the newly generated shift information and the new data generated after shifting respectively reflect the distribution law of the original data, and different encodings can be used. The method is processed. Among them, the shift information data has a non-uniform hook distribution characteristic, and the distribution characteristics of the shifted effective data are: a non-uniform hook distribution within the entire dynamic range, but a uniform distribution within the local dynamic range, which is effective The compression encoding process of the data provides a basis.
经过第二预处理模块 1601得到的符号位数据 Ss、左移位数 Sm和有效数据 Se分别送给符号位编码模块 1602 , 移位信息编码模块 1603和有效数据编码模 块 1604,得到符号位编码 Ssc、移位信息编码 Smc和移位后的有效数据编码 Sec。 符号位编码模块 1602使用状态 0、 1来表示每个样点的正负极性, 最终编码生 成一组二进制比特流。 根据左移位数的不均勾分布特性, 移位信息编码模块 1603釆用了无失真的熵编码。 熵编码可以釆用 Huffman编码、 算术编码或它 们的组合算法。 根据有效数据的分布特点, 有效数据编码模块 1604对其进行 了分类, 分类处理更加精细的反映出每一帧数据的分布特点。在无失真编码状 态下,编码器根据当前帧最高有效比特位及移位信息确定有效数据的有效比特 数, 并将相应数量的比特依次写入输出緩存中, 实现无失真编码输出。 在有失 真编码状态下, 有效数据编码模块 1604根据当前帧的最高有效比特位对有效 数据进行分类, 并选择相应的量化表格对有效数据进行量化编码, 实现有失真 压缩编码。 参见图 26, 图 26是本发明实施例八提供的解码器的结构示意图。 The symbol bit data S s , the left shift number S m and the valid data S e obtained by the second pre-processing module 1601 are sent to the sign bit encoding module 1602, the shift information encoding module 1603 and the valid data encoding module 1604, respectively, to obtain symbols. The bit code S s c, the shift information code S m c and the shifted valid data code S e c. The Sign Bit Encoding Module 1602 uses states 0, 1 to indicate the positive and negative polarity of each sample, and the final encoding generates a set of binary bit streams. According to the uneven distribution characteristic of the left shift number, the shift information encoding module 1603 employs distortion-free entropy coding. Entropy coding may employ Huffman coding, arithmetic coding, or a combination thereof. According to the distribution characteristics of the effective data, the effective data encoding module 1604 classifies the data, and the classification processing more finely reflects the distribution characteristics of each frame of data. In the form of distortionless coding In the state, the encoder determines the effective number of valid data according to the most significant bit of the current frame and the shift information, and sequentially writes the corresponding number of bits into the output buffer to implement distortionless coding output. In the distortion coding state, the effective data encoding module 1604 classifies the valid data according to the most significant bit of the current frame, and selects a corresponding quantization table to quantize and encode the valid data to implement distortion compression coding. Referring to FIG. 26, FIG. 26 is a schematic structural diagram of a decoder according to Embodiment 8 of the present invention.
本发明实施例八提供的解码器包括:  The decoder provided in Embodiment 8 of the present invention includes:
第二极性获取单元 1701 , 用于获取编码帧中携带每个样点的正负极性的 码字, 根据所述码字获取每个样点的正负极性;  The second polarity acquiring unit 1701 is configured to obtain a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
左移位数解码单元 1702 , 用于对所述编码帧中熵编码后的左移位数进行 解码, 获得每个样点的有效数据的左移位数;  The left shift number decoding unit 1702 is configured to decode the entropy encoded left shift number in the encoded frame to obtain a left shift number of valid data of each sample point;
有效数据解码单元 1703 , 用于对所述编码帧中量化编码或熵编码后的有 效数据进行解码, 获得每个样点的移位后的有效数据;  The effective data decoding unit 1703 is configured to decode the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
第二数据组装单元 1704 , 用于根据编码帧中包含的绝对值最大的样点的 最高有效比特位对每个样点的正负极性、有效数据的左移位数以及移位后的有 效数据进行组装获得原始数据块。  The second data assembling unit 1704 is configured to: positive and negative polarity of each sample, left shift number of valid data, and effective after shifting according to the most significant bit of the sample with the largest absolute value included in the encoded frame. The data is assembled to obtain the original data block.
本发明实施例八提供的解码器可以使用在前述对应的实施例四提供的数 据解码方法中, 详细过程参见上述方法实施例, 在此不再重复描述。  The decoder provided in Embodiment 8 of the present invention may be used in the data decoding method provided in the foregoing corresponding Embodiment 4. For the detailed process, refer to the foregoing method embodiment, and the description is not repeated herein.
参见图 27 , 图 27是本发明实施例八提供的解码器的原理框图。  Referring to FIG. 27, FIG. 27 is a schematic block diagram of a decoder according to Embodiment 8 of the present invention.
如图所示, 解码器在接收到编码比特流后, 第二帧解封模块 1801将编码 比特流中的信息分解成帧头信息 H1 符号位编码 Ssc、 移位信息编码 Smc和有 效数据编码 Sec。 As shown, after receiving the encoded bit stream, the second frame deblocking module 1801 decomposes the information in the encoded bit stream into frame header information H 1 sign bit code S s c , and shift information code S m c And valid data encoding S e c.
结合帧头信息 Hl 符号位编码 Ssc经过符号位解码模块 1802解码得到符 号位 Ss,符号位解码模块 1802通过判断输入比特流中每个比特的 0、 1状态来 确定当前帧中每个样点的正负极性。 Combining the frame header information H l sign bit code S s c is decoded by the sign bit decoding module 1802 to obtain the sign bit S s , and the sign bit decoding module 1802 determines the current frame by determining the 0, 1 state of each bit in the input bit stream. Positive and negative polarity of samples.
移位信息编码 Smc经过移位信息解码模块 1803解码得到左移位数 Sm,对 应于编码端, 移位信息解码模块 1803进行熵解码处理。 有效数据编码 Sec经过有效数据解码模块 1804解码得到有效数据 Se。 无 失真解码状态下, 根据帧头信息及移位信息, 有效数据解码模块 1804确定了 每个有效数据样点的有效比特数, 并从输入比特流中读入相应个数的比特, 进 行无失真解码。 有失真解码状态下, 有效数据解码模块 1804根据帧头信息对 当前帧进行分类, 釆用相应的方法进行反量化处理, 有失真地恢复有效数据, 实现有失真解码。 The shift information encoding S m c is decoded by the shift information decoding module 1803 to obtain a left shift number S m corresponding to the encoding end, and the shift information decoding module 1803 performs entropy decoding processing. The valid data encoding S e c is decoded by the valid data decoding module 1804 to obtain valid data S e . In the distortion-free decoding state, according to the frame header information and the shift information, the effective data decoding module 1804 determines the effective number of bits of each valid data sample, and reads a corresponding number of bits from the input bit stream to perform distortion-free. decoding. In the distortion decoding state, the effective data decoding module 1804 classifies the current frame according to the frame header information, performs inverse quantization processing by using a corresponding method, recovers valid data with distortion, and implements distortion decoding.
最后, 结合帧头信息, 第二反预处理模 1805块对符号位数据 Ss、 移位信 息数据 Sm和有效数据 Se进行分析处理, 确定了一帧原始信号的符号及符号扩 展位、 移位信息和有效比特位, 得到重构数据 Sr并输出。 参见图 28和图 29, 图 28和图 29分别是可以应用本发明实施例提供的数 据编码方法和数据解码方法的数据传输系统的示意图。 Finally, in combination with the frame header information, the second inverse pre-processing module 1805 analyzes the symbol bit data S s , the shift information data S m and the valid data S e to determine a symbol and a sign extension bit of the original signal of one frame, The information and the significant bits are shifted, and the reconstructed data Sr is obtained and output. Referring to FIG. 28 and FIG. 29, FIG. 28 and FIG. 29 are respectively schematic diagrams of a data transmission system to which a data encoding method and a data decoding method according to an embodiment of the present invention are applicable.
本发明实施例一、三提供的数据编码方法可以使用在图中的编码器中, 本 发明实施例二、 四提供的数据解码方法可以使用在图中的解码器中,解码器中 使用的解码方法和编码方法对应。  The data encoding method provided in Embodiments 1 and 3 of the present invention can be used in the encoder in the figure. The data decoding method provided in Embodiments 2 and 4 of the present invention can be used in the decoder in the figure, and the decoding used in the decoder. The method corresponds to the encoding method.
本发明实施例提供的编码器和解码器可以应用于各类信道和网络的远程 数据通信(例如数据通信、 文件传输、 语音通信、 音频通信等)、 近程和系统 内部的数据通信 (例如通用公共无线接口中的 IQ数据传输和拉远等)、设备内 或板内模块之间的数据传输 (例如模数 /数模变换器与其它部件的数据交换 等)。  The encoder and the decoder provided by the embodiments of the present invention can be applied to remote data communication (such as data communication, file transmission, voice communication, audio communication, etc.) of various channels and networks, short-range and data communication within the system (for example, general-purpose Data transmission between the IQ data in the public wireless interface, remote access, etc.), in-device or on-board modules (such as data exchange between analog-to-digital/digital-to-analog converters and other components).
另外,本发明实施例提供的编码器和解码器还可以应用于面向存储应用的 系统之中, 如数据的高效存储、 数字媒体存储、 数字图书馆等。  In addition, the encoder and the decoder provided by the embodiments of the present invention can also be applied to a system for storage applications, such as efficient storage of data, digital media storage, digital library, and the like.
需要说明的是, 上述编码器和解码器中各单元之间的信息交互、执行过程 等内容, 由于与本发明方法实施例基于同一构思, 具体内容可参见本发明方法 实施例中的叙述, 此处不再赘述。  It should be noted that the information interaction, the execution process, and the like between the units in the encoder and the decoder are based on the same concept as the method embodiment of the present invention. For details, refer to the description in the method embodiment of the present invention. I won't go into details here.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程 , 是可以通过计算机程序来指令相关的硬件来完成,的程序可存储于计算机可读 取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中, 的存储介质可为磁碟、 光盘、 只读存储记忆体(Read-Only Memory, ROM ) 或随机存 ϋ己忆体 ( Random Access Memory, RAM )等。 A person skilled in the art can understand that all or part of the process of implementing the above embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium. The flow of an embodiment of the methods as described above may be included. The storage medium may be a magnetic disk, an optical disk, or a read-only memory (ROM). Or random access to Random Access Memory (RAM).
以上对本发明所数据编码方法、数据解码方法、编码器和解码器进行了详 细介绍, 对于本领域的一般技术人员, 依据本发明实施例的思想, 在具体实施 方式及应用范围上均会有改变之处, 本说明书内容不应理解为对本发明的限 制。  The data encoding method, the data decoding method, the encoder and the decoder of the present invention are described in detail above. For those skilled in the art, according to the idea of the embodiment of the present invention, the specific implementation manner and the application range may be changed. The contents of this specification are not to be construed as limiting the invention.

Claims

权利要求 Rights request
1、 一种数据编码方法, 其特征在于, 包括: A data encoding method, comprising:
获取数据块中每个样点的正负极性;  Obtaining the positive and negative polarity of each sample in the data block;
获取所述数据块的样点中绝对值最大的样点的最高有效比特位; 获取所述数据块的每个样点中从所述最高有效比特位开始的 n位高比特 位数据, 对每个样点的高比特位数据分别进行第一类熵编码, 所述 n大于 1 , 小于所述绝对值最大的样点的有效数据的位数;  Obtaining a most significant bit of the sample having the largest absolute value among the samples of the data block; acquiring n-bit high-bit data from the most significant bit in each sample of the data block, for each The high bit data of each sample is respectively subjected to a first type of entropy coding, wherein n is greater than 1, and is less than the number of bits of valid data of the sample with the largest absolute value;
获取所述数据块的每个样点中从所述最高有效比特位开始的数据中除所 述高比特位数据之外的低比特位数据,对每个样点的低比特位数据分别进行第 一类量化编码或第二类熵编码;  Obtaining low-bit data other than the high-bit data in the data starting from the most significant bit in each sample of the data block, respectively performing low-bit data for each sample a type of quantization coding or a second type of entropy coding;
输出编码后的编码帧, 所述编码帧中包括所述最高有效比特位、携带所述 数据块的每个样点的正负极性的码字、所述数据块的每个样点的第一类熵编码 后的高比特位数据以及第一类量化编码或第二类熵编码后的低比特位数据。  Outputting the encoded coded frame, wherein the coded frame includes the most significant bit, a codeword carrying positive and negative polarities of each sample of the data block, and a sample of each sample of the data block A class of entropy encoded high bit data and a first type of quantized code or a second type of entropy encoded low bit data.
2、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 对所述数据块的每个样点的正负极性分别进行第三类熵编码;  The method according to claim 1, wherein the method further comprises: performing a third type of entropy coding on the positive and negative polarities of each sample of the data block;
所述携带每个样点的正负极性的码字为所述数据块的每个样点的第三类 熵编码后的正负极性。  The codeword carrying the positive and negative polarities of each sample is the third type of entropy coded positive and negative polarity of each sample of the data block.
3、 根据权利要求 1或 2所述的方法, 其特征在于,  3. A method according to claim 1 or 2, characterized in that
所述编码帧中还包括所述数据块的每个样点的高比特位数据第一类熵编 码的编码信息和低比特位数据第二类熵编码或第一类量化编码的编码信息。  The encoded frame further includes high-bit data of each sample of the data block, first-class entropy encoded coding information, and low-bit data second-class entropy coding or first-class quantized coding information.
4、 一种数据解码方法, 其特征在于, 包括:  4. A data decoding method, comprising:
获取接收到的编码帧中携带每个样点的正负极性的码字,根据所述码字获 取每个样点的正负极性;  Obtaining a codeword carrying positive and negative polarities of each sample in the received coded frame, and obtaining positive and negative polarities of each sample according to the codeword;
对所述编码帧中熵编码后的高比特位数据进行解码 ,获得每个样点的高比 特位数据;  Decoding high-bit data of the entropy-encoded data in the encoded frame to obtain high-specificity data of each sample;
对所述编码帧中量化编码或熵编码后的低比特位数据进行解码,获得每个 样点的低比特位数据; 根据接收到的编码帧中包含的最高有效比特位对所述每个样点的正负极 性、所述每个样点的高比特位数据和所述每个样点的低比特位数据进行组装获 得原始数据块。 Decoding the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample; Performing positive and negative polarity of each sample, high bit data of each sample, and low bit data of each sample according to the most significant bit included in the received encoded frame Assemble to get the original data block.
5、 根据权利要求 4所述的方法, 其特征在于, 所述根据所述码字获取每 个样点的正负极性包括:  5. The method according to claim 4, wherein the obtaining positive and negative polarities of each sample according to the codeword comprises:
对所述编码帧中携带每个样点正负极性的码字分别进行熵解码,获得每个 样点的正负极性。  The code words carrying the positive and negative polarities of each sample in the encoded frame are separately entropy decoded to obtain the positive and negative polarities of each sample.
6、 根据权利要求 4或 5所述的方法, 其特征在于,  6. A method according to claim 4 or 5, characterized in that
所述编码帧中还包括每个样点的高比特位数据熵编码的编码信息和低比 特位数据熵编码或量化编码的编码信息;  The coded frame further includes high bit data entropy coded coding information and low bit data entropy coded or quantized coded information of each sample;
所述对编码帧中熵编码后的高比特位数据进行解码 ,获得每个样点的高比 特位数据, 具体包括:  Decoding the high-bit data of the entropy-encoded data in the encoded frame to obtain high-specificity data of each sample, specifically including:
根据每个样点的高比特位数据熵编码的编码信息对编码帧中熵编码后的 高比特位数据进行熵解码, 获得每个样点的高比特位数据;  Entropy decoding the entropy-encoded high-bit data in the encoded frame according to the high-bit data entropy-encoded coding information of each sample to obtain high-bit data of each sample;
所述对编码帧中量化编码或熵编码后的低比特位数据进行解码,获得每个 样点的低比特位数据, 具体包括:  Decoding the low-bit data of the quantized or entropy-encoded data in the encoded frame to obtain the low-bit data of each sample, specifically including:
根据每个样点的低比特位数据熵编码或量化编码的编码信息对编码帧中 量化编码或熵编码后的低比特位数据进行解码, 获得每个样点的低比特位信 息。  The quantized or entropy encoded low bit data in the encoded frame is decoded according to the low bit data entropy encoded or quantized encoded information of each sample to obtain low bit information for each sample.
7、 根据权利要求 4或 5所述的方法, 其特征在于, 所述对编码帧中量化 编码或熵编码后的低比特位数据进行解码, 获得每个样点的低比特位数据, 包 括:  The method according to claim 4 or 5, wherein the decoding the low-bit data of the quantized or entropy-encoded data in the encoded frame to obtain the low-bit data of each sample includes:
对所述编码帧中熵编码后的低比特数据进行熵解码,获得每个样点的低比 特位数据; 或者,  Entropy decoding the entropy-encoded low-bit data in the encoded frame to obtain low-specificity data of each sample; or
对所述编码帧中量化编码后的低比特位数据进行反量化处理,获得每个样 点的低比特位数据。  The quantized low-bit data in the encoded frame is subjected to inverse quantization processing to obtain low-bit data of each sample.
8、 一种数据编码方法, 其特征在于, 包括:  8. A data encoding method, comprising:
获取数据块中每个样点的正负极性;  Obtaining the positive and negative polarity of each sample in the data block;
获取所述数据块的样点中绝对值最大的样点的最高有效比特位 p; 获取所述数据块的每个样点的最高有效比特位 d, 对每个样点的有效数据 位分别向左移 p-d位; Obtaining the most significant bit p of the sample with the largest absolute value among the samples of the data block; Obtaining the most significant bit d of each sample of the data block, and shifting the valid data bits of each sample to the left by a pd bit;
对所述数据块的每个样点的左移位数 p-d分别进行第四类熵编码; 对所述数据块的每个样点中移位后的有效数据位分别进行第五类熵编码 或第二类量化编码;  Performing a fourth type of entropy coding on the left shift number pd of each sample of the data block; performing a fifth type of entropy coding on the shifted valid data bits in each sample of the data block The second type of quantization code;
输出编码后的编码帧, 所述编码帧中包含所述最高有效比特位 P、 携带所 述数据块的每个样点的正负极性的码字、所述数据块的每个样点的第四类熵编 码后的左移位数以及第五类熵编码或第二类量化编码后的有效数据。  And outputting the encoded coded frame, where the coded frame includes the most significant bit P, a positive and negative polarity codeword carrying each sample of the data block, and each sample of the data block The fourth type of entropy-coded left shift number and the fifth type of entropy coding or the second type of quantized coded valid data.
9、 根据权利要求 8所述的方法, 其特征在于, 还包括:  9. The method according to claim 8, further comprising:
对所述数据块的每个样点的正负极性分别进行第六类熵编码;  Performing a sixth type of entropy coding on the positive and negative polarities of each sample of the data block;
所述携带所述数据块的每个样点的正负极性的码字为所述数据块的每个 样点的第六类熵编码后的正负极性。  The positive and negative polarity codewords of each sample carrying the data block are the sixth type of entropy encoded positive and negative polarities of each sample of the data block.
10、 根据权利要求 8或 9所述的方法, 其特征在于,  10. A method according to claim 8 or 9, characterized in that
所述编码帧中还包括所述数据块的每个样点的左移位数第四类熵编码的 编码信息和移位后的有效数据第二类量化编码或第五类熵编码的编码信息。  The coded frame further includes a left shift number of each sample of the data block, a fourth type of entropy coded coding information, and a shifted effective data, a second type of quantized code or a fifth type of entropy coded coded information. .
11、 一种数据解码方法, 其特征在于, 包括:  11. A data decoding method, comprising:
获取编码帧中携带每个样点的正负极性的码字 ,根据所述码字获取每个样 点的正负极性;  Obtaining a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtaining positive and negative polarities of each sample according to the codeword;
对所述编码帧中熵编码后的左移位数进行解码,获得每个样点的有效数据 的左移位数;  Decoding an entropy-encoded left shift number in the encoded frame to obtain a left shift number of valid data of each sample point;
对所述编码帧中量化编码或熵编码后的有效数据进行解码,获得每个样点 的移位后的有效数据;  Decoding the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
根据编码帧中包含的绝对值最大的样点的最高有效比特位对每个样点的 正负极性、每个样点的有效数据的左移位数以及移位后的有效数据进行组装获 得原始数据块。  The positive and negative polarities of each sample, the number of left shifts of valid data of each sample, and the valid data after shifting are assembled according to the most significant bit of the sample having the largest absolute value included in the encoded frame. Raw data block.
12、 根据权利要求 11所述的方法, 其特征在于, 所述根据码字获取每个 样点的正负极性具体为:  The method according to claim 11, wherein the obtaining positive and negative polarities of each sample according to the codeword is specifically:
对所述编码帧的每个样点的正负极性的码字分别进行熵解码,获得每个样 点的正负极性。 The code words of the positive and negative polarities of each sample of the encoded frame are separately entropy decoded to obtain the positive and negative polarities of each sample.
13、 根据权利要求 11或 12所述的方法, 其特征在于, 13. Method according to claim 11 or 12, characterized in that
所述编码帧中还包括每个样点的左移位数熵编码的编码信息和移位后的 有限数据熵编码或量化编码的编码信息;  The coded frame further includes code information of left shift number entropy coding of each sample and coded information of the shifted limited data entropy coding or quantization coding;
所述对所述编码帧中熵编码后的左移位数进行解码,获得每个样点的有效 数据的左移位数, 具体包括:  Decoding the left shift number after the entropy coding in the encoded frame, and obtaining the left shift number of the valid data of each sample, specifically:
根据所述编码帧的每个样点的左移位数熵编码的编码信息对编码帧中熵 编码后的左移位数进行熵解码, 获得每个样点的有效数据的左移位数;  And entropy decoding the entropy-encoded left shift number in the encoded frame according to the left shift number entropy coded coding information of each sample of the encoded frame, to obtain a left shift number of valid data of each sample point;
所述对编码帧中量化编码或熵编码后的有效数据进行解码,获得每个样点 的移位后的有效数据, 具体为:  Decoding the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample, specifically:
根据所述编码帧中每个样点的移位后的有效数据的熵编码或量化编码的 编码信息对编码帧中量化编码或熵编码后的有效数据进行解码,获得每个样点 的移位后的有效数据。  Decoding the quantized or entropy encoded valid data in the encoded frame according to the entropy encoded or quantized encoded information of the shifted valid data of each sample in the encoded frame to obtain a shift of each sample After valid data.
14、 根据权利要求 11或 12所述的方法, 其特征在于, 所述对编码帧中量 化编码或熵编码后的有效数据进行解码,获得每个样点的移位后的有效数据包 括:  The method according to claim 11 or 12, wherein the decoding of the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample comprises:
对所述编码帧中熵编码后的有效数据进行熵解码,获得每个样点的移位后 的有效数据; 或者,  Entropy decoding the entropy-encoded valid data in the encoded frame to obtain the shifted valid data of each sample; or
对编码帧中量化编码后的有效数据进行反量化处理,获得每个样点的移位 后的有效数据。  The quantized and validated data in the encoded frame is inverse quantized to obtain the shifted valid data for each sample.
15、 一种编码器, 其特征在于, 包括:  15. An encoder, comprising:
第一预处理单元, 用于获取数据块中每个样点的正负极性, 以及数据块的 样点中绝对值最大的样点的最高有效比特位;  a first pre-processing unit, configured to obtain positive and negative polarities of each sample in the data block, and a most significant bit of the sample with the largest absolute value among the samples of the data block;
高比特位编码单元,用于获取所述数据块中每个样点中从所述最高有效比 特位开始的 n位高比特位数据,对每个样点的高比特位数据分别进行第一类熵 编码, 所述 n大于 1 , 小于所述绝对值最大的样点的有效数据的位数;  a high-bit coding unit, configured to acquire n-bit high-bit data from the most significant bit in each sample in the data block, and perform a first class on each of the high-bit data of each sample Entropy coding, wherein n is greater than 1, and is less than the number of bits of valid data of the sample having the largest absolute value;
低比特位编码单元,用于获取所述数据块中每个样点中从所述最高有效比 特位开始的数据中除所述高比特位数据之外的低比特位数据,对每个样点的低 比特位数据分别进行第一类量化编码或第二类熵编码; 第一编码输出单元, 用于输出编码后的编码帧, 所述编码帧中包括所述最 高有效比特位、携带所述数据块的每个样点的正负极性的码字、 所述数据块的 每个样点的第一类熵编码后的高比特位数据以及第一类量化编码或第二类熵 编码后的低比特位数据组成的编码帧。 a low bit coding unit, configured to acquire low bit data other than the high bit data in data starting from the most significant bit in each sample in the data block, for each sample point The low bit data is respectively subjected to the first type of quantization coding or the second type of entropy coding; a first code output unit, configured to output an encoded code frame, where the coded frame includes the most significant bit, a codeword carrying positive and negative polarity of each sample of the data block, and the data A first type of entropy encoded high bit data of each sample of the block and an encoded frame of the first type of quantized code or the second type of entropy encoded low bit data.
16、 根据权利要求 15所述的编码器, 其特征在于, 还包括:  The encoder according to claim 15, further comprising:
第一极性编码单元,用于对所述数据块的每个样点的正负极性分别进行第 三类熵编码;  a first polarity encoding unit, configured to perform a third type of entropy encoding on the positive and negative polarities of each sample of the data block;
所述第一编码输出单元输出的编码帧中的携带所述数据块的每个样点的 正负极性的码字为所述数据块的每个样点的第三类熵编码后的正负极性。  The code words of the positive and negative polarities of each sample carrying the data block in the encoded frame output by the first code output unit are the third type of entropy coded positive of each sample of the data block Negative polarity.
17、 一种解码器, 其特征在于, 包括:  17. A decoder, comprising:
第一极性获取单元,用于获取接收到的编码帧中携带每个样点的正负极性 的码字, 根据所述码字获取每个样点的正负极性;  a first polarity acquiring unit, configured to acquire a codeword carrying positive and negative polarities of each sample in the received encoded frame, and obtain positive and negative polarities of each sample according to the codeword;
高比特位解码单元,用于对所述编码帧中熵编码后的高比特位数据进行解 码, 获得每个样点的高比特位数据;  a high bit decoding unit, configured to decode the entropy encoded high bit data in the encoded frame to obtain high bit data of each sample;
低比特位解码单元,用于对所述编码帧中量化编码或熵编码后的低比特位 数据进行解码, 获得每个样点的低比特位数据;  a low bit decoding unit, configured to decode the quantized or entropy encoded low bit data in the encoded frame to obtain low bit data of each sample;
第一数据组装单元,用于根据接收到的编码帧中包含的最高有效比特位将 每个样点的正负极性、每个样点的高比特位数据和低比特位数据进行组装获得 原始数据块。  a first data assembling unit, configured to assemble the positive and negative polarities of each sample, the high bit data of each sample, and the low bit data according to the most significant bit included in the received encoded frame to obtain the original data block.
18、 一种编码器, 其特征在于, 包括:  18. An encoder, comprising:
第二预处理单元,用于获取数据块中每个样点的正负极性以及所述数据块 的样点中绝对值最大的样点的最高有效比特位 p;  a second pre-processing unit, configured to obtain positive and negative polarities of each sample in the data block and a most significant bit p of the sample with the largest absolute value among the samples of the data block;
移位单元, 用于获取所述数据块中每个样点的最高有效比特位 d, 对每个 样点的有效数据位分别向左移 p-d位;  a shifting unit, configured to acquire a most significant bit d of each sample in the data block, and shift a valid data bit of each sample to a left by a p-d bit;
移位信息编码单元,用于对所述数据块中每个样点的左移位数 p-d分别进 行第四类熵编码;  a shift information encoding unit, configured to perform a fourth type of entropy encoding on each of the left shift numbers p-d of each sample in the data block;
有效数据编码单元,用于对所述数据块中每个样点中移位后的有效数据位 分别进行第五类熵编码或第二类量化编码; 第二编码输出单元, 用于输出编码后的编码帧, 所述编码帧中包含所述最 高有效比特位 P、 携带所述数据块的每个样点的正负极性的码字、 所述数据块 的每个样点的第四类熵编码后的左移位数以及第五类熵编码或第二类量化编 码后的有效数据。 An effective data encoding unit, configured to respectively perform a fifth type of entropy coding or a second type of quantization coding on the shifted valid data bits in each sample in the data block; a second code output unit, configured to output the encoded coded frame, where the coded frame includes the most significant bit P, a codeword carrying positive and negative polarities of each sample of the data block, The fourth type of entropy-coded left shift number of each sample of the data block and the fifth type of entropy coding or the second type of quantized coded valid data.
19、 根据权利要求 18所述的编码器, 其特征在于, 还包括:  The encoder according to claim 18, further comprising:
第二极性编码单元,用于对所述数据块的每个样点的正负极性分别进行第 六类熵编码;  a second polarity encoding unit, configured to perform a sixth type of entropy coding on the positive and negative polarities of each sample of the data block;
所述第二编码输出单元输出的编码帧中的携带所述数据块的每个样点的 正负极性的码字为所述数据块的每个样点的第六类熵编码后的正负极性。  The code words of the positive and negative polarities of each sample carrying the data block in the encoded frame output by the second coding output unit are the sixth type of entropy coded positive of each sample of the data block Negative polarity.
20、 一种解码器, 其特征在于, 包括:  20. A decoder, comprising:
第二极性获取单元, 用于获取编码帧中携带每个样点的正负极性的码字, 根据所述码字获取每个样点的正负极性;  a second polarity acquiring unit, configured to acquire a codeword carrying positive and negative polarities of each sample in the encoded frame, and obtaining positive and negative polarities of each sample according to the codeword;
左移位数解码单元, 用于对所述编码帧中熵编码后的左移位数进行解码, 获得每个样点的有效数据的左移位数;  a left shift number decoding unit, configured to decode the entropy encoded left shift number in the encoded frame, to obtain a left shift number of valid data of each sample point;
有效数据解码单元,用于对所述编码帧中量化编码或熵编码后的有效数据 进行解码, 获得每个样点的移位后的有效数据;  An effective data decoding unit, configured to decode the quantized or entropy encoded valid data in the encoded frame to obtain the shifted valid data of each sample;
第二数据组装单元,用于根据编码帧中包含的绝对值最大的样点的最高有 效比特位对每个样点的正负极性、每个样点的有效数据的左移位数以及移位后  a second data assembling unit, configured to: positive and negative polarity of each sample, left shift number of valid data of each sample, and shift according to a most significant bit of a sample having the largest absolute value included in the encoded frame After
PCT/CN2011/074930 2010-09-30 2011-05-30 Data encoding method, decoding method, encoder and decoder WO2011150810A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201010505926 CN101980464B (en) 2010-09-30 2010-09-30 Data coding method, decoding method, coder and decoder
CN201010505926.8 2010-09-30

Publications (1)

Publication Number Publication Date
WO2011150810A1 true WO2011150810A1 (en) 2011-12-08

Family

ID=43600948

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/074930 WO2011150810A1 (en) 2010-09-30 2011-05-30 Data encoding method, decoding method, encoder and decoder

Country Status (2)

Country Link
CN (1) CN101980464B (en)
WO (1) WO2011150810A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101980464B (en) * 2010-09-30 2013-01-16 华为技术有限公司 Data coding method, decoding method, coder and decoder
CN102664636B (en) * 2012-05-16 2016-03-23 苏州大学 A kind of variable-length encoding, coding/decoding method and device
CN103634273A (en) * 2012-08-21 2014-03-12 电信科学技术研究院 Data compression transmitting and decompression method and apparatus
FR3008263B1 (en) * 2013-07-05 2015-08-21 Sagemcom Energy & Telecom Sas METHOD FOR PROVIDING COMPRESSED DATA BY AN ELECTRIC COUNTER

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030081690A1 (en) * 2001-10-29 2003-05-01 Samsung Electronics Co., Ltd. Apparatus and method for transmitting/receiving data in a CDMA mobile communication system
CN101420231A (en) * 2007-10-25 2009-04-29 索尼株式会社 Encoding method and device, and program
CN101820408A (en) * 2010-04-06 2010-09-01 新邮通信设备有限公司 Method and device for generating baseband sending data
CN101980464A (en) * 2010-09-30 2011-02-23 华为技术有限公司 Data coding method, decoding method, coder and decoder

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030081690A1 (en) * 2001-10-29 2003-05-01 Samsung Electronics Co., Ltd. Apparatus and method for transmitting/receiving data in a CDMA mobile communication system
CN101420231A (en) * 2007-10-25 2009-04-29 索尼株式会社 Encoding method and device, and program
CN101820408A (en) * 2010-04-06 2010-09-01 新邮通信设备有限公司 Method and device for generating baseband sending data
CN101980464A (en) * 2010-09-30 2011-02-23 华为技术有限公司 Data coding method, decoding method, coder and decoder

Also Published As

Publication number Publication date
CN101980464B (en) 2013-01-16
CN101980464A (en) 2011-02-23

Similar Documents

Publication Publication Date Title
RU2417518C2 (en) Efficient coding and decoding conversion units
TWI453734B (en) Method for encoding a symbol, method for decoding a symbol, method for transmitting a symbol from a transmitter to a receiver, encoder, decoder and system for transmitting a symbol from a transmitter to a receiver
KR101737294B1 (en) Methods and devices for source-coding and decoding of data involving symbol compression
JP5313362B2 (en) High speed parsing of variable length fixed length code
US8942502B2 (en) Parallelization of variable length decoding
US8279947B2 (en) Method, apparatus and system for multiple-description coding and decoding
JP2009509456A (en) Sequential improvement of lattice vector quantization
CN103873877A (en) Image transmission method and device for remote desktop
CN1726644B (en) Apparatus and method for multiple description encoding
JP4163680B2 (en) Adaptive method and system for mapping parameter values to codeword indexes
WO2011150810A1 (en) Data encoding method, decoding method, encoder and decoder
US20140006036A1 (en) Method and apparatus for coding and decoding
WO2020095706A1 (en) Coding device, decoding device, code string data structure, coding method, decoding method, coding program, and decoding program
WO2012048662A1 (en) Method, device and system for data compression and decompression
JP2014521273A (en) Method and apparatus for encoding an image
KR20090122390A (en) A method and a device for processing bit symbols generated by a data source, a computer readable medium, a computer program element
US8421655B2 (en) Apparatus for parallel entropy encoding and decoding
US10742231B2 (en) Compression/encoding apparatus and method, decoding apparatus and method, and program
Mohamed Wireless Communication Systems: Compression and Decompression Algorithms
Langi Lossless compression performance of a simple counter-based entropy coder
Schwarz Source Coding and Compression
JP2017525266A (en) Method and apparatus for performing arithmetic coding based on concatenated ROM-RAM tables

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: 11789189

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11789189

Country of ref document: EP

Kind code of ref document: A1