Entropy decoding method, entropy decoder, entropy decoding device and entropy decoding equipment

By using the first read port and the second read port in parallel to read the macroblock header and residuals respectively in the entropy decoder, the problem of slow decoding speed of complex encoding blocks is solved, which improves the entropy decoding speed and reduces the hardware cost.

CN118764650BActive Publication Date: 2024-12-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411255900.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-03
Estimated Expiration
2044-09-06

Smart Images

  • Figure CN118764650B_ABST
    Figure CN118764650B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus. The method includes: continuously reading a first codeword from a macroblock address in a bitstream cache through a first reading port and decoding the first codeword; in response to obtaining a first data amount and a second data amount through syntax decoding, calculating the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the first data amount and the second data amount; reading a second codeword recorded in the residual cache segment through a second reading port and decoding the second codeword, the reading process of the first reading port and the reading process of the second reading port are performed in parallel; in response to completing syntax decoding, using the calculated starting address as a new macroblock address, returning to execute the step of continuously reading the first codeword from the macroblock address in the bitstream cache and decoding the first codeword until a preset decoding end condition is reached. The decoding speed of entropy decoding is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video coding and decoding technology, and in particular to an entropy decoding method, an entropy decoder, an entropy decoding apparatus and an entropy decoding device. Background Art

[0002] The entropy decoding method usually uses a single channel to parse the codewords included in a single code stream in sequence. After a codeword is successfully parsed, the decoder can successfully detect the codeword, remove the codeword from the single code stream, and then continue to decode the next codeword. The above entropy decoding method belongs to the serial calculation decoding method. There are usually complex coding blocks in the single code stream obtained by encoding the image. The conventional serial decoding method takes a long time to decode the complex coding blocks, which can easily cause decoding blocking, resulting in a slow entropy decoding speed and affecting the performance of the decoder. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus to improve the decoding speed of entropy decoding. The specific technical solution is as follows:

[0004] The embodiment of the present application provides an entropy decoding method, which is applied to an entropy decoder, wherein the entropy decoder includes: a first reading port and a second reading port; the method includes:

[0005] Continuously reading a first codeword from a macroblock address in a bitstream buffer through the first reading port, and performing syntax decoding on the read first codeword, wherein the bitstream buffer caches a plurality of macroblocks, the macroblock address is initially a start address of a macroblock header of a first macroblock to be decoded in the bitstream buffer, each of the macroblocks includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual;

[0006] In response to obtaining the first data amount and the second data amount through syntax decoding, calculating a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock buffered at the macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream buffer;

[0007] Reading the second codeword recorded in the residual buffer segment through the second reading port, and performing residual decoding on the read second codeword, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel;

[0008] In response to the completion of syntax decoding, the calculated starting address is used as a new macroblock address, and the step of continuously reading the first codeword from the macroblock address in the bitstream cache and performing syntax decoding on the read first codeword is returned to execute until a preset decoding end condition is reached.

[0009] In a possible embodiment, calculating the residual buffer segment of the macroblock residual of the current macroblock according to the first data amount and the second data amount includes:

[0010] Calculate a residual starting address of a macroblock residual of the current macroblock according to the first data amount and a starting address of the current macroblock;

[0011] A segment starting from the residual start address and having a length of the second data amount is determined as a residual cache segment.

[0012] In a possible embodiment, the entropy decoder includes a second reading port;

[0013] The step of reading the second codeword recorded in the residual buffer segment through the second reading port includes:

[0014] If the current macroblock is the first macroblock to be decoded in the bitstream buffer, reading the second codeword recorded in the residual buffer segment through the second reading port;

[0015] If the current macroblock is not the first macroblock to be decoded in the bitstream cache, in response to completion of decoding the second codeword of the previous macroblock, the second codeword recorded in the residual cache segment is read through the second read port, wherein the previous macroblock is the previous macroblock in the bitstream cache that is adjacent to the current macroblock.

[0016] In a possible embodiment, the entropy decoder includes a plurality of second reading ports;

[0017] The step of reading the second codeword recorded in the residual buffer segment through the second reading port includes:

[0018] In response to obtaining a new residual buffer segment through calculation, reading a second codeword recorded in the new residual buffer segment through a second reading port in an idle state;

[0019] In response to the second read port completing the reading of the second code word, the second code word recorded in the unprocessed residual buffer segment is read through the second read port.

[0020] The embodiment of the present application further provides an entropy decoder, the entropy decoder comprising a cache management unit, a macroblock syntax decoding unit, a macroblock residual block decoding unit, and a bitstream cache unit; the bitstream cache unit comprises: a first reading port and a second reading port;

[0021] The bitstream cache unit is used to cache multiple macroblocks, each of which includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual;

[0022] The cache management unit is configured to send a macroblock address to the bitstream cache unit, so that the bitstream cache unit continuously reads a first codeword from the macroblock address through the first reading port and sends the first codeword to the macroblock syntax decoding unit, wherein the macroblock address is initially a starting address of a macroblock header of a first macroblock to be decoded in the bitstream cache unit;

[0023] The macroblock syntax decoding unit is configured to perform syntax decoding on the received first codeword; and in response to completing syntax decoding, send a syntax decoding completion instruction to the cache management unit;

[0024] The cache management unit is further used to, in response to obtaining the first data amount and the second data amount through syntax decoding, calculate the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock cached at the macroblock address, and the next macroblock is the next macroblock adjacent to the current macroblock in the bitstream cache; send the residual cache segment to the bitstream cache unit so that the bitstream cache unit reads the second codeword recorded in the residual cache segment through the second reading port, and sends the second codeword to the macroblock residual block decoding unit; in response to the syntax decoding completion instruction, use the calculated starting address as the new macroblock address, return to execute the step of sending the macroblock address to the bitstream cache unit until a preset decoding end condition is reached, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel;

[0025] The macroblock residual block decoding unit is used to perform residual decoding on the received second codeword.

[0026] In a possible embodiment, the entropy decoder further includes: a macroblock overhead calculation unit;

[0027] The macroblock syntax decoding unit is further used to send the decoding result to the macroblock overhead calculation unit;

[0028] The macroblock overhead calculation unit is configured to calculate a first data amount and a second data amount in response to the decoding result, and send the first data amount and the second data amount to the cache management unit;

[0029] The cache management unit is further configured to, in response to obtaining the first data amount and the second data amount through syntax decoding, calculate, according to the first data amount and the second data amount, a residual cache segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock, including:

[0030] The cache management unit is further used to calculate the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the received first data amount and the second data amount.

[0031] In a possible embodiment, the cache management unit further includes: a first reading module, a second reading module, and a calculation module;

[0032] The calculation module is used to calculate the residual buffer segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the received first data amount and the second data amount, and send the residual buffer segment to the first reading module, and send the calculated starting address to the second reading module;

[0033] The first reading module is used to send the residual buffer segment to the bit stream buffer unit;

[0034] The second reading module is used to send a macroblock address to the bitstream cache unit, so that the bitstream cache unit continuously reads the first codeword starting from the macroblock address through the first reading port and sends the first codeword to the macroblock syntax decoding unit; in response to the syntax decoding completion instruction, the calculated starting address is used as the new macroblock address, and the step of sending the macroblock address to the bitstream cache unit is returned to execute.

[0035] In a possible embodiment, the calculation module includes: a first calculation submodule, a second calculation submodule, and a third calculation submodule;

[0036] The macroblock overhead calculation unit is used to send the first data amount and the second data amount to the cache management unit, including:

[0037] The macroblock overhead calculation unit is configured to send the first data amount and the second data amount to the first calculation submodule, send the first data amount to the second calculation submodule, and send the second data amount to the third calculation submodule;

[0038] The first calculation submodule is used to calculate the starting address of the macroblock header of the next macroblock according to the received first data amount and the second data amount, and send the starting address of the macroblock header of the next macroblock to the second reading module;

[0039] The second calculation submodule is used to calculate the starting address of the residual buffer segment according to the received first data volume, and send the starting address of the residual buffer segment to the first reading module;

[0040] The third calculation submodule is used to calculate the end address of the residual cache segment according to the received second data volume, and send the end address of the residual cache segment to the first reading module.

[0041] In a possible embodiment, the cache management unit further includes: a write control module and a cache water level status monitoring module;

[0042] The write control module is used to drive the bit stream cache unit to cache a plurality of macro blocks included in the data to be decoded in response to the data to be decoded;

[0043] The cache waterline status monitoring module is used to monitor the cache status of the bitstream cache unit; in response to the amount of data cached by the bitstream cache unit being greater than a preset upper limit threshold, drive the cache management unit to send a macroblock address to the bitstream cache unit, so that the bitstream cache unit continuously reads the first codeword from the macroblock address through the first read port and sends the first codeword to the macroblock syntax decoding unit, and the cache waterline status monitoring module sends a stop cache instruction to the write control module, so that the write control module stops driving the bitstream cache unit to cache the multiple macroblocks included in the data to be decoded in response to the stop cache instruction; in response to the decoding of the multiple macroblocks cached in the bitstream cache unit is completed or the amount of data cached by the bitstream cache unit is less than a preset lower limit threshold, send a cache instruction to the write control module, so that the write control module drives the bitstream cache unit to cache the multiple macroblocks that have not been cached in the data to be decoded in response to the cache instruction.

[0044] The embodiment of the present application further provides an entropy decoding device, which is applied to an entropy decoder, wherein the entropy decoder includes: a first reading port and a second reading port; the device includes:

[0045] a first codeword decoding module, configured to continuously read a first codeword from a macroblock address in a bitstream buffer through the first reading port, and perform syntax decoding on the read first codeword, wherein the bitstream buffer caches a plurality of macroblocks, the macroblock address is initially a start address of a macroblock header of a first macroblock to be decoded in the bitstream buffer, each of the macroblocks includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual;

[0046] a starting address calculation module, configured to calculate, in response to obtaining the first data amount and the second data amount through syntax decoding, a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock buffered at the macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream buffer;

[0047] A second codeword decoding module, used for reading the second codeword recorded in the residual buffer segment through the second reading port, and performing residual decoding on the read second codeword, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel;

[0048] The decoding step execution module is used for responding to the completion of syntax decoding, taking the calculated starting address as the new macroblock address, returning to execute the step of continuously reading the first codeword from the macroblock address in the bitstream cache, and performing syntax decoding on the read first codeword until a preset decoding end condition is reached.

[0049] In a possible embodiment, the starting address calculation module calculates the residual buffer segment of the macroblock residual of the current macroblock according to the first data amount and the second data amount, including:

[0050] Calculate a residual starting address of a macroblock residual of the current macroblock according to the first data amount and a starting address of the current macroblock;

[0051] A segment starting from the residual start address and having a length of the second data amount is determined as a residual cache segment.

[0052] The embodiment of the present application also provides an entropy decoding device, including:

[0053] Memory, used to store computer programs;

[0054] The processor is used to implement any of the above entropy decoding methods when executing the program stored in the memory.

[0055] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the entropy decoding methods described above.

[0056] Beneficial effects of the embodiments of the present application:

[0057] An entropy decoding method, an entropy decoder, an entropy decoding apparatus and an entropy decoding device provided by the embodiments of the present application, since each macroblock includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual, therefore, the first codeword can be continuously read from the macroblock address in the bitstream cache through the first reading port, and the first codeword read can be syntax-decoded to obtain the first data amount and the second data amount recorded in the macroblock header of the macroblock. According to the first data amount and the second data amount, the residual cache section of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock adjacent to the current macroblock can be calculated, and then the second code word can be read according to the residual cache section of the macroblock residual of the current macroblock through the second reading port, and the second code word can be decoded to realize the decoding of the macroblock residual of the current macroblock. At the same time, the starting address of the macroblock header of the next macroblock can be used as the macroblock address to read and decode the new first code word, that is, to decode the macroblock header of the next macroblock, and the macroblock header and the macroblock residual are read respectively through two independent first reading ports and second reading ports, and the reading process of the first reading port and the reading process of the second reading port can be carried out in parallel, thereby realizing the separate parallel decoding of the macroblock header and the macroblock residual of the macroblock. It can be seen that the embodiment of the present application can separate the macroblock header and macroblock residual of the macroblock into two independent sub-channels for parallel decoding, so that the decoding of the next macroblock does not have to wait for the previous macroblock to be completely decoded, thereby improving the decoding speed of entropy decoding and the decoding speed of the entropy decoding channel, thereby reducing the macroblock queuing time caused by the serial calculation entropy decoding method.

[0058] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0060] Figure 1a A schematic diagram of an entropy decoding method in the related art;

[0061] Figure 1b A schematic diagram of a structure of a decoder in the related art;

[0062] Figure 2 A schematic diagram of a flow chart of an entropy decoding method provided in an embodiment of the present application;

[0063] Figure 3 A schematic diagram of a macro block provided in an embodiment of the present application;

[0064] Figure 4a A schematic diagram of a first reading port reading a first code word and a second reading port reading a second code word in parallel provided in an embodiment of the present application;

[0065] Figure 4b Another schematic diagram of the first reading port reading the first code word and the second reading port reading the second code word in parallel provided in the embodiment of the present application;

[0066] Figure 5 A schematic diagram of a flow chart of a method for calculating residual buffer segments provided in an embodiment of the present application;

[0067] Figure 6a Another schematic diagram of a flow chart of an entropy decoding method provided in an embodiment of the present application;

[0068] Figure 6b A schematic diagram of the entropy decoding process provided in an embodiment of the present application;

[0069] Figure 7 A schematic diagram of the first structure of an entropy decoder provided in an embodiment of the present application;

[0070] Figure 8 A second structural diagram of an entropy decoder provided in an embodiment of the present application;

[0071] Fig. 9 A third structural diagram of the entropy decoder provided in an embodiment of the present application;

[0072] Fig.10 A fourth structural diagram of an entropy decoder provided in an embodiment of the present application;

[0073] Fig.11 A fifth structural diagram of the entropy decoder provided in an embodiment of the present application;

[0074] Fig.12 A schematic diagram of the structure of an entropy decoding device provided in an embodiment of the present application;

[0075] Fig.13 A schematic diagram of the structure of an entropy decoding device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0076] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0077] In order to more clearly explain an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus provided by the present application, some terms appearing in this document are explained below:

[0078] Image compression: Image compression refers to the technology of representing the original image pixel matrix with fewer bits losslessly or losslessly. Image compression is also called image coding.

[0079] Entropy decoding: Entropy decoding is the reverse process of entropy coding. Entropy coding refers to using new coding codewords to represent input data, thereby achieving the effect of data compression. The usual entropy coding method is to encode according to the probability of occurrence of each symbol in the input data, which can make the average code length of each symbol in the encoded data the shortest.

[0080] Coding macroblock: The image is divided into sub-image blocks of equal or different sizes, one sub-image block is one macroblock, so that different coding strategies can be implemented according to the different positions of the macroblocks in the image.

[0081] Coded bit stream: The coded data obtained after encoding the image, which is a binary bit sequence.

[0082] In order to more clearly illustrate an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus provided by the present application, the following is an illustrative description of possible application scenarios of an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus provided by the present application. It can be understood that the following examples are only possible application scenarios of an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus provided by the present application. In other possible embodiments, an entropy decoding method, an entropy decoder, an entropy decoding device and an entropy decoding apparatus provided by the present application can be applied to other possible application scenarios, and the following examples do not impose any limitation on this.

[0083] The entropy decoding method usually uses a single channel to parse the codewords included in a single code stream in sequence. After the current codeword is successfully parsed, the decoder can successfully detect the current codeword, remove the current codeword from the single code stream, and then continue to decode the next codeword. That is to say, in this entropy decoding method, it is necessary to wait for the current codeword to be successfully decoded before the next codeword can be decoded. The above entropy decoding method belongs to the serial calculation decoding method. The time that the next codeword waits for the current codeword to be decoded in the serial calculation entropy decoding method is referred to as the macroblock queuing time. There are usually complex coding blocks in the single code stream obtained by encoding the image. The conventional serial decoding method takes a long time to decode the complex coding blocks, which can easily cause decoding blockage, resulting in a slow entropy decoding speed, affecting the performance of the decoder.

[0084] A common method to increase the entropy decoding speed is to increase the number of decoding channels and to increase the decoding speed of entropy decoding by parallel computing. However, while the above-mentioned parallel computing entropy decoding method improves the decoding speed, it also needs to increase hardware resources on the decoder so that the decoder can perform multi-channel decoding normally, resulting in a high hardware cost for entropy decoding.

[0085] Currently, entropy decoding can usually be achieved through the following two solutions:

[0086] (1) According to the similarity relationship between various entropy decoding modes in video decoding, the video decoding operation is reorganized into three parts: bit decoding, syntax element decoding, and entropy decoding control. Figure 1a As shown, the entropy decoding device includes: a bit decoding module, a syntax element decoding module, a control module and a memory, the bit stream is input to the bit decoding module, the bit decoding operation is performed by the bit decoding module, the syntax element is output after the syntax element decoding operation is performed by the syntax element decoding module, and the entropy decoding control is performed by the control module. The above entropy decoding method can reasonably allocate computing resources, simplify the internal interface of the general entropy decoding device in video encoding and decoding, has good versatility, and can support multiple video encoding standards and entropy decoding modes.

[0087] (2) If Figure 1b The decoder shown in the figure can effectively cope with burst traffic in the decoding process and improve the decoder performance by directly controlling the quantization coefficient and decoding multiple channels in parallel, namely data output (1), ..., data output (n). The entropy decoding method can directly reduce the amount of burst code stream data and reduce the blocking time on the decoding side by controlling the quantization coefficient, while improving the parallelism of the entropy decoding channel and improving the performance of the entire decoder.

[0088] However, the entropy decoding method in the above scheme (1) is essentially still a serial calculation entropy decoding method, which cannot handle the data throughput limitation caused by serial calculation decoding, resulting in a slow decoding speed of entropy decoding. Although the entropy decoding method in the above method (2) can improve the decoding speed of entropy decoding, the method of parallel decoding of multiple channels will lead to an increase in the hardware resources required by the decoder, and the design and implementation of the hardware structure are relatively complex, making the hardware cost of entropy decoding relatively high.

[0089] Based on this, in order to improve the decoding speed of entropy decoding and reduce the hardware cost of entropy decoding, the present application provides an entropy decoding method, which is applied to an entropy decoder. The entropy decoder includes: a first reading port and a second reading port; Figure 2 As shown, the method includes:

[0090] S201, continuously reading a first code word from a macroblock address in a bit stream buffer through a first reading port, and performing syntax decoding on the read first code word.

[0091] Among them, multiple macroblocks are cached in the bitstream cache, and the macroblock address is initially the starting address of the macroblock header of the first macroblock to be decoded in the bitstream cache. Each macroblock includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual.

[0092] S202, in response to obtaining a first data amount and a second data amount through syntax decoding, calculating a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount.

[0093] The current macroblock is a macroblock cached at a macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream cache.

[0094] S203, reading the second codeword recorded in the residual buffer segment through the second reading port, and performing residual decoding on the read second codeword.

[0095] The reading process of the first reading port and the reading process of the second reading port are performed in parallel.

[0096] S204, in response to the completion of syntax decoding, using the calculated starting address as the new macroblock address, returns to the step of continuously reading the first codeword starting from the macroblock address in the bitstream cache, and performing syntax decoding on the read first codeword until a preset decoding end condition is reached.

[0097] In applying the embodiments of the present application, on the one hand, since each macroblock includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual, the first codeword can be continuously read from the macroblock address in the bitstream cache through the first reading port, and the first codeword can be syntax-decoded to obtain the first data amount and the second data amount recorded in the macroblock header of the macroblock. According to the first data amount and the second data amount, the residual cache section of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock adjacent to the current macroblock can be calculated, and then the second code word can be read according to the residual cache section of the macroblock residual of the current macroblock through the second reading port, and the second code word can be decoded to realize the decoding of the macroblock residual of the current macroblock. At the same time, the starting address of the macroblock header of the next macroblock can be used as the macroblock address to read and decode the new first code word, that is, to decode the macroblock header of the next macroblock, and the macroblock header and the macroblock residual are read respectively through two independent first reading ports and second reading ports, and the reading process of the first reading port and the reading process of the second reading port can be carried out in parallel, thereby realizing the separate parallel decoding of the macroblock header and the macroblock residual of the macroblock. It can be seen that the embodiment of the present application can separate the macroblock header and macroblock residual of the macroblock into two independent sub-channels for parallel decoding, so that the decoding of the next macroblock does not have to wait for the previous macroblock to be completely decoded, thereby improving the decoding speed of entropy decoding and the decoding speed of the entropy decoding channel, thereby reducing the macroblock queuing time caused by the serial calculation entropy decoding method.

[0098] On the other hand, as described above, the embodiment of the present application can separate the macroblock header and macroblock residual of the macroblock into two independent sub-channels for parallel decoding. The two independent sub-channels are referred to as independent dual-ports hereinafter. Therefore, the embodiment of the present application can realize pipeline parallel processing of the macroblock header and macroblock residual of the macroblock through a set of independent dual-port RAM (Random Access Memory) and address management logic. The hardware structure is simple, the hardware cost of entropy decoding is reduced, and the reusability is high. It is also applicable to other shallow compression algorithms that have high requirements on decoding delay and contain macroblock layer syntax.

[0099] The above S201-S204 will be described exemplarily below:

[0100] In S201, the plurality of macroblocks cached in the bitstream cache may be as follows: Figure 3 See Figure 3, assuming that there are n macroblocks cached in the bitstream buffer, each macroblock is recorded as macroblock 1, macroblock 2, macroblock 3, ..., macroblock n. Each macroblock includes a macroblock header and a macroblock residual, then macroblock 1 includes macroblock header 1 and macroblock residual 1; macroblock 2 includes macroblock header 2 and macroblock residual 2; macroblock 3 includes macroblock header 3 and macroblock residual 3; ...; macroblock n includes macroblock header n and macroblock residual n. See Figure 3 It can be seen that the starting address of a macroblock is also the starting address of the macroblock header of the macroblock. The starting address of each macroblock can be recorded as starting address 1, starting address 2, starting address 3, ..., starting address n.

[0101] The macroblock address is initially the starting address of the macroblock header of the first macroblock to be decoded in the bitstream cache, wherein the first macroblock to be decoded in the bitstream cache may refer to the first macroblock cached in the bitstream cache, for example, Figure 3 In other possible embodiments, the first macroblock to be decoded in the bitstream cache may also refer to the first macroblock in the macroblock segment to be decoded in the bitstream cache. For example, assuming that the macroblock segment to be decoded is Figure 3 In macroblock 3-macroblock 12, the first macroblock to be decoded is Figure 3 For the macroblock 3 shown in , the initial macroblock address corresponds to the starting address 3.

[0102] like Figure 3 As shown, continuous reading starts from the macroblock address, that is, continuous reading starts from the starting address of the macroblock header of the macroblock, then the first codeword read is the codeword contained in the macroblock header of the macroblock. When reading the first codeword, the reading of the first codeword can be controlled by a pointer. Specifically, the synax (syntax) read pointer can be set to control the reading of the first codeword.

[0103] The macroblock header records the encoded information, and the decoding result of the information can directly record the first data amount representing the macroblock header and the second data amount of the macroblock residual. In other possible embodiments, the above decoding result can also record other information that can be used to calculate the first data amount of the macroblock header and the second data amount of the macroblock residual. For example, assuming that the macroblock header includes four fields: field 1, field 2, field 3 and field 4, the macroblock header is decoded to obtain the decoding result. From the decoding result, it can be determined that the data amounts corresponding to field 1, field 2, field 3 and field 4 are: data amount 1, data amount 2, data amount 3 and data amount 4, respectively. Then, the value of the sum of data amount 1, data amount 2, data amount 3 and data amount 4 can be calculated to obtain the first data amount of the macroblock header, that is, the first data amount = data amount 1 + data amount 2 + data amount 3 + data amount 4. In addition, the data amount of the entire macroblock can be obtained through the decoding result, and the difference between the data amount of the entire macroblock and the first data amount is used as the second data amount of the macroblock residual.

[0104] When syntax decoding is performed on the first codeword, the codewords corresponding to the various syntax elements may be sequentially taken out from the first codeword according to the syntax mapping rule, and the codewords corresponding to the various syntax elements may be decoded.

[0105] In S202, the current macroblock is a macroblock cached at the macroblock address, which means that the starting address of the macroblock header of the current macroblock is the macroblock address, that is, the starting address of the current macroblock is the macroblock address. Figure 3 If the starting address shown in is 1, the current macroblock is macroblock 1.

[0106] The next macroblock adjacent to the current macroblock in the bitstream cache is used as the next macroblock. Adjacent means that there is no other macroblock between the current macroblock and the next macroblock in the bitstream cache.

[0107] In a possible embodiment, adjacent may refer to the end of the current macroblock and the beginning of the next macroblock being adjacent to each other, such as Figure 3 In this example, see Figure 3 , the starting address of the macroblock header of the current macroblock can be added to the first data amount and the second data amount to obtain the starting address of the macroblock header of the next macroblock. The starting address of the macroblock header of the current macroblock is the macroblock address. Therefore, the macroblock address can be added to the first data amount and the second data amount to obtain the starting address of the macroblock header of the next macroblock.

[0108] In other possible embodiments, adjacent may refer to a fixed interval of m empty bits between the end of the current macroblock and the beginning of the next macroblock. In this example, the m empty bits are the cache interval, and the user can set the cache interval for the entropy decoder in advance. Then, in the process of caching multiple macroblocks, the entropy decoder caches one macroblock and then caches the next macroblock after an interval of m empty bits. When calculating the starting address of the macroblock header of the next macroblock, the pre-set cache interval can be read from the entropy decoder to obtain the value of m, and the macroblock address is added to the first data amount, the second data amount and m to obtain the starting address of the macroblock header of the next macroblock. The following will provide an exemplary description of how to calculate the residual cache segment of the macroblock residual of the current macroblock, which will not be repeated here.

[0109] In S203, when reading the second codeword, the reading of the second codeword can be controlled by a pointer. Specifically, a resi (residual) read pointer can be set to control the reading of the second codeword. The second codeword recorded in the residual buffer segment is the macroblock residual.

[0110] Since the first code word is read through the first reading port and the second code word is read through the second reading port, the second code word can be read through the second reading port while the first code word is read through the first reading port, that is, the reading process of the first reading port and the reading process of the second reading port are performed in parallel.

[0111] However, since the reading of the second codeword depends on the residual cache segment, and the calculation of the residual cache segment depends on the decoding result of the first codeword of the same macroblock as the second codeword, the reading process of the first reading port and the reading process of the second reading port are carried out in parallel, which means that: while the first reading port reads the first codeword of a macroblock, the second reading port reads the second codeword of the macroblock or the second codeword of other macroblocks.

[0112] It is understandable that the data volume of the macroblock residual in the macroblock generally accounts for a high proportion, that is, the data volume of the second codeword is generally much larger than the data volume of the first codeword. Then, the decoding of the macroblock residual is slower than the decoding of the macroblock header. It is possible that the residual cache section of the macroblock residual of the next macroblock has been calculated, while the macroblock residual of the current macroblock has not yet been decoded. If the number of second reading ports is one, it is necessary to wait for the macroblock residual (that is, the second codeword) of the current macroblock to be read before the second codeword of the next macroblock can be read through the second reading port; and if the number of second reading ports is multiple, even if the second codeword of the current macroblock has not been read, the second codeword of the next macroblock can be read through the second reading port in an idle state. Therefore, if the number of second reading ports is different, the reading process of the second codeword of each macroblock will also be different.

[0113] Based on this, in a possible embodiment, the entropy decoder includes a second reading port; the second codeword recorded in the residual cache segment is read through the second reading port, including: if the current macroblock is the first macroblock to be decoded in the bitstream cache, the second codeword recorded in the residual cache segment is read through the second reading port; if the current macroblock is not the first macroblock to be decoded in the bitstream cache, then in response to the completion of decoding the second codeword of the previous macroblock, the second codeword recorded in the residual cache segment is read through the second reading port, wherein the previous macroblock is the previous macroblock adjacent to the current macroblock in the bitstream cache.

[0114] As described in S202 above, adjacent means that there is no other macroblock between the current macroblock and the previous macroblock in the bitstream buffer. Figure 4a The example shown is used to exemplarily illustrate the process of the first reading port reading the first code word and the second reading port reading the second code word in this embodiment.

[0115] For example, see Figure 4a When reading the first codeword and the second codeword, it is necessary to first read the first codeword of macroblock 1 through the first reading port, and determine the residual buffer section of macroblock 1 and the starting address of macroblock 2 through calculation after decoding the first codeword of macroblock 1. The first reading port reads the first codeword of macroblock 2 according to the starting address of macroblock 2, and at the same time, the second reading port reads the second codeword of macroblock 1 according to the residual buffer section of macroblock 1, and determines the residual buffer section of macroblock 2 and the starting address of macroblock 3 through calculation after decoding the first codeword of macroblock 2. The first reading port reads the first code word of macroblock 3 according to the starting address of macroblock 3. At this time, if the second code word of macroblock 1 has not been read, the second reading port waits for the second code word of macroblock 1 to be read, and then reads the second code word of macroblock 2 according to the residual cache segment of macroblock 2. If the second code word of macroblock 1 has been read, the second reading port reads the second code word of macroblock 2 according to the residual cache segment of macroblock 2, and so on, until all macroblocks that need to be decoded have been decoded.

[0116] In another possible embodiment, the entropy decoder includes multiple second reading ports; reading the second codeword recorded in the residual cache segment through the second reading port includes: in response to calculating a new residual cache segment, reading the second codeword recorded in the new residual cache segment through the second reading port in an idle state; in response to the second reading port completing the reading of the second codeword, reading the second codeword recorded in the unprocessed residual cache segment through the second reading port.

[0117] When a new residual cache segment is calculated, if there is an idle second reading port, the second code word recorded in the new residual cache segment is read through the idle second reading port; if there is no idle second reading port, the new residual cache segment is used as an unprocessed residual cache segment, and it is necessary to wait for a second reading port to complete reading the second code word, that is, after the second reading port is idle, and then read the second code word recorded in the unprocessed residual cache segment through the second reading port.

[0118] Exemplarily, it is assumed that the entropy decoder includes n second reading ports, and the n second reading ports are respectively: second reading port 1, second reading port 2, ..., second reading port n. When reading the first codeword and the second codeword, it is necessary to first read the first codeword of macroblock 1 through the first reading port, and determine the residual cache segment of macroblock 1 and the starting address of macroblock 2 through calculation after decoding the first codeword of macroblock 1. The first reading port reads the first codeword of macroblock 2 according to the starting address of macroblock 2, and at the same time, the second reading port 1 reads the second codeword of macroblock 1 according to the residual cache segment of macroblock 1, and determines the residual cache segment of macroblock 2 and the starting address of macroblock 3 through calculation after decoding the first codeword of macroblock 2. The first reading port reads the first codeword of macroblock 3 according to the starting address of macroblock 3. At this time, the second reading port 2 in the idle state reads the second codeword of macroblock 2 according to the residual buffer section of macroblock 2. The residual buffer section of macroblock 3 and the starting address of macroblock 4 are determined by calculation after decoding the first codeword of macroblock 3. The first reading port reads the first codeword of macroblock 4 according to the starting address of macroblock 4. At this time, the second reading port 3 in the idle state reads the second codeword of macroblock 3 according to the residual buffer section of macroblock 3, and so on, until all macroblocks that need to be decoded have been decoded.

[0119] For ease of understanding, the following will take the second reading port 1 and the second reading port 2 as examples to exemplarily illustrate the reading process of the first codeword and the second codeword. First, the first codeword of macroblock 1 is read through the first reading port, and the residual buffer segment of macroblock 1 and the starting address of macroblock 2 are determined by calculation after decoding the first codeword of macroblock 1. The first reading port reads the first codeword of macroblock 2 according to the starting address of macroblock 2. At the same time, the second reading port 1 reads the second codeword of macroblock 1 according to the residual buffer segment of macroblock 1, and determines the residual buffer segment of macroblock 2 and the starting address of macroblock 3 through calculation after decoding the first codeword of macroblock 2. The first reading port reads the first codeword of macroblock 3 according to the starting address of macroblock 3. At this time, the second reading port 2 in an idle state reads the second codeword of macroblock 2 according to the residual buffer segment of macroblock 2, and determines the residual buffer segment of macroblock 3 and the starting address of macroblock 4 through calculation after decoding the first codeword of macroblock 3.

[0120] The first reading port reads the first code word of macroblock 4 according to the starting address of macroblock 4. At this time, if the second reading port 1 has completed reading the second code word of macroblock 1 and the second reading port 2 has not completed reading the second code word of macroblock 2, that is, only the second reading port 1 is in an idle state, then the second reading port 1 in the idle state reads the second code word of macroblock 3 according to the residual cache segment of macroblock 3.

[0121] If the second reading port 1 has not completed reading the second code word of macroblock 1 and the second reading port 2 has not completed reading the second code word of macroblock 2, that is, both the second reading port 1 and the second reading port 2 are not in an idle state, it is necessary to wait for the second reading port 1 to complete reading the second code word of macroblock 1, or for the second reading port 2 to complete reading the second code word of macroblock 2, that is, wait for the second reading port 1 or the second reading port 2 to be in an idle state, and then the second reading port in the idle state reads the second code word of macroblock 3 according to the residual cache segment of macroblock 3.

[0122] If the second reading port 1 completes reading the second code word of macroblock 1 and the second reading port 2 completes reading the second code word of macroblock 2, that is, both the second reading port 1 and the second reading port 2 are in an idle state, then the second reading port 1 or the second reading port 2 in the idle state reads the second code word of macroblock 3 according to the residual cache segment of macroblock 3, and so on, until all macroblocks that need to be decoded have been decoded.

[0123] In this example, the process of the first reading port reading the first code word and the second reading port reading the second code word can be as follows: Figure 4b As shown, Figure 4b The first codeword reading process of the first reading port is shown above each macroblock, and the second codeword reading process of the second reading port is shown below each macroblock, wherein the solid line is the reading process of the second codeword through the second reading port 1, and the dotted line is the reading process of the second codeword through the second reading port 2. It can be understood that Figure 4b This is only one possible codeword reading process. In other possible examples, if the residual cache segment of the macroblock residual of macroblock 3 is calculated and only the second reading port 2 is in an idle state, the second codeword of macroblock 3 can be read through the second reading port 2, and the second codeword of macroblock 4 can be read through the second reading port 1.

[0124] The process of reading the first code word and the second code word has been described above by way of example. Figure 2 Example, for Figure 2 S204 in the embodiment is described as an example.

[0125] In S204, the preset decoding end condition may refer to that the macroblock headers and macroblock residuals of all macroblocks in the bitstream cache have been decoded. In this example, since the macroblock residual accounts for a relatively high proportion of the data volume in the macroblock, after the macroblock headers of all macroblocks in the bitstream cache have been decoded, there may be some macroblocks in the bitstream cache whose macroblock residuals have not been decoded. At this time, the step of reading the first codeword is no longer performed, but the macroblock residuals that have not been decoded need to be read and decoded according to the calculated residual cache segment.

[0126] The preset decoding end condition may also refer to that the macroblock headers and macroblock residuals of all macroblocks in the preset macroblock segment have been decoded, and the preset macroblock segment refers to a preset set of macroblocks that need to be decoded. Figure 3 In this example, since the macroblock residual accounts for a relatively high proportion of the data volume in the macroblock, after the macroblock headers of all macroblocks in the preset macroblock segment are decoded, there may be some macroblocks in the preset macroblock segment whose macroblock residuals have not yet been decoded. At this time, the step of reading the first codeword is no longer performed, but the macroblock residuals that have not yet been decoded need to be read and decoded according to the calculated residual buffer segment.

[0127] The preset decoding end condition may also refer to other possible decoding end conditions, and this application does not impose any limitation on this.

[0128] The following is an exemplary description of how to calculate the residual buffer segment of the macroblock residual of the current macroblock in the aforementioned S202. Figure 5 As shown, including:

[0129] S501, calculating and obtaining a residual starting address of a macroblock residual of the current macroblock according to a first data amount and a starting address of the current macroblock.

[0130] The sum of the first data amount of the macroblock header and the starting address of the current macroblock is used as the residual starting address y of the macroblock residual of the current macroblock. The starting address of the current macroblock is the aforementioned macroblock address.

[0131] S502: determine a section starting from the residual start address and having a length of a second data amount as a residual cache section.

[0132] The sum of the residual start address and the second data amount minus one is the final address of the macroblock residual of the current macroblock. If the second data amount is recorded as z, the residual buffer segment is [y, y+z-1].

[0133] Then, when reading the second code word, the resi read pointer can be used to start reading from address y and read z addresses continuously to obtain the second code word. That is, after reading address y, the resi read pointer reads address y+1, then reads address y+2, and so on, until address y+z-1 is read.

[0134] By selecting this embodiment, the residual starting address of the macroblock residual of the current macroblock can be calculated based on the first data amount and the starting address of the current macroblock, and the segment with a length of the second data amount starting from the residual starting address can be determined as the residual cache segment to obtain the residual cache segment. The residual starting address and the code length of the macroblock residual of the current macroblock can be used to more conveniently record the residual cache segment, thereby reducing the resources required for recording.

[0135] In order to facilitate the description of the entropy decoding method provided by the present application, the present application provides another flow chart of the entropy decoding method, such as Figure 6a As shown, the method includes:

[0136] S601, decoding starts.

[0137] S602, macroblock analysis.

[0138] Macroblock parsing is to continuously read the first codeword from the macroblock address in the bitstream buffer through the synax read pointer and perform syntax decoding on the read first codeword. S602 corresponds to the aforementioned S201, and the relevant description of the aforementioned S201 can be referred to, which will not be repeated here.

[0139] S603, macroblock overhead calculation.

[0140] The macroblock overhead calculation is to obtain a first data amount of the macroblock header and a second data amount of the macroblock residual recorded in the macroblock header according to syntax decoding of the first codeword.

[0141] S604, determine whether the analysis is completed?

[0142] S604 is to determine whether the first codeword is decoded. If the decoding is completed, that is, "yes", then S605 is executed, and if the decoding is not completed, that is, "no", then S602 is executed.

[0143] S605, address calculation.

[0144] According to the first data amount and the second data amount, the residual buffer section of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock are calculated. S605 corresponds to the aforementioned S202, and the relevant description of the aforementioned S202 can be referred to, which will not be repeated here.

[0145] The starting address of the macroblock header of the next macroblock calculated in S605 (i.e. Figure 6a ), return to execute S602, read and grammatically decode the first codeword corresponding to the macroblock header of the next macroblock. According to the residual buffer segment calculated in S605, execute S606, read and residually decode the second codeword corresponding to the macroblock residual of the current macroblock.

[0146] S606, determine whether the address calculation is completed?

[0147] S606 is to determine whether the residual buffer section is obtained by calculation. If the residual buffer section is obtained, that is, "yes", S607 is executed.

[0148] S607, residual block address calculation.

[0149] According to the residual buffer location, the address of the macroblock residual of the current macroblock is determined.

[0150] S608, residual block parsing.

[0151] The residual block parsing is to read the second codeword from the bit stream buffer according to the residual buffer segment through the resi read pointer, and perform residual decoding on the read second codeword. S608 corresponds to the aforementioned S203, and the relevant description of the aforementioned S203 can be referred to, which will not be repeated here.

[0152] S609, determine whether the bit stream is finished?

[0153] Determining whether the bit stream ends is to determine whether the preset decoding end condition is reached. Figure 6a In the example shown, the preset decoding condition is that the macroblock headers and macroblock residuals of all macroblocks in the bitstream cache have been decoded. If the preset decoding end condition is met, that is, "yes", S610 is executed, and if the preset decoding end condition is not met, that is, "no", S606 is executed.

[0154] S610, decoding ends.

[0155] In order to more conveniently describe the above decoding process, the present application also provides a schematic diagram of a decoding process for respectively decoding the macroblock header and the macroblock residual of each macroblock in the bitstream buffer, such as Figure 6b As shown. In this embodiment, the entropy decoder includes a second reading port. Assume that the macroblock headers included in each macroblock are: macroblock header 1, macroblock header 2, macroblock header 3, macroblock header 4, ..., macroblock header n; the macroblock residuals included in each macroblock are: macroblock residual 1, macroblock residual 2, macroblock residual 3, ..., macroblock residual n-1, macroblock residual n.

[0156] See also Figure 6b, read macroblock header 1 according to the macroblock address, and perform syntax decoding on macroblock header 1; calculate the starting address of macroblock header 2 and the residual cache section of macroblock residual 1 according to the result obtained after decoding macroblock header 1, read macroblock header 2 according to the starting address of macroblock header 2, and perform syntax decoding on macroblock header 2, and at the same time, read macroblock residual 1 according to the residual cache section of macroblock residual 1, and perform residual decoding on macroblock residual 1; calculate the starting address of macroblock header 3 and the residual cache section of macroblock residual 2 according to the result obtained after decoding macroblock header 2, read macroblock header 3 according to the starting address of macroblock header 3, and perform syntax decoding on macroblock header 3, and at the same time, after the decoding of macroblock residual 1 is completed, read macroblock residual 2 according to the residual cache section of macroblock residual 2, and perform residual decoding on macroblock residual 2; ...; and so on, until the macroblock headers and macroblock residuals of all macroblocks in the bitstream cache have been decoded.

[0157] In some cases, the decoding of the macroblock residual of the current macroblock needs to depend on the decoding result of the macroblock residual of the previous macroblock. Therefore, in this case, it can be as follows Figure 6b As shown in , the macroblock residuals in each macroblock are residually decoded according to the arrangement order of each macroblock, that is, the macroblock residuals in each macroblock are residually decoded in the order of macroblock residual 1, macroblock residual 2, ..., macroblock residual n.

[0158] In other possible examples, if there is no dependency between the decoding of macroblock residuals of different macroblocks, the residual decoding of the macroblock residuals in each macroblock may be performed regardless of the arrangement order of the macroblocks. For example, if the residual cache sections of macroblock residual 2 and macroblock residual 3 have been calculated, after the decoding of macroblock residual 1 is completed, macroblock residual 3 can be read and decoded according to the residual cache section of macroblock residual 3, and after the decoding of macroblock residual 3 is completed, macroblock residual 2 can be read and decoded according to the residual cache section of macroblock residual 2. This application does not impose any limitation on the decoding order of each macroblock residual.

[0159] Figure 6b This is only a possible decoding process diagram. In fact, since the macroblock residual accounts for a relatively high proportion of the data volume in the macroblock, the decoding of the macroblock residual is slower than the decoding of the macroblock header. It is possible that the residual buffer section of the macroblock residual of the next macroblock has been calculated, while the macroblock residual of the current macroblock has not yet been decoded. For example, Figure 6bAs shown, the residual cache section of macroblock residual 1 and the starting address of macroblock header 2 can be obtained by decoding macroblock header 1, macroblock residual 1 is read and decoded according to the residual cache section of macroblock residual 1, and macroblock header 2 is read and decoded according to the starting address of macroblock header 2. Since the decoding of macroblock residual is slower than the decoding of macroblock header, when the residual cache section of macroblock residual 2 and the starting address of macroblock header 3 are obtained after decoding macroblock header 2, the decoding of macroblock residual 1 may not be completed.

[0160] Based on the above description, in the actual decoding process, the macroblock residual of the next macroblock can be decoded according to the residual cache section of the macroblock residual of the next macroblock only after the macroblock residual of the current macroblock is decoded. Therefore, after the macroblock headers of all macroblocks in the bitstream cache are decoded, there may be some macroblock residuals in the bitstream cache that have not been decoded. At this time, it is necessary to read and decode the undecoded macroblock residuals according to the calculated residual cache section. Still taking the above example as an example, it is necessary to continue to decode macroblock residual 1 at this time, and read and decode macroblock header 3 according to the starting address of macroblock header 3. Assuming that the decoding of macroblock residual 1 is completed during the decoding of macroblock header 3, macroblock residual 2 can be read and decoded according to the residual cache section of macroblock residual 2, that is, during the decoding of macroblock header 3, since the decoding of macroblock residual 1 is completed, macroblock residual 2 can be read and decoded while decoding macroblock header 3.

[0161] Corresponding to the aforementioned entropy decoding method, the present application also provides an entropy decoder, such as Figure 7 As shown, the entropy decoder includes: a cache management unit 71, a macroblock syntax decoding unit 72, a macroblock residual block decoding unit 73, and a bitstream cache unit 74; the bitstream cache unit includes: a first reading port and a second reading port;

[0162] A bit stream buffer unit 74, used for buffering a plurality of macroblocks, each macroblock including a macroblock header and a macroblock residual, wherein the macroblock header records a first amount of data of the macroblock header and a second amount of data of the macroblock residual;

[0163] The cache management unit 71 is used to send a macroblock address to the bitstream cache unit 74, so that the bitstream cache unit 74 continuously reads the first codeword from the macroblock address through the first reading port and sends the first codeword to the macroblock syntax decoding unit 72, wherein the macroblock address is initially the starting address of the macroblock header of the first macroblock to be decoded in the bitstream cache unit 74;

[0164] The macroblock syntax decoding unit 72 is used to perform syntax decoding on the received first codeword; and in response to completing the syntax decoding, send a syntax decoding completion instruction to the cache management unit 71;

[0165] The cache management unit 71 is further used to calculate the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the first data amount and the second data amount in response to the first data amount and the second data amount obtained through syntax decoding, wherein the current macroblock is the macroblock cached at the macroblock address, and the next macroblock is the next macroblock adjacent to the current macroblock in the bitstream cache; send the residual cache segment to the bitstream cache unit 74, so that the bitstream cache unit 74 reads the second codeword recorded in the residual cache segment through the second reading port, and sends the second codeword to the macroblock residual block decoding unit 73; in response to the syntax decoding completion instruction, use the calculated starting address as the new macroblock address, return to execute the step of sending the macroblock address to the bitstream cache unit 74, until the preset decoding end condition is reached, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel;

[0166] The macroblock residual block decoding unit 73 is configured to perform residual decoding on the received second codeword.

[0167] In the embodiment of the present application, since each macroblock includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual, the first codeword can be continuously read from the macroblock address in the bitstream cache through the first reading port, and the first codeword can be syntax-decoded to obtain the first data amount and the second data amount recorded in the macroblock header of the macroblock. According to the first data amount and the second data amount, the residual cache section of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock adjacent to the current macroblock can be calculated, and then the second code word can be read according to the residual cache section of the macroblock residual of the current macroblock through the second reading port, and the second code word can be decoded to realize the decoding of the macroblock residual of the current macroblock. At the same time, the starting address of the macroblock header of the next macroblock can be used as the macroblock address to read and decode the new first code word, that is, to decode the macroblock header of the next macroblock, and the macroblock header and the macroblock residual are read respectively through two independent first reading ports and second reading ports, and the reading process of the first reading port and the reading process of the second reading port can be carried out in parallel, thereby realizing the separate parallel decoding of the macroblock header and the macroblock residual of the macroblock. It can be seen that the embodiment of the present application can separate the macroblock header and macroblock residual of the macroblock into two independent sub-channels for parallel decoding, so that the decoding of the next macroblock does not have to wait for the previous macroblock to be completely decoded, thereby improving the decoding speed of entropy decoding and the decoding speed of the entropy decoding channel, thereby reducing the macroblock queuing time caused by the serial calculation entropy decoding method.

[0168] exist Figure 7In the illustrated embodiment, the bitstream cache unit 74 may include a codestream write port and two independent read ports, and the two read ports are respectively denoted as read port A and read port B, wherein read port A is the aforementioned first read port, and read port B is the aforementioned second read port. Read port A is connected to the macroblock syntax decoding subchannel, that is, read port A is connected to the macroblock syntax decoding unit 72, and read port B is connected to the macroblock residual decoding subchannel, that is, read port B is connected to the macroblock residual block decoding unit 73. The codestream write port is used to cache the encoded bitstream when the encoded bitstream is input, that is, to cache multiple macroblocks. Read port A is used to send the macroblock header syntax codeword of the macroblock to the macroblock syntax decoding unit 72, that is, to send the first codeword, and read port B is used to send the residual block codeword of the macroblock to the macroblock residual block decoding unit 73, that is, to send the second codeword. The macroblock syntax decoding unit 72 performs syntax decoding on the first codeword and outputs the syntax element, that is Figure 7 The macroblock syntax element in the output; the macroblock residual block decoding unit 73 performs syntax decoding on the second codeword and outputs the macroblock residual, that is, Figure 7 The macroblock residual output in .

[0169] The bitstream cache unit 74 may also include a codestream write port and N independent read ports, and the N read ports are respectively recorded as read port A, read port B, read port C, ..., read port N, wherein read port A is the aforementioned first read port, and read ports B-read ports N are the aforementioned second read ports. Read port A is connected to the macroblock syntax decoding unit 72, and read ports B-read ports N are connected to the macroblock residual block decoding unit 73. The codestream write port is used to cache the coded bitstream when the coded bitstream is input, that is, to cache multiple macroblocks. Read port A is used to send the first codeword to the macroblock syntax decoding unit 72, and read ports B-read ports N are used to send the second codeword to the macroblock residual block decoding unit 73.

[0170] In a possible embodiment, Figure 8 As shown, the entropy decoder further includes: a macroblock overhead calculation unit 75;

[0171] The macroblock syntax decoding unit 72 is further configured to send the decoding result to the macroblock overhead calculation unit;

[0172] a macroblock overhead calculation unit 75, configured to calculate a first data amount and a second data amount in response to a decoding result, and send the first data amount and the second data amount to the cache management unit 71;

[0173] The cache management unit 71 is further configured to calculate, in response to obtaining the first data amount and the second data amount through syntax decoding, a residual cache segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, including:

[0174] The cache management unit 71 is further configured to calculate the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the received first data amount and second data amount.

[0175] In a possible embodiment, Fig. 9 As shown, the cache management unit 71 further includes: a first reading module 711, a second reading module 712, and a calculation module 713;

[0176] The calculation module 713 is used to calculate the residual buffer segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the received first data amount and second data amount, and send the residual buffer segment to the first reading module 711, and send the calculated starting address to the second reading module 712;

[0177] A first reading module 711 is used to send the residual buffer segment to the bit stream buffer unit 74;

[0178] The second reading module 712 is used to send the macroblock address to the bitstream cache unit 74, so that the bitstream cache unit 74 continuously reads the first codeword starting from the macroblock address through the first reading port and sends the first codeword to the macroblock syntax decoding unit 72; in response to the syntax decoding completion instruction, the calculated starting address is used as the new macroblock address, and the step of sending the macroblock address to the bitstream cache unit 74 is returned to execute.

[0179] exist Fig. 9 In the illustrated embodiment, the first reading module 711 controls the bitstream cache unit 74 to read the second codeword according to the residual cache segment through the resi read pointer; the second reading module 712 controls the bitstream cache unit 74 to read the first codeword according to the macroblock address through the synax read pointer.

[0180] In a possible embodiment, Fig.10 As shown, the calculation module 713 includes: a first calculation submodule 713a, a second calculation submodule 713b, and a third calculation submodule 713c;

[0181] The macroblock overhead calculation unit 75 is used to send the first data amount and the second data amount to the cache management unit, including:

[0182] The macroblock overhead calculation unit 75 is used to send the first data amount and the second data amount to the first calculation submodule 713a, send the first data amount to the second calculation submodule 713b, and send the second data amount to the third calculation submodule 713c;

[0183] A first calculation submodule 713a is used to calculate the starting address of the macroblock header of the next macroblock according to the received first data amount and second data amount, and send the starting address of the macroblock header of the next macroblock to the second reading module 712;

[0184] The second calculation submodule 713b is used to calculate the starting address of the residual buffer segment according to the received first data volume, and send the starting address of the residual buffer segment to the first reading module 711;

[0185] The third calculation submodule 713 c is used to calculate the end address of the residual buffer segment according to the received second data volume, and send the end address of the residual buffer segment to the first reading module 711 .

[0186] In a possible embodiment, Fig.11 As shown, the cache management unit 71 further includes: a write control module 714, a cache water level status monitoring module 715;

[0187] A write control module 714, configured to drive the bit stream cache unit 74 to cache a plurality of macroblocks included in the data to be decoded in response to the data to be decoded;

[0188] The cache water level status monitoring module 715 is used to monitor the cache status of the bitstream cache unit 74; in response to the amount of data cached by the bitstream cache unit 74 being greater than a preset upper limit threshold, the cache management unit 71 is driven to send a macroblock address to the bitstream cache unit 74, so that the bitstream cache unit 74 continuously reads the first codeword from the macroblock address through the first read port and sends the first codeword to the macroblock syntax decoding unit 72, and the cache water level status monitoring module 715 sends a stop cache instruction to the write control module 714, so that the write control module 714 stops driving the bitstream cache unit 74 to cache multiple macroblocks included in the data to be decoded in response to the stop cache instruction; in response to the completion of decoding of multiple macroblocks cached in the bitstream cache unit 74 or the amount of data cached by the bitstream cache unit 74 is less than a preset lower limit threshold, a cache instruction is sent to the write control module 714, so that the write control module 714 drives the bitstream cache unit 74 to cache multiple macroblocks that are not cached in the data to be decoded in response to the cache instruction.

[0189] Specifically, the cache waterline status monitoring module 715 can send a stop cache instruction to the write control module 714 when the amount of data cached in the bitstream cache unit 74 is greater than a preset upper limit threshold. The write control module 714 stops driving the bitstream cache unit 74 to cache multiple macroblocks included in the data to be decoded in response to the stop cache instruction. The preset upper limit threshold can be the maximum amount of data that the bitstream cache unit 74 can cache, or it can be slightly less than the maximum amount of data that the bitstream cache unit 74 can cache. And at this time, it is necessary to decode the multiple macroblocks cached in the bitstream cache unit 74. The cache waterline status monitoring module 715 can be used to drive the second reading module 712 to send a macroblock address to the bitstream cache unit 74, so that the bitstream cache unit 74 obtains the macroblock address, that is, obtains the starting address of the macroblock header of the first macroblock to be decoded, and then starts decoding each macroblock cached in the bitstream cache unit 74. The process of decoding each macroblock cached in the bitstream cache unit 74 can be referred to. Figure 2 as well as Figure 6a The illustrated embodiments will not be described in detail here.

[0190] When the decoding of each macroblock cached in the bitstream cache unit 74 is completed or the amount of data cached in the bitstream cache unit 74 is less than the preset lower limit threshold, at this time, there is no macroblock cached in the bitstream cache unit 74 or the cached macroblocks are small, and it is necessary to continue to cache the macroblocks that are not cached in the data to be decoded. Therefore, the cache water level line status monitoring module 715 can send a cache instruction to the write control module so that the write control module responds to the cache instruction and drives the bitstream cache unit to cache multiple macroblocks that are not cached in the data to be decoded. When the amount of data cached in the bitstream cache unit 74 is greater than the preset upper limit threshold again, the cache is stopped, and the decoding of each macroblock cached in the bitstream cache unit 74 is started, and the above process is repeated until all the macroblocks that need to be decoded in the data to be decoded are decoded.

[0191] The preset lower limit threshold may be set according to user experience, or may be set according to the cache speed of the bitstream cache unit 74 and the decoding speed of the entropy decoder. The faster the decoding speed, the higher the preset lower limit threshold; the faster the cache speed, the lower the preset lower limit threshold. It can be understood that if the difference between the preset lower limit threshold and the preset upper limit threshold is small, then when the cache speed is fast and the amount of data cached by the bitstream cache unit 74 is less than the preset lower limit threshold, only a shorter cache time is required to make the amount of data cached by the bitstream cache unit 74 greater than the preset upper limit threshold; when the decoding speed is fast and the amount of data cached by the bitstream cache unit 74 is greater than the preset upper limit threshold, only a shorter decoding time is required to make the amount of data cached by the bitstream cache unit 74 less than the preset lower limit threshold. Therefore, in order to avoid the entropy decoder having to switch between caching and decoding in a short period of time, resulting in unstable performance of the entropy decoder, when setting the preset upper limit threshold and the preset lower limit threshold, the faster the caching speed, the greater the difference between the preset upper limit threshold and the preset lower limit threshold should be, and the faster the decoding speed, the greater the difference between the preset upper limit threshold and the preset lower limit threshold should be.

[0192] By selecting this embodiment, the cache status of the bitstream cache unit can be monitored by the cache water level status monitoring module to avoid the situation where the amount of data to be decoded sent by the module sending the data to be decoded is greater than the maximum amount of data that can be cached by the bitstream cache unit, that is, to avoid cache overflow of the bitstream cache unit, and prevent the entropy decoder from reading empty data stored in the bitstream cache unit.

[0193] exist Fig.11 In the illustrated embodiment, when the encoded bitstream is input, that is, when the data to be decoded is input into the entropy decoder, the write control module controls the bitstream write port of the bitstream cache unit 74 through the write pointer to sequentially write the codewords in the data to be decoded into the cache, and each time a codeword is written, the write pointer is incremented by 1. When the cache watermark status monitoring module 715 detects that there are undecoded codewords in the bitstream cache unit 74, the decoding process starts. At this time, since there are undecoded codewords and decoding has just started, the synax read pointer, the resi read pointer, and the decoded macroblock number will all be initialized to 0, and the cache watermark of the cache watermark status monitoring module 715 is non-0.

[0194] The second reading module 712 controls the read port A of the bitstream cache unit 74 through the synax read pointer to start reading from the address where the undecoded codeword exists detected by the cache water level line status monitoring module 715, that is, the macroblock address. Each time an address is read, the synax read pointer is increased by 1, and the read codeword is sent to the macroblock syntax decoding unit 72. Until the syntax decoding completion instruction sent by the macroblock syntax decoding unit 72 to the second reading module 712 is received, the synax read pointer stops moving backward, and the macroblock header decoding of the current macroblock is completed.

[0195] The macroblock overhead calculation unit 75 calculates the first data amount and the second data amount in response to the decoding result of the macroblock header of the current macroblock, and sends the first data amount and the second data amount to the first calculation submodule 713a, sends the first data amount to the second calculation submodule 713b, and sends the second data amount to the third calculation submodule 713c.

[0196] The first calculation submodule 713a calculates the starting address x of the macroblock header of the next macroblock based on the received first data amount and the second data amount, and sends the starting address x of the macroblock header of the next macroblock to the second reading module 712; the second calculation submodule 713b calculates the starting address y of the residual cache segment of the macroblock residual of the current macroblock based on the received first data amount, and sends the starting address y of the residual cache segment to the first reading module 711; the third calculation submodule 713c calculates the code length z of the residual cache segment based on the received second data amount, and sends the code length z of the residual cache segment to the first reading module 711.

[0197] The first reading module 711 can control the reading port B of the bit stream buffer unit 74 to start reading from address y through the resi read pointer, and continuously read z addresses to obtain the macroblock residual of the current macroblock, that is, the second codeword, and send the second codeword to the macroblock residual block decoding unit 73. The macroblock residual block decoding unit 73 can perform residual decoding on the received second codeword.

[0198] At the same time, the second reading module 712 controls the reading port A of the bit stream cache unit 74 through the synax read pointer to start reading from the starting address x of the macroblock header of the next macroblock. Each time an address is read, the synax read pointer is incremented by 1, and the read codeword is sent to the macroblock syntax decoding unit 72. When the syntax decoding completion instruction sent by the macroblock syntax decoding unit 72 to the second reading module 712 is received, the synax read pointer stops moving backwards, and the decoding of the macroblock header of the next macroblock is completed. Repeat the above decoding process until the preset decoding end condition is reached.

[0199] Corresponding to the aforementioned entropy decoding method, the embodiment of the present application further provides an entropy decoding device, which is applied to an entropy decoder. The entropy decoder includes: a first reading port and a second reading port; Fig.12 As shown, the device comprises:

[0200] A first codeword decoding module 1201 is configured to continuously read a first codeword from a macroblock address in a bitstream buffer through a first reading port, and perform syntax decoding on the read first codeword, wherein a plurality of macroblocks are cached in the bitstream buffer, the macroblock address is initially a start address of a macroblock header of a first macroblock to be decoded in the bitstream buffer, each macroblock includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual;

[0201] A starting address calculation module 1202 is used to calculate, in response to obtaining a first data amount and a second data amount through syntax decoding, a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock buffered at the macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream buffer;

[0202] The second codeword decoding module 1203 is used to read the second codeword recorded in the residual buffer segment through the second reading port, and perform residual decoding on the read second codeword, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel;

[0203] The decoding step execution module 1204 is used to respond to the completion of syntax decoding, use the calculated starting address as the new macroblock address, return to execute the step of continuously reading the first codeword from the macroblock address in the bitstream cache, and perform syntax decoding on the read first codeword until a preset decoding end condition is reached.

[0204] In a possible embodiment, the starting address calculation module calculates the residual buffer segment of the macroblock residual of the current macroblock according to the first data amount and the second data amount, including:

[0205] Calculate the residual starting address of the macroblock residual of the current macroblock according to the first data amount and the starting address of the current macroblock;

[0206] A segment starting from the residual start address and having a length of the second data amount is determined as a residual cache segment.

[0207] In one possible embodiment, the entropy decoder includes a second reading port;

[0208] The second codeword decoding module reads the second codeword recorded in the residual buffer segment through the second reading port, including:

[0209] If the current macroblock is the first macroblock to be decoded in the bitstream cache, the second codeword recorded in the residual cache segment is read through the second reading port;

[0210] If the current macroblock is not the first macroblock to be decoded in the bitstream cache, in response to the completion of decoding the second codeword of the previous macroblock, the second codeword recorded in the residual cache segment is read through the second read port, wherein the previous macroblock is the previous macroblock adjacent to the current macroblock in the bitstream cache.

[0211] In a possible embodiment, the entropy decoder includes a plurality of second reading ports;

[0212] The second codeword decoding module reads the second codeword recorded in the residual buffer segment through the second reading port, including:

[0213] In response to obtaining a new residual buffer segment through calculation, reading a second codeword recorded in the new residual buffer segment through a second reading port in an idle state;

[0214] In response to the second read port completing the reading of the second code word, the second code word recorded in the unprocessed residual buffer segment is read through the second read port.

[0215] The present application also provides an entropy decoding device, such as Fig.13 As shown, including:

[0216] Memory 1301, used for storing computer programs;

[0217] The processor 1302 is used to implement the following steps when executing the program stored in the memory 1301:

[0218] Continuously reading a first codeword from a macroblock address in a bitstream buffer through a first reading port, and performing syntax decoding on the read first codeword, wherein a plurality of macroblocks are buffered in the bitstream buffer, the macroblock address is initially a start address of a macroblock header of a first macroblock to be decoded in the bitstream buffer, each macroblock includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual;

[0219] In response to obtaining a first data amount and a second data amount through syntax decoding, calculating a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock buffered at the macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream buffer;

[0220] Reading the second codeword recorded in the residual buffer segment through the second reading port, and performing residual decoding on the read second codeword, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel;

[0221] In response to the completion of syntax decoding, the calculated starting address is used as the new macroblock address, and the step of continuously reading the first codeword from the macroblock address in the bitstream cache and performing syntax decoding on the read first codeword is returned until a preset decoding end condition is reached.

[0222] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 1302, the communication interface, and the memory 1301 communicate with each other via the communication bus.

[0223] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0224] The communication interface is used for communication between the above electronic device and other devices.

[0225] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0226] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0227] In another embodiment provided by the present application, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above entropy decoding methods are implemented.

[0228] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any entropy decoding method in the above embodiments.

[0229] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.

[0230] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0231] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the entropy decoder, entropy decoding device, entropy decoding equipment, computer-readable storage medium, and computer program product embodiments containing instructions, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0232] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. An entropy decoding method, characterized in that: Applied to an entropy decoder, the entropy decoder comprises: a first reading port and a second reading port; the method comprises: Continuously reading a first codeword from a macroblock address in a bitstream buffer through the first reading port, and performing syntax decoding on the read first codeword, wherein the bitstream buffer caches a plurality of macroblocks, the macroblock address is initially a start address of a macroblock header of a first macroblock to be decoded in the bitstream buffer, each of the macroblocks includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual; In response to obtaining the first data amount and the second data amount through syntax decoding, calculating a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock buffered at the macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream buffer; Reading the second codeword recorded in the residual buffer segment through the second reading port, and performing residual decoding on the read second codeword, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel; In response to the completion of syntax decoding, the calculated starting address is used as a new macroblock address, and the step of continuously reading the first codeword from the macroblock address in the bitstream cache and performing syntax decoding on the read first codeword is returned to execute until a preset decoding end condition is reached.

2. The method according to claim 1, characterized in that The step of calculating the residual buffer segment of the macroblock residual of the current macroblock according to the first data amount and the second data amount includes: Calculate a residual starting address of a macroblock residual of the current macroblock according to the first data amount and a starting address of the current macroblock; A segment starting from the residual start address and having a length of the second data amount is determined as a residual cache segment.

3. The method according to claim 1, characterized in that: The entropy decoder includes a second reading port; The step of reading the second codeword recorded in the residual buffer segment through the second reading port includes: If the current macroblock is the first macroblock to be decoded in the bitstream buffer, reading the second codeword recorded in the residual buffer segment through the second reading port; If the current macroblock is not the first macroblock to be decoded in the bitstream cache, in response to completion of decoding the second codeword of the previous macroblock, the second codeword recorded in the residual cache segment is read through the second read port, wherein the previous macroblock is the previous macroblock in the bitstream cache that is adjacent to the current macroblock.

4. The method according to claim 1, characterized in that: The entropy decoder includes a plurality of second reading ports; The step of reading the second codeword recorded in the residual buffer segment through the second reading port includes: In response to obtaining a new residual buffer segment through calculation, reading a second codeword recorded in the new residual buffer segment through a second reading port in an idle state; In response to the second read port completing the reading of the second code word, the second code word recorded in the unprocessed residual buffer segment is read through the second read port.

5. An entropy decoder, characterized in that The entropy decoder comprises a cache management unit, a macroblock syntax decoding unit, a macroblock residual block decoding unit, and a bit stream cache unit; The bit stream cache unit comprises: a first reading port and a second reading port; The bitstream cache unit is used to cache multiple macroblocks, each of which includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual; The cache management unit is configured to send a macroblock address to the bitstream cache unit, so that the bitstream cache unit continuously reads a first codeword from the macroblock address through the first reading port and sends the first codeword to the macroblock syntax decoding unit, wherein the macroblock address is initially a starting address of a macroblock header of a first macroblock to be decoded in the bitstream cache unit; The macroblock syntax decoding unit is configured to perform syntax decoding on the received first codeword; and in response to completing syntax decoding, send a syntax decoding completion instruction to the cache management unit; The cache management unit is further used to, in response to obtaining the first data amount and the second data amount through syntax decoding, calculate the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock cached at the macroblock address, and the next macroblock is the next macroblock adjacent to the current macroblock in the bitstream cache; send the residual cache segment to the bitstream cache unit so that the bitstream cache unit reads the second codeword recorded in the residual cache segment through the second reading port, and sends the second codeword to the macroblock residual block decoding unit; in response to the syntax decoding completion instruction, use the calculated starting address as the new macroblock address, return to execute the step of sending the macroblock address to the bitstream cache unit until a preset decoding end condition is reached, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel; The macroblock residual block decoding unit is used to perform residual decoding on the received second codeword.

6. The entropy decoder according to claim 5, characterized in that The entropy decoder further comprises: a macroblock overhead calculation unit; The macroblock syntax decoding unit is further used to send the decoding result to the macroblock overhead calculation unit; The macroblock overhead calculation unit is configured to calculate a first data amount and a second data amount in response to the decoding result, and send the first data amount and the second data amount to the cache management unit; The cache management unit is further configured to, in response to obtaining the first data amount and the second data amount through syntax decoding, calculate, according to the first data amount and the second data amount, a residual cache segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock, including: The cache management unit is further used to calculate the residual cache segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the received first data amount and the second data amount; The cache management unit further includes: a first reading module, a second reading module, and a calculation module; The calculation module is used to calculate the residual buffer segment of the macroblock residual of the current macroblock and the starting address of the macroblock header of the next macroblock according to the received first data amount and the second data amount, and send the residual buffer segment to the first reading module, and send the calculated starting address to the second reading module; The first reading module is used to send the residual buffer segment to the bit stream buffer unit; The second reading module is used to send a macroblock address to the bitstream cache unit, so that the bitstream cache unit continuously reads the first codeword from the macroblock address through the first reading port and sends the first codeword to the macroblock syntax decoding unit; in response to the syntax decoding completion instruction, the calculated start address is used as a new macroblock address, and the step of sending the macroblock address to the bitstream cache unit is returned; The calculation module includes: a first calculation submodule, a second calculation submodule, and a third calculation submodule; The macroblock overhead calculation unit is used to send the first data amount and the second data amount to the cache management unit, including: The macroblock overhead calculation unit is configured to send the first data amount and the second data amount to the first calculation submodule, send the first data amount to the second calculation submodule, and send the second data amount to the third calculation submodule; The first calculation submodule is used to calculate the starting address of the macroblock header of the next macroblock according to the received first data amount and the second data amount, and send the starting address of the macroblock header of the next macroblock to the second reading module; The second calculation submodule is used to calculate the starting address of the residual buffer segment according to the received first data volume, and send the starting address of the residual buffer segment to the first reading module; The third calculation submodule is used to calculate the end address of the residual cache segment according to the received second data volume, and send the end address of the residual cache segment to the first reading module.

7. The entropy decoder according to claim 5 or 6, characterized in that The cache management unit also includes: a write control module and a cache water level status monitoring module; The write control module is used to drive the bit stream cache unit to cache a plurality of macro blocks included in the data to be decoded in response to the data to be decoded; The cache waterline status monitoring module is used to monitor the cache status of the bitstream cache unit; in response to the amount of data cached by the bitstream cache unit being greater than a preset upper limit threshold, drive the cache management unit to send a macroblock address to the bitstream cache unit, so that the bitstream cache unit continuously reads the first codeword from the macroblock address through the first read port and sends the first codeword to the macroblock syntax decoding unit, and the cache waterline status monitoring module sends a stop cache instruction to the write control module, so that the write control module stops driving the bitstream cache unit to cache the multiple macroblocks included in the data to be decoded in response to the stop cache instruction; in response to the decoding of the multiple macroblocks cached in the bitstream cache unit is completed or the amount of data cached by the bitstream cache unit is less than a preset lower limit threshold, send a cache instruction to the write control module, so that the write control module drives the bitstream cache unit to cache the multiple macroblocks that have not been cached in the data to be decoded in response to the cache instruction.

8. An entropy decoding device, characterized in that: Applied to an entropy decoder, the entropy decoder comprises: a first reading port and a second reading port; the device comprises: a first codeword decoding module, configured to continuously read a first codeword from a macroblock address in a bitstream buffer through the first reading port, and perform syntax decoding on the read first codeword, wherein the bitstream buffer caches a plurality of macroblocks, the macroblock address is initially a start address of a macroblock header of a first macroblock to be decoded in the bitstream buffer, each of the macroblocks includes a macroblock header and a macroblock residual, and the macroblock header records a first data amount of the macroblock header and a second data amount of the macroblock residual; a starting address calculation module, configured to calculate, in response to obtaining the first data amount and the second data amount through syntax decoding, a residual buffer segment of a macroblock residual of a current macroblock and a starting address of a macroblock header of a next macroblock according to the first data amount and the second data amount, wherein the current macroblock is a macroblock buffered at the macroblock address, and the next macroblock is a next macroblock adjacent to the current macroblock in the bitstream buffer; A second codeword decoding module, used for reading the second codeword recorded in the residual buffer segment through the second reading port, and performing residual decoding on the read second codeword, wherein the reading process of the first reading port and the reading process of the second reading port are performed in parallel; The decoding step execution module is used for responding to the completion of syntax decoding, taking the calculated starting address as the new macroblock address, returning to execute the step of continuously reading the first codeword from the macroblock address in the bitstream cache, and performing syntax decoding on the read first codeword until a preset decoding end condition is reached.

9. An entropy decoding device, characterized in that include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-4 when executing a program stored in a memory.

10. A computer program product, characterized in that When the method is executed on a computer, the computer is enabled to execute the method described in any one of claims 1 to 4.