CN118301258A - Decoding method, system and decoder for Golomb coding - Google Patents

Decoding method, system and decoder for Golomb coding Download PDF

Info

Publication number
CN118301258A
CN118301258A CN202410394130.1A CN202410394130A CN118301258A CN 118301258 A CN118301258 A CN 118301258A CN 202410394130 A CN202410394130 A CN 202410394130A CN 118301258 A CN118301258 A CN 118301258A
Authority
CN
China
Prior art keywords
data
register
golomb
decoding
time sequence
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202410394130.1A
Other languages
Chinese (zh)
Inventor
王振
李俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Institute of Technology
Original Assignee
Wuhan Institute of Technology
Filing date
Publication date
Application filed by Wuhan Institute of Technology filed Critical Wuhan Institute of Technology
Publication of CN118301258A publication Critical patent/CN118301258A/en
Pending legal-status Critical Current

Links

Abstract

The invention relates to a decoding method, a decoding system and a decoding device of Golomb coding, wherein the method comprises the following steps: acquiring compressed data; dividing the compressed data into a plurality of groups according to time sequence to obtain a plurality of groups of time sequence code streams; sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data; decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameter is Golomb-Rice coding of a mapping value of a prediction error in JPEG-LS compression, and the mapping prediction error data is decoded time sequence data; the invention utilizes the register to carry out left shift operation on the Golomb coding data, then calculates the parameters solved in the code stream to obtain the decoding data, the shift operation is more efficient compared with the traditional data calculation decoding operation, and the operation of the shift and calculation can improve the decoding efficiency.

Description

Decoding method, system and decoder for Golomb coding
Technical Field
The invention relates to the technical fields of high-speed image decompression, automatic control, image processing, visual tracking and the like, in particular to a decoding method, a decoding system and a decoding device of Golomb coding.
Background
Golomb decoding is a process for restoring Golomb-encoded data to original data. Golomb coding is a lossless data compression technique, particularly suited for compression of non-negative integer sequences. Golomb coding and decoding are widely used in the field of digital signal processing to compress and decompress audio and image data to reduce storage and transmission requirements. Taking the example of a JPEG-LS decompressed image, golomb decoding is used in JPEG-LS primarily to decode non-negative integer values of prediction errors that represent differences between original image pixel values and predicted pixel values. Among them, JPEG-LS is a new lossless compression standard for continuous tone images. Software decoding is often limited by computational resources and therefore does not provide adequate decoding speed in applications that handle large-scale data or require high performance. In real-time processing or high throughput data processing applications, problems such as processing delays and performance starvation may result.
Disclosure of Invention
In order to solve the technical problems of low decoding speed, decoding delay and the like when the coded data is decoded by adopting the Golomb in the prior art, the invention provides a decoding method, a decoding system and a decoder for Golomb coding.
The technical scheme for solving the technical problems is as follows:
A decoding method of Golomb coding, comprising the steps of:
Acquiring compressed data; the compressed data is obtained by performing data compression on time sequence data by using a Golomb coding method;
Dividing the compressed data into a plurality of groups according to time sequence to obtain a plurality of groups of time sequence code streams;
sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data;
decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameter is Golomb-Rice coding of a mapping value of a prediction error in JPEG-LS compression, and the mapping prediction error data is the decoded time sequence data.
The beneficial effects of the invention are as follows: after the Golomb encoded data is shifted left by the register, the decoded parameters in the code stream are calculated to obtain decoded data, the shift operation is more efficient than the traditional data calculation decoding operation, and the shift and calculation operation can improve the decoding efficiency.
On the basis of the technical scheme, the invention can be improved as follows.
Further, compressed data is obtained, specifically comprising the following steps:
The compressed data is acquired and stored in a FIFO memory.
Further, the number of the registers is I; the storage capacity of the register is equal to the size of the time sequence code stream;
Sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data, wherein the method comprises the following steps of:
Intercepting I groups of the time sequence code streams from the FIFO memory;
the time sequence code streams of the I group are respectively stored in I registers temporarily;
The time sequence code stream in the ith register is averagely divided into a plurality of groups according to the sequence from high order to low order to obtain a plurality of data segments; wherein i=1, 2, …, I;
Calculating the bit number of which the preceding code value of the marking bit in all the data segments in the register i is 0, and obtaining a parameter val_count; wherein, the marking bit is the bit with the first code value of 1 from the high order to the low order;
and performing left shift operation on the time sequence code stream in the ith register according to the parameter val_count.
Further, performing a shift left operation on the timing code stream in the ith register according to the parameter val_count, including the following steps:
If the val_count is equal to the storage capacity of the register, shifting the time sequence code stream in the register i by val_count bit left, and intercepting val_count bit data from the high bit of the (i+1) th register to supplement to the low val_count bit of the (i) th register;
If val_count is not equal to the storage capacity of the register i, shifting the time sequence code stream in the register i by val_count+1 bit to the left, and intercepting val_count+1 bit data from the high bit of the (i+1) th register to supplement the data to the low val_count+1 bit of the (i) th register;
after performing a shift operation on the time sequence code stream in the ith register according to the parameter val_count, the method further comprises the following steps:
Judging whether the time sequence code stream is supplemented into the (i+1) th register, if so, intercepting a group of time sequence code streams from the FIFO memory to supplement the (i+1) th register, and if not, not supplementing the time sequence code stream into the (i+1) th register.
Further, judging whether to supplement the time sequence code stream, comprising the following steps:
Calculating the number of bits of 1 in all the data segments in the (i+1) th register;
If the number of bits of 1 in all the data segments in the (i+1) th register is zero, the time sequence code stream needs to be supplemented;
if the number of bits of "1" in all the data segments in the i+1th register is not zero, the time sequence code stream does not need to be supplemented.
Further, decoding calculation is performed on the pre-decoded data by using the Golomb coding parameter to obtain mapped prediction error data, including the following steps:
Determining a decoding mode by using the Golomb coding parameter and the parameter val_count;
And after determining the decoding mode, decoding and calculating the pre-decoded data by utilizing the Golomb coding parameter and the parameter val_count to obtain the mapping prediction error data.
Further, the Golomb coding parameters include a parameter K, a parameter qbpp, and a parameter LIMIT; parameter K represents a number of bits required to store the mapped prediction error data such that the Golomb code represents a mapped prediction error with a shortest codeword, parameter qbpp represents a maximum length of the codeword by the Golomb code, and parameter LIMIT; wherein, K is [0,12];
determining a decoding mode by using the Golomb coding parameter and the parameter val_count includes the following steps:
subtracting 1 from the difference obtained by subtracting the parameter qbpp from the parameter LIMIT to obtain a judgment value;
And comparing the parameter val_count with the judgment value to determine a decoding mode.
Further, after determining the decoding mode, performing decoding calculation on the pre-decoded data by using the Golomb coding parameter and the parameter val_count to obtain mapped prediction error data, including the following steps:
if the parameter val_count is equal to the judgment value, the calculation formula of the mapping prediction error data is as follows:
MErrval=n_12+1;
Wherein MErrval denotes the mapping prediction error data, n_12 denotes the pre-decoded data, and the pre-decoded data is the data of the high K bit in the i-th register after the left shift operation;
If the parameter val_count is not equal to the judgment value, the calculation formula of the mapping prediction error data is as follows:
MErrval=val_count*(1<<K)+n_12。
In order to solve the technical problems, the invention also provides a decoding system of Golomb coding, which has the following specific technical scheme:
a decoding system of Golomb code comprises a data acquisition module and a decoding module;
The data acquisition module is used for acquiring compressed data; the compressed data is obtained by performing data compression on time sequence data by using a Golomb coding method;
the data acquisition module is also used for dividing the compressed data into a plurality of groups according to time sequence to obtain a plurality of groups of time sequence code streams;
The decoding module is used for sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data;
The decoding module is also used for decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameter is Golomb-Rice coding of a mapping value of a prediction error in JPEG-LS compression, and the mapping prediction error data is the decoded time sequence data.
In order to solve the technical problems, the invention also provides a Golomb coding decoder, which has the following specific technical scheme:
A Golomb encoded decoder decodes the compressed data using the above-described Golomb encoded decoding method.
Drawings
FIG. 1 is a block flow diagram of a decoding method of Golomb encoding in an embodiment of the invention;
FIG. 2 is a diagram illustrating a coding structure of Golomb coding according to an embodiment of the present invention;
FIG. 3 is a diagram showing a coding structure of Golomb coding according to an embodiment of the present invention;
FIG. 4 is a flow chart showing the number of bits equal to 0 before the first bit from the high bit to the low bit in the statistic register is 1 in the embodiment of the invention;
FIG. 5 is a flowchart illustrating a process of calculating the parameter val_count according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating shifting in registers according to an embodiment of the present invention;
FIG. 7 is a state transition diagram in an embodiment of the invention
FIG. 8 is a schematic diagram of a shift of no more than 64 bits from the last pixel processed in an embodiment of the invention;
FIG. 9 is a diagram illustrating a displacement of 64 bits or more from the last pixel processed in the embodiment of the invention;
FIG. 10 is a diagram showing assignment logic for different cases in the S7 state according to an embodiment of the present invention;
FIG. 11 is a diagram illustrating assignment logic for different cases in the S5 state in an embodiment of the present invention;
FIG. 12 is a diagram showing shifting 0-64 bits by shift_Golomb_in in S5 state according to the embodiment of the present invention;
FIG. 13 is a diagram showing shifting of 65-128 bits by shift_Golomb_in in the S5 state according to an embodiment of the present invention.
Detailed Description
The principles and features of the present invention are described below with reference to the drawings, the examples are illustrated for the purpose of illustrating the invention and are not to be construed as limiting the scope of the invention.
Example 1
As shown in fig. 1, the present embodiment provides a decoding method of Golomb coding, including the following steps:
S10, obtaining compressed data; the compressed data is obtained by performing data compression on time sequence data by using a Golomb coding method;
The compressed data is obtained by the following specific steps:
Compressed data is acquired and stored in FIFO memory. The FIFO representation FirstInputFirstOutput is referred to as first-in first-out. Due to the rapid development of microelectronic technology, the capacity of the new generation of FIFO chips is larger, the volume is smaller, and the price is cheaper. As a new type of large-scale integrated circuit, FIFO chips are increasingly being used in high-speed data acquisition, high-speed data processing, high-speed data transmission, and multi-machine processing systems due to their flexible, convenient, and efficient characteristics. The FIFO memory is a first-in first-out memory. The time sequence data is specifically time sequence image data, the compressed data is lossless compressed data or NEAR lossless compressed data, the NEAR value of the image data is zero when the compressed data is lossless compressed data, and the NEAR value is 1 or 2 when the compressed data is lossless compressed data; the compressed data is; lossless compression data means that the compression parameter NEAR value of the image data is equal to zero; NEAR lossless compression data means that the compression parameter NEAR value of the image data is equal to 1 or 2; the compressed data is specifically Golomb-Rice encoding of a mapped value of a prediction error of the time-series image data.
As shown in fig. 2 and 3, the coding process corresponding to the Golomb decoding process is the reverse direction of the decoding operation, and has an important reference meaning. In the encoding operation, a quotient q of MErrval divided by a parameter k needs to be calculated, if q < LIMIT-qbpp-1, q bits of 0 are encoded into a Golomb code stream, 1 bit of 1 is encoded into the Golomb code stream, and finally n low k bits are added into the encoded code stream in a binary form, wherein the calculation formula of n is as follows:
n=MErrval-q×2k
If q is greater than or equal to LIMIT-qbpp-1, then 0 of LIMIT-qbpp-1 bits is encoded into the Golomb code stream, then 1 bit of 1 is encoded into the Golomb code stream, and finally the lower qbpp bits of MErrval-1 are encoded into the Golomb code stream in binary form. Parameter K represents a number of bits required to store the mapped prediction error data such that the Golomb code represents a mapped prediction error with a shortest codeword, parameter qbpp represents a fixed value, parameter LIMIT represents a maximum length of the codeword by the Golomb code, and MErrval represents the mapped prediction error data.
S20, dividing the compressed data into a plurality of groups according to time sequence, and obtaining a plurality of groups of time sequence code streams.
S30, sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data;
When I is equal to 3,3 64-bit registers are designed to buffer Golomb code streams read from the FIFO memory, i.e. time-series code streams, first a group of 64-bit time-series code streams are read from the FIFO memory and registered in the register a, then a group of 64-bit time-series code streams are read and registered in the register B, and finally a group of 64-bit time-series code streams are read and registered in the register C.
As shown in FIG. 4, after the Golomb code stream to be decoded is stored in all three registers, the 64-bit data in register A is divided into 8 groups of 8-bit wide line signals from high to low, respectively val0, val1, val2, val3, val4, val5, val6, val7, the highest 8 bits are assigned to val0, and the lowest 8 bits are assigned to val7. When it is required to find which bit of bit=1 is in the register, detecting val0, val1, val2, val3, val4, val5, val6, val7 at the same time, detecting the number of bits continuously being 0 in 8 sets of data from high to low, taking the value of the number of bits continuously being 0 in 8 sets of data as parameters val0_count, val1_count, val2_count, val3_count, val4_count, val5_count, val6_count and val7_count, and outputting the result as the number of 0 to be counted in the corresponding set, taking val0_count as an example, 8'b0000_1101 outputting result as 4,8' b0010_1011 outputting result as 2, and the other sets of methods of counting 0 are the same.
As shown in fig. 5, after calculating the results of val0_count, val1_count, val2_count, val3_count, val4_count, val5_count, val6_count and val7_count, judging whether the 8-bit code streams have 0 bit or not through the corresponding net signals val_b0, val_b1, val_b2, val_b3, val_b4, val_b5, val_b6 and val_b7, outputting 1 if all 0, otherwise outputting 0; for example: if val0_count=8, then valb0=1, val0_count+.8, then valb0=0.
After val_count is calculated in the calculation period of decoding of a single group of Golomb code streams, the code streams in the register a, the register B and the register C are updated through an external trigger command start_val in the first clock period, that is, when the external trigger command start_val received by the decoder is valid (which may be high-level trigger valid or low-level trigger valid), the code streams in the register a, the register B and the register C are updated in a manner of shifting according to the result of val_count. If the result of val_count is 64, the bit number to be shifted is 64, otherwise, val_count+1 bit is shifted to shift all the counted bits to 0 and 1bit 1 in the code to the left.
As shown in fig. 6, assuming that the number of bits to be shifted is n, the register C is shifted left by n bits; the code stream updated by the register B is formed by splicing the high (64-n) bit in the original register B and the high n bit in the original register C, wherein the high (64-n) bit in the original register B is positioned at the high position, and the high n bit in the original register C is positioned at the low position; the code stream updated by the register A is formed by splicing the high (64-n) bit in the original register A and the high n bit in the original register B, wherein the high (64-n) bit in the original register A is positioned at the high position, and the high n bit in the original register B is positioned at the low position. The code stream mode in the update register is as follows: when the result of val_count is equal to the number of bits of the current register, namely when the result of val_count is equal to the storage capacity of the current register, the code stream in the register is shifted to the left by val_ coun bits; if the result of val_count is not equal to the number of bits in the current register, the bit stream in the register shifts left by val_ coun +1 bits, and the low-order bits are complemented by the subsequent bit stream after shifting left.
At the next clock cycle when start_val is active and when the external trigger instruction start_k is active, register a, register B and register C will be shifted here by parameter K or by parameter qbpp. Meanwhile, if the coding mode shown in fig. 2 is adopted, the mapping prediction MErrval is derived by using the parameter K and the calculated val_count and then by using the Golomb code stream; in the case of the coding scheme shown in fig. 3, the mapping prediction error MErrval is derived using the parameters qbpp in combination with the Golomb code stream.
Specifically, the step of judging whether to supplement the time sequence code stream comprises the following steps:
Calculating the number of bits of 1 in all the data segments in the (i+1) th register;
If the number of bits of 1 in all the data segments in the (i+1) th register is zero, the time sequence code stream needs to be supplemented;
if the number of bits of "1" in all the data segments in the i+1th register is not zero, the time sequence code stream does not need to be supplemented.
S40, decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameters are used when the time sequence data is subjected to lossless compression by using a Golomb coding method, and the mapping prediction error data are the decoded time sequence data.
Decoding and calculating the pre-decoded data by using the Golomb coding parameter to obtain mapping prediction error data, comprising the following steps:
s41, determining a decoding mode by utilizing the Golomb coding parameter and the parameter val_count;
S42, after determining the decoding mode, decoding and calculating the pre-decoding data by utilizing the Golomb coding parameter and the parameter val_count to obtain the mapping prediction error data. Wherein, the Golomb coding parameters comprise a parameter K, a parameter qbpp and a parameter LIMIT; parameter K represents a number of bits required to store the mapped prediction error data such that the Golomb code represents a mapped prediction error with a shortest codeword, parameter qbpp represents a maximum length of the codeword by the Golomb code, and parameter LIMIT;
determining a decoding mode by using the Golomb coding parameter and the parameter val_count includes the following steps:
s43, subtracting 1 from the difference obtained by subtracting the parameter qbpp from the parameter LIMIT to obtain a judgment value;
S44, comparing the parameter val_count with the judgment value to determine a decoding mode.
After determining the decoding mode, decoding and calculating the pre-decoded data by using the Golomb coding parameter and the parameter val_count to obtain mapping prediction error data, wherein the method comprises the following steps:
s45, if the parameter val_count is equal to the judgment value, the calculation formula of the mapping prediction error data is as follows:
MErrval=n_12+1;
wherein MErrval denotes the mapped prediction error data, and n_12 denotes the pre-decoded data;
S46, if the parameter val_count is not equal to the judgment value, the calculation formula of the mapping prediction error data is as follows:
MErrval=val_count*(1<<K)+n_12。
According to the embodiment of the invention, after the Golomb encoded data is subjected to left shift shifting operation by using the register, the parameters solved in the code stream are calculated to obtain the decoded data, the shifting operation is more efficient than the traditional data calculation decoding operation, and meanwhile, the operation of shifting and calculating can improve the decoding efficiency, and 1< < K represents that the binary system of 1 is subjected to left shift K shift.
Example 2
In this embodiment, 16×64 pixels are taken as a small block, and at the same time, 16 small blocks are taken as a group of Golomb code streams, so that the problem of 0 compensation is involved in Golomb coding, 0 compensation is needed to be discarded according to the bit number of shift in decoding, otherwise, the problem that the 0 compensation is calculated into effective Golomb coding can occur, and the problem of subsequent Golomb decoding is affected. The specific method comprises the following steps:
As shown in fig. 7, S0 is an initialized state, and each time the system is reset, the system jumps to S0. The coded Golomb code stream is temporarily stored in a FIFO memory, and the data outlet of the FIFO memory is 64 bits. When the FIFO memory has no data, the decoding system waits in the S0 state, and reads the FIFO register signal to be low level; when the empty signal of the FIFO is detected to be pulled low, the state jumps to S01 and the read FIFO signal is set high.
In the S01 state, the read FIFO signal is set to low level, and the Golomb code information is read once, and the 64-bit Golomb code information is temporarily stored in the Golomb_in register, namely, the FIFO memory, to be used. Wherein, the Golomb_in register, namely the FIFO memory, is the FIFO memory; and the system jumps from the S01 state to the S1 state.
In the S1 state, the code stream in the Golomb_in register, i.e., the FIFO memory, is assigned to register A. If the empty signal of Golomb_FIFO is low, the read signal of FIFO is set high, and the state jumps to S02; if Golomb_FIFO is empty, the read signal of the FIFO remains low while the state remains at S1.
In the S02 state, the read FIFO signal is set to low level, and the Golomb code information is read once, and the 64-bit Golomb code information is temporarily stored in the Golomb_in register, namely, the FIFO memory, and is ready for use. The S02 state jumps to the S2 state.
In the S2 state, the code stream in the Golomb_in register, i.e., the FIFO memory, is assigned to register B. If the empty signal of Golomb_FIFO is low level, the read signal of FIFO is set high level, and the state jumps to S03; if Golomb_FIFO is empty, the read signal of the FIFO remains low while the state remains at S2.
In the S03 state, the read FIFO signal is set to a low level, and the Golomb code information is read once, and the state jumps to the S003 state.
In the S003 state, the code stream in the golomb_in register, i.e., FIFO memory, is assigned to the register C. In this state, the read golomb_fifo signal remains low, and Golomb code information is already present in Golomb register A, B, C, so the state will jump to S3 by setting the golomb_ready signal, i.e., the shift ready signal, high.
In the S3 state, the Golomb code stream in the register A, B, C needs to be shifted according to the calculated val_count, the parameter K, and the parameter qbpp, where the shifting is performed when the external trigger signals start_val and start_k are valid. The Golomb code stream may be calculated as a predictive mapping error MErrval for each two shifts. The state jump of S3 will shift according to the tile position, pixel position and shifted number of bits in case start_val and start_k are valid.
Fig. 2 and 3 are schematic diagrams of Golomb coding scheme 1 and coding scheme 2, respectively. The difference in coding scheme determines how the present invention calculates the predicted map error MErrval, and also involves the process of register shifting by different parameters. According to the coding mode in the figure, the invention calculates the number of 0 for each group of Golomb codes, then shifts left, shifts 0 which is equal to 1 bit and is in front of the Golomb codes, shifts the Golomb codes through a parameter K and a parameter qbpp, and discards the complementary 0 related to special cases at the moment through shifting, and finally calculates the Golomb codes through a Golomb code stream and the parameters to obtain MErrval.
FIG. 4 shows that when the Golomb stream to be decoded is stored in each of the three registers, the 64-bit data in the Golomb register A is divided into 8 groups of 8-bit wide line network signals from high to low, respectively val0, val1, val2, val3, val4, val5, val6, val7, and the number of bits in the 8-bit data is detected from high to low to be 0 continuously, and the value is outputted as val0_count, val1_count, val2_count, val3_count, val4_count, val5_count, val6_count and val7_count, and the output result is the number of 0 to be counted in the corresponding group. 8, each group is counted simultaneously, so that the counting speed is increased.
FIG. 5 shows how to calculate val_count, the present invention determines whether all of the 8-bit code streams are 0 through the line signals val_B0, val_B1, val_B2, val_B3, val_B4, val_B5, val_B6, val_B7, and outputs 1 if all of the 8-bit code streams are 0, otherwise outputs 0. By the above signals, from the high order to the low order, the group of all the groups judged to be all 0 plus the group of which the highest is not all 0 is selected, and how many continuous 0s are shared from the high order to the low order is calculated as the output of val_count. How to calculate val_count. Number of bits of 0 in each group of 8-bit code stream
In the S3 state, when start_val is valid, the number of bits to be shifted by val_count (statistical 0) is shift_val_left, and this value needs to be assigned to exe_num_shift, and in the shift operation of register a, register B, and register C of the temporary Golomb code stream, the shift operation is performed by exe_num_shift. As shown in fig. 6, if shift_val_left=n, the lower order of register C complements n-bit 0, the upper order complements the lower order of register B, the upper order of register B complements the lower order of register a, and the upper order of register a is shifted left.
Meanwhile, the use64 register a is a counter that counts whether a set of 64 bits are all shifted left, so that in the case where the start_val is valid, the number of bits of shift_val_left needs to be added on the basis of the original use64_golomb_a, and then the state jump is determined by the value of use 64_golomb_a. Meanwhile, the pix_cnt signal is the number of pixels that have been decoded within 16 small blocks (16×64 pixels for one small block), and every 16 small blocks are cleared, and this value remains unchanged if the start_val is valid. When start_val is valid, as shown in fig. 7, since the post-displacement condition does not need to be considered, the state remains in the S3 state.
As shown in fig. 8, in the S3 state, in the case where the start_k is valid, each time the last pixel point of 16 small blocks is processed, and the shift count of the use64_golomb_a is smaller than 64 bits, it is enough to indicate that the 0-compensating operation is performed during the encoding process of the 16 th small block of the group, and the state is kept in the S3 state. In this case, as shown in fig. 7, the 0 of the complementary bit is shifted left together with the number of bits determined by the parameter K, so that the 0 of the complementary bit does not affect the subsequent shift determination, and the shift method is the same as that of fig. 6.
As shown in fig. 9, in the S3 state, in the case where start_k is valid, whenever the last pixel point of 16 small blocks is processed, and the shift count of use64_golomb_a is 64 bits or more, it is indicated that the number of bits of the group to be shifted exceeds 64 bits, and the data needs to be re-read from the FIFO; the shift_golomb_in needs to be calculated, namely how many bits are reassigned to a register, the value is calculated by using the value of the shift_golomb_A-64+shift_k_left, namely the total number of shifts is subtracted by the number of bits 64 of the register, and the number of bits needed to be shifted through the parameter K at the present time is added, the subsequent state can jump to the S5 state, and the value carries out the register assignment and the shift in the S5 state; at the same time, the latest shift bit number, use64_Golomb_A, will also be updated by use64_Golomb_A-64+shift_k_left for subsequent shift accumulation; meanwhile, in this case, the signal exe_num_shift shifted in this state is shifted according to shift_k_left, and the shifting method is the same as that of fig. 6; the next state to this state is S7.
As shown in fig. 10, in the S7 state, different assignment operations are performed through the have_rd_fifo_golomb instruction signal, in the first case, if the have_rd_fifo_golomb is high, if the read FIFO signal has been set to high, the fifo_rd_golomb is set to low, and meanwhile, golomb_wait_num performs +1 operations, and the golomb_wait_num is a time count of assigning the read Golomb code stream to the FIFO memory, which is a golomb_in register, after reading the signal GolombFIFO. In the second case, if have_rd_fifo_golomb is low, i.e. the previous state does not read GolombFIFO data, two cases are separated: if GolombFIFO is not empty, i.e., the FIFO register stores data, then read GolombFIFO is set high, have_rd_fifo_golomb is set high, golomb_wait_num is set 1, i.e., high. If GolombFIFO is empty, i.e., there is no data in the FIFO register or FIFO memory, then the read GolombFIFO instruction is set low, the have_rd_fifo_golomb instruction is set low, and the golomb_wait_num instruction is set 0. According to the state jump condition in the last section, when the current have_rd_fifo_golomb is at a low level, performing assignment operation according to the second condition. In the subsequent state skipping in S7, if golomb_wait_num is greater than or equal to 2, the state is skipped to S5, otherwise, the state is kept in S7, so that the state skipping logic is satisfied, and the next state is S5.
In the S5 state, both the S7 and S4 states may jump to the S5 state, so that the S5 state also needs to be logically assigned in different situations. As shown in fig. 11, in the first case, if the last pixel point of 16 pieces of image data is processed at this time, it is necessary to determine the subsequent processing according to whether the displacement exceeds 64 bits at this time, and if the displacement exceeds 64 bits in this state, it is determined as an error condition, and the system issues an error warning; as shown in fig. 13, if the count shift of the register a is less than or equal to 64 bits, different operations are performed: if the value is equal to 64 bits, indicating that the 0 supplementing operation is not performed during encoding, wherein the register A is unchanged, and the subsequent state is continuously accumulated, and exe_num_shift is also 0; if the number of bits is less than 64 bits, indicating that the 0-padding operation is performed during encoding, the bit number of shift_golomb_ unuse needs to be added to the register a so as not to affect the subsequent accumulation, and exe_num_shift is equal to the bit number of shift_golomb_ unuse, and the 0-padding bits will be shifted away in the next transition state. Wherein shift_golomb_ unuse represents the number of bits of the Golomb code stream that have been unused by the last pixel of the small block of image data. In the first case, the state jumps to the S6 state, and the shift is performed according to exe_num_shift in the S6 state, and the shift method is the same as that of FIG. 6; where exe_num_shift represents the number of bits shifted left at the time of the shift-left operation.
In the second case in the S5 state, if the last pixel of 16 tiles is not processed at this time, both of the have_rd_fifo_golomb and golomb_wait_num are set to 0 because both of the signal values are valid values that are changed in the previous state. According to the description sequence in the previous paragraph, in the second case, the above two signals are set to 0, but in the previous state, the latest read Golomb code stream has been temporarily stored in the golomb_in register, i.e., FIFO memory, and the value of shift_golomb_in has been calculated, so that it is necessary to shift the registers A, B, C by golomb_in, respectively, in the present state. In the first case the state jumps to the S3 state.
In the S5 state, explanation is made on the shift_golomb_in operation: shift_golomb_in represents the number of bits exceeding 64 bits, and the shift method is different depending on the number of bits exceeded, the number of bits shifted is a first shift method within 0 to 64 bits, and the number of bits shifted is a second shift method within 64 to 128 bits. The current design of 0-128 bit assignment meets the decoding requirement, and of course, more special cases can be solved by changing the number of Golomb registers and the corresponding shifting mode according to different encoding modes.
As shown in fig. 13, beyond 0-64 bits illustrates: register C is already empty at this point; at this time, the code stream in the register B is shifted left in the register C in the previous state, but the lower bit still has 0, so the code stream still needs to be supplemented to the register B through the golmb _in register; the code stream in register a is now shifted left in register B at the previous state and 64 bits are sufficient. Therefore, during the shifting process, the register a does not need any shifting operation, the low n bit code stream in the register B is insufficient, so that the high n bit of the FIFO memory temporarily stored in the golomb_in register is assigned to the low bit of the register B, the rest of the code stream is assigned to the high bit of the register C, and the low bit of the code stream is subjected to the 0 supplementing operation.
As shown in fig. 12, over 64-128 bit shift modes: register C is already empty at this point; because 64 bits are exceeded at this time, register B is also in an empty state; at this time, the code stream in the register a is shifted left in the register B in the previous state, but the lower a bit in the register a still has 0, so the code stream still needs to be complemented in the register a through the golomb_in register, i.e. the FIFO memory. Therefore, to meet the normal shift of the subsequent code stream, the code stream temporarily stored in the FIFO memory needs to be assigned to the lower a bit of the register a first, the remaining code stream is assigned to the upper 64-a bits of the register B, and the remaining position is the complementary 0. Note that n bits at this time are the number of bits of a+b+c as shown in fig. 12.
The embodiment of the invention can correspondingly adjust the state machine and the bit number of shift according to the specificity of Golomb coding and decoding in specific application as well as the shift method of the register in each state through state jump of different conditions so as to meet the decoding requirement.
Finally, when start_k is valid each time, that is, the bit of the code stream with bit 1 and all 0s in front of it have been shifted, the corresponding code stream in the register a will be extracted according to the parameter K, and when the parameter K is equal to any value between 0 and 12, the corresponding high 0 to 12 bits in the register a are intercepted and assigned to the n_12 register, and the data temporarily stored in the n_12 register is the binary low bit of n in fig. 2 or the binary low bit of (MErrval-1) in fig. 3. When n_12 acquires the code stream to be extracted, it is determined by which formula the MErrval value is solved according to whether val_count is equal to (limit-qbpp-1). If the coding scheme shown in FIG. 3, MErrval is equal to n_12+1; if the coding scheme shown in fig. 2 is used, MErrval is equal to val_count (1 < < K) +n_12.
Therefore, in the state skip part, S0 to S003 are all preparation stages, S3, S5, S4, S6, S7 are different states required for decoding, and under normal conditions, when the start_k after the start_val is valid, that is, two clock cycles decode one MErrval, that is, the calculation result required by one pixel in the jpeg_ls image decoding application, for the special case listed in fig. 7, the control of the code stream is just to skip in the above states.
Example 3
In order to solve the technical problems, the invention also provides a decoding system of Golomb coding, which has the following specific technical scheme:
a decoding system of Golomb code comprises a data acquisition module and a decoding module;
The data acquisition module is used for acquiring compressed data; the compressed data is obtained by performing data compression on time sequence data by using a Golomb coding method;
the data acquisition module is also used for dividing the compressed data into a plurality of groups according to time sequence to obtain a plurality of groups of time sequence code streams;
The decoding module is used for sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data;
The decoding module is also used for decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameter is Golomb-Rice coding of a mapping value of a prediction error in JPEG-LS compression, and the mapping prediction error data is the decoded time sequence data.
Example 4
The present embodiment provides a Golomb encoded decoder that decodes the compressed data using the Golomb encoded decoding method of embodiment 1 or embodiment 2.
Example 5
The present embodiment provides a storage medium storing a computer program or computer instructions that, when executed by a processor of a computer, implement the steps of the decoding method of Golomb encoding described above.
The storage medium may be any internal storage unit of a device having data processing capabilities, such as a hard disk or a memory. The storage medium may be any external storage device that has a data processing capability, for example, a plug-in hard disk, a smart memory card, an SD card, a flash memory card, or the like, which is provided on the device. Further, the storage medium may also include an internal storage unit or an external storage device of any device having data processing capabilities. The computer readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing apparatus, and may also be used for temporarily storing data that has been output or is to be output.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (10)

1. A decoding method of Golomb coding, comprising the steps of:
Acquiring compressed data; the compressed data is obtained by performing data compression on time sequence data by using a Golomb coding method;
Dividing the compressed data into a plurality of groups according to time sequence to obtain a plurality of groups of time sequence code streams;
sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data;
decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameter is Golomb-Rice coding of a mapping value of a prediction error in JPEG-LS compression, and the mapping prediction error data is the decoded time sequence data.
2. The decoding method of Golomb code according to claim 1, further comprising, after obtaining the compressed data:
the compressed data is stored in FIFO memory.
3. The Golomb encoded decoding method according to claim 2, wherein the number of registers is I; the storage capacity of the register is equal to the size of the time sequence code stream;
Sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data, wherein the method comprises the following steps of:
Intercepting I groups of the time sequence code streams from the FIFO memory;
the time sequence code streams of the I group are respectively stored in I registers temporarily;
The time sequence code stream in the ith register is averagely divided into a plurality of groups according to the sequence from high order to low order to obtain a plurality of data segments; wherein i=1, 2, …, I;
calculating the bit number of which the previous code value is 0 in all the marked bit positions in the ith register to obtain a parameter val_count; wherein, the marking bit is the bit with the first code value of 1 from the high order to the low order;
and performing left shift operation on the time sequence code stream in the ith register according to the parameter val_count.
4. A decoding method of Golomb code according to claim 3, characterized in that the left shift operation is performed on the time-series code stream in the i-th register according to a parameter val_count, comprising the steps of:
If the val_count is equal to the storage capacity of the ith register, shifting the time sequence code stream in the ith register by val_count bit left, and intercepting val_count bit data from the high bit of the (i+1) th register to supplement to the low val_count bit of the ith register;
If the val_count is not equal to the storage capacity of the ith register, shifting the time sequence code stream in the ith register by val_count+1 bit left, and intercepting val_count+1 bit data from the high bit of the (i+1) th register to supplement the low val_count+1 bit of the ith register;
after performing a shift operation on the time sequence code stream in the ith register according to the parameter val_count, the method further comprises the following steps:
Judging whether the time sequence code stream is required to be supplemented into the (i+1) th register, if so, intercepting a group of time sequence code streams from the FIFO memory to be supplemented into the (i+1) th register, and if not, not supplementing the time sequence code stream into the (i+1) th register.
5. The Golomb encoded decoding method according to claim 4, wherein determining whether the time-series code stream needs to be supplemented into the (i+1) th of the registers comprises the steps of:
Calculating the number of bits of 1 in all the data segments in the (i+1) th register;
If the number of bits of 1 in all the data segments in the (i+1) th register is zero, the time sequence code stream needs to be supplemented into the (i+1) th register;
if the number of bits of "1" in all the data segments in the (i+1) -th register is not zero, the (i+1) -th register is not required to be supplemented with the time sequence code stream.
6. A decoding method of Golomb coding according to claim 3, wherein the decoding calculation of the pre-decoded data using Golomb coding parameters results in mapping prediction error data, comprising the steps of:
Determining a decoding mode by using the Golomb coding parameter and the parameter val_count;
And after determining the decoding mode, decoding and calculating the pre-decoded data by utilizing the Golomb coding parameter and the parameter val_count to obtain the mapping prediction error data.
7. The decoding method of Golomb code according to claim 6, wherein the Golomb coding parameters include parameter K, parameter qbpp, and parameter LIMIT; parameter K represents a number of bits required to store the mapped prediction error data such that the Golomb code represents a mapped prediction error with a shortest codeword, parameter qbpp represents a maximum length of the codeword by the Golomb code, and parameter LIMIT; wherein, K is [0,12];
determining a decoding mode by using the Golomb coding parameter and the parameter val_count includes the following steps:
subtracting 1 from the difference obtained by subtracting the parameter qbpp from the parameter LIMIT to obtain a judgment value;
And comparing the parameter val_count with the judgment value to determine a decoding mode.
8. The decoding method of Golomb code as claimed in claim 7, wherein,
After determining the decoding mode, decoding and calculating the pre-decoded data by using the Golomb coding parameter and the parameter val_count to obtain mapping prediction error data, wherein the method comprises the following steps:
if the parameter val_count is equal to the judgment value, the calculation formula of the mapping prediction error data is as follows:
MErrval=n_12+1;
Wherein MErrval denotes the mapping prediction error data, n_12 denotes the pre-decoded data, and the pre-decoded data is the data of the high K bit in the i-th register after the left shift operation;
If the parameter val_count is not equal to the judgment value, the calculation formula of the mapping prediction error data is as follows:
MErrval=val_count*(1<<K)+n_12。
9. a decoding system of Golomb code, which is characterized by comprising a data acquisition module and a decoding module;
The data acquisition module is used for acquiring compressed data; the compressed data is obtained by performing data compression on time sequence data by using a Golomb coding method;
the data acquisition module is also used for dividing the compressed data into a plurality of groups according to time sequence to obtain a plurality of groups of time sequence code streams;
The decoding module is used for sequentially performing left shift operation on a plurality of groups of time sequence code streams in a register to obtain a plurality of groups of pre-decoding data;
The decoding module is also used for decoding and calculating the pre-decoded data by utilizing the Golomb coding parameters to obtain mapping prediction error data; the Golomb coding parameter is Golomb-Rice coding of a mapping value of a prediction error in JPEG-LS compression, and the mapping prediction error data is the decoded time sequence data.
10. A Golomb encoded decoder, wherein the compressed data is decoded using the Golomb encoded decoding method of any one of claims 1 to 8.
CN202410394130.1A 2024-04-02 Decoding method, system and decoder for Golomb coding Pending CN118301258A (en)

Publications (1)

Publication Number Publication Date
CN118301258A true CN118301258A (en) 2024-07-05

Family

ID=

Similar Documents

Publication Publication Date Title
US11705924B2 (en) Low-latency encoding using a bypass sub-stream and an entropy encoded sub-stream
KR100227275B1 (en) Variable length code detection in a signal processing system
US8520740B2 (en) Arithmetic decoding acceleration
US7936938B2 (en) Methods and devices for encoding a digital image signal and associated decoding methods and devices
US6043765A (en) Method and apparatus for performing a parallel speculative Huffman decoding using both partial and full decoders
US6603413B2 (en) Variable-length decoding apparatus and method
US8306108B2 (en) Adaptive canonical Huffman decoder and method thereof and video decoder
KR20060013021A (en) Context adaptive binary arithmetic decoder method and apparatus
US7343542B2 (en) Methods and apparatuses for variable length encoding
US4760461A (en) Binary data compression and expansion processing apparatus
JP2001308715A (en) Variable length encoder and variable length decoder
RU2265879C2 (en) Device and method for extracting data from buffer and loading these into buffer
KR19980032139A (en) Apparatus and method for detecting bitstream signal format in signal processing system
US5752266A (en) Method controlling memory access operations by changing respective priorities thereof, based on a situation of the memory, and a system and an integrated circuit implementing the method
US6285789B1 (en) Variable length code decoder for MPEG
US5781134A (en) System for variable length code data stream position arrangement
US8817875B2 (en) Methods and systems to encode and decode sequences of images
CN118301258A (en) Decoding method, system and decoder for Golomb coding
KR100466455B1 (en) Code converter, variable length code decoder and method of decoding variable length code
CN100346293C (en) Trace buffer, method and pipeline processor for loop compression
CN110545437B (en) Coefficient encoding method, coefficient decoding method, electronic device, and medium
US6781528B1 (en) Vector handling capable processor and run length encoding
US6707398B1 (en) Methods and apparatuses for packing bitstreams
JP4578444B2 (en) Zero pixel count circuit
US6707397B1 (en) Methods and apparatus for variable length codeword concatenation

Legal Events

Date Code Title Description
PB01 Publication