WO2024051645A1 - 一种解码方法、编码方法及相关设备 - Google Patents
一种解码方法、编码方法及相关设备 Download PDFInfo
- Publication number
- WO2024051645A1 WO2024051645A1 PCT/CN2023/116724 CN2023116724W WO2024051645A1 WO 2024051645 A1 WO2024051645 A1 WO 2024051645A1 CN 2023116724 W CN2023116724 W CN 2023116724W WO 2024051645 A1 WO2024051645 A1 WO 2024051645A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- encoding
- coding
- ending
- unit
- virtual
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 165
- 230000006835 compression Effects 0.000 claims description 51
- 238000007906 compression Methods 0.000 claims description 51
- 238000004891 communication Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 abstract description 84
- 238000013139 quantization Methods 0.000 description 31
- 230000005540 biological transmission Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 11
- 238000004364 calculation method Methods 0.000 description 9
- 238000012545 processing Methods 0.000 description 9
- 230000006870 function Effects 0.000 description 5
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000011156 evaluation Methods 0.000 description 3
- GXFZCDMWGMFGFL-KKXMJGKMSA-N (+)-Tubocurarine chloride hydrochloride Chemical compound [Cl-].[Cl-].C([C@H]1[N+](C)(C)CCC=2C=C(C(=C(OC3=CC=C(C=C3)C[C@H]3C=4C=C(C(=CC=4CC[NH+]3C)OC)O3)C=21)O)OC)C1=CC=C(O)C3=C1 GXFZCDMWGMFGFL-KKXMJGKMSA-N 0.000 description 2
- 239000008709 Curare Substances 0.000 description 2
- 230000004888 barrier function Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000003795 chemical substances by application Substances 0.000 description 1
- 238000011217 control strategy Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000011002 quantification Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/146—Data rate or code amount at the encoder output
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/184—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/44—Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/70—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N19/91—Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
Definitions
- the present application relates to the field of coding and decoding technology, and in particular, to a decoding method, an encoding method and related equipment.
- the typical process of display interface compression is that at the input side interface, the encoder performs coding operations such as prediction, quantization, and entropy coding on the input single frame image, and compresses it into a bit stream; the bit stream is transmitted to the output through the display link Side interface; output side interface, the decoder decompresses the bit stream, and finally outputs the reconstructed image through decoding operations such as entropy decoding, inverse quantization, and reconstruction.
- a bitstream buffer is introduced at the encoding end, and the fallback mode is used to reduce buffer overflow.
- the set threshold overflow line
- special encoding is performed on the image block in fallback mode, so that the image block is The number of encoding bits of the image block is the specified value, thereby ensuring that the number of encoding bits of the image block input buffer plus the amount of data in the current buffer does not overflow.
- the way to determine whether the buffer overflows during the above encoding and decoding is whether the sum of the virtual filling data amount and the current buffer data amount is greater than the overflow line.
- the above method of determining overflow may cause the amount of data in the current buffer plus the amount of virtual padding data to exceed the overflow line, thus affecting encoding/decoding.
- This application provides a decoding method, encoding method and related equipment for reducing buffer overflow during encoding and decoding in fallback mode.
- the first aspect of the embodiment of the present application provides a decoding method.
- the decoding method can be executed by a decoding device or by a component of the decoding device (such as a processor, a chip or a chip system, etc.).
- the bit stream of the first coding unit is first obtained, and the first coding unit is at least one coding unit among multiple coding units; the ending descending step size is determined, and the ending descending step size is used to update the virtual values of the multiple coding units.
- the filling amount determine the virtual filling amount of multiple coding units based on the ending descending step size, and the virtual filling amount is used to reduce the storage space of the buffer in the decoding device; determine the coding mode of the first coding unit among the multiple coding units as the fallback mode ;Decoding the bit stream of the first coding unit based on the virtual padding amount and the fallback mode to obtain the first data.
- the virtual filling amount is considered in the fallback mode, that is, encoding and decoding are performed based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the storage space of the buffer, This reduces buffer overflow during encoding and decoding in fallback mode.
- the method before the above step: determining the ending descending step size, the method further includes: obtaining the original number of bits of the first coding unit, the preset compression rate, and multiple coding units. The minimum number of encoding bits; determining the ending descending step size, including: determining the logarithmic value of the ending descending step size based on the original number of bits, the preset compression rate, and the minimum number of encoding bits; determining the ending descending step size based on the logarithmic value of the ending descending step size.
- the logarithmic value of the ending descending step is determined based on the minimum number of coding bits, and the ending descending step is determined based on the logarithmic value of the ending descending step. That is, the minimum number of encoding bits is taken into consideration when setting the end descending step size, thereby ensuring that the buffer data volume will not overflow after decoding of the current encoding unit is completed.
- the upper limit of the logarithmic value of the ending descending step is the logarithmic value of the first difference with 2 as the base, and the first difference is the original bit The product of the number and the preset compression rate minus the minimum number of encoding bits.
- the minimum number of encoding bits in the fallback mode will be affected by the ending descending step size.
- the maximum range of the ending step size is determined by the minimum number of encoding bits in the fallback mode. It ensures that the code control can use virtual filling to gradually reduce the data volume of the physical buffer to the expected buffer data volume, and at the same time, the fallback mode will not overflow the buffer in the virtual filling state.
- the above step: determining the virtual filling amount of multiple coding units based on the ending descending step size includes: if the first coding unit is sorted in the multiple coding units is greater than or equal to the preset threshold, the virtual filling amount is determined based on the logarithmic value of the basic data amount and the ending descending step size.
- the preset threshold is used to determine the number of coding units for virtual filling in multiple coding units.
- the basic data amount is the first The amount of data that has been dummy padded in code units preceding the code unit.
- a coding unit threshold for virtual padding in multiple coding units can be set according to actual needs, and then the overall virtual padding amount of multiple coding units is determined based on the threshold.
- the above-mentioned virtual filling amount is equal to the sum of the basic data amount and the ending descending step size.
- This possible implementation provides a simple calculation of the virtual filling amount, which is calculated by gradually accumulating coding units, so that the overall virtual filling amount of multiple coding units can be obtained.
- the above step: decoding the bit stream of the first coding unit based on the virtual padding amount and the fallback mode includes: determining the fallback mode based on the virtual padding amount.
- the ending descending step size is determined based on the minimum number of encoding bits, and the encoding code length of the fallback mode is set according to the ending descending step size to reduce buffer overflow. It can also be understood that during virtual filling, the code length in fallback mode takes into account the ending descending step, thereby ensuring that the buffer data volume will not overflow after decoding of the current coding unit is completed.
- the encoding code length is the difference between the first value and the header information overhead bits of the fallback mode, and the first value is the th The quotient of the second difference value and the number of pixels in the first coding unit, the second difference value is the product of the original number of bits in the first coding unit and the preset compression rate minus the difference in the ending descending step size; if the virtual padding amount is equal to 0 , then the encoding code length is the difference between the product of the original number of bits and the preset compression rate and the header information overhead bits in fallback mode.
- different encoding code lengths are determined based on different situations of virtual padding, so as to take into account the decoding process of coding units with virtual padding and the decoding process of coding units without virtual padding.
- the second aspect of the embodiment of the present application provides an encoding method.
- the encoding method can be executed by an encoding device or by a component of the encoding device (such as a processor, a chip or a chip system, etc.).
- the first coding unit is first obtained, and the first coding unit is at least one coding unit among multiple coding units; the ending descending step size is determined, and the ending descending step size is used to update the virtual filling amount of the multiple coding units;
- the virtual filling amount of multiple coding units is determined based on the ending descending step size.
- the virtual filling amount is used to reduce the storage space of the buffer in the encoding device; the coding mode of the first coding unit among the multiple coding units is determined to be the fallback mode; based on the virtual filling amount The first encoding unit is encoded with the padding amount and the fallback mode to obtain a bit stream.
- the virtual filling amount is considered in the fallback mode, that is, encoding is performed based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the storage space of the buffer, thereby reducing Buffer overflow during encoding in fallback mode.
- the above step of: determining that the coding mode of the first coding unit among the plurality of coding units is the fallback mode includes: if the multiple coding modes are different for the first coding unit The coding code lengths are all greater than the preset code length, then the coding mode of the first coding unit is determined to be the fallback mode.
- the preset code length is the quotient of the second difference and the number of pixels in the first coding unit, and the second difference is The product of the original number of bits of the first coding unit and the preset compression rate minus the difference in the ending descending step size.
- the specific encoding mode can be determined from multiple encoding modes through evaluation indicators, thereby improving the encoding performance of the encoding unit.
- the method before the above step: determining the ending descending step size, the method further includes: obtaining the original number of bits of the first coding unit, the preset compression rate, and multiple coding units. The minimum number of encoding bits; determining the ending descending step size, including: determining the logarithmic value of the ending descending step size based on the original number of bits, the preset compression rate, and the minimum number of encoding bits; determining the ending descending step size based on the logarithmic value of the ending descending step size.
- the logarithmic value of the ending descending step is determined based on the minimum number of coding bits, and the logarithmic value of the ending descending step is determined based on the minimum number of coding bits.
- Determine the ending descending step size That is, the minimum number of encoding bits is taken into consideration when setting the end descending step size, thereby ensuring that the buffer data volume will not overflow after decoding of the current encoding unit is completed.
- the upper limit of the logarithmic value of the ending descending step is the logarithmic value of the first difference with 2 as the base, and the first difference is the original bit The product of the number and the preset compression rate minus the minimum number of encoding bits.
- the minimum number of encoding bits in the fallback mode will be affected by the ending descending step size.
- the maximum range of the ending step size is determined by the minimum number of encoding bits in the fallback mode. It ensures that the code control can use virtual filling to gradually reduce the data volume of the physical buffer to the expected buffer data volume, and at the same time, the fallback mode will not overflow the buffer in the virtual filling state.
- the above step: determining the virtual filling amount of multiple coding units based on the ending descending step size includes: if the first coding unit is sorted in the multiple coding units is greater than or equal to the preset threshold, the virtual filling amount is determined based on the logarithmic value of the basic data amount and the ending descending step size.
- the preset threshold is used to determine the number of coding units for virtual filling in multiple coding units.
- the basic data amount is the first The amount of data that has been dummy padded in code units preceding the code unit.
- a coding unit threshold for virtual padding in multiple coding units can be set according to actual needs, and then the overall virtual padding amount of multiple coding units is determined based on the threshold.
- the above-mentioned virtual filling amount is equal to the sum of the basic data amount and the ending descending step size.
- This possible implementation provides a simple calculation of the virtual filling amount, which is calculated by gradually accumulating coding units, so that the overall virtual filling amount of multiple coding units can be obtained.
- the above step: encoding the first coding unit based on the virtual padding amount and the fallback mode to obtain a bit stream includes: determining the fallback mode based on the virtual padding amount The encoding code length; the first encoding unit is encoded based on the encoding code length to obtain a bit stream.
- the ending descending step size is determined based on the minimum number of encoding bits, and the encoding code length of the fallback mode is set according to the ending descending step size to reduce buffer overflow. It can also be understood that during virtual filling, the code length in fallback mode takes into account the ending descending step, thereby ensuring that the buffer data volume will not overflow after the current encoding unit is encoded.
- the encoding code length is the difference between the first value and the header information overhead bits of the fallback mode, and the first value is the th The quotient of the second difference value and the number of pixels in the first coding unit, the second difference value is the product of the original number of bits in the first coding unit and the preset compression rate minus the difference in the ending descending step size; if the virtual padding amount is equal to 0 , then the encoding code length is the difference between the product of the original number of bits and the preset compression rate and the header information overhead bits in fallback mode.
- different coding code lengths are determined based on different situations of the virtual padding amount, so as to take into account the coding process of coding units with virtual padding and the coding process of coding units without virtual padding.
- the third aspect of the embodiment of the present application provides a decoding device.
- the decoding device includes: an acquisition unit, used to acquire a bit stream of a first coding unit, where the first coding unit is at least one coding unit among a plurality of coding units; a determination unit, used to determine the ending descending step size, the ending descending step size Used to update the virtual filling amount of multiple coding units; the determining unit is also used to determine the virtual filling amount of multiple coding units based on the ending descending step size, and the virtual filling amount is used to reduce the storage space of the buffer in the decoding device; the determining unit , and is also used to determine that the coding mode of the first coding unit among the plurality of coding units is the fallback mode; the decoding unit is used to decode the bit stream of the first coding unit based on the virtual filling amount and the fallback mode to obtain the first data.
- the above-mentioned obtaining unit is also used to obtain the original number of bits of the first coding unit, the preset compression rate, and the minimum number of coding bits of multiple coding units;
- the determining unit is specifically used to determine the logarithmic value of the ending descending step based on the original number of bits, the preset compression rate and the minimum number of encoding bits; the determining unit is specifically used to determine the ending descending step based on the logarithmic value of the ending descending step.
- the upper limit of the logarithmic value of the above-mentioned ending descending step is the logarithmic value of the first difference with 2 as the base, and the first difference is the original bit The product of the number and the preset compression rate minus the minimum number of encoding bits.
- the above-mentioned determining unit is specifically configured to determine based on the amount of basic data if the ranking of the first coding unit among the plurality of coding units is greater than or equal to a preset threshold.
- the logarithmic value of the descending step size at the end determines the amount of virtual filling.
- the preset threshold is used to determine the number of coding units for virtual filling in multiple coding units.
- the basic data amount is that virtual filling has been performed in multiple coding units before the first coding unit. amount of data.
- the above-mentioned virtual filling amount is equal to the sum of the basic data amount and the ending descending step size.
- the above-mentioned decoding unit is specifically configured to determine the encoding code length of the fallback mode based on the virtual padding amount; the decoding unit is specifically configured to determine the encoding code length of the fallback mode based on the encoding code length.
- the bit stream of one coding unit is decoded.
- the encoding code length is the difference between the first value and the header information overhead bits of the fallback mode, and the first value is the th The quotient of the second difference value and the number of pixels in the first coding unit, the second difference value is the product of the original number of bits in the first coding unit and the preset compression rate minus the difference in the ending descending step size; if the virtual padding amount is equal to 0 , then the encoding code length is the difference between the product of the original number of bits and the preset compression rate and the header information overhead bits in fallback mode.
- the fourth aspect of the embodiment of the present application provides an encoding device.
- the coding device includes: an acquisition unit, used to acquire a first coding unit, which is at least one coding unit among a plurality of coding units; a determination unit, used to determine an ending descending step, and the ending descending step is used for updating The virtual filling amount of multiple encoding units; the determination unit is also used to determine the virtual filling amount of multiple encoding units based on the ending descending step size, and the virtual filling amount is used to reduce the storage space of the buffer in the encoding device; the determination unit is also used Determining that the coding mode of the first coding unit among the plurality of coding units is the fallback mode; the coding unit is configured to code the first coding unit based on the virtual padding amount and the fallback mode to obtain a bit stream.
- the above-described determining unit is specifically configured to determine the first coding mode if the coding code lengths of the first coding unit in the multiple coding modes are all greater than the preset code length.
- the coding mode of the coding unit is fallback mode.
- the preset code length is the quotient of the second difference and the number of pixels in the first coding unit.
- the second difference is the product of the original number of bits of the first coding unit and the preset compression rate. Subtract the difference in the ending descending steps.
- the above-mentioned obtaining unit is also used to obtain the original number of bits of the first coding unit, the preset compression rate, and the minimum number of coding bits of multiple coding units; determine The unit is specifically used to determine the logarithmic value of the ending descending step based on the original number of bits, the preset compression rate and the minimum number of encoding bits; the determination unit is specifically used to determine the ending descending step based on the logarithmic value of the ending descending step.
- the upper limit of the logarithmic value of the ending descending step is the logarithmic value of the first difference with base 2, and the first difference is the original bit The product of the number and the preset compression rate minus the minimum number of encoding bits.
- the above-mentioned determining unit is specifically configured to, if the ranking of the first coding unit in the plurality of coding units is greater than or equal to a preset threshold, based on the basic data amount and The logarithmic value of the ending descending step determines the amount of virtual padding.
- the preset threshold is used to determine the number of coding units that are virtually padded in multiple coding units.
- the basic data amount is the number of coding units that have been virtually padded in multiple coding units before the first coding unit. The amount of data.
- the above-mentioned virtual filling amount is equal to the sum of the basic data amount and the ending descending step size.
- the above coding unit is specifically configured to determine the coding code length of the fallback mode based on the virtual filling amount; the coding unit is specifically configured to determine the first coding code length based on the coding code length.
- the coding unit performs encoding to obtain a bit stream.
- the encoding code length is the difference between the first value and the header information overhead bits of the fallback mode, and the first value is the th The quotient of the second difference value and the number of pixels in the first coding unit, the second difference value is the product of the original number of bits in the first coding unit and the preset compression rate minus the difference in the ending descending step size; if the virtual padding amount is equal to 0 , then the encoding code length is the difference between the product of the original number of bits and the preset compression rate and the header information overhead bits in fallback mode.
- the fifth aspect of the embodiment of the present application provides a decoding device, including: a processor.
- the processor is coupled to a memory.
- the memory is used to store programs or instructions.
- the decoding device implements the above-mentioned first aspect. A method in any possible implementation of an aspect or first aspect.
- a sixth aspect of the embodiment of the present application provides a coding device, including: a processor.
- the processor is coupled to a memory.
- the memory is used to store programs or instructions.
- the coding device implements the above-mentioned first aspect.
- a seventh aspect of the embodiment of the present application provides a communication system, including: the foregoing fifth aspect or the decoding device of any one of the fifth aspects, and the foregoing sixth aspect or any one of the encoding devices of the sixth aspect.
- the eighth aspect of the embodiments of the present application provides a computer-readable medium on which a computer program or instructions are stored.
- the computer can execute the first aspect or any possibility of the first aspect.
- method in the implementation, or The computer is caused to execute the method in the aforementioned second aspect or any possible implementation of the second aspect.
- a ninth aspect of the embodiment of the present application provides a computer program product.
- the computer program product When executed on a computer, the computer program product causes the computer to execute the method in the foregoing first aspect or any possible implementation of the first aspect, or causes the computer to execute The method in the aforementioned second aspect or any possible implementation of the second aspect.
- the virtual filling amount is considered in the fallback mode, that is, encoding and decoding are performed based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used It is used to reduce the storage space of the buffer, thereby reducing buffer overflow during the encoding and decoding process in fallback mode.
- Figure 1 is a schematic structural diagram of a communication system provided by an embodiment of the present application.
- FIG. 2 is a schematic diagram of the overall decoding process provided by the embodiment of the present application.
- FIG. 3 is another schematic diagram of the overall decoding process provided by the embodiment of the present application.
- Figure 4 is a schematic diagram of the overall encoding process provided by the embodiment of the present application.
- Figure 5 is another schematic diagram of the overall encoding process provided by the embodiment of the present application.
- Figure 6 is a schematic flow chart of a decoding method provided by an embodiment of the present application.
- Figure 7 is a schematic flow chart of the encoding method provided by the embodiment of the present application.
- Figure 8 is a schematic structural diagram of a decoding device provided by an embodiment of the present application.
- Figure 9 is a schematic structural diagram of the encoding device provided by the embodiment of the present application.
- Figure 10 is another schematic structural diagram of a decoding device provided by an embodiment of the present application.
- Figure 11 is another schematic structural diagram of an encoding device provided by an embodiment of the present application.
- This application provides a decoding method, encoding method and related equipment for reducing buffer overflow during encoding and decoding in fallback mode.
- Media devices use display interfaces when transmitting images and videos to compress (encode) and decompress (decode) the image and video data passing through the display interface, which is abbreviated as interface compression.
- Coding units can be objects to be processed during encoding or decoding.
- coding units are divided into images.
- a coding unit is a unit corresponding to a syntax element or bit stream obtained after decoding.
- Code rate control can also be called code control. It is the process of adjusting the output code rate during the encoding process. Based on the analysis of the current image content, bit stream buffer margin and other information, it changes the encoding quantization parameters and encoding mode. and other means to adjust the output bit rate.
- CBR is a code control strategy, which is characterized by the fact that the length of the bit stream output by the encoder is consistent within unit time.
- QP Quantization Parameter
- the residual values generated by the prediction operation or the coefficients generated by the transformation operation are quantized and written into the bit stream; during the decoding process, the syntax elements are inversely quantized to obtain the residual values or coefficients.
- QP is a parameter used in the quantization process. Generally, the larger the QP value, the more obvious the degree of quantification. Adjusting the QP value will directly affect the length of the encoded bit stream and the decoded image quality.
- Fallback mode is a prediction mode, which is characterized by overflow when the number of encoding bits in the input buffer plus the amount of data in the current buffer exceeds the set threshold (overflow line) under other prediction mode encoding.
- the image block is specially coded so that the number of coded bits of the image block is the specified value, thereby ensuring that the number of coded bits in the image block input buffer plus the amount of data in the current buffer does not overflow.
- the number of encoding bits in the input buffer is the number of encoding bits of the current image block minus the number of channel transmission bits.
- Virtual filling can be used to adjust the available space of the buffer by setting the amount of virtual filling data (it does not actually fill the current buffer with so much data, it is just a data amount number). Specifically, the sum of the virtual filling data amount and the data amount of the current buffer can be used for overflow judgment. When the sum of the virtual filling data amount and the current buffer data amount is greater than the overflow line, it is determined to be an overflow, otherwise there is no overflow. That is, under virtual filling, the overflow is determined by comparing the overflow line with the sum of the virtual filling data amount and the current buffer's data amount; without virtual filling, the overflow is determined by comparing the overflow line and the current buffer's data amount. , the overflow line is generally a fixed value, which is a value agreed in advance and does not change whether there is a virtual filling operation or not.
- a bitstream buffer is introduced at the encoding end, and the fallback mode is used to reduce buffer overflow.
- the set threshold overflow line
- special encoding is performed on the image block in fallback mode, so that the image block is The number of encoding bits of the image block is the specified value, thereby ensuring that the number of encoding bits of the image block input buffer plus the amount of data in the current buffer does not overflow.
- the way to determine whether the buffer overflows during the above encoding and decoding is whether the sum of the virtual filling data amount and the current buffer data amount is greater than the overflow line.
- the above method of determining overflow may cause the amount of data in the current buffer plus the amount of virtual padding data to exceed the overflow line, thus affecting encoding/decoding.
- embodiments of the present application provide a decoding method, an encoding method and related equipment.
- the virtual filling amount is considered in the fallback mode, that is, encoding and decoding are performed based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the storage space of the buffer, thereby reducing the number of errors in the fallback mode. Buffer overflow during encoding and decoding.
- the communication system includes a first device 101 and a second device 102.
- the first device 101 performs data communication with the second device 102.
- the first device 101 and the second device 102 are devices with encoding and/or decoding functions.
- the first device 101 serves as the sending end, and the second device 102 serves as the receiving end.
- the first device 101 encodes the data to obtain a data bit stream, and sends the data bit stream to the second device 102 .
- the second device 102 decodes the bit stream to obtain data. Then, data transmission between the first device 101 and the second device 102 is realized.
- the second device 102 serves as the sending end, and the first device 101 serves as the receiving end.
- the second device 102 will encode the data to obtain a data bit stream, and send the data bit stream to the first device 101 .
- the first device 101 decodes the bit stream to obtain data. Then, data transmission between the first device 101 and the second device 102 is realized.
- first device 101 and a second device 102 are taken as an example for schematic description.
- the communication system in the embodiment of the present application may have other forwarding devices, etc., to implement bit stream forwarding between the first device 101 and the second device 102.
- the number of the first device 101 and the second device 102 may also be multiple, and the details are not limited here.
- Figure 1 only takes terminal-network transmission as an example for exemplary description.
- the first device 101 and the second device 102 may be terminal devices.
- the first device 101 and the second device 102 are network devices.
- the first device 101 is a terminal device
- the second device 102 is a network device.
- the second device 102 is a terminal device
- the first device 101 is a network device. That is, the transmission between the first device 101 and the second device 102 may be terminal-to-terminal transmission, network-to-network transmission, or terminal-to-network transmission, etc., which are not limited here.
- the terminal device can be a device with encoding and/or decoding functions, and can be deployed on land, including indoors or outdoors, handheld, wearable or vehicle-mounted; it can also be deployed on water (such as ships, etc.); it can also be deployed in the air (e.g. on airplanes, balloons, satellites, etc.).
- the terminal device can be a mobile phone (mobile phone), tablet computer (Pad), computer with wireless transceiver function, virtual reality (VR) terminal device, augmented reality (AR) terminal device, industrial control (industrial) Wireless terminals in control, vehicle-mounted terminal equipment, wireless terminals in self-driving, wireless terminals in remote medical, wireless terminals in smart grid, transportation safety ), wireless terminals in smart cities, wireless terminals in smart homes, wearable terminal devices, etc.
- Terminal equipment can sometimes also be called terminal, user equipment (UE), access terminal equipment, vehicle-mounted terminal, industrial control terminal, UE unit, UE station, mobile station, mobile station, remote station, remote terminal equipment, mobile Equipment, UE agent or UE device, etc.
- Terminal equipment can also be fixed or or mobile.
- a network device is a device with encoding and/or decoding capabilities.
- Network equipment can include various forms of base stations: macro base stations, micro base stations (also called small stations), relay stations, access points, etc.
- the names of network devices may be different, such as eNB or eNodeB (Evolutional NodeB) in LTE (Long Term Evolution).
- the network device can also be a wireless controller in a CRAN (Cloud Radio Access Network) scenario.
- the network device may also be a base station device in a 5G network or a network device in a future evolved network.
- Network devices can also be wearable devices or vehicle-mounted devices.
- Network devices can also be transmission and reception points (Transmission and Reception Point, TRP).
- the overall decoding process includes: entropy decoding stage, inverse quantization stage, prediction reconstruction stage, etc. It is understandable that in actual applications, the decoding process may also have other situations.
- the decoding process includes an entropy decoding stage.
- the decoding process includes an entropy decoding stage, an inverse quantization stage, etc., and the details are not limited here.
- the decoder performs entropy decoding on the bit stream of the image to obtain syntax elements, then inverts the syntax elements to obtain residual information, and then performs prediction reconstruction on the residual information to output reconstruction.
- Image that is, the image after bitstream restoration.
- the decoding method provided by the embodiment of the present application can be applied in the entropy decoding stage or in the overall decoding process, and the details are not limited here.
- the calculation process in code rate control mainly includes the process of determining quantization parameters and updating the code control parameters.
- the entropy decoding stage obtains the image complexity and number of encoding bits corresponding to the input bit stream.
- the code rate control obtains the virtual filling amount and quantization parameters based on the image complexity.
- the entropy decoding stage obtains syntax elements through the input bit stream and the virtual padding provided by the code rate control.
- the inverse quantization stage outputs residual information based on the syntax elements output by the entropy decoding stage and the quantization parameters provided by the code rate control.
- the prediction reconstruction stage uses The residual information outputs the reconstructed image.
- the process of updating the coding control parameters is calculated and updated based on the number of encoding bits provided in the entropy decoding stage and the above-mentioned quantization parameters. Each step will be described in detail later and will not be expanded upon here.
- the process of determining quantization parameters includes steps 301 to 307.
- the process of updating code control parameters includes steps 308 to 312.
- Step 301 Calculate buffer fullness.
- the first device retrieves the physical buffer data amount PhyBuf T at the specified time T from the physical buffer fullness record table.
- the physical buffer fullness record table stores the data in the physical buffer when encoding/decoding each previous encoding block. quantity.
- the first device then takes out the virtual filling amount VirEnd T at the specified time T from the virtual filling amount record table.
- the virtual filling amount table stores the data amount of virtual filling during the encoding/decoding of each previous encoding block.
- the first device After the first device obtains PhyBuf T and VirEnd T , it calculates the buffer fullness based on PhyBuf T and VirEnd T.
- buffer fullness F is as shown in Formula 1.
- F represents the buffer fullness
- RcBuf T represents the amount of data in the buffer at time T
- RcBuf MAX represents the maximum amount of data allowed in the buffer (it can also be called the upper limit of the buffer, which can be preset or Determined based on the hardware storage space, the specifics are not limited here)
- X 0 is a preset parameter, and can be set according to actual needs.
- Step 302 Calculate the expected amount of block bits.
- the first device calculates the expected amount of block bits, where the expected amount of block bits Bpp represents the expected encoding bits of the current encoding block without considering the image content.
- the first device first obtains the expected initial value Bpp INI and the expected adjusted value Bpp ADJ . Then calculate Bpp based on Bpp INI and Bpp ADJ .
- Bpp INI is obtained by multiplying the original number of bits of the input image block and the preset compression rate
- Bpp ADJ is proportional to (RcBuf END -RcBuf T )
- RcBuf END is the expected code control buffer at the end of the encoding/decoding process.
- RcBuf T is the data amount of the buffer at time T calculated in the aforementioned step 301.
- Step 303 Calculate the information ratio.
- the first device first obtains the bit offset bitsOffset and the average lossless coded bits B AVG at time T, and then calculates the information ratio R based on bitsOffset and B AVG .
- the information ratio R represents the ratio of the information retained in the coding block to the original coding block after quantization.
- Bpp is the expected amount of block bits calculated in the aforementioned step 302, InvTab, X 1 , X 2 , X 3 , X 4 , and The lossless encoding bit record array is obtained, and BitsOffset represents the initial value of the bit offset.
- Step 304 Obtain the number of lossless encoding bits.
- the first device obtains the number of lossless encoding bits B LL , where B LL represents the estimated value of the number of encoding bits of the encoding block without quantization, which can be obtained by looking up the lossless encoding bit number record group Record BLL .
- B LL Record BLL [T][k]
- T represents the specified time
- k represents the input image complexity
- Step 305 Calculate the target number of bits.
- bitsOffset calculates the target number of bits B TGT .
- B TGT (R*(B LL -bitsOffset)+X 6 )*X 7 ;
- R is the information ratio calculated in the aforementioned step 303
- B LL is the number of lossless encoding bits calculated in the aforementioned step 304
- bitsOffset is the bit offset calculated in the aforementioned step 303
- X 6 and X 7 are preset parameters.
- Step 306 Clamp the target bit number.
- the first device After obtaining the expected amount of block bits Bpp, the number of lossless coding bits B LL , and the buffer fullness F, the first device calculates the minimum target bit B MIN and the maximum target bit B MAX based on Bpp, B LL , and F. And use B MIN and B MAX to clamp the target number of bits B TGT .
- B TGT MIN(MAX(B MIN ,B TGT ),B MAX );
- the above formula 5 is just an example of the target bit number clamping process.
- the target bit number clamping process can also have other methods, which are not limited here.
- Step 307 Calculate quantization parameters.
- the first device After acquiring the lossless encoding bit number B LL and the target bit number B TGT , the first device calculates the quantization parameter QP based on B LL and B TGT .
- X 8 , X 9 , and X 10 are preset parameters.
- the process of updating code control parameters in code rate control includes steps 308 to 312.
- Step 308 Calculate the number of lossless encoding bits.
- the first device After the first device decodes the bit stream, it obtains the actual number of coded bits B CU obtained after encoding/decoding the current coding block, and calculates the number of lossless coded bits B LC based on B CU and the quantization parameter QP obtained in step 307.
- B LC ((4*B CU +8*QP+X 11 )+X 8 )*X 9 ;
- B CU represents the actual number of coded bits obtained after encoding/decoding the current coding block
- QP is the quantization parameter obtained in the aforementioned step 307
- X 8 , X 9 , and X 11 are preset parameters
- X 8 and X 8 and X 9 in formula six are the same.
- the first device can also calculate the record table position.
- T PRE (T CUR +N-1)%N;
- T PRE represents the time of the previous coding block
- T CUR represents the time of the current coding block, that is, the specified time T in the aforementioned steps 301 to 307
- N is the coding block to which the number of coded bits in the code control input belongs and the image to which the image complexity belongs.
- the interval value of the block is the coding block to which the number of coded bits in the code control input belongs and the image to which the image complexity belongs.
- Step 309 Update the average lossless encoding bit number record table.
- the first device After acquiring T PRE and T CUR , the first device updates the average lossless encoding bit number record table Record BAVG based on T PRE and T CUR .
- Record BAVG is an array of length N, Record BAVG [t] represents the value of the t-th position.
- T PRE and T CUR are the recording table positions calculated in the aforementioned step 308
- B LC is the number of lossless coding bits calculated in the aforementioned step 308
- X 12 and X 13 are preset parameters.
- Step 310 Update the lossless encoding bit number record table.
- the first device After acquiring the lossless coding bit numbers B LC , T PRE and TCUR , the first device updates the lossless coding bit number record table Record BLL based on B LC , T PRE and TCUR .
- Record BLL is a two-dimensional array with size N*K.
- Record BLL [t][k] represents the t-th position and the image complexity is the value of k.
- T PRE and T CUR are the record table positions calculated in the aforementioned step 308
- B LC is the number of lossless coding bits calculated in the aforementioned step 308
- X 14 and X 15 are preset parameters.
- Step 311 Update the virtual filling amount record table.
- the first device After acquiring T PRE and T CUR , the first device updates the virtual filling amount record table Record VirEnd based on T PRE and T CUR .
- Record VirEnd is a one-dimensional array of length N, and Record VirEnd [t] represents the virtual filling value at the t-th position.
- Th block is the block number threshold of coding units for virtual padding among multiple coding units. Step is the set end descending step size.
- Step 312 Update the physical buffer fullness record table.
- the first device After obtaining TCUR , the first device updates the physical buffer fullness record table Record PHY based on TCUR .
- Record PHY is an array of length N
- Record PHY [t] represents the value of the t-th position.
- the value of Record PHY [T CUR ] is updated to the actual data amount of the current physical buffer.
- the first device can also update the record table position.
- the above describes the decoding process, the process of determining quantization parameters in code rate control, and updating code control parameters by taking the first device as an example.
- the coding process is described below.
- the overall coding process includes: prediction stage, quantization stage, entropy coding stage, etc. It is understandable that in actual applications, the encoding process may also have other situations.
- the encoding process includes an entropy encoding stage.
- the encoding process includes a quantization stage, an entropy encoding stage, etc., and the details are not limited here.
- the encoding end predicts the image blocks to obtain residual information, then quantizes the residual information through the quantization stage to obtain syntax elements, and then performs entropy encoding on the syntax elements to output a bit stream.
- the encoding method provided by the embodiment of the present application can be applied in the entropy coding stage or in the overall encoding process, and is not specifically limited here.
- the prediction stage obtains the input image block and obtains the residual information based on the input image block.
- the code rate control obtains the virtual filling amount and quantization parameters based on the image complexity.
- the quantization stage performs quantization processing based on the residual information and the quantization parameters obtained from the code rate control to obtain the syntax elements.
- the entropy coding stage performs entropy coding and outputs a bit stream based on the virtual padding amount and syntax elements.
- the decoding process obtains the image complexity by entropy decoding the input bit stream.
- the encoding process to obtain image complexity includes: dividing the image block into several sub-blocks, and for each sub-block, gradually calculating the difference between adjacent pixel values in both horizontal and vertical directions. After summing the absolute values of the differences, the complexity value corresponding to the sub-block is obtained. The complexity value is compared with the agreed threshold to obtain the complexity level of the sub-block. Rule the complexity level of each sub-block. After operation, the image complexity k of the current image block is obtained. Image complexity is one of K values.
- the overall decoding process and encoding process are described above, and the decoding method and encoding method provided by the embodiments of the present application are described below.
- the method may be executed by the decoding device, or may be executed by a component of the decoding device (such as a processor, a chip, or a chip system, etc.).
- the decoding device may be the first device or the second device in the scenario shown in FIG. 1 .
- the methods provided by the embodiments of this application can be applied to scenarios such as image and video transmission.
- FIG. 6 is a schematic flowchart of a decoding method provided by an embodiment of the present application.
- the method may include steps 601 to 605 . Steps 601 to 605 will be described in detail below.
- Step 601 Obtain the bit stream of the first coding unit.
- the decoding device receives the bit stream of the first coding unit sent from the encoding device. In another possible implementation manner, the decoding device receives the bit streams of multiple coding units sent from the coding unit, and determines the bit stream of the first coding unit from the bit streams of the multiple coding units. In another possibility In the current method, the decoding device selects the bit stream of the first coding unit from the database/memory, and the details are not limited here.
- the first coding unit is at least one coding unit among multiple coding units.
- Step 602 Determine the ending descending step size.
- the decoding device determines a trailing step size used to update virtual padding amounts of a plurality of coding units. From the results, this virtual padding is used to reduce the storage space of the buffer in the decoding device. From a process perspective, the virtual filling amount virtually increases the amount of data input into the buffer during the decoding process, thereby increasing the actual storage space of the buffer to reduce the risk of data overflow in the buffer after decoding by the first encoding unit.
- the decoding device before the decoding device determines the ending descending step size, the decoding device first obtains the original number of bits of the first coding unit, the preset compression rate, and the minimum number of coding bits of the multiple coding units.
- the original number of bits of the first coding unit can be understood as the number of bits of the first coding unit before encoding. Generally, the original number of bits will be carried in the bit stream, so that the decoding device can obtain the first bit number based on the bit stream.
- the preset compression rate and minimum number of encoding bits can be set according to actual needs, and are not limited here.
- the process of determining the ending descending step size includes steps one and two.
- Step 1 Determine the logarithmic value of the ending descending step size according to the original number of bits of the first coding unit, the preset compression rate, and the minimum number of coding bits of multiple coding units.
- the range of the logarithmic value of the ending descending step is determined based on the original number of bits of the first coding unit, the preset compression rate, and the minimum number of coding bits of multiple coding units. Then select the specific value of the logarithmic value of the ending descending step from the range.
- the upper limit of the range of the logarithmic value of the ending descending step is the logarithmic value of the first difference with base 2, and the first difference is the product of the original bit number and the preset compression rate minus the minimum number of encoding bits.
- B fbmin represents the minimum number of coding bits of multiple coding units.
- the decoding device After the decoding device determines the range of the logarithmic value of the ending descending step, it can select a specific value of the logarithmic value of the ending descending step according to the first preset condition or randomly from the above range.
- the above-mentioned first preset condition is that the value of the ending descending step pair value is a second value, the second value is within the above-mentioned range, and the second value satisfies the second preset condition, and the second preset condition
- the quotient including the third difference divided by 2 raised to the power of the second value is greater than or equal to the preset threshold, and the quotient is less than or equal to the logarithm of the third value, and the third difference is the upper storage limit of the buffer and the expected storage
- the third value is the number of coding units for virtual padding in multiple coding units.
- D worst (RcBuf MAX - RcBuf END ), RcBuf MAX represents the maximum value of the code control buffer, and RcBuf END represents the expected code control buffer data amount.
- RcBuf END is the default value.
- RcBuf END can also be understood as reducing the storage space of the buffer to this value.
- the value range of RcBuf END is between 0-RcBuf MAX .
- Th block is the preset number of coding units for virtual filling (which can also be called the block number threshold).
- the above process can also be understood as, in order to ensure the storage of subsequent image blocks (that is, the buffer does not overflow), the buffer data volume needs to be reduced to a specified value.
- the amount of reduction is determined by the logarithmic value of the ending drop step size and the block number threshold.
- Step 2 Determine the ending descending step based on the logarithmic value of the ending descending step.
- the decoding device determines the logarithmic value of the ending descending step, it determines the ending descending step based on the logarithmic value of the ending descending step.
- the logarithmic value of the descending step at the end can be recorded as log 2 Step, and the descending step at the end is Step. It can be seen that
- Step 603 Determine virtual padding amounts of multiple coding units based on the ending descending step size.
- the decoding device After the decoding device determines the ending descending step size, it determines the virtual padding amounts of the plurality of coding units based on the ending descending step size. This virtual padding is used to reduce the storage space of the buffer in the decoding device.
- the virtual filling amount is determined based on the basic data amount and the logarithmic value of the ending descending step size, and the preset threshold is In determining the number of coding units for virtual padding in multiple coding units, the basic data amount is the data amount for which virtual padding has been performed in multiple coding units before the first coding unit.
- the virtual filling amount of multiple coding units is equal to the sum of the basic data amount and the ending descending step size.
- the virtual filling amount of multiple coding units is the product of the maximum value in the first set and the ending descending step.
- the first set includes 0 and a fourth difference value.
- the fourth difference value is The difference between the preset number and the number of second coding units.
- the second coding unit is an undecoded decoding unit among the plurality of coding units.
- the decoding units that are not decoded may include coding units that require dummy padding and are not decoded, or may include coding units that need dummy padding and are not decoded, and coding units that do not require dummy padding and are decoded.
- VirEnd T represents the virtual filling amount of multiple coding units at time T
- Th block is the block number threshold
- Block remain represents the number of undecoded coding units in multiple coding units.
- Step 604 Determine the coding mode of the first coding unit among the plurality of coding units to be the fallback mode.
- the decoding device determines that the encoding mode of the first encoding unit among the plurality of encoding units is the fallback mode.
- the decoding device performs entropy decoding on the bit streams of the multiple coding units to determine that the coding mode of the first coding unit among the multiple coding units is the fallback mode. .
- the decoding device performs entropy decoding on the bit stream of the first coding unit to determine that the coding mode of the first coding unit is the fallback mode.
- Step 605 Decode the first coding unit based on the virtual padding amount and the fallback mode to obtain the first data.
- the decoding device After determining the virtual padding amount, the decoding device decodes the first encoding unit based on the virtual padding amount and the fallback mode to obtain the first data.
- the decoding device first determines the encoding code length of the fallback mode based on the virtual padding amount, and then decodes the bit stream of the first encoding unit based on the encoding code length to obtain the first data.
- the above-mentioned determination of the encoding code length of the fallback mode based on the virtual padding amount specifically includes: if the virtual padding amount is greater than 0, the encoding code length is the difference between the first value and the header information overhead bits of the fallback mode, and the first value is The quotient of the second difference value and the number of pixels in the first coding unit, the second difference value is the product of the original number of bits in the first coding unit and the preset compression rate minus the difference of the ending descending step size. If the virtual padding amount is equal to 0, the encoding code length is the product of the original number of bits and the preset compression rate. That is, different encoding code lengths are determined according to different situations of the virtual padding amount, so as to take into account the decoding process of the coding unit with virtual padding and the decoding process of the coding unit without virtual padding.
- the above process can also determine the coding code length at the coding unit level. For example, if the second coding unit is dummy padded, the coding code length of the second coding unit is the first value and the fallback mode. The difference in header information overhead bits. If the second coding unit does not perform dummy padding, the coding code length of the second coding unit is the product of the original number of bits of the second coding unit and the preset compression rate.
- the decoding device performs decoding and other processing on the bit stream of the first encoding unit based on the encoding code length to obtain the first data.
- the decoding device performs entropy decoding on the bit stream of the first encoding unit based on the encoding code length to obtain the syntax element (that is, the first data is the syntax element).
- the decoding device performs entropy decoding, inverse quantization, and other processing on the bit stream of the first coding unit based on the encoding code length to obtain a reconstructed image (that is, the first data is a reconstructed image).
- step 602 may follow step 604.
- step 604 may follow step 603 and so on.
- the virtual filling amount is considered in the fallback mode, that is, encoding and decoding are performed based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the size of the buffer. storage space to reduce buffer overflow during encoding and decoding in fallback mode.
- the ending descending step size is determined according to the minimum number of encoding bits in the fallback mode, and the encoding code length of the fallback mode is set according to the ending descending step size to reduce buffer overflow.
- the code length in fallback mode takes into account the ending descending step, thereby ensuring that the buffer data volume will not overflow after decoding of the current coding unit is completed.
- the data volume of the buffer is gradually reduced to the expected buffer data volume through virtual filling.
- the fallback mode is the last barrier to prevent overflow, and it needs to be coordinated with the virtual filling operation of code control to ensure that the buffer will not overflow in the fallback mode during virtual filling.
- the minimum number of encoding bits in the fallback mode will be affected by the ending descending step size.
- the maximum range of the ending step size is determined by the minimum number of encoding bits in the fallback mode. It ensures that the code control can use virtual filling to gradually reduce the data volume of the physical buffer to the expected buffer data volume, and at the same time, the fallback mode will not overflow the buffer in the virtual filling state.
- the decoding method provided by the embodiment of the present application is described above, and the encoding method provided by the embodiment of the present application is described below.
- the method may be executed by the encoding device, or may be executed by a component of the encoding device (such as a processor, a chip, or a chip system, etc.).
- the encoding device may be the first device or the second device in the scenario shown in FIG. 1 .
- the methods provided by the embodiments of this application can be applied to scenarios such as image and video transmission.
- FIG. 7 is a schematic flowchart of an encoding method provided by an embodiment of the present application.
- the method may include steps 701 to 705 . Steps 701 to 705 will be described in detail below.
- Step 701 Obtain the first coding unit.
- the encoding device collects/photographs the first encoding unit through the user's operation. In another possible implementation manner, the encoding device collects/shoots the original data through the user's operation, splits the original data to obtain multiple coding units, and selects the first coding unit from the multiple coding units. In another possible implementation manner, the encoding device selects the first encoding unit from the database/memory, etc., which is not limited here.
- the encoding device first obtains image data, and splits the image data to obtain multiple encoding units.
- the first coding unit is at least one coding unit among multiple coding units.
- Step 702 Determine the ending descending step size.
- the encoding device determines the ending descending step size, the ending descending step size is used to update the virtual filling amount of multiple encoding units, and the virtual filling amount is used to reduce the storage space of the buffer in the encoding device.
- step 702 The description of determining the ending descending step size in this step 702 is similar to the description of step 602 in the embodiment shown in FIG. 6 and will not be described again here.
- Step 703 Determine virtual padding amounts of multiple coding units based on the ending descending step size.
- the encoding device After the encoding device obtains the ending descending step size, it determines the virtual filling amount of multiple encoding units based on the ending descending step size. The virtual filling amount is used to reduce the storage space of the buffer in the encoding device.
- step 703 The description of determining the virtual filling amounts of multiple coding units based on the ending descending step size in step 703 is similar to the description of step 603 in the embodiment shown in FIG. 6 and will not be described again here.
- Step 704 Determine the coding mode of the first coding unit in the plurality of sub-data to be the fallback mode.
- the coding device After acquiring the first coding unit, the coding device determines that the coding mode of the first coding unit is the fallback mode.
- the preset code length of the first coding unit in multiple coding modes is greater than the preset code length, it is determined that the coding mode of the first coding unit is the fallback mode, and the preset code length is the second difference between the second difference and the second code length.
- the quotient of the number of pixels in a coding unit, the second difference is the original value of the first coding unit The product of the number of bits and the preset compression ratio minus the ending descending step.
- evaluation index is the preset code length and is just an example.
- the evaluation index may also include the number of encoding bits, distortion degree, etc., which are not limited here.
- Step 705 Encode the first coding unit based on the virtual padding amount and the fallback mode to obtain a bit stream.
- the encoding device After obtaining the virtual padding amount, the encoding device encodes the first coding unit based on the virtual padding amount and the fallback mode to obtain a bit stream.
- the decoding device first determines the encoding code length of the fallback mode based on the virtual padding amount, and then performs encoding and other processing on the first encoding unit based on the encoding code length to obtain a bit stream.
- step 605 For the above description of determining the encoding code length of the fallback mode based on the virtual padding amount, reference may be made to the description in step 605 in the embodiment shown in FIG. 6 , which will not be described again here.
- the encoding device performs encoding and other processing on the first encoding unit based on the encoding code length.
- the encoding device performs entropy encoding on the first encoding unit based on the encoding code length to obtain a bit stream.
- the encoding device performs prediction, quantization, entropy coding and other processing on the first coding unit based on the coding code length to obtain a bit stream.
- step 702 may follow step 704.
- step 704 may follow step 703 and so on.
- the virtual filling amount is considered in the fallback mode, that is, encoding and decoding are performed based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the storage space of the buffer, This reduces buffer overflow during encoding and decoding in fallback mode.
- the ending descending step size is determined according to the minimum number of encoding bits in the fallback mode, and the encoding code length of the fallback mode is set according to the ending descending step size to reduce buffer overflow.
- the code length in fallback mode takes into account the ending descending step, thereby ensuring that the buffer data volume will not overflow after the current image block encoding is completed.
- the data volume of the buffer is gradually reduced to the expected buffer data volume through virtual filling.
- the fallback mode is the last barrier to prevent overflow, and it needs to be coordinated with the virtual filling operation of code control to ensure that the buffer will not overflow in the fallback mode during virtual filling.
- the minimum number of encoding bits in the fallback mode will be affected by the ending descending step size.
- the maximum range of the ending step size is determined by the minimum number of encoding bits in the fallback mode. It ensures that the code control can use virtual filling to gradually reduce the data volume of the physical buffer to the expected buffer data volume, and at the same time, the fallback mode will not overflow the buffer in the virtual filling state.
- decoding method and encoding method in the embodiment of the present application are described above, and the decoding device and encoding device in the embodiment of the present application are described below.
- An embodiment of the decoding device in the embodiment of the present application includes:
- Acquisition unit 801 configured to acquire the bit stream of the first coding unit, where the first coding unit is at least one coding unit among multiple coding units;
- Determining unit 802 used to determine the ending descending step size, and the ending descending step size is used to update the virtual filling amount of multiple coding units;
- the determination unit 802 is also used to determine the virtual filling amount of multiple coding units based on the ending descending step size.
- the virtual filling amount is used to reduce the storage space of the buffer in the decoding device;
- the determining unit 802 is also used to determine that the coding mode of the first coding unit among the plurality of coding units is the fallback mode;
- the decoding unit 803 is configured to decode the bit stream of the first coding unit based on the virtual padding amount and the fallback mode to obtain the first data.
- each unit in the decoding device is similar to those described in the aforementioned embodiments shown in Figures 1 to 6, and will not be described again here.
- the virtual filling amount is considered in the fallback mode, that is, the decoding unit 803 performs decoding based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the storage space of the buffer, This reduces buffer overflow during decoding in fallback mode.
- An embodiment of the encoding device in the embodiment of the present application includes:
- Obtaining unit 901 is used to acquire a first coding unit, where the first coding unit is at least one coding unit among multiple coding units;
- the determination unit 902 is used to determine the ending descending step size, and the ending descending step size is used to update the virtual filling amount of multiple coding units;
- the determination unit 902 is also used to determine the virtual filling amount of multiple encoding units based on the ending descending step size.
- the virtual filling amount is used to reduce the storage space of the buffer in the encoding device;
- the determining unit 902 is also used to determine that the coding mode of the first coding unit among the plurality of coding units is the fallback mode;
- the encoding unit 903 is configured to encode the first encoding unit based on the virtual padding amount and the fallback mode to obtain a bit stream.
- each unit in the encoding device performs the operations performed by each unit in the encoding device.
- the operations performed by each unit in the encoding device are similar to those described in the embodiments shown in FIGS. 1 to 5 and 7 , and will not be described again here.
- the virtual filling amount is considered in the fallback mode, that is, the encoding unit 903 performs encoding based on the virtual filling amount and the fallback mode, and the virtual filling amount can be used to reduce the storage space of the buffer. , thereby reducing buffer overflows during encoding in fallback mode.
- the decoding device may include a processor 1001, a memory 1002, and a communication port 1003.
- the processor 1001, memory 1002 and communication port 1003 are interconnected through lines.
- the memory 1002 stores program instructions and data.
- the memory 1002 stores program instructions and data corresponding to the steps executed by the decoding device in the corresponding embodiments shown in FIGS. 1 to 6 .
- the processor 1001 is configured to perform the steps performed by the decoding device shown in any of the aforementioned embodiments shown in FIGS. 1 to 6 .
- the communication port 1003 can be used to receive and send data, and to perform steps related to obtaining, sending, and receiving in any of the embodiments shown in FIGS. 1 to 6 .
- the decoding device may include more or fewer components than in Figure 10 .
- This application is only illustrative and not limiting.
- the encoding device may include a processor 1101, a memory 1102, and a communication port 1103.
- the processor 1101, memory 1102 and communication port 1103 are interconnected through lines.
- the memory 1102 stores program instructions and data.
- the memory 1102 stores program instructions and data corresponding to the steps executed by the encoding device in the corresponding embodiments shown in FIGS. 1 to 5 and 7 .
- the processor 1101 is configured to perform the steps performed by the encoding device shown in any of the embodiments shown in FIGS. 1 to 5 and 7 .
- the communication port 1103 can be used to receive and send data, and to perform steps related to obtaining, sending, and receiving in any of the embodiments shown in FIGS. 1 to 5 and 7 .
- the data processing device may include more or fewer components than in FIG. 11 , which is only illustrative and not limiting in this application.
- Embodiments of the present application also provide a computer-readable storage medium that stores one or more computer-executable instructions.
- the processor executes the communication device (such as a decoding device and/or or encoding device) possible implementation methods.
- Embodiments of the present application also provide a computer program product (or computer program) that stores one or more computers.
- the processor executes the above communication device (such as a decoding device and/or Encoding device) possible implementation methods.
- Embodiments of the present application also provide a chip system, which includes at least one processor for supporting functions involved in possible implementations of a communication device (such as a decoding device and/or encoding device).
- the chip system also includes an interface circuit, which provides program instructions and/or data to at least one processor.
- the chip system may also include a memory, which is used to store necessary program instructions and data for the communication device.
- the chip system may be composed of chips, or may include chips and other discrete devices.
- the disclosed systems, devices and methods can be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separate, and the components shown as units may be or It may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
- the above integrated units can be implemented in the form of hardware or software functional units.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), magnetic disk or optical disk and other media that can store program code. .
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本申请实施例提供了一种解码方法,在该方法中,先获取第一编码单元的位流,第一编码单元为多个编码单元中的至少一个编码单元;确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少解码设备中缓冲区的存储空间;确定多个编码单元中第一编码单元的编码模式为回退模式;基于虚拟填充量与回退模式对第一编码单元的位流进行解码,以得到第一数据。在编解码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编解码过程中的缓冲区上溢。
Description
本申请要求于2022年9月8日提交中国专利局、申请号为202211099536.4、发明名称为“解码方法”的中国专利申请以及2023年3月6日提交中国专利局、申请号为202310258261.2、发明名称为“一种解码方法、编码方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及编解码技术领域,尤其涉及一种解码方法、编码方法及相关设备。
近年来,随着媒体采集设备的性能提升、人们对视频质量的需求增加,视频数据的规格也在迅速提升中,表现在视频的分辨率、帧率更高了。更高规格的视频在单位时间内有着更大的数据量,这对显示接口、显示链路的吞吐量提出了新的挑战。其中,显示接口压缩的典型流程为,在输入侧接口,编码器对输入的单帧图像进行预测、量化、熵编码等编码操作,将其压缩为比特流;比特流通过显示链路传输到输出侧接口;输出侧接口,解码器将比特流进行解压缩,通过熵解码、反量化、重建等解码操作,最终输出重建图像。
目前,在接口压缩场景中,为了使得后续显示等操作稳定,通过在编码端引入比特流缓冲区,配合回退模式减少缓冲区的上溢。具体的,单帧图像的图像块输入缓冲区的编码比特数加上当前缓冲区的数据量超过设定的阈值(上溢线)时,对图像块进行回退模式下的特殊编码,使得该图像块的编码比特数为指定值,从而保证图像块输入缓冲区的编码比特数加上当前缓冲区的数据量不上溢。
然而,对于虚拟填充的场景,上述编解码时判断缓冲区是否上溢的方式为虚拟填充数据量和当前缓冲区的数据量之和是否大于上溢线。在回退模式下上述判断上溢的方法可能导致当前缓冲区的数据量加上虚拟填充数据量超过上溢线,进而影响编码/解码。
发明内容
本申请提供了一种解码方法、编码方法及相关设备,用于减少在回退模式下进行编解码过程中的缓冲区上溢。
本申请实施例第一方面提供了一种解码方法,该解码方法可以由解码设备执行,也可以由解码设备的部件(例如处理器、芯片或芯片***等)执行。在该方法中,先获取第一编码单元的位流,第一编码单元为多个编码单元中的至少一个编码单元;确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少解码设备中缓冲区的存储空间;确定多个编码单元中第一编码单元的编码模式为回退模式;基于虚拟填充量与回退模式对第一编码单元的位流进行解码,以得到第一数据。
本申请实施例中,在编解码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编解码过程中的缓冲区上溢。
可选地,在第一方面的一种可能的实现方式中,上述步骤:确定结尾下降步长之前,方法还包括:获取第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数;确定结尾下降步长,包括:基于原始比特数、预设压缩率以及最小编码比特数确定结尾下降步长对数值;基于结尾下降步长对数值确定结尾下降步长。
该种可能的实现方式中,根据最小编码比特数确定结尾下降步长对数值,并根据结尾下降步长对数值确定结尾下降步长。即设置结尾下降步长的过程中考虑到最小编码比特数,从而保证了当前编码单元解码结束后缓冲区数据量不会上溢。
可选地,在第一方面的一种可能的实现方式中,上述的结尾下降步长对数值的取值的上限为以2为底第一差值的对数值,第一差值为原始比特数与预设压缩率的乘积减去最小编码比特数的差值。
该种可能的实现方式中,在编码/解码时,当编码单元处于虚拟填充状态时,回退模式的最小编码比特数会受结尾下降步长影响。同时,结尾下降步长的最大范围由回退模式的最小编码比特数决定。确保了码控可以利用虚拟填充使物理缓冲区的数据量逐渐下降至预期的缓冲区数据量,同时回退模式在虚拟填充状态下缓冲区不会上溢。
可选地,在第一方面的一种可能的实现方式中,上述步骤:基于结尾下降步长确定多个编码单元的虚拟填充量,包括:若第一编码单元在多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与结尾下降步长对数值确定虚拟填充量,预设阈值用于确定多个编码单元中进行虚拟填充的编码单元数量,基础数据量为在第一编码单元之前多个编码单元中已进行虚拟填充的数据量。
该种可能的实现方式中,可以根据实际需要设置多个编码单元中进行虚拟填充的编码单元阈值,进而根据该阈值确定多个编码单元的整体虚拟填充量。
可选地,在第一方面的一种可能的实现方式中,上述的虚拟填充量等于基础数据量与结尾下降步长相加。
该种可能的实现方式中,提供一种虚拟填充量的简单计算,通过逐步编码单元累加进行计算,从而可以得到多个编码单元的整体虚拟填充量。
可选地,在第一方面的一种可能的实现方式中,上述步骤:基于虚拟填充量与回退模式对第一编码单元的位流进行解码,包括:基于虚拟填充量确定回退模式的编码码长;基于编码码长对第一编码单元的位流进行解码。
该种可能的实现方式中,根据最小编码比特数确定结尾下降步长,并根据结尾下降步长设置回退模式的编码码长,以减少缓冲区的上溢。也可以理解为,虚拟填充时,回退模式的码长考虑了结尾下降步长,从而保证了当前编码单元解码结束后缓冲区数据量不会上溢。
可选地,在第一方面的一种可能的实现方式中,若虚拟填充量大于0,则编码码长为第一数值与回退模式的头信息开销比特的差值,第一数值为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值;若虚拟填充量等于0,则编码码长为原始比特数与预设压缩率的乘积之后与回退模式的头信息开销比特的差值。
该种可能的实现方式中,通过虚拟填充量的不同情况确定不同的编码码长,以兼顾进行虚拟填充的编码单元解码过程与未进行虚拟填充的编码单元的解码过程。
本申请实施例第二方面提供了一种编码方法,该编码方法可以由编码设备执行,也可以由编码设备的部件(例如处理器、芯片或芯片***等)执行。在该方法中,先获取第一编码单元,第一编码单元为多个编码单元中的至少一个编码单元;确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少编码设备中缓冲区的存储空间;确定多个编码单元中第一编码单元的编码模式为回退模式;基于虚拟填充量与回退模式对第一编码单元进行编码以得到位流。
本申请实施例中,在编码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编码过程中的缓冲区上溢。
可选地,在第二方面的一种可能的实现方式中,上述步骤:确定多个编码单元中第一编码单元的编码模式为回退模式,包括:若多个编码模式对于第一编码单元的编码码长皆大于预设码长,则确定第一编码单元的编码模式为回退模式,预设码长为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值。
该种可能的实现方式中,在编码过程中,可以先通过评测指标从多个编码模式中确定具体编码模式,进而提升编码单元的编码性能。
可选地,在第二方面的一种可能的实现方式中,上述步骤:确定结尾下降步长之前,方法还包括:获取第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数;确定结尾下降步长,包括:基于原始比特数、预设压缩率以及最小编码比特数确定结尾下降步长对数值;基于结尾下降步长对数值确定结尾下降步长。
该种可能的实现方式中,根据最小编码比特数确定结尾下降步长对数值,并根据结尾下降步长对数值
确定结尾下降步长。即设置结尾下降步长的过程中考虑到最小编码比特数,从而保证了当前编码单元解码结束后缓冲区数据量不会上溢。
可选地,在第二方面的一种可能的实现方式中,上述的结尾下降步长对数值的取值的上限为以2为底第一差值的对数值,第一差值为原始比特数与预设压缩率的乘积减去最小编码比特数的差值。
该种可能的实现方式中,在编码/解码时,当编码单元处于虚拟填充状态时,回退模式的最小编码比特数会受结尾下降步长影响。同时,结尾下降步长的最大范围由回退模式的最小编码比特数决定。确保了码控可以利用虚拟填充使物理缓冲区的数据量逐渐下降至预期的缓冲区数据量,同时回退模式在虚拟填充状态下缓冲区不会上溢。
可选地,在第二方面的一种可能的实现方式中,上述步骤:基于结尾下降步长确定多个编码单元的虚拟填充量,包括:若第一编码单元在多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与结尾下降步长对数值确定虚拟填充量,预设阈值用于确定多个编码单元中进行虚拟填充的编码单元数量,基础数据量为在第一编码单元之前多个编码单元中已进行虚拟填充的数据量。
该种可能的实现方式中,可以根据实际需要设置多个编码单元中进行虚拟填充的编码单元阈值,进而根据该阈值确定多个编码单元的整体虚拟填充量。
可选地,在第二方面的一种可能的实现方式中,上述的虚拟填充量等于基础数据量与结尾下降步长相加。
该种可能的实现方式中,提供一种虚拟填充量的简单计算,通过逐步编码单元累加进行计算,从而可以得到多个编码单元的整体虚拟填充量。
可选地,在第二方面的一种可能的实现方式中,上述步骤:基于虚拟填充量与回退模式对第一编码单元进行编码以得到位流,包括:基于虚拟填充量确定回退模式的编码码长;基于编码码长对第一编码单元进行编码以得到位流。
该种可能的实现方式中,根据最小编码比特数确定结尾下降步长,并根据结尾下降步长设置回退模式的编码码长,以减少缓冲区的上溢。也可以理解为,虚拟填充时,回退模式的码长考虑了结尾下降步长,从而保证了当前编码单元编码结束后缓冲区数据量不会上溢。
可选地,在第二方面的一种可能的实现方式中,若虚拟填充量大于0,则编码码长为第一数值与回退模式的头信息开销比特的差值,第一数值为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值;若虚拟填充量等于0,则编码码长为原始比特数与预设压缩率的乘积之后与回退模式的头信息开销比特的差值。
该种可能的实现方式中,通过虚拟填充量的不同情况确定不同的编码码长,以兼顾进行虚拟填充的编码单元的编码过程与未进行虚拟填充的编码单元的编码过程。
本申请实施例第三方面提供了一种解码设备。该解码设备包括:获取单元,用于获取第一编码单元的位流,第一编码单元为多个编码单元中的至少一个编码单元;确定单元,用于确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;确定单元,还用于基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少解码设备中缓冲区的存储空间;确定单元,还用于确定多个编码单元中第一编码单元的编码模式为回退模式;解码单元,用于基于虚拟填充量与回退模式对第一编码单元的位流进行解码,以得到第一数据。
可选地,在第三方面的一种可能的实现方式中,上述的获取单元,还用于获取第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数;确定单元,具体用于基于原始比特数、预设压缩率以及最小编码比特数确定结尾下降步长对数值;确定单元,具体用于基于结尾下降步长对数值确定结尾下降步长。
可选地,在第三方面的一种可能的实现方式中,上述的结尾下降步长对数值的取值的上限为以2为底第一差值的对数值,第一差值为原始比特数与预设压缩率的乘积减去最小编码比特数的差值。
可选地,在第三方面的一种可能的实现方式中,上述的确定单元,具体用于若第一编码单元在多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与结尾下降步长对数值确定虚拟填充量,预设阈值用于确定多个编码单元中进行虚拟填充的编码单元数量,基础数据量为在第一编码单元之前多个编码单元中已进行虚拟填充的数据量。
可选地,在第三方面的一种可能的实现方式中,上述的虚拟填充量等于基础数据量与结尾下降步长相加。
可选地,在第三方面的一种可能的实现方式中,上述的解码单元,具体用于基于虚拟填充量确定回退模式的编码码长;解码单元,具体用于基于编码码长对第一编码单元的位流进行解码。
可选地,在第三方面的一种可能的实现方式中,若虚拟填充量大于0,则编码码长为第一数值与回退模式的头信息开销比特的差值,第一数值为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值;若虚拟填充量等于0,则编码码长为原始比特数与预设压缩率的乘积之后与回退模式的头信息开销比特的差值。
本申请实施例第四方面提供了一种编码设备。该编码设备包括:获取单元,用于获取第一编码单元,第一编码单元为多个编码单元中的至少一个编码单元;确定单元,用于确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;确定单元,还用于基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少编码设备中缓冲区的存储空间;确定单元,还用于确定多个编码单元中第一编码单元的编码模式为回退模式;编码单元,用于基于虚拟填充量与回退模式对第一编码单元进行编码以得到位流。
可选地,在第四方面的一种可能的实现方式中,上述的确定单元,具体用于若多个编码模式对于第一编码单元的编码码长皆大于预设码长,则确定第一编码单元的编码模式为回退模式,预设码长为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值。
可选地,在第四方面的一种可能的实现方式中,上述获取单元,还用于获取第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数;确定单元,具体用于基于原始比特数、预设压缩率以及最小编码比特数确定结尾下降步长对数值;确定单元,具体用于基于结尾下降步长对数值确定结尾下降步长。
可选地,在第四方面的一种可能的实现方式中,上述的结尾下降步长对数值的取值的上限为以2为底第一差值的对数值,第一差值为原始比特数与预设压缩率的乘积减去最小编码比特数的差值。
可选地,在第四方面的一种可能的实现方式中,上述确定单元,具体用于若第一编码单元在多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与结尾下降步长对数值确定虚拟填充量,预设阈值用于确定多个编码单元中进行虚拟填充的编码单元数量,基础数据量为在第一编码单元之前多个编码单元中已进行虚拟填充的数据量。
可选地,在第四方面的一种可能的实现方式中,上述的虚拟填充量等于基础数据量与结尾下降步长相加。
可选地,在第四方面的一种可能的实现方式中,上述编码单元,具体用于基于虚拟填充量确定回退模式的编码码长;编码单元,具体用于基于编码码长对第一编码单元进行编码以得到位流。
可选地,在第四方面的一种可能的实现方式中,若虚拟填充量大于0,则编码码长为第一数值与回退模式的头信息开销比特的差值,第一数值为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值;若虚拟填充量等于0,则编码码长为原始比特数与预设压缩率的乘积之后与回退模式的头信息开销比特的差值。
本申请实施例第五方面提供了一种解码设备,包括:处理器,处理器与存储器耦合,存储器用于存储程序或指令,当程序或指令被处理器执行时,使得该解码设备实现上述第一方面或第一方面的任意可能的实现方式中的方法。
本申请实施例第六方面提供了一种编码设备,包括:处理器,处理器与存储器耦合,存储器用于存储程序或指令,当程序或指令被处理器执行时,使得该编码设备实现上述第二方面或第二方面的任意可能的实现方式中的方法。
本申请实施例第七方面提供了一种通信***,包括:前述第五方面或第五方面任意一种的解码设备,与前述第六方面或第六方面任意一种的编码设备。
本申请实施例第八方面提供了一种计算机可读介质,其上存储有计算机程序或指令,当计算机程序或指令在计算机上运行时,使得计算机执行前述第一方面或第一方面的任意可能的实现方式中的方法,或者
使得计算机执行前述第二方面或第二方面的任意可能的实现方式中的方法。
本申请实施例第九方面提供了一种计算机程序产品,该计算机程序产品在计算机上执行时,使得计算机执行前述第一方面或第一方面的任意可能的实现方式中的方法,或者使得计算机执行前述第二方面或第二方面的任意可能的实现方式中的方法。
从以上技术方案可以看出,本申请具有以下优点:在编解码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编解码过程中的缓冲区上溢。
图1为本申请实施例提供的通信***的结构示意图;
图2为本申请实施例提供的整体解码流程的一种示意图;
图3为本申请实施例提供的整体解码流程的另一种示意图;
图4为本申请实施例提供的整体编码流程的一种示意图;
图5为本申请实施例提供的整体编码流程的另一种示意图;
图6为本申请实施例提供的解码方法的流程示意图;
图7为本申请实施例提供的编码方法的流程示意图;
图8为本申请实施例提供的解码设备的一个结构示意图;
图9为本申请实施例提供的编码设备的一个结构示意图;
图10为本申请实施例提供的解码设备的另一个结构示意图;
图11为本申请实施例提供的编码设备的另一个结构示意图。
本申请提供了一种解码方法、编码方法及相关设备,用于减少在回退模式下进行编解码过程中的缓冲区上溢。
为了便于理解,下面先对本申请实施例主要涉及的相关术语和概念进行介绍。
1、接口压缩
媒体设备在传输图像、视频时会使用到显示接口,对通过显示接口的图像视频数据进行压缩(编码)、解压缩(解码)操作,简写为接口压缩。
2、编码单元
编码单元可以是编码过程或解码过程中待处理的对象。例如,编码单元由图像划分得到。又例如,编码单元是解码后获取的语法元素或位流对应的单元。
3、码率控制
码率控制也可以称为码控,在编码过程中对输出码率进行调整的过程,基于对当前的图像内容、比特流缓冲区余量等信息进行分析,通过改变编码的量化参数、编码模式等手段,起到调整输出码率的作用。
4、恒定码率(Constant Bit Rate,CBR)策略
CBR是一种码控策略,其特点是在单位时间内,编码器输出的比特流长度一致。
5、量化参数(Quantization Parameter,QP)
在编码过程中,预测操作产生的残差值或变换操作产生的系数进行量化后写入比特流;在解码过程中对语法元素进行反量化得到残差值或系数。QP为该量化过程使用的参数,通常QP值越大、量化的程度越明显。调整QP值会直接影响编码后比特流的长度和解码后的图像质量。
6、回退模式
回退模式是一种预测模式,其特点是当在其他预测模式编码下,输入缓冲区的编码比特数加上当前缓冲区的数据量超过设定的阈值(上溢线)时,即上溢时,对图像块进行特殊编码,使得该图像块的编码比特数为指定值,从而保证图像块输入缓冲区的编码比特数加上当前缓冲区的数据量不上溢。其中,输入缓冲区的编码比特数为当前图像块编码比特数减去信道传输比特数。
7、虚拟填充
虚拟填充是通过设置虚拟填充数据量(并不是真的向当前缓冲区填充这么多数据量,只是一个数据量数字),可以用于调节缓冲区的可用空间。具体的,可以将虚拟填充数据量和当前缓冲区的数据量之和用于上溢判断。当虚拟填充数据量和当前缓冲区的数据量之和大于上溢线时,则判定为上溢,否则不上溢。即,在虚拟填充下,上溢是通过比较上溢线和虚拟填充数据量和当前缓冲区的数据量之和;无虚拟填充下,上溢是通过比较上溢线和当前缓冲区的数据量,上溢线一般为固定值,是提前就约定好的值,并不因为有无虚拟填充操作而改变。
目前,在接口压缩场景中,为了使得后续显示等操作稳定,通过在编码端引入比特流缓冲区,配合回退模式减少缓冲区的上溢。具体的,单帧图像的图像块输入缓冲区的编码比特数加上当前缓冲区的数据量超过设定的阈值(上溢线)时,对图像块进行回退模式下的特殊编码,使得该图像块的编码比特数为指定值,从而保证图像块输入缓冲区的编码比特数加上当前缓冲区的数据量不上溢。
然而,对于虚拟填充的场景,上述编解码时判断缓冲区是否上溢的方式为虚拟填充数据量和当前缓冲区的数据量之和是否大于上溢线。在回退模式下上述判断上溢的方法可能导致当前缓冲区的数据量加上虚拟填充数据量超过上溢线,进而影响编码/解码。
为了解决上述技术问题,本申请实施例提供一种解码方法、编码方法及相关设备。在编解码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编解码过程中的缓冲区上溢。
在对本申请实施例所提供的方法进行描述之前,先对本申请实施例所提供的方法所适用的通信***进行描述。该通信***包括第一设备101与第二设备102。第一设备101与第二设备102进行数据通信。其中,第一设备101与第二设备102是具有编码和/或解码功能的设备。
在一种可能实现的方式中,第一设备101作为发送端,第二设备102作为接收端。为了减少数据量的传输,第一设备101会将数据进行编码得到数据的位流,并向第二设备102发送数据的位流。第二设备102接收位流之后,对位流进行解码以得到数据。进而实现第一设备101与第二设备102之间的数据传输。
在另一种可能实现的方式中,第二设备102作为发送端,第一设备101作为接收端。为了减少数据量的传输,第二设备102会将数据进行编码得到数据的位流,并向第一设备101发送数据的位流。第一设备101接收位流之后,对位流进行解码以得到数据。进而实现第一设备101与第二设备102之间的数据传输。
本申请实施例中,仅以一个第一设备101以及一个第二设备102为例进行示意性说明。在实际应用中,本申请实施例中的通信***可以有其他的转发设备等,以实现第一设备101与第二设备102之间的位流转发。另外,第一设备101与第二设备102的数量也可以是多个,具体此处不做限定。
本申请实施例中,图1仅以终端-网络端传输为例进行示例性描述。在实际应用中,第一设备101与第二设备102可以是终端设备。或者第一设备101与第二设备102是网络设备。又或者第一设备101是终端设备,第二设备102是网络设备。又或者是第二设备102终端设备,第一设备101是网络设备。即第一设备101与第二设备102之间的传输可以是终端-终端传输,也可以是网络端-网络端传输,还可以是终端-网络端传输等,具体此处不做限定。
其中,以终端-网络端传输为例。终端设备可以是一种具有编码和/或解码功能的设备,可以部署在陆地上,包括室内或室外、手持、穿戴或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球和卫星上等)。该终端设备可以是手机(mobile phone)、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、车载终端设备、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端、可穿戴终端设备等等。本申请的实施例对应用场景不做限定。终端设备有时也可以称为终端、用户设备(user equipment,UE)、接入终端设备、车载终端、工业控制终端、UE单元、UE站、移动站、移动台、远方站、远程终端设备、移动设备、UE代理或UE装置等。终端设备也可以是固定的或
者移动的。
网络设备是一种编码和/或解码功能的设备。网络设备可以包括各种形式的基站:宏基站,微基站(也称为小站),中继站,接入点等。在采用不同的无线接入技术的***中,网络设备的名称可能会有所不同,例如LTE(Long Term Evolution,长期演进)中的eNB或eNodeB(Evolutional NodeB)。网络设备还可以是CRAN(Cloud Radio Access Network,云无线接入网络)场景下的无线控制器。网络设备还可以是5G网络中的基站设备或者未来演进的网络中的网络设备。网络设备还可以是可穿戴设备或车载设备。网络设备还可以是传输接收节点(Transmission and Reception Point,TRP)。
接下来对本申请实施例提供的方法所应用的整体编码流程与整体解码流程进行描述。
请参阅图2,本申请实施例提供的整体解码流程。该整体解码流程包括:熵解码阶段、反量化阶段、预测重建阶段等。可以理解的是,在实际应用中,解码流程还可以有其他情况。例如,解码流程包括熵解码阶段。又例如,解码流程包括熵解码阶段与反量化阶段等,具体此处不做限定。
示例性的,以解码端解码图像为例,解码端对图像的位流进行熵解码得到语法元素,再对语法元素进行反向量得到残差信息,再对残差信息进行预测重建等处理输出重建图像(即位流还原后的图像)。
本申请实施例所提供的解码方法可以应用在熵解码阶段,也可以应用在整体解码流程,具体此处不做限定。
下面结合码率控制对上述解码流程进行具体描述。请参阅图3,码率控制中的计算过程主要包括确定量化参数过程与更新码控参数过程。首先,熵解码阶段获取输入比特流对应的图像复杂度与编码比特数。码率控制根据图像复杂度获取虚拟填充量与量化参数。其次,熵解码阶段通过输入比特流与码率控制提供的虚拟填充量获取语法元素,反量化阶段根据熵解码阶段输出的语法元素与码率控制提供的量化参数输出残差信息,预测重建阶段根据该残差信息输出重建图。更新码控参数过程通过熵解码阶段提供的编码比特数与上述的的量化参数进行计算更新处理。后续会对各步骤进行详细描述,此处不再展开。
下面以第一设备为例对码率控制中确定量化参数与更新码控参数的流程进行描述。其中,确定量化参数过程包括步骤301至步骤307。更新码控参数过程包括步骤308至步骤312。
步骤301,计算缓冲区满度。
第一设备从物理缓冲区满度记录表中取出指定时刻T的物理缓冲区数据量PhyBufT,该物理缓冲区满度记录表保存有此前各个编码块编码/解码时,物理缓冲区中的数据量。
第一设备再从虚拟填充量记录表中取出指定时刻T的虚拟填充量VirEndT,该虚拟填充量表保存有此前各个编码块编码/解码时,虚拟填充的数据量。
第一设备获取PhyBufT与VirEndT之后,根据PhyBufT与VirEndT计算缓冲区满度。
具体的,缓冲区满度F的计算过程如公式一所示。
其中,F表示缓冲区满度,RcBufT表示缓冲区在时刻T的数据量,RcBufMAX表示缓冲区允许的最大数据量(也可以称为缓冲区的上限,可以是预设的,也可以是根据硬件存储空间确定的,具体此处不做限定),X0为预设参数,具体可以根据实际需要设置。
可以理解的是,上述公式一只是计算缓冲区满度的一种示例,在实际应用中,计算缓冲区满度还可以有其他方式,具体此处不做限定。
步骤302,计算块比特预期量。
第一设备计算块比特预期量,该块比特预期量Bpp代表当前编码块在不考虑图像内容的情形下,预期的编码比特。
第一设备先获取预期量的初始值BppINI与预期量的调整值BppADJ。再根据BppINI与BppADJ计算Bpp。
具体的,块比特预期量Bpp的计算过程如公式二所示。
公式二:Bpp=BppINI+BppADJ;
公式二:Bpp=BppINI+BppADJ;
其中,BppINI由输入图像块的原始比特数与预设压缩率相乘得到,BppADJ与(RcBufEND-RcBufT)成正比,RcBufEND为编码/解码过程全部结束时预期的码控缓冲区数据量。RcBufT为前述步骤301中计算的缓冲区在时刻T的数据量。
可以理解的是,上述公式二只是计算块比特预期量的一种示例,在实际应用中,计算块比特预期量还可以有其他方式,具体此处不做限定。
步骤303,计算信息比率。
第一设备先获取比特偏移量bitsOffset与时刻T的平均无损编码比特BAVG,再根据bitsOffset与BAVG计算信息比率R。信息比率R表示经过量化处理后,编码块保留的信息和原始编码块的比率。
具体的,信息比率R的计算过程如公式二所示。
其中,Bpp为前述步骤302中计算的块比特预期量,InvTab、X1、X2、X3、X4、X5为预设参数,BAVG表示T时刻的平均无损编码比特,通过查询平均无损编码比特记录数组得到,BitsOffset表示比特偏移量的初始值。
可以理解的是,上述公式三只是计算信息比率的一种示例,在实际应用中,计算信息比率还可以有其他方式,具体此处不做限定。
步骤304,获取无损编码比特数。
第一设备获取无损编码比特数BLL,BLL表示编码块在无量化情形下编码比特数的估计值,可以通过对无损编码比特数记录组查表RecordBLL得到。
具体的,BLL=RecordBLL[T][k],T表示指定时刻,k表示输入的图像复杂度。
步骤305,计算目标比特数。
第一设备获取信息比率R、无损编码比特数BLL、比特偏移量bitsOffset之后,基于R、BLL、
bitsOffset计算目标比特数BTGT。
具体的,目标比特数BTGT的计算过程如公式四所示。
公式四:BTGT=(R*(BLL-bitsOffset)+X6)*X7;
公式四:BTGT=(R*(BLL-bitsOffset)+X6)*X7;
其中,R为前述步骤303中计算的信息比率,BLL为前述步骤304中计算的无损编码比特数,bitsOffset为前述步骤303中计算的比特偏移量,X6、X7为预设参数。
可以理解的是,上述公式四只是计算目标比特数的一种示例,在实际应用中,计算目标比特数还可以有其他方式,具体此处不做限定。
步骤306,对目标比特数钳位。
第一设备获取块比特预期量Bpp、无损编码比特数BLL、缓冲区满度F之后,基于Bpp、BLL、F计算最小目标比特BMIN与最大目标比特BMAX。并使用BMIN与BMAX对目标比特数BTGT进行钳位。
具体的,目标比特数BTGT的钳位过程如公式五所示。
公式五:BTGT=MIN(MAX(BMIN,BTGT),BMAX);
公式五:BTGT=MIN(MAX(BMIN,BTGT),BMAX);
可以理解的是,上述公式五只是目标比特数钳位过程的一种示例,在实际应用中,目标比特数钳位过程还可以有其他方式,具体此处不做限定。
步骤307,计算量化参数。
第一设备获取无损编码比特数BLL与目标比特数BTGT之后,基于BLL与BTGT计算量化参数QP。
具体的,量化参数QP的计算过程如公式六所示。
公式六:QP=(BLL-(BTGT+X8)*X9)*X10;
公式六:QP=(BLL-(BTGT+X8)*X9)*X10;
其中,X8、X9、X10为预设参数。
可以理解的是,上述公式六只是计算量化参数的一种示例,在实际应用中,计算量化参数还可以有其他方式,具体此处不做限定。
接下来以第一设备为例对码率控制中更新码控参数的流程进行描述。更新码控参数过程包括步骤308至步骤312。
步骤308,计算无损编码比特数。
第一设备解码比特流之后,获取当前编码块编码/解码后得到的实际编码比特数BCU,并根据BCU与前述步骤307中获取的量化参数QP计算无损编码比特数BLC。
具体的,无损编码比特数BLC的计算过程如公式七所示。
公式七:BLC=((4*BCU+8*QP+X11)+X8)*X9;
公式七:BLC=((4*BCU+8*QP+X11)+X8)*X9;
其中,BCU表示当前编码块编码/解码后得到的实际编码比特数,QP为前述步骤307中获取的量化参数,X8、X9、X11为预设参数,X8与X9与前述公式六中的X8与X9相同。
可以理解的是,上述公式七只是计算无损编码比特数的一种示例,在实际应用中,计算无损编码比特
数还可以有其他方式,具体此处不做限定。
可选地,第一设备还可以计算记录表位置。
具体的,计算记录表位置的过程如公式八所示。
公式八:TPRE=(TCUR+N-1)%N;
公式八:TPRE=(TCUR+N-1)%N;
其中,TPRE表示上一编码块时刻,TCUR表示当前编码块时刻,即前述步骤301至步骤307中的指定时刻T,N为码控输入中编码比特数所属编码块和图像复杂度所属图像块的间隔值。
可以理解的是,上述公式八只是计算记录表位置的一种示例,在实际应用中,计算记录表位置还可以有其他方式,具体此处不做限定。
步骤309,更新平均无损编码比特数记录表。
第一设备获取TPRE与TCUR之后,基于TPRE与TCUR更新平均无损编码比特数记录表RecordBAVG。RecordBAVG为长度为N的数组,RecordBAVG[t]表示第t个位置的值。
具体的,更新平均无损编码比特数记录表的过程如公式九所示。
公式九:RecordBAVG[TCUR]=(RecordBAVG[TPRE]+X12*BLC)*X13;
公式九:RecordBAVG[TCUR]=(RecordBAVG[TPRE]+X12*BLC)*X13;
其中,TPRE与TCUR为前述步骤308中计算的记录表位置,BLC为前述步骤308中计算的无损编码比特数,X12、X13为预设参数。
可以理解的是,上述公式九只是更新平均无损编码比特数记录表的一种示例,在实际应用中,更新平均无损编码比特数记录表还可以有其他方式,具体此处不做限定。
步骤310,更新无损编码比特数记录表。
第一设备获取无损编码比特数BLC、TPRE以及TCUR之后,基于BLC、TPRE以及TCUR更新无损编码比特数记录表RecordBLL。RecordBLL为大小是N*K的二维数组,RecordBLL[t][k]表示第t个位置,图像复杂度为k的值。
具体的,更新无损编码比特数记录表的过程如公式十所示。
公式十:RecordBLL[TCUR][k]=(RecordBLL[TPRE][k]*(8-X14)+BLC*X14+4)*X15;
公式十:RecordBLL[TCUR][k]=(RecordBLL[TPRE][k]*(8-X14)+BLC*X14+4)*X15;
其中,TPRE与TCUR为前述步骤308中计算的记录表位置,BLC为前述步骤308中计算的无损编码比特数,X14、X15为预设参数。
可以理解的是,上述公式十只是更新无损编码比特数记录表的一种示例,在实际应用中,更新无损编码比特数记录表还可以有其他方式,具体此处不做限定。
步骤311,更新虚拟填充量记录表。
第一设备获取TPRE与TCUR之后,基于TPRE与TCUR更新虚拟填充量记录表RecordVirEnd。RecordVirEnd为长度为N的一维数组,RecordVirEnd[t]表示第t个位置的虚拟填充量值。
若T时刻剩余未编码/未解码的块数小于或等于块数阈值Thblock,则RecordVirEnd[TCUR]=RecordVirEnd[TPRE]+2Step。若T时刻剩余未编码/未解码的块数大于块数阈值Thblock,则RecordVirEnd[TCUR]=RecordVirEnd[TPRE]。其中,Thblock为多个编码单元中进行虚拟填充的编码单元的块数阈值。Step为设置的结尾下降步长。
步骤312,更新物理缓冲区满度记录表。
第一设备获取TCUR之后,基于TCUR更新物理缓冲区满度记录表RecordPHY。其中,RecordPHY为长度为N的数组,RecordPHY[t]表示第t个位置的值。
具体的,将RecordPHY[TCUR]的值更新为当前物理缓冲区的实际数据量。
进一步的,第一设备还可以更新记录表位置。更新过程可以表示为TCUR=(TCUR+1)%N。
上面以第一设备为例对解码流程、码率控制中确定量化参数以及更新码控参数的流程进行了描述。下面对编码流程进行描述。
请参阅图4,本申请实施例提供的整体编码流程。该整体编码流程包括:预测阶段、量化阶段、熵编码阶段等。可以理解的是,在实际应用中,编码流程还可以有其他情况。例如,编码流程包括熵编码阶段。又例如,编码流程包括量化阶段与熵编码阶段等,具体此处不做限定。
示例性的,以编码端编码图像块为例,编码端对图像块进行预测得到残差信息,再通过量化阶段对残差信息进行量化得到语法元素,再对语法元素进行熵编码输出比特流。
本申请实施例所提供的编码方法可以应用在熵编码码阶段,也可以应用在整体编码流程,具体此处不做限定。
下面结合码率控制对上述编码流程进行具体描述。请参阅图5,首先,预测阶段获取输入图像块,并根据输入图像块获取残差信息,码率控制根据图像复杂度获取虚拟填充量与量化参数。其次,量化阶段根据残差信息与码率控制得到的量化参数进行量化处理以得到语法元素。熵编码阶段根据虚拟填充量与语法元素进行熵编码输出比特流。
其中,编码过程中获取图像复杂度的方式与解码过程不同,解码过程是通过对输入比特流进行熵解码得到图像复杂度。编码过程获取图像复杂度的过程包括:将图像块分为若干个子块,对于每个子块,从水平和竖直两个方向逐步计算相邻像素值的差值。将差值的绝对值求和后,得到该子块对应的复杂度值,将复杂度值和约定好的阈值进行比较,得到该子块的复杂度等级将各个子块的复杂度等级进行规则运算后,得到当前图像块的图像复杂度k。图像复杂度为K个值中的一个。
另外,码率控制的处理流程可以参阅前述图3所示实施例的描述。此处不再赘述。
上面对整体解码流程与编码流程进行了描述,下面对本申请实施例提供的解码方法与编码方法进行描述。该方法可以由解码设备执行,也可以由解码设备的部件(例如处理器、芯片、或芯片***等)执行。该解码设备可以是前述图1所示场景中的第一设备或第二设备。本申请实施例提供的方法可以应用于图像、视频传输等场景。
请参阅图6,本申请实施例提供的解码方法的一个流程示意图,该方法可以包括步骤601至步骤605。下面对步骤601至步骤605进行详细说明。
步骤601,获取第一编码单元的位流。
本申请实施例中,解码设备获取第一编码单元的位流的方式有多种,在一种可能实现的方式中,解码设备接收来自编码设备发送的第一编码单元的位流。在另一种可能实现的方式中,解码设备接收来自编码单元发送的多个编码单元的位流,并从多个编码单元的位流中确定第一编码单元的位流。在另一种可能实
现的方式中,解码设备从数据库/存储器中选取第一编码单元的位流等,具体此处不做限定。
其中,第一编码单元为多个编码单元中的至少一个编码单元。
步骤602,确定结尾下降步长。
解码设备确定结尾下降步长,该结尾下降步长用于更新多个编码单元的虚拟填充量。从结果上看,该虚拟填充量用于减少解码设备中缓冲区的存储空间。从过程中看,虚拟填充量在解码过程中虚拟增加将输入缓冲区的数据量,从而使得缓冲区的实际存储空间增大,以减少第一编码单元解码后缓冲区的数据量上溢风险。
可选地,解码设备在确定结尾下降步长之前,解码设备先获取第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数。其中,第一编码单元的原始比特数可以理解为是第一编码单元在编码前的比特数,一般情况下,原始比特数会被携带在位流中,从而解码设备根据位流就可以获取第一编码单元的原始比特数。预设压缩率与最小编码比特数可以根据实际需要设置,具体此处不做限定。
该种情况下,确定结尾下降步长的过程包括步骤一与步骤二。
步骤一、根据第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数确定结尾下降步长对数值。
先根据第一编码单元的原始比特数、预设压缩率以及多个编码单元的最小编码比特数确定结尾下降步长对数值的范围。再从范围中选取结尾下降步长对数值的具体取值。
具体的,结尾下降步长对数值的范围上限为以2为底第一差值的对数值,第一差值为原始比特数与预设压缩率的乘积减去最小编码比特数的差值。结尾下降步长对数值的范围下限为0。即结尾下降步长对数值的范围为[0,log2Stepmax],其中,log2Stepmax=log2(BppINI-Bfbmin),BppINI表示预期量的初始值,由输入图像块的原始比特数与预设压缩率相乘得到,Bfbmin表示多个编码单元的最小编码比特数。
解码设备确定结尾下降步长对数值的范围之后,可以按照第一预设条件或者随机从上述范围中选取结尾下降步长对数值的具体取值。
优选地,上述的第一预设条件为结尾下降步长对数值的取值为第二数值,该第二数值位于上述范围内,且第二数值满足第二预设条件,第二预设条件包括第三差值除以2的第二数值次方的商大于或等于预设阈值,且该商小于或等于第三数值的对数值,第三差值为缓冲区的存储量上限与预期存储量的差值,第三数值为多个编码单元中进行虚拟填充的编码单元数量。
上述优选过程可以理解为:第二数值(i=log2Step),在上述范围内,令的值最大,且小于或等于log2Thblock。其中,Dworst=(RcBufMAX-RcBufEND),RcBufMAX表示码控缓冲区的最大值,RcBufEND表示预期的码控缓冲区数据量。RcBufEND为预设值,RcBufEND也可以理解为将缓冲区的存储空间降到这个值,RcBufEND的取值范围在0-RcBufMAX之间。Thblock为预设的进行虚拟填充的编码单元数量(也可以称为块数阈值)。
上述过程也可以理解为,为了保证后续图像块的存储(即缓冲区不上溢),需要将缓冲区数据量下降到指定值,下降多少由结尾下降步长对数值与块数阈值确定。
步骤二、基于结尾下降步长对数值确定结尾下降步长。
解码设备确定结尾下降步长对数值之后,基于结尾下降步长对数值确定结尾下降步长。
其中,结尾下降步长对数值可以记作log2Step,结尾下降步长为Step,可以看出
可以理解的是,上述只是确定结尾下降步长的一种示例,在实际应用中,还可以有其他确定下降步长对数值的方式,具体此处不做限定。
步骤603,基于结尾下降步长确定多个编码单元的虚拟填充量。
解码设备确定结尾下降步长之后,基于结尾下降步长确定多个编码单元的虚拟填充量。该虚拟填充量用于减少解码设备中缓冲区的存储空间。
在一种可能实现的方式中,若第一编码单元在多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与结尾下降步长对数值确定虚拟填充量,预设阈值用于确定多个编码单元中进行虚拟填充的编码单元数量,基础数据量为在第一编码单元之前多个编码单元中已进行虚拟填充的数据量。
优选地,多个编码单元的虚拟填充量等于基础数据量与结尾下降步长相加。
在另一种可能实现的方式中,多个编码单元的虚拟填充量为第一集合中的最大值与结尾下降步长的乘积,第一集合包括0与第四差值,第四差值为预设数量与第二编码单元的数量的差值,第二编码单元为多个编码单元中未进行解码的解码单元。其中,未进行解码的解码单元可以包括需要进行虚拟填充且未解码的编码单元,也可以包括需要进行虚拟填充且未解码的编码单元与不需要进行虚拟填充且为解码的编码单元。
上述另一种可能实现的方式过程可以如公式十一所示。
公式十一:VirEndT=MAX(Thblock-Blockremain,0)*Step;
公式十一:VirEndT=MAX(Thblock-Blockremain,0)*Step;
其中,VirEndT表示多个编码单元在T时刻的虚拟填充量,Thblock为块数阈值,Blockremain表示多个编码单元中未解码的编码单元数量。
可以理解的是,上述几种方式只是确定多个编码单元的虚拟填充量的几种示例,在实际应用中,还可以有其他确定虚拟填充量的方式,具体此处不做限定。
步骤604,确定多个编码单元中第一编码单元的编码模式为回退模式。
解码设备确定多个编码单元中第一编码单元的编码模式为回退模式。
可选地,若解码单元接收的是多个编码单元的位流,则解码设备对多个编码单元的位流进行熵解码以确定多个编码单元中第一编码单元的编码模式为回退模式。
可选地,若解码单元接收的是第一编码单元的位流,则解码设备对第一编码单元的位流进行熵解码以确定第一编码单元的编码模式为回退模式。
步骤605,基于虚拟填充量与回退模式对第一编码单元进行解码,以得到第一数据。
解码设备确定虚拟填充量之后,基于虚拟填充量与回退模式对第一编码单元进行解码,以得到第一数据。
解码设备先基于虚拟填充量确定回退模式的编码码长,再基于编码码长对第一编码单元的位流进行解码等处理以得到第一数据。
其中,上述基于虚拟填充量确定回退模式的编码码长具体包括:若虚拟填充量大于0,则编码码长为第一数值与回退模式的头信息开销比特的差值,第一数值为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始比特数与预设压缩率的乘积减去结尾下降步长的差值。若虚拟填充量等于0,则编码码长为原始比特数与预设压缩率的乘积。即通过虚拟填充量的不同情况确定不同的编码码长,以兼顾进行虚拟填充的编码单元解码过程与未进行虚拟填充的编码单元的解码过程。
可以理解的是,上述过程也可以以编码单元为粒度进行编码码长的确定,例如,若第二编码单元进行了虚拟填充,则第二编码单元的编码码长为第一数值与回退模式的头信息开销比特的差值。若第二编码单元未进行虚拟填充,则第二编码单元的编码码长为第二编码单元的原始比特数与预设压缩率的乘积。
可选地,还可以先确定回退模式的码长标志Flagcl。若VirEndT>0,则Flagcl=1。若VirEndT≤0,则Flagcl=0。进一步的,若Flagcl=1,cldata=(BppINI-Step)/Sizeblock。若Flagcl=0,cldata=BppINI。其中,BppINI为预期量的初始值,由输入图像块的原始比特数与预设压缩率相乘得到,Step为结尾下降步长,Sizeblock为第一编码块的像素数量。计算出cldata之后,回退模式的编码码长
cl=cldata-clheader,clheader为回退模式的头信息开销比特。
另外,本步骤中,解码设备基于编码码长对第一编码单元的位流进行解码等处理以得到第一数据的情况有多种。例如,解码设备基于编码码长对第一编码单元的位流进行熵解码得到语法元素(即第一数据为语法元素)。又例如,解码设备基于编码码长对第一编码单元的位流进行熵解码、反量化等处理得到重建图像(即第一数据为重建后的图像)。
需要说明的是,本申请实施例中的各步骤没有时序限制,例如,步骤602可以在步骤604之后。又例如,步骤604可以在步骤603之后等。
本申请实施例中,一方面,在编解码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编解码过程中的缓冲区上溢。具体的,根据回退模式的最小编码比特数确定结尾下降步长,并根据结尾下降步长设置回退模式的编码码长,以减少缓冲区的上溢。也可以理解为,虚拟填充时,回退模式的码长考虑了结尾下降步长,从而保证了当前编码单元解码结束后缓冲区数据量不会上溢。另一方面,通过虚拟填充令缓冲区的数据量逐渐下降至预期的缓冲区数据量。同时在实际编码中,回退模式作为最后一道保障不上溢的屏障,需要配合码控的虚拟填充操作,保证在虚拟填充时,回退模式下缓冲区不会上溢。具体的,在编码/解码时,当编码单元处于虚拟填充状态时,回退模式的最小编码比特数会受结尾下降步长影响。同时,结尾下降步长的最大范围由回退模式的最小编码比特数决定。确保了码控可以利用虚拟填充使物理缓冲区的数据量逐渐下降至预期的缓冲区数据量,同时回退模式在虚拟填充状态下缓冲区不会上溢。
上面对本申请实施例提供的解码方法进行了描述,下面对本申请实施例提供的编码方法进行了描述。该方法可以由编码设备执行,也可以由编码设备的部件(例如处理器、芯片、或芯片***等)执行。该编码设备可以是前述图1所示场景中的第一设备或第二设备。本申请实施例提供的方法可以应用于图像、视频传输等场景。
请参阅图7,本申请实施例提供的编码方法的一个流程示意图,该方法可以包括步骤701至步骤705。下面对步骤701至步骤705进行详细说明。
步骤701,获取第一编码单元。
本申请实施例中,编码设备获取第一编码单元的方式有多种,在一种可能实现的方式中,编码设备通过用户的操作采集/拍摄得到第一编码单元。在另一种可能实现的方式中,编码设备通过用户的操作采集/拍摄得到原始数据,再对原始数据进行拆分以得到多个编码单元,并从多个编码单元中选取第一编码单元。在另一种可能实现的方式中,编码设备从数据库/存储器中选取第一编码单元等,具体此处不做限定。
可选地,编码设备先获取图像数据,并对图像数据进行拆分得到多个编码单元。第一编码单元为多个编码单元中的至少一个编码单元。
步骤702,确定结尾下降步长。
编码设备确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量,虚拟填充量用于减少编码设备中缓冲区的存储空间。
本步骤702中确定结尾下降步长的描述与前述图6所示实施例中步骤602的描述类似,此处不再赘述。
步骤703,基于结尾下降步长确定多个编码单元的虚拟填充量。
编码设备获取结尾下降步长之后,基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少编码设备中缓冲区的存储空间。
本步骤703中基于结尾下降步长确定多个编码单元的虚拟填充量的描述与前述图6所示实施例中步骤603的描述类似,此处不再赘述。
步骤704,确定多个子数据中第一编码单元的编码模式为回退模式。
编码设备获取第一编码单元之后,确定第一编码单元的编码模式为回退模式。
可选地,若多个编码模式对于第一编码单元的编码码长皆大于预设码长,则确定第一编码单元的编码模式为回退模式,预设码长为第二差值与第一编码单元中像素数量的商,第二差值为第一编码单元的原始
比特数与预设压缩率的乘积减去结尾下降步长的差值。
可以理解的是,上述评判指标是预设码长只是示例,在实际应用中,评判指标还可以包括编码比特数、失真度等,具体此处不做限定。
步骤705,基于虚拟填充量与回退模式对第一编码单元进行编码以得到位流。
编码设备获取虚拟填充量之后,基于虚拟填充量与回退模式对第一编码单元进行编码以得到位流。
解码设备先基于虚拟填充量确定回退模式的编码码长,再基于编码码长对第一编码单元进行编码等处理以得到位流。
其中,上述基于虚拟填充量确定回退模式的编码码长的描述可以参考前述图6所示实施例中步骤605中的描述,此处不再赘述。
另外,本步骤中,编码设备基于编码码长对第一编码单元进行编码等处理的情况有多种。例如,编码设备基于编码码长对第一编码单元进行熵编码得到位流。又例如,编码设备基于编码码长对第一编码单元进行预测、量化、熵编码等处理得到位流。
需要说明的是,本申请实施例中的各步骤没有时序限制,例如,步骤702可以在步骤704之后。又例如,步骤704可以在步骤703之后等。
本申请实施例中,在编解码过程中,通过在回退模式下考虑虚拟填充量,即基于虚拟填充量与回退模式进行编解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编解码过程中的缓冲区上溢。具体的,根据回退模式的最小编码比特数确定结尾下降步长,并根据结尾下降步长设置回退模式的编码码长,以减少缓冲区的上溢。也可以理解为,虚拟填充时,回退模式的码长考虑了结尾下降步长,从而保证了当前图像块编码结束后缓冲区数据量不会上溢。另一方面,通过虚拟填充令缓冲区的数据量逐渐下降至预期的缓冲区数据量。同时在实际编码中,回退模式作为最后一道保障不上溢的屏障,需要配合码控的虚拟填充操作,保证在虚拟填充时,回退模式下缓冲区不会上溢。具体的,在编码/解码时,当编码单元处于虚拟填充状态时,回退模式的最小编码比特数会受结尾下降步长影响。同时,结尾下降步长的最大范围由回退模式的最小编码比特数决定。确保了码控可以利用虚拟填充使物理缓冲区的数据量逐渐下降至预期的缓冲区数据量,同时回退模式在虚拟填充状态下缓冲区不会上溢。
上面对本申请实施例中的解码方法、编码方法进行了描述,下面对本申请实施例中的解码设备与编码设备进行描述。
请参阅图8,本申请实施例中解码设备的一个实施例包括:
获取单元801,用于获取第一编码单元的位流,第一编码单元为多个编码单元中的至少一个编码单元;
确定单元802,用于确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;
确定单元802,还用于基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少解码设备中缓冲区的存储空间;
确定单元802,还用于确定多个编码单元中第一编码单元的编码模式为回退模式;
解码单元803,用于基于虚拟填充量与回退模式对第一编码单元的位流进行解码,以得到第一数据。
本实施例中,解码设备中各单元所执行的操作与前述图1至图6所示实施例中描述的类似,此处不再赘述。
本实施例中,在解码过程中,通过在回退模式下考虑虚拟填充量,即解码单元803基于虚拟填充量与回退模式进行解码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行解码过程中的缓冲区上溢。
请参阅图9,本申请实施例中编码设备的一个实施例包括:
获取单元901,用于获取第一编码单元,第一编码单元为多个编码单元中的至少一个编码单元;
确定单元902,用于确定结尾下降步长,结尾下降步长用于更新多个编码单元的虚拟填充量;
确定单元902,还用于基于结尾下降步长确定多个编码单元的虚拟填充量,虚拟填充量用于减少编码设备中缓冲区的存储空间;
确定单元902,还用于确定多个编码单元中第一编码单元的编码模式为回退模式;
编码单元903,用于基于虚拟填充量与回退模式对第一编码单元进行编码以得到位流。
本实施例中,编码设备中各单元所执行的操作与前述图1至图5、图7所示实施例中描述的类似,此处不再赘述。
本实施例中,在编解码过程中,通过在回退模式下考虑虚拟填充量,即编码单元903基于虚拟填充量与回退模式进行编码,且虚拟填充量可以用于减少缓冲区的存储空间,从而减少在回退模式下进行编码过程中的缓冲区上溢。
参阅图10,本申请提供的另一种解码设备的结构示意图。该解码设备可以包括处理器1001、存储器1002和通信端口1003。该处理器1001、存储器1002和通信端口1003通过线路互联。其中,存储器1002中存储有程序指令和数据。
存储器1002中存储了前述图1至图6所示对应的实施方式中,由解码设备执行的步骤对应的程序指令以及数据。
处理器1001,用于执行前述图1至图6所示实施例中任一实施例所示的由解码设备执行的步骤。
通信端口1003可以用于进行数据的接收和发送,用于执行前述图1至图6所示实施例中任一实施例中与获取、发送、接收相关的步骤。
一种实现方式中,解码设备可以包括相对于图10更多或更少的部件,本申请对此仅仅是示例性说明,并不作限定。
参阅图11,本申请提供的另一种编码设备的结构示意图。该编码设备可以包括处理器1101、存储器1102和通信端口1103。该处理器1101、存储器1102和通信端口1103通过线路互联。其中,存储器1102中存储有程序指令和数据。
存储器1102中存储了前述图1至图5、图7所示对应的实施方式中,由编码设备执行的步骤对应的程序指令以及数据。
处理器1101,用于执行前述图1至图5、图7所示实施例中任一实施例所示的由编码设备执行的步骤。
通信端口1103可以用于进行数据的接收和发送,用于执行前述图1至图5、图7所示实施例中任一实施例中与获取、发送、接收相关的步骤。
一种实现方式中,数据处理设备可以包括相对于图11更多或更少的部件,本申请对此仅仅是示例性说明,并不作限定。
本申请实施例还提供一种存储一个或多个计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,该处理器执行如前述实施例中通信设备(例如解码设备和/或编码设备)可能的实现方式的方法。
本申请实施例还提供一种存储一个或多个计算机的计算机程序产品(或称计算机程序),当计算机程序产品被该处理器执行时,该处理器执行上述通信设备(例如解码设备和/或编码设备)可能实现方式的方法。
本申请实施例还提供了一种芯片***,该芯片***包括至少一个处理器,用于支持通信设备(例如解码设备和/或编码设备)可能的实现方式中所涉及的功能。可选的,芯片***还包括接口电路,接口电路为至少一个处理器提供程序指令和/或数据。在一种可能的设计中,该芯片***还可以包括存储器,存储器,用于保存该通信设备必要的程序指令和数据。该芯片***,可以由芯片构成,也可以包含芯片和其他分立器件。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的***,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者
也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,read-only memory)、随机存取存储器(RAM,random access memory)、磁碟或者光盘等各种可以存储程序代码的介质。
Claims (23)
- 一种解码方法,其特征在于,所述方法应用于解码设备,所述方法包括:获取第一编码单元的位流,所述第一编码单元为多个编码单元中的至少一个编码单元;确定结尾下降步长,所述结尾下降步长用于更新所述多个编码单元的虚拟填充量;基于所述结尾下降步长确定所述多个编码单元的虚拟填充量,所述虚拟填充量用于减少所述解码设备中缓冲区的存储空间;确定所述多个编码单元中第一编码单元的编码模式为回退模式;基于所述虚拟填充量与所述回退模式对所述第一编码单元的位流进行解码,以得到第一数据。
- 根据权利要求1所述的方法,其特征在于,所述确定结尾下降步长之前,所述方法还包括:获取所述第一编码单元的原始比特数、预设压缩率以及所述多个编码单元的最小编码比特数;所述确定结尾下降步长,包括:基于所述原始比特数、所述预设压缩率以及所述最小编码比特数确定结尾下降步长对数值;基于所述结尾下降步长对数值确定所述结尾下降步长。
- 根据权利要求2所述的方法,其特征在于,所述结尾下降步长对数值的取值的上限为以2为底第一差值的对数值,所述第一差值为所述原始比特数与所述预设压缩率的乘积减去所述最小编码比特数的差值。
- 根据权利要求2或3所述的方法,其特征在于,所述基于所述结尾下降步长确定所述多个编码单元的虚拟填充量,包括:若所述第一编码单元在所述多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与所述结尾下降步长对数值确定所述虚拟填充量,所述预设阈值用于确定所述多个编码单元中进行虚拟填充的编码单元数量,所述基础数据量为在所述第一编码单元之前所述多个编码单元中已进行虚拟填充的数据量。
- 根据权利要求4所述的方法,其特征在于,所述虚拟填充量等于所述基础数据量与结尾下降步长相加。
- 根据权利要求1至5中任一项所述的方法,其特征在于,所述基于所述虚拟填充量与所述回退模式对所述第一编码单元的位流进行解码,包括:基于所述虚拟填充量确定所述回退模式的编码码长;基于所述编码码长对所述第一编码单元的位流进行解码。
- 根据权利要求6所述的方法,其特征在于,若所述虚拟填充量大于0,则所述编码码长为第一数值与所述回退模式的头信息开销比特的差值,所述第一数值为第二差值与所述第一编码单元中像素数量的商,所述第二差值为所述第一编码单元的原始比特数与预设压缩率的乘积减去所述结尾下降步长的差值;若所述虚拟填充量等于0,则所述编码码长为所述原始比特数与所述预设压缩率的乘积之后与所述回退模式的头信息开销比特的差值。
- 一种编码方法,其特征在于,所述方法应用于编码设备,所述方法包括:获取第一编码单元,所述第一编码单元为多个编码单元中的至少一个编码单元;确定结尾下降步长,所述结尾下降步长用于更新所述多个编码单元的虚拟填充量;基于所述结尾下降步长确定所述多个编码单元的虚拟填充量,所述虚拟填充量用于减少所述编码设备中缓冲区的存储空间;确定所述多个编码单元中第一编码单元的编码模式为回退模式;基于所述虚拟填充量与所述回退模式对所述第一编码单元进行编码以得到位流。
- 根据权利要求8所述的方法,其特征在于,所述确定所述多个编码单元中第一编码单元的编码模式为回退模式,包括:若多个编码模式对于所述第一编码单元的编码码长皆大于预设码长,则确定所述第一编码单元的编码模式为所述回退模式,所述预设码长为第二差值与所述第一编码单元中像素数量的商,所述第二差值为所述第一编码单元的原始比特数与预设压缩率的乘积减去所述结尾下降步长的差值。
- 一种解码设备,其特征在于,所述解码设备包括:获取单元,用于获取第一编码单元的位流,所述第一编码单元为多个编码单元中的至少一个编码单元;确定单元,用于确定结尾下降步长,所述结尾下降步长用于更新所述多个编码单元的虚拟填充量;所述确定单元,还用于基于所述结尾下降步长确定所述多个编码单元的虚拟填充量,所述虚拟填充量用于减少所述解码设备中缓冲区的存储空间;所述确定单元,还用于确定所述多个编码单元中第一编码单元的编码模式为回退模式;解码单元,用于基于所述虚拟填充量与所述回退模式对所述第一编码单元的位流进行解码,以得到第一数据。
- 根据权利要求10所述的设备,其特征在于,所述获取单元,还用于获取所述第一编码单元的原始比特数、预设压缩率以及所述多个编码单元的最小编码比特数;所述确定单元,具体用于基于所述原始比特数、所述预设压缩率以及所述最小编码比特数确定结尾下降步长对数值;所述确定单元,具体用于基于所述结尾下降步长对数值确定所述结尾下降步长。
- 根据权利要求11所述的设备,其特征在于,所述结尾下降步长对数值的取值的上限为以2为底第一差值的对数值,所述第一差值为所述原始比特数与所述预设压缩率的乘积减去所述最小编码比特数的差值。
- 根据权利要求11或12所述的设备,其特征在于,所述确定单元,具体用于若所述第一编码单元在所述多个编码单元中的排序大于或等于预设阈值,则基于基础数据量与所述结尾下降步长对数值确定所述虚拟填充量,所述预设阈值用于确定所述多个编码单元中进行虚拟填充的编码单元数量,所述基础数据量为在所述第一编码单元之前所述多个编码单元中已进行虚拟填充的数据量。
- 根据权利要求13所述的设备,其特征在于,所述虚拟填充量等于所述基础数据量与结尾下降步长相加。
- 根据权利要求10至14中任一项所述的设备,其特征在于,所述解码单元,具体用于基于所述虚拟填充量确定所述回退模式的编码码长;所述解码单元,具体用于基于所述编码码长对所述第一编码单元的位流进行解码。
- 根据权利要求15所述的设备,其特征在于,若所述虚拟填充量大于0,则所述编码码长为第一数值与所述回退模式的头信息开销比特的差值,所述第一数值为第二差值与所述第一编码单元中像素数量的商,所述第二差值为所述第一编码单元的原始比特数与预设压缩率的乘积减去所述结尾下降步长的差值;若所述虚拟填充量等于0,则所述编码码长为所述原始比特数与所述预设压缩率的乘积之后与所述回退模式的头信息开销比特的差值。
- 一种编码设备,其特征在于,所述编码设备包括:获取单元,用于获取第一编码单元,所述第一编码单元为多个编码单元中的至少一个编码单元;确定单元,用于确定结尾下降步长,所述结尾下降步长用于更新所述多个编码单元的虚拟填充量;所述确定单元,还用于基于所述结尾下降步长确定所述多个编码单元的虚拟填充量,所述虚拟填充量用于减少所述编码设备中缓冲区的存储空间;所述确定单元,还用于确定所述多个编码单元中第一编码单元的编码模式为回退模式;编码单元,用于基于所述虚拟填充量与所述回退模式对所述第一编码单元进行编码以得到位流。
- 根据权利要求17所述的设备,其特征在于,所述确定单元,具体用于若多个编码模式对于所述第一编码单元的编码码长皆大于预设码长,则确定所述第一编码单元的编码模式为所述回退模式,所述预设码长为第二差值与所述第一编码单元中像素数量的商,所述第二差值为所述第一编码单元的原始比特数与预设压缩率的乘积减去所述结尾下降步长的差值。
- 一种解码设备,其特征在于,包括:处理器,所述处理器与存储器耦合,所述存储器用于存储程序或指令,当所述程序或指令被所述处理器执行时,使得所述解码设备执行如权利要求1至7中任一项所述的方法。
- 一种编码设备,其特征在于,包括:处理器,所述处理器与存储器耦合,所述存储器用于存储程序或指令,当所述程序或指令被所述处理器执行时,使得所述编码设备执行如权利要求8或9所述的方法。
- 一种通信***,其特征在于,包括如权利要求19所述的解码设备,和/或如权利要求20所述的编码设备。
- 一种计算机可读存储介质,其特征在于,所述介质存储有指令,当所述指令被计算机执行时,实 现权利要求1至9中任一项所述的方法。
- 一种计算机程序产品,其特征在于,包括指令,当所述指令在计算机上运行时,使得计算机执行如权利要求1至9中任一项所述的方法。
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211099536 | 2022-09-08 | ||
CN202211099536.4 | 2022-09-08 | ||
CN202310258261.2A CN117676159A (zh) | 2022-09-08 | 2023-03-06 | 一种解码方法、编码方法及相关设备 |
CN202310258261.2 | 2023-03-06 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024051645A1 true WO2024051645A1 (zh) | 2024-03-14 |
Family
ID=90074026
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/116724 WO2024051645A1 (zh) | 2022-09-08 | 2023-09-04 | 一种解码方法、编码方法及相关设备 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN117676159A (zh) |
WO (1) | WO2024051645A1 (zh) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5491480A (en) * | 1994-05-25 | 1996-02-13 | Industrial Technology Research Institute | Variable length decoder using serial and parallel processing |
US20050015259A1 (en) * | 2003-07-18 | 2005-01-20 | Microsoft Corporation | Constant bitrate media encoding techniques |
CN102724510A (zh) * | 2012-06-21 | 2012-10-10 | 中科开元信息技术(北京)有限公司 | 一种基于虚拟编码缓冲区充盈度的码率控制算法 |
US20200202574A1 (en) * | 2018-12-21 | 2020-06-25 | Samsung Display Co., Ltd. | Fallback modes for display compression |
WO2021244341A1 (zh) * | 2020-06-05 | 2021-12-09 | 中兴通讯股份有限公司 | 图像编码方法及装置、电子设备及计算机可读存储介质 |
-
2023
- 2023-03-06 CN CN202310258261.2A patent/CN117676159A/zh active Pending
- 2023-09-04 WO PCT/CN2023/116724 patent/WO2024051645A1/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5491480A (en) * | 1994-05-25 | 1996-02-13 | Industrial Technology Research Institute | Variable length decoder using serial and parallel processing |
US20050015259A1 (en) * | 2003-07-18 | 2005-01-20 | Microsoft Corporation | Constant bitrate media encoding techniques |
CN102724510A (zh) * | 2012-06-21 | 2012-10-10 | 中科开元信息技术(北京)有限公司 | 一种基于虚拟编码缓冲区充盈度的码率控制算法 |
US20200202574A1 (en) * | 2018-12-21 | 2020-06-25 | Samsung Display Co., Ltd. | Fallback modes for display compression |
WO2021244341A1 (zh) * | 2020-06-05 | 2021-12-09 | 中兴通讯股份有限公司 | 图像编码方法及装置、电子设备及计算机可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN117676159A (zh) | 2024-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10904408B2 (en) | Picture file processing method, device, and computer storage medium | |
CN109842803B (zh) | 一种图像压缩的方法及装置 | |
JP5290357B2 (ja) | 動的にスケーリングされるファイル符号化 | |
WO2018103568A1 (zh) | 云桌面内容编码与解码方法及装置、*** | |
US7627180B2 (en) | Image compression apparatus | |
JP4430845B2 (ja) | 画像データを処理するための方法およびシステム | |
CN111131828B (zh) | 一种图像压缩方法、装置、电子设备和存储介质 | |
US20130114687A1 (en) | Fixed intra run-level mode for cavlc in hevc | |
WO2016165603A1 (zh) | 一种视频数据的编解码方法及装置 | |
US10368086B2 (en) | Image coding/decoding method, device, and system | |
WO2013064120A1 (zh) | 一种变换模式的编解码方法和装置 | |
WO2013067949A1 (zh) | 矩阵编码方法与装置及解码方法与装置 | |
JP2013511226A (ja) | 埋め込みグラフィック符号化:並列復号に向けて並べ替えられたビットストリーム | |
CN113709463A (zh) | 数据传输方法及装置 | |
US9118920B2 (en) | Method and apparatus for encoding image and method and apparatus for decoding image | |
US8681860B2 (en) | Moving picture compression apparatus and method of controlling operation of same | |
WO2024078066A1 (zh) | 视频解码方法、视频编码方法、装置、存储介质及设备 | |
WO2024051645A1 (zh) | 一种解码方法、编码方法及相关设备 | |
US10348452B2 (en) | Apparatus and method for transmitting video data in communication system | |
US8442338B2 (en) | Visually optimized quantization | |
CN116684595A (zh) | 一种超低时延的图像编码***、方法、装置及存储介质 | |
US20230039840A1 (en) | Picture processing method and apparatus | |
CN116248895B (zh) | 虚拟现实全景漫游的视频云转码方法及*** | |
CN116527903B (zh) | 图像浅压缩方法及解码方法 | |
KR102506115B1 (ko) | 타겟 태스크별 양자화 테이블 생성 방법 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23862339 Country of ref document: EP Kind code of ref document: A1 |