Coding method and decoding method for quantization parameter, and electronic device
By determining the QP predicted value of the non-private CU to be encoded and calculating the QP residuals on the encoding side, the problem of inconsistency in QP encoding and decoding between the private CU and the non-private CU is solved, and the reconstruction quality is improved.
Patent Information
- Application Number
- PCT/CN2024/137332
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-08
- Filing Date
- 2024-12-06
- Publication Date
- 2025-06-12
AI Technical Summary
In the prior art, the encoding and decoding process of the quantization parameters of the same encoding unit is inconsistent between the private CU and the non-private CU, resulting in the QP decoding at the decoding end being inconsistent with the QP encoded at the encoding end, affecting the reconstruction quality.
By determining the QP prediction value of the non-private CU to be encoded based on the QP reconstruction value of the encoded non-private CU, calculating the QP residual, and encoding is performed according to the context model of the QP residual, ensuring that the QP encoding and decoding at the decoding end and the encoding end are consistent.
The QP decoding process of the decoding end to the non-private CU is consistent with the encoding process of the encoding end, improving the reconstruction quality of the reconstruction block of the non-private CU.
Smart Images

Figure CN2024137332_12062025_PF_FP_ABST
Abstract
Description
Quantization parameter encoding and decoding method and electronic device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on December 8, 2023, with application number 202311692069.0 and application name “Encoding and decoding method and electronic device for quantization parameters”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of coding and decoding, and in particular to a coding and decoding method for quantization parameters and an electronic device. Background Art
[0003] With the rapid development of the Internet and multimedia technology, as well as the continuous decline in the hardware cost and implementation cost of video surveillance, video surveillance technology has been widely used; for example, video surveillance technology is used to implement remote video surveillance of target areas to assist in public security management, accident warning, etc.
[0004] However, the collected video images may carry user information (such as faces, license plate numbers, etc.). If the video images are leaked, the user information will also be leaked, which may cause losses to the user; therefore, video privacy protection technology came into being.
[0005] In the prior art, the selection of context models for CU-level luminance QP-related parameters for private and non-private CUs within the same Coding Unit (CU) Quantization Parameter (QP) group depends on the same NumDeltaQp (the number of encoded CUs in the same CU QP group). Since only non-private CUs are decoded in low-private scenarios, this results in different NumDeltaQp values during the encoding and decoding process, making the encoding and decoding process of QP-related parameters for the same CU inconsistent. In addition, the method for determining QP prediction values for private and non-private CUs in the same CU QP group is the same, which results in prediction deviations during decoding in low-private scenarios, causing the QP obtained by the decoder to be inconsistent with the QP encoded by the encoder. Summary of the Invention
[0006] In view of this, the present application provides a quantization parameter encoding and decoding method and electronic device.
[0007] Exemplarily, the present application can be applied to any scenario requiring video (or image) privacy protection (eg, a video surveillance scenario), and the present application does not impose any limitation thereto.
[0008] In a first aspect, an embodiment of the present application provides a method for encoding a quantization parameter, the method comprising: first, determining a QP prediction value of a non-private CU to be encoded in a coding unit quantization parameter CU QP group based on a QP reconstructed value of an encoded non-private CU in a CU QP group; then, determining a QP residual of the non-private CU to be encoded based on an original QP value of the non-private CU to be encoded and a QP prediction value of the non-private CU to be encoded; then, determining a context model corresponding to the QP residual of the non-private CU to be encoded based on the number of encoded non-private CUs in the CU QP group; and finally, performing entropy encoding on the QP residual of the non-private CU to be encoded based on the context model corresponding to the QP residual of the non-private CU to be encoded.
[0009] In this way, for a decoder with only low user privileges (e.g., user privileges lower than a preset privilege), since the encoding and decoding of the QP of the non-private CU by the codec only depends on the QP of the encoded / decoded non-private CU, it can be ensured that the QP decoded by the decoder is consistent with the QP encoded by the encoder. Furthermore, the encoding and decoding of the QP of the non-private CU by the codec only depends on the number of QPs of the encoded / decoded non-private CUs, thereby ensuring that the context model used by the decoder in the decoding process of the QP residual of the non-private CU is the same as the context model used by the encoder in the encoding process of the QP residual of the non-private CU. In this way, the decoding process of the QP of the non-private CU by the decoder and the encoding process of the QP of the non-private CU by the encoder are consistent, thereby improving the reconstruction quality of the reconstructed block of the non-private CU.
[0010] It should be understood that the encoding method of the first aspect is also applicable to a terminal device with high user authority (such as user authority higher than the preset authority) decoding the QP of a non-private CU.
[0011] For example, for video data that requires privacy protection, each frame of the video data may include one or more privacy CUs and / or one or more non-privacy CUs.
[0012] Exemplarily, a private CU contains private information, and a non-private CU does not contain private information.
[0013] Among them, private information can refer to secrets that are not willing to be disclosed or known to others (people outside a certain range), and this secret is not related to other people or social interests. In some scenarios, private information can also be called user information, which can refer to information that directly or indirectly describes the user's identity. For example, user information includes but is not limited to: user name, date of birth, ID number, address, telephone number, face, license plate number, movement posture, clothing, etc., and this application does not limit this.
[0014] Exemplarily, a CU QP group (that is, a CU-level QP group) may include multiple CUs; wherein, a CU QP group may include one or more privacy CUs and / or one or more non-privacy CUs.
[0015] For example, the absolute value of the QP residual of the non-private CU to be encoded can be calculated first; then, the absolute value of the QP residual of the non-private CU to be encoded can be quantized to obtain a first quantized value; then, the first quantized value can be entropy encoded based on the context model corresponding to the QP residual of the non-private CU to be encoded. In this case, the sign (i.e., positive or negative) of the QP residual of the non-private CU to be encoded can also be encoded.
[0016] For example, the QP residual of the non-private CU may be referred to as the deltaQP of the non-private CU.
[0017] Exemplarily, the syntax element corresponding to the first quantization value in the codestream may be cu_qp_delta_abs, and the syntax element corresponding to the sign of the QP residual of the non-privacy CU to be encoded may be cu_qp_delta_sign.
[0018] According to the first aspect, the method further includes: first, determining a predicted QP value of a private CU to be encoded in the CU QP group based on the reconstructed QP values of the encoded CUs in the CU QP group; then, determining a QP residual of the private CU to be encoded based on the original QP value of the private CU to be encoded and the predicted QP value of the private CU to be encoded; then, determining a context model corresponding to the QP residual of the private CU to be encoded based on the number of encoded CUs in the CU QP group; and finally, performing entropy coding on the QP residual of the private CU to be encoded based on the context model corresponding to the QP residual of the private CU to be encoded. In this way, the QP of the private CU can be encoded.
[0019] It should be noted that this application does not limit the encoding order of the QP of the private CU and the QP of the non-private CU at the encoding end.
[0020] It should be noted that the encoding of the QP of the private CU in this application can rely on the encoded private CU or the encoded non-private CU. Since the decoding end with high user privileges can decode the QP of both the private CU and the non-private CU, this can also ensure that the decoding process of the QP of the private CU at the decoding end and the encoding process of the QP of the private CU at the encoding end are consistent.
[0021] According to the first aspect, or any implementation of the first aspect above, determining a QP prediction value of a to-be-encoded private CU in a CU QP group based on a QP reconstructed value of an already-encoded CU in the CU QP group includes: determining the QP prediction value of the to-be-encoded private CU based on the QP reconstructed value of the already-encoded private CU in the CU QP group; and determining a context model corresponding to a QP residual of the to-be-encoded private CU based on the number of already-encoded CUs in the CU QP group includes: determining the context model corresponding to the QP residual of the to-be-encoded private CU based on the number of already-encoded private CUs in the CU QP group.
[0022] In this way, the encoding process of the QP of the non-private CU and the QP of the private CU can be completely decoupled, as can the decoding process of the QP of the non-private CU and the QP of the private CU. This ensures that the decoding process of the QP of the non-private CU and the QP of the private CU at the decoding end is consistent with the encoding process of the QP of the non-private CU and the QP of the private CU at the encoding end.
[0023] In addition, for terminal devices with high user privileges, the QP decoding of the private CU does not depend on the QP of the non-private CU. In this way, whether the QP of the non-private CU is lost or not, it will not affect the QP of the decoded private CU. In addition, when the QP of the non-private CU is inaccurate, it will not affect the accuracy of the QP of the private CU.
[0024] According to the first aspect, or any implementation of the first aspect above, determining a QP prediction value of a private CU to be encoded in a CU QP group based on a QP reconstructed value of an encoded CU in the CU QP group includes: determining the QP prediction value of the private CU to be encoded based on the QP reconstructed values of all encoded CUs in the CU QP group; and determining a context model corresponding to a QP residual of the private CU to be encoded based on the number of encoded CUs in the CU QP group includes: determining the context model corresponding to the QP residual of the private CU to be encoded based on the number of all encoded CUs in the CU QP group.
[0025] In this way, the encoding process of the QP of the non-private CU and the QP of the private CU can be partially decoupled, and the decoding process of the QP of the non-private CU and the QP of the private CU can be partially decoupled to ensure that the decoding process of the QP of the non-private CU and the QP of the private CU at the decoding end is consistent with the encoding process of the QP of the non-private CU and the QP of the private CU at the encoding end.
[0026] Furthermore, the predicted QP value of the to-be-encoded private CU depends on the already-encoded non-private CU and / or the already-encoded private CU. This allows for more comprehensive information to be used in determining the predicted value of the to-be-encoded private CU. Consequently, the predicted QP value of the determined private CU can be made more accurate, thereby improving the reconstruction quality of the reconstructed block of the private CU.
[0027] According to the first aspect, or any implementation of the first aspect above, determining a QP prediction value of a private CU to be encoded based on a QP reconstructed value of an encoded private CU in a CU QP group includes: when the private CU to be encoded is not the first CU in the CU QP group, using a QP reconstructed value of an encoded private CU preceding the private CU to be encoded as the QP prediction value of the private CU to be encoded.
[0028] According to the first aspect, or any implementation of the first aspect above, determining a predicted QP value of a private CU to be encoded based on a reconstructed QP value of an already encoded private CU in a CU QP group includes: when the private CU to be encoded is the first CU in the CU QP group, using a reconstructed QP value of an already encoded private CU to the left of the private CU to be encoded in the CU QP group as the predicted QP value of the private CU to be encoded.
[0029] According to the first aspect, or any implementation of the first aspect above, determining the QP prediction value of the private CU to be encoded based on the QP reconstructed values of all encoded CUs in the CU QP group includes: when the private CU to be encoded is not the first CU in the CU QP group, using the QP reconstructed value of the encoded CU preceding the private CU to be encoded as the QP prediction value of the private CU to be encoded.
[0030] According to the first aspect, or any implementation of the first aspect above, determining the QP prediction value of the private CU to be encoded based on the QP reconstructed values of all encoded CUs in the CU QP group includes: when the private CU to be encoded is the first CU in the CU QP group, using the QP reconstructed value of the encoded CU to the left of the private CU to be encoded in the CU QP group as the QP prediction value of the private CU to be encoded.
[0031] According to the first aspect, or any implementation of the first aspect above, determining a QP prediction value of a non-private CU to be encoded in a CU QP group based on a QP reconstructed value of an encoded non-private CU in a coding unit quantization parameter CU QP group includes: when the non-private CU to be encoded is not the first CU in the CU QP group, using a QP reconstructed value of a previously encoded non-private CU of the non-private CU to be encoded as the QP prediction value of the non-private CU to be encoded.
[0032] According to the first aspect, or any implementation of the first aspect above, determining a QP prediction value of a non-private CU to be encoded in a CU QP group based on a QP reconstructed value of an already encoded non-private CU in a coding unit quantization parameter CU QP group includes: when the non-private CU to be encoded is the first CU in the CU QP group, using the QP reconstructed value of the already encoded non-private CU to the left of the non-private CU to be encoded as the QP prediction value of the non-private CU to be encoded.
[0033] According to the first aspect, or any implementation of the first aspect above, the bitstream generated according to the encoding method of the quantization parameter includes a first identifier, where the first identifier indicates the number of encoded non-private CUs in the CU QP group; after entropy encoding of the QP residual of the non-private CU to be encoded, the value of the first identifier is increased by 1.
[0034] Exemplarily, the syntax element corresponding to the first identifier may be NumDeltaQp.
[0035] According to the first aspect, or any implementation of the first aspect above, the bitstream generated according to the encoding method of the quantization parameter includes a second identifier, where the second identifier indicates the number of encoded private CUs in the CU QP group; after entropy encoding the QP residual of the private CU to be encoded, the value of the second identifier is increased by 1.
[0036] Exemplarily, the syntax element corresponding to the second identifier may be NumDeltaQpPrivacy.
[0037] According to the first aspect, or any implementation of the first aspect above, the bitstream generated according to the encoding method of the quantization parameter includes a third identifier, where the third identifier indicates the number of all encoded CUs in the CU QP group; after entropy encoding the QP residual of the non-private CU to be encoded, the value of the third identifier is incremented by 1; after entropy encoding the QP residual of the private CU to be encoded, the value of the third identifier is incremented by 1.
[0038] For example, the syntax element corresponding to the third identifier may be NumDeltaQpPrivacy
[0039] It should be noted that the code stream generated according to the first aspect and any one of the implementations of the first aspect may include the first identifier and the second identifier; or include the first identifier and the third identifier.
[0040] In a second aspect, an embodiment of the present application provides a quantization parameter decoding method, the decoding method comprising: first, receiving a bitstream, the bitstream including QP residual coded data of a non-private CU in a coding unit quantization parameter CU QP group; then, determining, based on the number of decoded non-private CUs in the CU QP group, a context model corresponding to the QP residual of a non-private CU to be decoded in the CU QP group; then, performing entropy decoding on the QP residual coded data of the non-private CU to be decoded based on the context model corresponding to the QP residual of the non-private CU to be decoded, to obtain the QP residual of the non-private CU to be decoded; then, determining a QP prediction value of the non-private CU to be decoded based on the QP reconstructed values of the decoded non-private CUs in the CU QP group; and then, adding the QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded to obtain a QP reconstructed value of the non-private CU to be decoded.
[0041] According to the second aspect, the bitstream also includes QP residual coded data of a private CU in the CU QP group. The method further includes: determining, based on the number of decoded CUs in the CU QP group, a context model corresponding to the QP residual of the private CU to be decoded in the CU QP group; performing entropy decoding on the QP residual coded data of the private CU to be decoded based on the context model corresponding to the QP residual of the private CU to be decoded to obtain the QP residual of the private CU to be decoded; determining a QP prediction value of the private CU to be decoded based on the QP reconstructed values of the decoded CUs in the CU QP group; and adding the QP prediction value of the private CU to be decoded and the QP residual of the private CU to be decoded to obtain a QP reconstructed value of the private CU to be decoded.
[0042] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a to-be-decoded private CU in a CU QP group based on a QP reconstructed value of a decoded CU in the CU QP group includes: determining the QP prediction value of the to-be-decoded private CU based on the QP reconstructed value of the decoded private CU in the CU QP group; and determining a context model corresponding to a QP residual of the to-be-decoded private CU based on the number of decoded CUs in the CU QP group includes: determining a context model corresponding to a QP residual of the to-be-decoded private CU based on the number of decoded private CUs in the CU QP group.
[0043] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a to-be-decoded private CU in a CU QP group based on a QP reconstructed value of a decoded CU in the CU QP group includes: determining the QP prediction value of the to-be-decoded private CU based on the QP reconstructed values of all decoded CUs in the CU QP group; and determining a context model corresponding to a QP residual of the to-be-decoded private CU based on the number of decoded CUs in the CU QP group includes: determining a context model corresponding to a QP residual of the to-be-decoded private CU based on the number of all decoded CUs in the CU QP group.
[0044] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a to-be-decoded private CU based on a QP reconstructed value of a decoded private CU in a CU QP group includes: when the to-be-decoded private CU is not the first CU in the CU QP group, using the QP reconstructed value of the decoded private CU preceding the to-be-decoded private CU as the QP prediction value of the to-be-decoded private CU.
[0045] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a to-be-decoded private CU based on a QP reconstructed value of a decoded private CU in a CU QP group includes: when the to-be-decoded private CU is the first CU in the CU QP group, using a QP reconstructed value of a decoded private CU to the left of the to-be-decoded private CU in the CU QP group as the QP prediction value of the to-be-decoded private CU.
[0046] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a to-be-decoded private CU based on the QP reconstructed values of all decoded CUs in the CU QP group includes: when the to-be-decoded private CU is not the first CU in the CU QP group, using the QP reconstructed value of the decoded CU preceding the to-be-decoded private CU as the QP prediction value of the to-be-decoded private CU.
[0047] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a to-be-decoded private CU based on QP reconstructed values of all decoded CUs in the CU QP group includes: when the to-be-decoded private CU is the first CU in the CU QP group, using the QP reconstructed value of a decoded CU to the left of the to-be-decoded private CU in the CU QP group as the QP prediction value of the to-be-decoded private CU.
[0048] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a non-private CU to be decoded in a CU QP group based on a QP reconstructed value of a decoded non-private CU in a decoding unit quantization parameter CU QP group includes: when the non-private CU to be decoded is not the first CU in the CU QP group, using the QP reconstructed value of the decoded non-private CU preceding the non-private CU to be decoded as the QP prediction value of the non-private CU to be decoded.
[0049] According to the second aspect, or any implementation of the second aspect above, determining a QP prediction value of a non-private CU to be decoded in a CU QP group based on a QP reconstructed value of a decoded non-private CU in a decoding unit quantization parameter CU QP group includes: when the non-private CU to be decoded is the first CU in the CU QP group, using the QP reconstructed value of the decoded non-private CU to the left of the non-private CU to be decoded as the QP prediction value of the non-private CU to be decoded.
[0050] According to the second aspect, or any implementation of the second aspect above, the bitstream further includes a first identifier, and the method further includes: determining the number of decoded non-private CUs in the CU QP group based on the value of the first identifier; and after entropy decoding the QP residual coded data of the non-private CU to be decoded, adding 1 to the value of the first identifier.
[0051] According to the second aspect, or any implementation of the second aspect above, the bitstream further includes a second identifier, and the method further includes: determining the number of decoded private CUs in the CU QP group based on the value of the second identifier; and after entropy decoding the QP residual coded data of the to-be-decoded private CU, incrementing the value of the second identifier by 1.
[0052] According to the second aspect, or any implementation of the second aspect above, the bitstream further includes a third identifier, and the method further includes: determining the number of all decoded CUs in the CU QP group based on the value of the third identifier; after entropy decoding the QP residual coded data of the to-be-decoded non-private CU, incrementing the value of the third identifier by 1; and after entropy decoding the QP residual coded data of the to-be-decoded private CU, incrementing the value of the third identifier by 1.
[0053] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0054] In a third aspect, an embodiment of the present application provides a quantization parameter encoding device, the device comprising:
[0055] A first prediction value determination module is configured to determine a QP prediction value of a non-private CU to be encoded in a CU QP group according to a QP reconstruction value of an encoded non-private CU in a coding unit quantization parameter CU QP group;
[0056] A residual module, configured to determine a QP residual of the non-private CU to be encoded based on the original QP value of the non-private CU to be encoded and the predicted QP value of the non-private CU to be encoded;
[0057] A first model determination module is configured to determine a context model corresponding to the QP residual of the non-private CU to be encoded according to the number of encoded non-private CUs in the CU QP group;
[0058] The entropy coding module is used to entropy code the QP residual of the non-private CU to be coded according to the context model corresponding to the QP residual of the non-private CU to be coded.
[0059] It should be understood that the quantization parameter encoding device of the third aspect can be used to execute the encoding method of the first aspect or any possible implementation of the first aspect.
[0060] The third aspect and any implementation of the third aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the third aspect and any implementation of the third aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0061] In a fourth aspect, an embodiment of the present application provides a quantization parameter decoding device, the device comprising:
[0062] A code stream receiving module, configured to receive a code stream, the code stream including QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group;
[0063] A second model determination module is configured to determine a context model corresponding to a QP residual of a non-private CU to be decoded in the CU QP group according to the number of decoded non-private CUs in the CU QP group;
[0064] An entropy decoding module is used to perform entropy decoding on the QP residual coded data of the non-private CU to be decoded according to the context model corresponding to the QP residual of the non-private CU to be decoded, so as to obtain the QP residual of the non-private CU to be decoded;
[0065] A second prediction value determination module is configured to determine a QP prediction value of a non-private CU to be decoded based on a QP reconstruction value of a decoded non-private CU in the CU QP group;
[0066] The adding module is used to add the QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded to obtain the QP reconstructed value of the non-private CU to be decoded.
[0067] It should be understood that the decoding device of the fourth aspect can be used to execute the decoding method of the second aspect or any possible implementation of the second aspect.
[0068] The fourth aspect and any implementation of the fourth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the fourth aspect and any implementation of the fourth aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0069] In a fifth aspect, an embodiment of the present application provides an electronic device comprising: a memory and a processor, wherein the memory is coupled to the processor; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method in the first aspect or any possible implementation of the first aspect.
[0070] The fifth aspect and any implementation of the fifth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the fifth aspect and any implementation of the fifth aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0071] In the sixth aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, the memory being coupled to the processor; the memory storing program instructions, which, when executed by the processor, enables the electronic device to execute the method in the second aspect or any possible implementation of the second aspect.
[0072] The sixth aspect and any implementation of the sixth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the sixth aspect and any implementation of the sixth aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0073] In the seventh aspect, an embodiment of the present application provides a chip comprising one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the steps in the first aspect or any possible implementation of the first aspect are executed.
[0074] The seventh aspect and any implementation of the seventh aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the seventh aspect and any implementation of the seventh aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0075] In an eighth aspect, an embodiment of the present application provides a chip comprising one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the steps in the second aspect or any possible implementation of the second aspect are executed.
[0076] The eighth aspect and any implementation of the eighth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the eighth aspect and any implementation of the eighth aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0077] In the ninth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer or a processor, it enables the computer or the processor to execute the method in the first aspect or any possible implementation of the first aspect.
[0078] The ninth aspect and any implementation of the ninth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the ninth aspect and any implementation of the ninth aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0079] In the tenth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer or a processor, it enables the computer or the processor to execute the method in the second aspect or any possible implementation of the second aspect.
[0080] The tenth aspect and any implementation of the tenth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the tenth aspect and any implementation of the tenth aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0081] In the eleventh aspect, an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer or the processor executes the method in the first aspect or any possible implementation of the first aspect.
[0082] The eleventh aspect and any implementation of the eleventh aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the eleventh aspect and any implementation of the eleventh aspect can be referred to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, and will not be repeated here.
[0083] In the twelfth aspect, an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer or the processor executes the method in the second aspect or any possible implementation of the second aspect.
[0084] The twelfth aspect and any implementation of the twelfth aspect correspond to the second aspect and any implementation of the second aspect, respectively. The technical effects corresponding to the twelfth aspect and any implementation of the twelfth aspect can be referred to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, and will not be repeated here.
[0085] In a thirteenth aspect, an embodiment of the present application provides a code stream, which is generated according to the above-mentioned first aspect and any one of the implementation methods of the first aspect.
[0086] In a fourteenth aspect, an embodiment of the present application provides a code stream, which includes QP residual coding data of a non-private CU in a coding unit quantization parameter CU QP group and a first identifier, wherein the first identifier indicates the number of encoded non-private CUs in the CU QP group.
[0087] According to the fourteenth aspect, the code stream further includes QP residual coding data of the private CU in the CU QP group and a second flag, where the second flag indicates the number of coded private CUs in the CU QP group.
[0088] According to the fourteenth aspect, or any implementation of the above fourteenth aspect, the code stream also includes QP residual coding data of the private CU in the CU QP group and a third identifier, where the third identifier indicates the number of all encoded CUs in the CU QP group.
[0089] In a fifteenth aspect, an embodiment of the present application further provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a code stream as in the fourteenth aspect and any one of the implementation methods of the fourteenth aspect, or stores the code stream of the thirteenth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] FIG1A is a schematic diagram illustrating an exemplary application scenario;
[0091] FIG1B is a schematic diagram of an exemplary compression frame;
[0092] FIG2A is a schematic diagram of an exemplary coding framework;
[0093] FIG2B is a schematic diagram of an exemplary decoding framework;
[0094] FIG3 is an exemplary diagram illustrating the encoding process of the quantization parameter QP;
[0095] FIG4 is an exemplary diagram illustrating a decoding process of a quantization parameter QP;
[0096] FIG5 is an exemplary diagram illustrating the encoding process of the quantization parameter QP;
[0097] FIG6 is an exemplary diagram illustrating a decoding process of a quantization parameter QP;
[0098] FIG7 is an exemplary diagram illustrating the encoding process of the quantization parameter QP;
[0099] FIG8 is an exemplary diagram illustrating a decoding process of a quantization parameter QP;
[0100] FIG9 is a schematic structural diagram of an exemplary device. DETAILED DESCRIPTION
[0101] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0102] The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0103] In the description and claims of the embodiments of this application, the terms "first" and "second" are used to distinguish different objects, rather than to describe a specific order of objects. For example, the terms "first target object" and "second target object" are used to distinguish different objects, rather than to describe a specific order of objects.
[0104] In the embodiments of this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.
[0105] In the description of the embodiments of this application, unless otherwise specified, "multiple" means two or more. For example, "multiple processing units" means two or more processing units; "multiple systems" means two or more systems.
[0106] Figure 1A is a schematic diagram of an exemplary application scenario. The application scenario shown in Figure 1A is a video surveillance scenario; it should be understood that the present application can also be applied to any scenario requiring video (or image) privacy protection, and the present application does not limit this.
[0107] 1A , illustratively, image acquisition devices can be deployed at locations such as intersections, shopping mall entrances and exits, and school gates, and the image acquisition devices can collect video data, and then transmit the collected video data to at least one terminal device through the network. For example, the video data collected by the image acquisition device deployed at the intersection can be transmitted to the smart screen, the video data collected by the image acquisition device deployed at the shopping mall entrance and exit can be transmitted to the smart screen and tablet computer, the video data collected by the image acquisition device deployed at the school gate can be transmitted to the smart screen and personal computer, and so on. After the terminal device receives the video data sent by the image acquisition device, it can store and display the video data (or the video data processed as required) to facilitate the user to monitor the monitored area.
[0108] It should be noted that in this application, the actions of the image acquisition device to collect video data, transmit video data, and the terminal device to store, process and display video data are all carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.
[0109] For example, the image acquisition device can compress (or encode) the acquired video data to obtain a code stream (also called a bit stream or bit stream), and then transmit the code stream to the terminal device to reduce the amount of transmitted data and reduce bandwidth requirements.
[0110] FIG. 1B is a schematic diagram of an exemplary compression frame.
[0111] Referring to Figure 1B, illustratively, the image acquisition device may include a camera, an encoding module (or encoder), and a sending module. Exemplarily, the encoding module may be a software module or a hardware module, and the embodiments of the present application are not limited to this. It should be understood that Figure 1B is only an example of an image acquisition device. The image acquisition device in other embodiments of the present application has more modules than those shown in Figure 1B, and the embodiments of the present application are not limited to this.
[0112] Referring to FIG1B , illustratively, the terminal device may include a display module, a decoding module (or decoder), and a receiving module. Exemplarily, the decoding module may be a software module or a hardware module, which is not limited in this embodiment of the present application. It should be understood that FIG1B is only an example of a terminal device, and terminal devices in other embodiments of the present application may have more modules than those shown in FIG1B , which is not limited in this embodiment of the present application.
[0113] Continuing with Figure 1B , the process by which an image capture device transmits raw video data captured by a camera to a terminal device for display is as follows: the camera can output the captured raw video data to the encoding module; the encoding module can then encode the raw video data to generate a bitstream, which it then outputs to the transmitting module; the transmitting module can then transmit the bitstream to the terminal device. Subsequently, the receiving module of the terminal device can receive the bitstream, which it then outputs to the decoding module; the decoding module can then decode the bitstream to generate reconstructed video data, which it then outputs to the display module, which then displays the reconstructed video data.
[0114] For example, the image acquisition device in FIG1B may be referred to as an encoding end, and the terminal device in FIG1B may be referred to as a decoding end; the encoding process of the encoding end and the decoding process of the decoding end may refer to the description of subsequent embodiments.
[0115] Figure 2A is a schematic diagram of an encoder encoding framework. The dotted line in Figure 2A represents the data flow of control parameters. For example, the control parameters may include, but are not limited to, mode decision results, coding unit (CU) division information, transform parameters, and quantization parameters (QP), etc., which are not limited in this application.
[0116] Referring to Figure 2A , for example, a frame of video data (referred to as the original image of the current frame) can be input into the blocking module. The blocking module can divide the original image of the current frame into multiple CUs according to the CU division information, and then encode each CU in sequence. The following description takes the encoding of one CU (referred to as the current CU) as an example.
[0117] For example, it can be determined whether to perform inter-frame prediction or intra-frame prediction on the current CU based on the mode decision result. When it is determined that intra-frame prediction is to be performed on the current CU, the intra-frame prediction module can search from the reconstructed block of the current frame to determine the prediction block of the current CU; then, the residual between the current CU and the prediction block of the current CU is determined (which can also be called the residual of the current CU or the image residual of the current CU). Afterwards, the transformation module transforms the residual according to the transformation parameters to obtain the transformed residual; the quantization module quantizes the transformed residual according to the quantization parameters to obtain the transformed and quantized residual; the entropy coding module performs entropy coding and other operations on the transformed and quantized residual to obtain the code stream of the current CU.
[0118] For example, when it is determined that inter-frame prediction is to be performed on the current CU, the inter-frame prediction module can perform motion search and motion estimation from the encoded frame to determine the motion vector (MV) of the current CU and the prediction block of the current CU; then, the residual between the current CU and the prediction block of the current CU is determined. After that, the transform module transforms the residual according to the transform parameters to obtain a transformed residual; the quantization module quantizes the transformed residual according to the quantization parameters to obtain a transformed and quantized residual; the entropy coding module performs entropy coding and other operations on the transformed and quantized residual to obtain the code stream of the current CU.
[0119] In addition, the control parameters may be encoded into the bitstream, wherein the control parameters may be quantized and entropy encoded to achieve encoding of the control parameters into the bitstream.
[0120] Exemplarily, a reconstruction operation can also be performed during the process of encoding the original image of the current frame to generate a reconstructed image of the current frame. Exemplarily, the inverse quantization module can inverse quantize the transformed and quantized residuals according to the quantization parameters to obtain the transformed residuals; the inverse transform module can inverse transform the transformed residuals according to the transform parameters to obtain the residuals of the current CU (wherein, the residuals obtained by inverse quantization and inverse transform are different from the residuals before transformation and quantization, and this application does not distinguish between the two in terms of name). Then, the residual of the current CU is added to the prediction block of the current CU to obtain the reconstructed block of the current CU. Afterwards, the loop filtering module can perform loop filtering on the reconstructed block of the current CU to obtain the filtered reconstructed block of the current CU and store it in the decoded image cache. In this way, the filtered reconstructed blocks of all CUs obtained by dividing the original image of the current frame can constitute the reconstructed image of the current frame.
[0121] FIG2B is a schematic diagram illustrating the decoding process of a decoder. The dotted line in FIG2B represents the data flow of control parameters. For example, the control parameters may include, but are not limited to, mode decision results, coding unit (CU) division information, transform parameters, and quantization parameters (QP), etc., which are not limited in this application.
[0122] 2B , exemplarily, the entropy decoding module can parse (also referred to as entropy decoding) the CU division information from the bitstream, and determine the current CU based on the CU division information. Then, for the current CU, the entropy decoding module can parse the mode decision result from the corresponding part of the current CU in the bitstream. When the prediction mode of the current CU is determined to be the inter-frame prediction mode according to the mode decision result, the inter-frame prediction module can perform inter-frame prediction on the current CU to obtain the prediction block of the current CU. When the mode decision result determines that the prediction mode of the current CU is the intra-frame prediction mode, the intra-frame prediction module can perform intra-frame prediction on the current CU to obtain the prediction block of the current CU.
[0123] Exemplarily, the entropy decoding module can also parse out control parameters and transformed and quantized residuals from the bitstream; then, the inverse quantization module can inverse quantize the transformed and quantized residuals according to the quantization parameters to obtain the transformed residuals; the inverse transform module can inverse transform the transformed residuals according to the transform parameters to obtain the residuals of the current CU. Then, the residual of the current CU and the prediction block of the current CU can be added to obtain the reconstructed block of the current CU; then, the loop filtering module can loop filter the reconstructed block of the current CU to obtain the filtered reconstructed block of the current CU and store it in the decoded image cache. The filtered reconstructed blocks of multiple CUs belonging to the current frame can constitute the reconstructed image of the current frame.
[0124] The following describes the encoding and decoding process of the quantization parameter QP.
[0125] For example, for video data that requires privacy protection, each frame of the video data may include one or more privacy CUs and / or one or more non-privacy CUs.
[0126] Exemplarily, a private CU contains private information, and a non-private CU does not contain private information.
[0127] Among them, private information can refer to secrets that are not willing to be disclosed or known to others (people outside a certain range), and this secret is not related to other people or social interests. In some scenarios, private information can also be called user information, which can refer to information that directly or indirectly describes the user's identity. For example, user information includes but is not limited to: user name, date of birth, ID number, address, telephone number, face, license plate number, movement posture, clothing, etc., and this application does not limit this.
[0128] The following describes the encoding and decoding processes of the quantization parameter QP of the private CU and the quantization parameter QP of the non-private CU respectively.
[0129] FIG3 shows an exemplary process of encoding the quantization parameter QP. FIG3 shows the process of encoding the quantization parameter QP of a non-privacy CU.
[0130] S301 : Determine a QP prediction value of a non-private CU to be encoded in a CU QP group according to a QP reconstruction value of an encoded non-private CU in a coding unit quantization parameter CU QP group.
[0131] Exemplarily, a CU QP group (that is, a CU-level QP group) may include multiple CUs; wherein, a CU QP group may include one or more privacy CUs and / or one or more non-privacy CUs.
[0132] Typically, to protect privacy information in video data, only decoders with low user privileges (e.g., user privileges lower than a preset privilege) are allowed to decode non-private CUs, while decoders with low user privileges are not allowed to decode private CUs. Furthermore, the present application can determine the QP prediction value of the non-private CU to be encoded in the CU QP group based on the QP reconstruction value of the encoded non-private CU in the CU QP group. In this way, the decoder can also use the same method to determine the QP prediction value of the non-private CU to be decoded in the CU QP group during the decoding process, without relying on the private CU.
[0133] S302 : Determine a QP residual of the non-private CU to be encoded according to the original QP value of the non-private CU to be encoded and the predicted QP value of the non-private CU to be encoded.
[0134] In one possible approach, the QP residual of the non-private CU to be encoded may be obtained by subtracting the QP predicted value of the non-private CU to be encoded from the QP original value of the non-private CU to be encoded.
[0135] In one possible approach, the QP residual of the non-private CU to be encoded may be obtained by subtracting the original QP value of the non-private CU to be encoded from the QP prediction value of the non-private CU to be encoded.
[0136] The original QP value of the non-private CU to be encoded may refer to the QP value used to quantize the non-private CU to be encoded, and the original QP value of the non-private CU to be encoded may also be called the QP target value of the non-private CU to be encoded.
[0137] For example, the QP residual of the non-private CU may be referred to as the deltaQP of the non-private CU.
[0138] S303 : Determine a context model corresponding to the QP residual of the non-private CU to be encoded according to the number of encoded non-private CUs in the CU QP group.
[0139] For example, the encoder can pre-store multiple context models (also known as probability models); each context model can be assigned a corresponding context model index. During the QP encoding process for the non-private CU to be encoded, a first context model index can be determined based on the number of encoded non-private CUs in the CU QP group. Then, based on the first context model index, the context model corresponding to the QP residual of the non-private CU to be encoded is selected from the multiple context models.
[0140] For example, the encoder stores four context models, whose context model indices (expressed as ctxIdxInc) are 0, 1, 2, and 3. Based on the number of encoded non-private CUs in the CU QP group (expressed as NumDeltaQp), one way to determine the context model index corresponding to the QP residual of the non-private CU to be encoded can be: ctxIdxInc = min(NumDeltaQp, 2); that is, the minimum value between the number of encoded non-private CUs in the CU QP group and 2 is selected as the first context model index.
[0141] It should be understood that modeling can also be performed during the encoding process. For example, a context model corresponding to the QP residual of the non-private CU to be encoded can be established based on the first context model index. This application does not impose any restrictions on this.
[0142] In this way, the decoding end can also determine the context model corresponding to the QP residual of the non-private CU to be decoded in this way without relying on the private CU.
[0143] S304 : Perform entropy coding on the QP residual of the non-private CU to be encoded according to the context model corresponding to the QP residual of the non-private CU to be encoded.
[0144] For example, the absolute value of the QP residual of the non-private CU to be encoded can be calculated first; then, the absolute value of the QP residual of the non-private CU to be encoded can be quantized to obtain a first quantized value; then, the first quantized value can be entropy encoded based on the context model corresponding to the QP residual of the non-private CU to be encoded. In this case, the sign (i.e., positive or negative) of the QP residual of the non-private CU to be encoded can also be encoded.
[0145] In this way, the bitstream obtained by encoding according to S301 to S304 may include the QP residual coded data of the non-private CU in the CU QP group. The QP residual coded data of the non-private CU in the CU QP group may include the coded data of the first quantization value and the coded data of the sign of the QP residual of the non-private CU.
[0146] FIG4 illustrates an exemplary decoding process of a quantization parameter QP. FIG4 illustrates the decoding process of a quantization parameter QP for a non-private CU. The decoding process in FIG4 corresponds to the encoding process in FIG3.
[0147] S401 : Receive a bitstream, where the bitstream includes QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group.
[0148] Exemplarily, after the encoding end sends the code stream to the decoding end, the decoding end may receive the code stream; the code stream may include QP residual coding data of the non-privacy CU in the CU QP group.
[0149] S402 : Determine, according to the number of decoded non-private CUs in the CU QP group, a context model corresponding to the QP residual of the non-private CU to be decoded in the CU QP group.
[0150] For example, the decoding end may pre-store multiple context models (also called probability models); each context model may be assigned a corresponding context model index. It should be noted that the context model stored at the decoding end is the same as the context model stored at the encoding end, and the context model index for the same context model at the decoding end and the encoding end is also the same.
[0151] Exemplarily, a first context model index can be determined based on the number of decoded non-private CUs in the CU QP group; then, based on the first context model index, a context model corresponding to the QP residual of the non-private CU to be decoded is selected from multiple context models.
[0152] For example, the decoding end stores four context models, and the context model indices of these four context models (which can be represented by ctxIdxInc) are 0, 1, 2, and 3. One way to determine the context model index corresponding to the QP residual of the non-private CU to be decoded based on the number of decoded non-private CUs in the CU QP group (which can be represented by NumDeltaQp) can be: ctxIdxInc = min(NumDeltaQp, 2); that is, the minimum value between the number of decoded non-private CUs in the CU QP group and 2 is selected as the first context model index.
[0153] It should be understood that modeling can also be performed during the decoding process. For example, a context model corresponding to the QP residual of the non-private CU to be decoded can be established based on the first context model index. This application does not impose any restrictions on this.
[0154] S403 , entropy decoding is performed on the QP residual coded data of the non-private CU to be decoded according to the context model corresponding to the QP residual of the non-private CU to be decoded, to obtain the QP residual of the non-private CU to be decoded.
[0155] Exemplarily, the QP residual encoding data of the to-be-decoded non-private CU in the CU QP group may include encoding data of the first quantization value and encoding data of the sign of the QP residual of the to-be-decoded non-private CU.
[0156] Exemplarily, according to the context model corresponding to the QP residual of the non-private CU to be decoded, the encoded data of the first quantization value is entropy decoded to obtain the first quantization value; then, the first quantization value can be inverse quantized to obtain the absolute value of the QP residual of the non-private CU to be decoded.
[0157] Exemplarily, the encoded data of the sign of the QP residual of the non-private CU to be decoded can be entropy decoded to obtain the sign of the QP residual of the non-private CU to be decoded; and the QP residual of the non-private CU to be decoded is determined based on the absolute value of the QP residual of the non-private CU to be decoded and the sign of the QP residual of the non-private CU to be decoded.
[0158] For example, the following method may be used: deltaQP=cu_qp_delta_sign?-cu_qp_delta_abs:cu_qp_delta_abs
[0159] Among them, deltaQP is the QP residual of the non-private CU to be decoded, cu_qp_delta_abs is the absolute value of the QP residual of the non-private CU to be decoded, and cu_qp_delta_sign is the sign of the QP residual of the non-private CU to be decoded.
[0160] S404 : Determine a QP prediction value of the non-private CU to be decoded according to the QP reconstruction value of the decoded non-private CU in the CU QP group.
[0161] For example, S404 can refer to the description of S301 and will not be repeated here. That is, the decoding end determines the QP prediction value of the non-private CU to be decoded in the same way as the encoding end determines the QP prediction value of the non-private CU to be encoded.
[0162] S405 : Add the QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded to obtain a QP reconstructed value of the non-private CU to be decoded.
[0163] Exemplarily, the QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded may be added together to obtain a QP reconstructed value of the non-private CU to be decoded.
[0164] For a decoder with only low user privileges, since the QP encoding and decoding of the non-private CU's QP by the codec only depends on the QP of the encoded / decoded non-private CU, the QP decoded by the decoder is guaranteed to be consistent with the QP encoded by the encoder. Furthermore, the QP encoding and decoding of the non-private CU's QP by the codec only depends on the number of encoded / decoded non-private CU's QPs. This ensures that the context model used by the decoder in the decoding process of the non-private CU's QP residual is the same as the context model used by the encoder in the encoding process of the non-private CU's QP residual. This ensures that the decoding process of the non-private CU's QP by the decoder is consistent with the encoding process of the non-private CU's QP by the encoder, thereby improving the reconstruction quality of the reconstructed blocks of the non-private CU.
[0165] It should be understood that the decoding process of S401 to S405 is also applicable to a terminal device with high user authority (eg, user authority higher than a preset authority) decoding the QP of a non-private CU.
[0166] In one possible approach, the encoding process of the QP of the non-private CU and the QP of the private CU can be completely decoupled, as well as the decoding process of the QP of the non-private CU and the QP of the private CU can be completely decoupled to ensure that the decoding process of the QP of the non-private CU and the QP of the private CU at the decoding end is consistent with the encoding process of the QP of the non-private CU and the QP of the private CU at the encoding end.
[0167] FIG5 is a schematic diagram illustrating an exemplary encoding process of a quantization parameter QP. FIG5 illustrates the encoding process of the quantization parameter QP of a non-private CU and the quantization parameter QP of a private CU.
[0168] S501 : Determine a QP prediction value of a non-private CU to be encoded in a CU QP group according to a QP reconstruction value of an encoded non-private CU in a coding unit quantization parameter CU QP group.
[0169] For example, when the non-private CU to be encoded is not the first CU in the CU QP group, the QP reconstructed value of the previously encoded non-private CU of the non-private CU to be encoded is used as the QP prediction value of the non-private CU to be encoded. When the non-private CU to be encoded is the first CU in the CU QP group, the QP reconstructed value of the encoded non-private CU to the left of the non-private CU to be encoded is used as the QP prediction value of the non-private CU to be encoded.
[0170] S502 : Determine a QP residual of the non-private CU to be encoded according to the original QP value of the non-private CU to be encoded and the predicted QP value of the non-private CU to be encoded.
[0171] S503 : Determine a context model corresponding to the QP residual of the non-private CU to be encoded according to the number of encoded non-private CUs in the CU QP group.
[0172] Exemplarily, the code stream includes a first identifier (which may be NumDeltaQp, and the first identifier may indicate the number of coded non-private CUs in the CU QP group); and the number of coded non-private CUs in the CU QP group may be determined according to the value of the first identifier.
[0173] For example, S502 to S503 may refer to the description of S302 to S303 above, which will not be repeated here.
[0174] S504 : Perform entropy coding on the QP residual of the non-private CU to be encoded according to the context model corresponding to the QP residual of the non-private CU to be encoded.
[0175] For example, the absolute value of the QP residual of the non-private CU to be encoded can be calculated first, and then the absolute value of the QP residual of the non-private CU to be encoded can be quantized to obtain a first quantization value. The first quantization value can include multiple bits, and different context models can be used to perform entropy coding on the multiple bits of the first quantization value.
[0176] Exemplarily, the first bit of the first quantized value may be entropy encoded according to a context model corresponding to the QP residual of the non-private CU to be encoded; and the other bits of the first quantized value may be entropy encoded using a specified context model.
[0177] Exemplarily, the designated context model may refer to the context model with context model index ctxIdxInc=3.
[0178] For example, a unary code may be used to entropy encode the QP residual of the non-private CU to be encoded according to the context model corresponding to the QP residual of the non-private CU to be encoded. It should be understood that the present application does not limit the algorithm used for entropy encoding the first quantization value.
[0179] For example, after S504 is executed, the value of the first flag may be increased by 1. Thus, when S503 is executed for the next non-private CU to be encoded, the number of encoded non-private CUs in the CU QP group may be determined according to the value of the first flag.
[0180] S505 : Determine a QP prediction value of a to-be-encoded private CU in the CU QP group according to the QP reconstruction value of the encoded private CU in the CU QP group.
[0181] Typically, a decoding end with high user privileges can decode both non-private CUs and private CUs. To decouple the encoding and decoding processes of the QP of non-private CUs and the QP of private CUs, the present application can determine the QP prediction value of the private CU to be encoded in the CU QP group based solely on the QP reconstruction value of the encoded private CU in the CU QP group. In this way, the decoding end can also use the same method to determine the QP prediction value of the private CU to be encoded in the CU QP group during the decoding process, without relying on the non-private CU.
[0182] For example, when the private CU to be encoded is not the first CU in the CU QP group, the QP reconstructed value of the previously encoded private CU is used as the QP prediction value of the private CU to be encoded. When the private CU to be encoded is the first CU in the CU QP group, the QP reconstructed value of the previously encoded private CU to the left of the private CU to be encoded in the CU QP group is used as the QP prediction value of the private CU to be encoded.
[0183] S506 : Determine a QP residual of the private CU to be encoded according to the original QP value of the private CU to be encoded and the predicted QP value of the private CU to be encoded.
[0184] In one possible approach, the QP residual of the private CU to be encoded may be obtained by subtracting the QP predicted value of the private CU to be encoded from the QP original value of the private CU to be encoded.
[0185] In one possible approach, the QP residual of the private CU to be encoded may be obtained by subtracting the original QP value of the private CU to be encoded from the QP prediction value of the private CU to be encoded.
[0186] The original QP value of the to-be-encoded private CU may refer to a QP value used to quantize the to-be-encoded private CU, and the original QP value of the to-be-encoded private CU may also be referred to as a QP target value of the to-be-encoded private CU.
[0187] S507 : Determine, according to the number of coded private CUs in the CU QP group, a context model corresponding to the QP residual of the to-be-coded private CU in the CU QP group.
[0188] For example, the encoding end can pre-store multiple context models (also called probability models); each context model can be set with a corresponding context model index; the second context model index can be determined based on the number of encoded privacy CUs in the CU QP group; then, based on the second context model index, the context model corresponding to the QP residual of the to-be-encoded privacy CU is selected from the multiple context models.
[0189] For example, the encoder stores four context models, whose context model indices (expressed as ctxIdxInc) are 0, 1, 2, and 3, respectively. Based on the number of encoded private CUs in the CU QP group (expressed as NumDeltaQpPrivacy), one way to determine the context model index corresponding to the QP residual of the private CU to be encoded can be: ctxIdxInc = min(NumDeltaQpPrivacy, 2); that is, the minimum value between the number of encoded private CUs in the CU QP group and 2 is selected as the second context model index.
[0190] It should be understood that modeling can also be performed during the encoding process. For example, a context model corresponding to the QP residual of the to-be-encoded private CU can be established based on the second context model index. This application does not impose any restrictions on this.
[0191] In this way, the decoding end can also determine the context model corresponding to the QP residual of the private CU to be decoded in this way without relying on the non-private CU.
[0192] Exemplarily, the code stream includes a second identifier (which may be NumDeltaQpPrivacy, and the second identifier may indicate the number of encoded privacy CUs in the CU QP group); and the number of encoded privacy CUs in the CU QP group may be determined according to the value of the second identifier.
[0193] S508 : Perform entropy coding on the QP residual of the private CU to be coded according to the context model corresponding to the QP residual of the private CU to be coded.
[0194] For example, the absolute value of the QP residual of the to-be-encoded private CU can be calculated first; then, the absolute value of the QP residual of the to-be-encoded private CU can be quantized to obtain a second quantized value. The second quantized value can include multiple bits, and different context models can be used to perform entropy coding on the multiple bits of the first quantized value.
[0195] For example, the first bit of the second quantized value may be entropy encoded according to a context model corresponding to the QP residual of the privacy CU to be encoded; and the other bits of the second quantized value may be entropy encoded using a specified context model.
[0196] For example, a unary code can be used to entropy encode the QP residual of the private CU to be encoded according to the context model corresponding to the QP residual of the private CU to be encoded. It should be understood that the present application does not limit the algorithm used for entropy encoding the second quantization value.
[0197] For example, after S508 is executed, the value of the second flag may be increased by 1. Thus, when S507 is executed for the next private CU to be encoded, the number of encoded private CUs in the CU QP group may be determined according to the value of the second flag.
[0198] The following is a brief description of the encoding process of the non-private CU.
[0199] Intra-frame mode and inter-frame motion information derivation:
[0200] When deriving the intra prediction mode for a non-private CU, if the reference location is a private area, the location is set to unavailable;
[0201] When inferring inter-frame motion information for a non-private CU, if the referenced spatial position or temporal position (TMVP) is a privacy region, the position is set to unavailable.
[0202] Intra-frame prediction and inter-frame prediction:
[0203] When performing intra prediction on a non-private CU, if the reference pixel position is located in the private area, the reference pixel is set to unavailable;
[0204] When performing inter-frame prediction on a non-private CU, if the reference pixel is located in the private region, the reference pixel is set to the median value, where the median value refers to the average of the maximum and minimum pixel values.
[0205] Loop filtering:
[0206] Deblocking filter (DBK) module: The boundary between the privacy CU and the non-privacy CU is not filtered (the pixels on both sides of the boundary are not filtered).
[0207] Adaptive Loop Filter (ALF) module: When filtering a non-private CU, if the reference pixel of the pixel to be filtered exists within the privacy region, filtering of that pixel is skipped. The boundary between the non-private CU and the privacy CU is not filtered.
[0208] Sample Adaptive Offset (SAO) module: When filtering a non-private CU, if the reference pixel of the pixel to be filtered exists within the privacy region, filtering of that pixel is skipped. The boundary between the non-private CU and the privacy CU is not filtered.
[0209] Entropy coding process:
[0210] A first entropy encoder is used to entropy encode the image of the non-private CU (for example, the image residual of the CU) to obtain a non-private VCL NALU (Video Coding Layer, video coding layer; network abstract layer unit). A second entropy encoder is used to entropy encode the image of the private CU (or the image residual of the private CU) to obtain a private VCL NALU.
[0211] It should be noted that the first entropy encoder may be used to perform S504, and the second entropy encoder may be used to perform S508. The difference between the first entropy encoder and the second entropy encoder is that the upper and lower models stored are different.
[0212] Illustratively, the code stream obtained by encoding according to the encoding method of S501 to S508 may include a non-privacy VCL NALU (Video Coding Layer, video coding layer; Network abstract layer unit, network abstract layer unit) and a privacy VCL NALU.
[0213] Exemplarily, in the process of encoding according to the encoding method of S501 to S508, non-image coding data, such as some high-level syntax (such as sequence parameter set (Sequence Parameter Set, SPS) picture parameter set (Picture Parameter Set, PPS), picture header (Picture Header, PH), can also be encoded to obtain NON-VCL NALU.
[0214] That is, the code stream obtained by encoding at the encoding end may include privacy VCL NALU, non-privacy VCL NALU and NON-VCL NALU.
[0215] Exemplarily, the non-private VCL NALU may include image residual coding data of the non-private CU (obtained by encoding the image residual of the non-private CU), QP residual coding data of the non-private CU (such as cu_qp_delta_abs of the non-private CU and cu_qp_delta_sign of the non-private CU), and a first identifier.
[0216] For example, the private VCL NALU may include the image residual coding data of the private CU (obtained by encoding the image residual of the private CU), the QP residual coding data of the private CU (such as cu_qp_delta_abs of the private CU and cu_qp_delta_sign of the private CU), and the second flag.
[0217] For example, different non-private CUs belonging to the same CU QP group may be located in different non-private VCL NALUs.
[0218] For example, different privacy CUs belonging to the same CU QP group may be located in different privacy VCL NALUs.
[0219] Exemplarily, the NALU header of the VCL NALU includes a fourth identifier, and the fourth identifier indicates whether the VCL NALU is a privacy VCL NALU or a non-privacy VCL NALU.
[0220] Exemplarily, the VCL NALU also includes the CU's QP residual coding data and the CU's image residual coding data. The non-private VCL NALU also includes a fifth flag, where the fifth flag indicates whether the CU is located in a privacy region. In addition, the non-private VCL NALU may also include parameters such as filtering parameters. For details, please refer to the description in the AVS 3 standard, and this application does not impose any restrictions on this.
[0221] For example, the definition of the coding tree in the code stream obtained by encoding according to the encoding method of S501 to S508 can be shown in the following Table 1:
[0222] Table 1 Coding tree definition
[0223] NumDeltaQp
[0224] It can be called the first flag, indicating the number of coded non-privacy CUs in a CU QP group.
[0225] NumDeltaQpPrivacy
[0226] It can be called the second flag, indicating the number of coded privacy CUs in a CU QP group.
[0227] The definitions of other syntax elements in Table 1 can refer to the description in the AVS 3 standard and will not be repeated here.
[0228] It should be noted that, compared with the coding tree in the prior art, the coding tree in Table 1 of this application adds NumDeltaQpPrivacy.
[0229] For example, the definition of the coding unit in the code stream obtained by encoding according to the encoding method of S501 to S508 can be shown in the following Table 2:
[0230] Table 2 Coding unit definition
[0231] cu_qp_delta_abs
[0232] Indicates the absolute value of the QP residual of the CU.
[0233] cu_qp_delta_sign
[0234] Indicates the sign of the CU's QP residual
[0235] NumDeltaQpPrivacy
[0236] It can be called the second flag, indicating the number of coded privacy CUs in a CU QP group.
[0237] NumDeltaQp
[0238] It can be called the first flag, indicating the number of coded non-privacy CUs in a CU QP group.
[0239] The definitions of other syntax elements in Table 2 can refer to the description in the AVS 3 standard and will not be repeated here.
[0240] It should be noted that, compared with the coding unit in the prior art, the coding unit in Table 2 of this application adds NumDeltaQpPrivacy.
[0241] For example, the method of determining ctxIndexInc of cu_qp_delta_abs may be as follows:
[0242] If binIndex is 0 and PrivacyLevel is 0, then ctxIndexInc = min(NumDeltaQp, 2);
[0243] Otherwise, if binIndex is 0 and PrivacyLevel is not 0, then ctxIndexInc = min(NumDeltaQpPrivacy, 2);
[0244] Otherwise, ctxIndexInc is equal to 3.
[0245] The definitions of binIndex and PrivacyLevel can refer to the description in the AVS 3 standard and will not be repeated here.
[0246] Figure 6 is a schematic diagram illustrating an exemplary decoding process for the quantization parameter QP. Figure 6 illustrates the decoding process for the quantization parameter QP of a non-private CU and the decoding process for the quantization parameter QP of a private CU. The decoding process in Figure 6 corresponds to the encoding process in Figure 5.
[0247] S601 : Receive a bitstream, where the bitstream includes QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group.
[0248] For example, after receiving the code stream, the decoder can first parse the NON-VCL NALU to obtain high-level syntax such as SPS, PPS, and PH. It can also parse the NALU header of the VCL NALU to obtain the fourth identifier. Then, based on the fourth identifier, it can determine the privacy VCL NALU and non-privacy VCL NALU in the code stream.
[0249] Exemplarily, a first entropy decoder may be used to parse the non-private VCL NALU to obtain a Slice / Tile / Patch Header.
[0250] Exemplarily, a first entropy decoder may be used to parse the non-private VCL NALU to obtain filtering parameters of the coding tree (eg, adaptive loop filter (ALF) parameters, sample adaptive offset (SAO) parameters, etc.).
[0251] Exemplarily, a first entropy decoder can be used to parse the non-private VCL NALU to obtain partitioning information until the partitioning is stopped (leaf node (i.e., CU)); then, a fifth identifier is obtained by parsing the non-private VCL NALU to determine whether the CU to be decoded is a non-private CU to be decoded.
[0252] If the CU is located in the privacy area and the current permission is high user permission, switch to the second entropy decoder, parse the privacy VCL NALU to obtain the information of the privacy CU, and then execute S606 to S609.
[0253] If the CU is located in the privacy area and the current permission is low user permission, the CU parsing is skipped.
[0254] If the CU is not located in the private area, the first entropy decoder is used again to parse the non-private VCL NALU to obtain the non-private CU information, and then S602 to S605 are executed.
[0255] Exemplarily, the difference between the first entropy decoder and the second entropy decoder is that the first entropy decoder and the second entropy decoder store different context models. The first entropy decoder corresponds to the first entropy encoder, and the second entropy decoder corresponds to the second entropy encoder.
[0256] S602 : Determine, according to the number of decoded non-private CUs in the CU QP group, a context model corresponding to the QP residual of the non-private CU to be decoded in the CU QP group.
[0257] For example, if the CU is not located in the private area, the information of the non-private CU obtained by continuing to parse the non-private VCL NALU using the first entropy decoder may include a first identifier (NumDeltaQp); then, the number of decoded non-private CUs in the CU QP group may be determined based on the value of the first identifier.
[0258] The number of decoded non-private CUs in the CU QP group is the value of NumDeltaQp.
[0259] Exemplarily, after determining the context model corresponding to the QP residual of the non-private CU to be decoded, the first entropy decoder may perform the following S603 to S605 . For details, reference may be made to the description of S403 to S405 above, which will not be repeated here.
[0260] S603 : Perform entropy decoding on the QP residual coded data of the non-private CU to be decoded according to the context model corresponding to the QP residual of the non-private CU to be decoded, to obtain the QP residual of the non-private CU to be decoded.
[0261] S604 : Determine a QP prediction value of the non-private CU to be decoded according to the QP reconstruction value of the decoded non-private CU in the CU QP group.
[0262] S605 : Add the QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded to obtain a QP reconstructed value of the non-private CU to be decoded.
[0263] For example, after executing S605 , the value of the first flag may be increased by 1. Thus, when executing S602 for the next non-private CU to be decoded, the number of encoded non-private CUs in the CU QP group may be determined according to the value of the first flag.
[0264] S606 : Determine a context model corresponding to the QP residual of the to-be-decoded private CU according to the number of decoded private CUs in the CU QP group.
[0265] For example, if the CU is located in the privacy area and the decoding end has high user permissions, it switches to the second entropy decoder and parses the privacy VCL NALU to obtain information about the privacy CU, which may include a second identifier (NumDeltaQpPrivacy); then, the number of decoded privacy CUs in the CU QP group can be determined based on the value of the second identifier.
[0266] The number of decoded privacy CUs in the CU QP group is the value of NumDeltaQpPrivacy.
[0267] For example, after determining the context model corresponding to the QP residual of the to-be-decoded private CU, the second entropy decoder may perform the following S607 to S609 . For details, please refer to the description of S407 to S409 above, which will not be repeated here.
[0268] S607 , entropy decoding is performed on the QP residual coded data of the private CU to be decoded according to the context model corresponding to the QP residual of the private CU to be decoded, to obtain the QP residual of the private CU to be decoded.
[0269] S608 : Determine a QP prediction value of the to-be-decoded private CU according to the QP reconstruction value of the decoded private CU in the CU QP group.
[0270] S609 : Add the QP prediction value of the to-be-decoded private CU and the QP residual of the to-be-decoded private CU to obtain a QP reconstructed value of the to-be-decoded private CU.
[0271] For example, after S609 is executed, the value of the second flag may be increased by 1. Thus, when S606 is executed for the next private CU to be decoded, the number of encoded private CUs in the CU QP group may be determined according to the value of the second flag.
[0272] It should be noted that the intra-frame mode and inter-frame motion information derivation, intra-frame prediction and inter-frame prediction, and loop filtering in the decoding process of the non-private CU are similar to the intra-frame mode and inter-frame motion information derivation, intra-frame prediction and inter-frame prediction, and loop filtering in the encoding process of the non-private CU described above, and will not be repeated here.
[0273] Exemplarily, the decoding process of the non-private CU also includes an entropy decoding process and inverse quantization, inverse transformation, and reconstruction for illustration.
[0274] Dequantization, inverse transformation and reconstruction:
[0275] If the decoding end has low user privileges, the reconstructed pixels in the privacy area are set to default values.
[0276] Entropy decoding process:
[0277] The first entropy encoder is used to entropy decode the non-private VCL NALU to obtain a reconstructed block of the non-private CU. When the decoding end has high user authority, the second entropy encoder can also be used to decode the private VCL NALU to obtain a reconstructed block of the private CU.
[0278] For example, the specific implementation process of the codec determining the quantization parameter QP of the CU to be encoded / decoded (including the private CU and the non-private CU) may be as follows:
[0279] Exemplarily, the determined quantization parameter of the CU to be encoded / decoded is QPx (X is Y, Cb or Cr).
[0280] Step 1: Determine the quantization parameter CurrentQp of the CU to be encoded / decoded, which should range from 0 to (63+8×(BitDepth–8)).
[0281] If FixedQP is 0 and CuDeltaQpFlag is 1, and the coordinates of the upper-left corner of the CU to be coded are equal to (CuQpGroupX, CuQpGroupY) (i.e., the coordinates of the upper-left corner of the CU QP group to which the CU to be coded belongs), the predicted quantization parameter PreviousCuQp (i.e., the QP prediction value of the non-private CU) is initialized to the luma quantization parameter (reconstructed QP value) QPY of the coding unit A to the left of the CU to be coded (the already coded non-private CU). The PrivacyLevel of the CU to be coded is set to 0, and a determination is made as to whether coding unit A is available. If coding unit A is "unavailable," the value of PreviousCuQp is equal to PatchQp. The predicted quantization parameter PreviousCuQpPrivacy (i.e., the QP prediction value of the private CU) is initialized to the luma quantization parameter QPY of the coding unit A to the left of the CU to be coded (the already coded private CU). The PrivacyLevel of the CU to be encoded is set to 1 to determine whether the coding unit A is available. If the coding unit A is "unavailable", the value of PreviousCuQpPrivacy is equal to PatchQp.
[0282] ——If the PrivacyLevel of the CU to be encoded is 0, predCuQp is equal to PreviousCuQp; otherwise, predCuQp is equal to PreviousCuQpPrivacy.
[0283] - If FixedQP is 1 or CuDeltaQpFlag is 0, CurrentQp = ((PreviousQp + LCuDeltaQp + 64 + 8 * (BitDepth - 8)) % (64 + 8 * (BitDepth - 8))) CurrentQp.
[0284] Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and the CU to be coded contains only chroma components, CurrentQp is equal to the quantization parameter of the luma coding unit corresponding to the 4×4 sub-block in the lower right corner of the CU to be coded.
[0285] Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and CuCtp is 0, CurrentQp is equal to PreviousCuQPpredCuQp.
[0286] ——Otherwise, CurrentQp=((PreviousCuQPpredCuQp+CuDeltaQp+64+8*(BitDepth–8))%(64+8*(BitDepth–8))).
[0287] ——If PrivacyLevel is 0, set the value of PriviousCuQp to CurrentQp; otherwise, set the value of PreviousCuQpPrivacy to CurrentQp. [Update for the next CU]
[0288] The value of PreviousQp is equal to the quantization parameter QPY of the last decoded LCU. If the last decoded LCU is "unavailable" or FixedQP is equal to 1, the value of PreviousQp is equal to PatchQp. If the last decoded LCU and the CU to be encoded do not belong to the same slice, the last decoded LCU is "unavailable".
[0289] Among them, the syntax elements involved in the specific implementation process of the quantization parameter QP can be referred to the description in the AVS 3 standard and will not be repeated here.
[0290] For terminal devices with only low user privileges, since the encoding and decoding of the QP of the non-private CU by the codec only depends on the QP of the encoded / decoded non-private CU, it can be guaranteed that the QP decoded by the decoder is consistent with the QP encoded by the encoder. Furthermore, the encoding and decoding of the QP of the non-private CU by the codec only depends on the number of QPs of the encoded / decoded non-private CU. This ensures that the context model used by the decoder in the decoding process of the QP residual of the non-private CU is the same as the context model used by the encoder in the encoding process of the QP residual of the non-private CU. In this way, the decoding process of the QP of the non-private CU by the decoder and the encoding process of the QP of the non-private CU by the encoder are consistent, thereby improving the reconstruction quality of the reconstructed blocks of the non-private CU.
[0291] For terminal devices with high user privileges, the QP decoding of the private CU does not depend on the QP of the non-private CU. In this way, whether the QP of the non-private CU is lost or not, it will not affect the QP of the decoded private CU. In addition, when the QP of the non-private CU is inaccurate, it will not affect the accuracy of the QP of the private CU.
[0292] In one possible approach, the encoding process of the QP of the non-private CU and the QP of the private CU can be partially decoupled, and the decoding process of the QP of the non-private CU and the QP of the private CU can be partially decoupled to ensure that the decoding process of the QP of the non-private CU and the QP of the private CU at the decoding end is consistent with the encoding process of the QP of the non-private CU and the QP of the private CU at the encoding end.
[0293] FIG7 is a schematic diagram illustrating an exemplary encoding process of a quantization parameter QP. FIG7 illustrates the encoding process of the quantization parameter QP of a non-privacy CU and the quantization parameter QP of a privacy CU.
[0294] S701 : Determine a QP prediction value of a non-private CU to be encoded in a CU QP group according to a QP reconstruction value of an encoded non-private CU in a coding unit quantization parameter CU QP group.
[0295] S702 : Determine a QP residual of the non-private CU to be encoded according to the original QP value of the non-private CU to be encoded and the predicted QP value of the non-private CU to be encoded.
[0296] S703 : Determine a context model corresponding to the QP residual of the non-private CU to be encoded according to the number of encoded non-private CUs in the CU QP group.
[0297] S704 : Perform entropy coding on the QP residual of the non-private CU to be coded according to the context model corresponding to the QP residual of the non-private CU to be coded.
[0298] For example, S701 to S704 may refer to the description of S501 to S504 above, which will not be repeated here.
[0299] S705 : Determine a QP prediction value of the to-be-encoded private CU according to the QP reconstruction values of all encoded CUs in the CU QP group.
[0300] Generally, a decoding end with high user privileges can decode both non-private CUs and private CUs. Therefore, the present application determines the QP prediction value of the private CU to be encoded in the CU QP group based on the QP reconstruction values of all encoded CUs (including encoded private CUs and encoded non-private CUs) in the CU QP group at the encoding end. In this way, the decoding end can also use the same method to determine the QP prediction value of the private CU to be decoded in the CU QP group during the decoding process.
[0301] In this case, the predicted QP value of the to-be-encoded private CU depends on the already-encoded non-private CU and / or the already-encoded private CU. This allows for more comprehensive information to be used in determining the predicted value of the to-be-encoded private CU. Consequently, the predicted QP value of the determined private CU can be made more accurate, thereby improving the reconstruction quality of the reconstructed block of the private CU.
[0302] For example, when the private CU to be encoded is not the first CU in the CU QP group, the QP reconstructed value of the coded CU preceding the private CU to be encoded (which may be a coded private CU or a coded non-private CU) is used as the QP prediction value of the private CU to be encoded. When the private CU to be encoded is the first CU in the CU QP group, the QP reconstructed value of the coded CU to the left of the private CU to be encoded in the CU QP group (which may be a coded private CU or a coded non-private CU) is used as the QP prediction value of the private CU to be encoded.
[0303] S706 : Determine a QP residual of the private CU to be encoded according to the original QP value of the private CU to be encoded and the predicted QP value of the private CU to be encoded.
[0304] For example, S706 may refer to the description of 506 above, which will not be repeated here.
[0305] S707 : Determine a context model corresponding to the QP residual of the to-be-encoded private CU according to the number of all encoded CUs in the CU QP group.
[0306] For example, the encoding end may pre-store multiple context models (also referred to as probability models); a context model index may be set corresponding to each context model; a third context model index may be determined based on the number of all encoded CUs in the CU QP group (i.e., the sum of the number of encoded privacy CUs and the number of encoded non-privacy CUs); and then, based on the third context model index, a context model corresponding to the QP residual of the to-be-encoded privacy CU is selected from the multiple context models.
[0307] For example, the encoder stores four context models, whose context model indices (expressed as ctxIdxInc) are 0, 1, 2, and 3, respectively. Based on the number of encoded CUs in the CU QP group (expressed as NumDeltaQpPrivacy), one way to determine the context model index corresponding to the QP residual of the private CU to be encoded can be: ctxIdxInc = min(NumDeltaQpPrivacy, 2); that is, the minimum value between the number of encoded CUs in the CU QP group and 2 is selected as the third context model index.
[0308] Exemplarily, the code stream includes a third identifier (which may be NumDeltaQpPrivacy, and the third identifier may indicate the number of coded CUs in the CU QP group); and then the number of coded CUs in the CU QP group may be determined according to the value of the third identifier.
[0309] It should be understood that modeling can also be performed during the encoding process. For example, a context model corresponding to the QP residual of the to-be-encoded private CU can be established based on the third context model index. This application does not impose any restrictions on this.
[0310] S708 : Perform entropy coding on the QP residual of the private CU to be coded according to the context model corresponding to the QP residual of the private CU to be coded.
[0311] For example, the absolute value of the QP residual of the to-be-encoded private CU can be calculated first; then, the absolute value of the QP residual of the to-be-encoded private CU can be quantized to obtain a third quantized value. The third quantized value can include multiple bits, and different context models can be used to perform entropy coding on the multiple bits of the first quantized value.
[0312] For example, the first bit of the third quantized value may be entropy encoded according to the context model corresponding to the QP residual of the privacy CU to be encoded; the other bits of the third quantized value may be entropy encoded using a specified context model to obtain a code stream.
[0313] For example, a unary code can be used to entropy encode the QP residual of the private CU to be encoded according to the context model corresponding to the QP residual of the private CU to be encoded. It should be understood that this application does not limit the algorithm used for entropy encoding the QP residual of the private CU.
[0314] For example, after S708 is executed, the value of the third flag may be increased by 1. Thus, when S707 is executed for the next private CU to be encoded, the number of encoded CUs in the CU QP group may be determined according to the value of the third flag.
[0315] For example, the definition of the coding tree in the code stream obtained by encoding according to the encoding method of S701 to S708 can be shown in the following Table 3:
[0316] Table 3 Coding tree definition
[0317] The definitions of the syntax elements in Table 3 can refer to the description in Table 1 and will not be repeated here.
[0318] It should be noted that, compared with the coding tree in the prior art, the coding tree in Table 3 of this application adds NumDeltaQpPrivacy.
[0319] For example, the definition of the coding unit in the code stream obtained by encoding according to the encoding method of S701 to S708 can be shown in the following Table 4:
[0320] Table 4 Coding unit definition
[0321] The definitions of the syntax elements in Table 4 can refer to the description in Table 2 and will not be repeated here.
[0322] It should be noted that, compared with the coding unit in the prior art, the coding unit in Table 4 of this application adds NumDeltaQpPrivacy.
[0323] In addition, the encoding process of the non-private CU corresponding to the embodiment of FIG7 is similar to the encoding process of the non-private CU described above, and will not be repeated here.
[0324] Figure 8 is a schematic diagram illustrating an exemplary decoding process for the quantization parameter QP. Figure 8 illustrates the decoding process for the quantization parameter QP of a non-private CU and the decoding process for the quantization parameter QP of a private CU. The decoding process in Figure 8 corresponds to the encoding process in Figure 7.
[0325] S801: Receive a bitstream, where the bitstream includes QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group.
[0326] S802 : Determine, according to the number of decoded non-private CUs in the CU QP group, a context model corresponding to the QP residual of the non-private CU to be decoded in the CU QP group.
[0327] S803 , entropy decoding is performed on the QP residual coded data of the non-private CU to be decoded according to the context model corresponding to the QP residual of the non-private CU to be decoded, to obtain the QP residual of the non-private CU to be decoded.
[0328] S804 : Determine a QP prediction value of the non-private CU to be decoded according to the QP reconstruction value of the decoded non-private CU in the CU QP group.
[0329] S805 : Add the QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded to obtain a QP reconstructed value of the non-private CU to be decoded.
[0330] For example, S801 to S805 may refer to the description of S601 to S605 above, which will not be repeated here.
[0331] S806 : Determine a context model corresponding to the QP residual of the to-be-decoded private CU according to the number of all decoded CUs in the CU QP group.
[0332] For example, if the CU is located in the privacy area and the decoding end has high user permissions, it switches to the second entropy decoder and parses the privacy VCL NALU to obtain information about the privacy CU, which may include a third identifier (NumDeltaQpPrivacy); then, the number of decoded privacy CUs in the CU QP group can be determined based on the value of the third identifier.
[0333] The number of decoded privacy CUs in the CU QP group is the value of NumDeltaQpPrivacy.
[0334] For example, after determining the context model corresponding to the QP residual of the to-be-decoded private CU, the second entropy decoder may perform the following S807 to S809 . For details, refer to the description of S407 to S409 above, which will not be repeated here.
[0335] S807 , performing entropy decoding on the QP residual coded data of the private CU to be decoded according to the context model corresponding to the QP residual of the private CU to be decoded, to obtain the QP residual of the private CU to be decoded.
[0336] S808 : Determine a QP prediction value of the to-be-decoded private CU according to the QP reconstruction values of all decoded CUs in the CU QP group.
[0337] S809 : Add the QP prediction value of the to-be-decoded private CU and the QP residual of the to-be-decoded private CU to obtain a QP reconstructed value of the to-be-decoded private CU.
[0338] For example, after S809 is executed, the value of the third flag may be increased by 1. Thus, when S806 is executed for the next private CU to be decoded, the number of encoded private CUs in the CU QP group may be determined according to the value of the third flag.
[0339] It should be noted that the decoding process of the non-private CU corresponding to the embodiment of FIG8 is similar to the decoding process of the non-private CU in the embodiment of FIG6 above, and will not be repeated here.
[0340] For example, the specific implementation process of the codec determining the quantization parameter QP of the CU to be encoded / decoded (including the private CU and the non-private CU) may be as follows:
[0341] Exemplarily, the determined quantization parameter of the CU to be encoded / decoded is QPx (X is Y, Cb or Cr).
[0342] Step 1: Determine the quantization parameter CurrentQp of the current coding unit, which should range from 0 to (63+8×(BitDepth–8)).
[0343] If FixedQP is 0 and CuDeltaQpFlag is 1, and the coordinates of the upper left corner of the current coding unit are equal to (CuQpGroupX, CuQpGroupY), the predicted quantization parameter PreviousCuQp is initialized to the luma quantization parameter QPY of the coding unit A to the left of the current coding unit that contains the luma component. The PrivacyLevel of the current coding unit is set to 0 to determine whether coding unit A is available. If coding unit A is "unavailable", the value of PreviousCuQp is equal to PatchQp. The predicted quantization parameter PreviousCuQpPrivacy is initialized to the luma quantization parameter QPY of the coding unit A to the left of the current coding unit that contains the luma component. The PrivacyLevel of the current coding unit is set to 1 to determine whether coding unit A is available. If coding unit A is "unavailable", the value of PreviousCuQpPrivacy is equal to PatchQp.
[0344] If the PrivacyLevel of the current coding unit is 0, predCuQp is equal to PreviousCuQp; otherwise, predCuQp is equal to PreviousCuQpPrivacy.
[0345] If FixedQP is 1 or CuDeltaQpFlag is 0, CurrentQp=((PreviousQp+LCuDeltaQp+64+8*(BitDepth−8))%(64+8*(BitDepth−8)))CurrentQp.
[0346] Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and the current coding unit contains only chroma components, CurrentQp is equal to the quantization parameter of the luma coding unit corresponding to the 4×4 sub-block in the lower right corner of the current coding unit.
[0347] Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and CuCtp is 0, CurrentQp is equal to predCuQp.
[0348] Otherwise, CurrentQp=((predCuQp+CuDeltaQp+64+8*(BitDepth−8))%(64+8*(BitDepth−8))).
[0349] Set the value of PreviousCuQpPrivacy to CurrentQp. If PrivacyLevel is 0, set the value of PriviousCuQp to CurrentQp.
[0350] The value of PreviousQp is equal to the quantization parameter QPY of the previously decoded LCU. If the previously decoded LCU is "unavailable" or FixedQP is equal to 1, the value of PreviousQp is equal to PatchQp. If the previously decoded LCU and the current LCU do not belong to the same slice, the previously decoded LCU is "unavailable".
[0351] It should be noted that this application only encodes cu_qp_delta_abs for the CU with QP residual and containing brightness (it can be a CU containing brightness and chrominance, any component has residual, or if it is a CU containing brightness, the brightness component has residual); and when cu_qp_delta_abs is not 0, cu_qp_delta_sign is encoded again.
[0352] It should also be noted that the CU QP involved in this application can be understood as the CU-level brightness QP.
[0353] It should also be noted that this application does not limit the encoding order of the QP of the private CU and the QP of the non-private CU.
[0354] In an example, FIG9 shows a schematic block diagram of a device 900 according to an embodiment of the present application. The device 900 may include: a processor 901 and a transceiver / transceiver pin 902 , and optionally, a memory 903 .
[0355] The various components of the device 900 are coupled together via a bus 904, wherein the bus 904 includes, in addition to a data bus, a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are referred to as bus 904 in the figure.
[0356] Optionally, the memory 903 may be used to store instructions in the aforementioned method embodiment. The processor 901 may be used to execute the instructions in the memory 903 and control the receiving pin to receive a signal and control the transmitting pin to send a signal.
[0357] The apparatus 900 may be the electronic device or a chip of the electronic device in the above method embodiment.
[0358] Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0359] The present application also provides a chip including one or more interface circuits and one or more processors; the one or more processors receive or send data via the one or more interface circuits, and when the one or more processors execute computer instructions, the steps of the above-mentioned related methods are implemented. The interface circuit is a transceiver / transceiver pin 902.
[0360] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method in the above-mentioned embodiment.
[0361] This embodiment further provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer executes the above-mentioned related steps to implement the method in the above-mentioned embodiment.
[0362] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to execute the methods in the above-mentioned method embodiments.
[0363] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0364] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0365] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0366] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0367] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0368] Any content of each embodiment of this application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.
[0369] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0370] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disc (CD-ROM) or any other form of storage medium well known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0371] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer-readable storage media and communication media, wherein communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0372] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A method for decoding a quantization parameter, characterized in that: The method comprises: Receive a bitstream, where the bitstream includes QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group; Determining a first context model index according to the number of decoded non-privacy CUs in the CU QP group; Selecting, according to the first context model index, a context model corresponding to the QP residual of the non-privacy CU to be decoded in the CU QP group from multiple context models; According to the context model corresponding to the QP residual of the non-private CU to be decoded, entropy decoding is performed on the QP residual coded data of the non-private CU to be decoded to obtain the QP residual of the non-private CU to be decoded; Determining a QP prediction value of the non-private CU to be decoded according to a QP reconstruction value of a decoded non-private CU in the CU QP group; The QP prediction value of the non-private CU to be decoded and the QP residual of the non-private CU to be decoded are added to obtain a QP reconstruction value of the non-private CU to be decoded.
2. The method according to claim 1, characterized in that The bitstream also includes QP residual coding data of the private CU in the CU QP group, and the method further includes: Determining, according to the number of decoded privacy CUs in the CU QP group, a context model corresponding to the QP residual of the to-be-decoded privacy CU; According to the context model corresponding to the QP residual of the to-be-decoded private CU, entropy decoding is performed on the QP residual coded data of the to-be-decoded private CU to obtain the QP residual of the to-be-decoded private CU; Determine a QP prediction value of the to-be-decoded private CU according to a QP reconstruction value of a decoded private CU in the CU QP group; The QP prediction value of the to-be-decoded private CU and the QP residual of the to-be-decoded private CU are added to obtain a QP reconstruction value of the to-be-decoded private CU.
3. The method according to claim 2, characterized in that The determining, according to the QP reconstruction value of the decoded privacy CU in the CU QP group, the QP prediction value of the to-be-decoded privacy CU includes: When the to-be-decoded private CU is not the first CU of the CU QP group, a QP reconstruction value of a previous decoded private CU of the to-be-decoded private CU is used as a QP prediction value of the to-be-decoded private CU.
4. The method according to any one of claims 1 to 3, characterized in that: The determining, according to the QP reconstruction value of the decoded non-privacy CU in the decoding unit quantization parameter CU QP group, the QP prediction value of the to-be-decoded non-privacy CU in the CU QP group includes: When the non-private CU to be decoded is not the first CU of the CU QP group, a QP reconstruction value of a previous decoded non-private CU of the non-private CU to be decoded is used as a QP prediction value of the non-private CU to be decoded.
5. The method according to any one of claims 1 to 4, characterized in that: The determining, according to the QP reconstruction value of the decoded non-privacy CU in the decoding unit quantization parameter CU QP group, the QP prediction value of the to-be-decoded non-privacy CU in the CU QP group includes: When the non-private CU to be decoded is the first CU of the CU QP group, a QP reconstruction value of a decoded non-private CU on the left side of the non-private CU to be decoded is used as a QP prediction value of the non-private CU to be decoded.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: After entropy decoding the QP residual coded data of the to-be-decoded non-privacy CU, adding 1 to the value of the first identifier; The first identifier is used to indicate the number of decoded non-privacy CUs in the CU QP group.
7. The method according to claim 2 or 3, characterized in that: The method further comprises: After entropy decoding the QP residual coded data of the to-be-decoded privacy CU, adding 1 to the value of the second identifier; The second identifier is used to indicate the number of decoded privacy CUs in the CU QP group.
8. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 7.
9. A chip, characterized in that: It comprises one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the steps of the method as claimed in any one of claims 1 to claim 7 are executed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program runs on a computer or a processor, the computer or the processor executes the method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product comprises computer instructions, which, when executed by a computer or a processor, cause the steps of the method according to any one of claims 1 to 7 to be performed.
Citation Information
Patent Citations
Method of encoding an image including a privacy mask
CN108206951A
Image processing method, encoding device, decoding device and storage medium
CN116800965A
Quantization parameter encoding and decoding method and electronic equipment
CN118612438A
Video coding and decoding method, apparatus, device and system, and storage medium
WO2023184248A1