Quantization parameter encoding and decoding method and electronic equipment
By determining the QP prediction value and context model of non-private CU during the encoding and decoding process of video images in video surveillance, the problem of inconsistency in parameters of private CU and non-private CU is solved, and the reconstruction quality and the protection of private data are improved.
Patent Information
- Application Number
- CN202410619808.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-08
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2043-12-08
AI Technical Summary
In the existing technology, during the encoding and decoding process of video images in video surveillance, the context model selection of the quantization parameter QP-related parameters of the private CU and the non-private CU is inconsistent, which leads to inconsistency in the decoding process in low-privilege scenarios and affects 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 in the coding unit CU QP group, and determining the context model of the QP residual through the number of encoded CUs, the QP residual of the non-private CU is The difference is entropy encoded to ensure that the QP of the decoding end and the encoding end are consistent.
It improves the reconstruction quality of non-private CUs, ensures that the QP decoding process on the low-privilege decoder is consistent with the encoding process on the encoder, and enhances the protection of private data and the accuracy of reconstruction.
Smart Images

Figure CN118612438A
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202311692069.0, and the original application date is December 8, 2023. The entire contents of the original application are incorporated into this application by reference. 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 of a quantization parameter 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 the context model of the CU-level brightness QP-related parameters of the privacy CU and the non-privacy CU in the same coding unit (Coding Unit, CU) quantization parameter (Quantization Parameter, QP) group depends on the same NumDeltaQp (the number of encoded CUs in the same CU QP group). Since only the non-privacy CU is decoded in the low-authority scenario, this will cause the NumDeltaQp of the encoding and decoding process to be different, making the encoding and decoding process of the QP-related parameters of the same CU inconsistent. In addition, for the privacy CU and the non-privacy CU in the same CU QP group, the method of determining the QP prediction value is the same, and a prediction deviation is generated during decoding in the low-authority scenario, resulting in the QP decoded by the decoding end being inconsistent with the QP encoded by the encoding end. 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 (eg, video surveillance scenario) that requires video (or image) privacy protection, and the present application is not limited 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 according to a QP reconstruction value of an encoded non-private CU in a coding unit quantization parameter CU QP group; then, determining a QP residual of the non-private CU to be encoded according to 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; subsequently, determining 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; and then, performing entropy encoding 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.
[0009] In this way, for a decoding end with only low user authority (such as user authority lower than the preset authority), since the encoding and decoding of the QP of the non-privacy CU by the codec only depends on the QP of the encoded / decoded non-privacy CU, it can be ensured that the QP decoded by the decoding end is consistent with the QP encoded by the encoding end. And the encoding and decoding of the QP of the non-privacy CU by the codec only depends on the number of QPs of the encoded / decoded non-privacy CU, thereby ensuring that the context model used in the decoding process of the QP residual of the non-privacy CU and the context model used in the encoding process of the QP residual of the non-privacy CU by the encoding end are the same; in this way, the decoding process of the QP of the non-privacy CU by the decoding end and the encoding process of the QP of the non-privacy CU by the encoding end can be consistent, thereby improving the reconstruction quality of the reconstructed block of the non-privacy 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 preset authority) decoding the QP of a non-privacy CU.
[0011] Exemplarily, for video data that needs to be privacy protected, each frame of the video data may include one or more privacy CUs and / or one or more non-privacy CUs.
[0012] Exemplarily, the privacy CU contains privacy information, and the non-privacy CU does not contain privacy information.
[0013] Among them, private information may refer to secrets that are not willing to be disclosed or known to others (people outside a certain range), and this secret is irrelevant to other people and social interests. In some scenarios, private information can also be called user information, and user information can refer to information that directly or indirectly describes the identity of the user. For example, user information includes but is not limited to: user name, date of birth, ID number, address, telephone number, face, license plate number, sports 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 is quantized to obtain a first quantization value; then, the first quantization value is entropy encoded according to 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 sign) 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-privacy CU may be referred to as the deltaQP of the non-privacy CU.
[0017] Exemplarily, the syntax element corresponding to the first quantization value in the bitstream 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 the QP prediction value of the privacy CU to be encoded in the CUQP group according to the QP reconstruction value of the encoded CU in the CUQP group; then, determining the QP residual of the privacy CU to be encoded according to the QP original value of the privacy CU to be encoded and the QP prediction value of the privacy CU to be encoded; then, determining the context model corresponding to the QP residual of the privacy CU to be encoded according to the number of encoded CUs in the CUQP group; and then, entropy encoding the QP residual of the privacy CU to be encoded according to the context model corresponding to the QP residual of the privacy CU to be encoded. In this way, the QP of the privacy CU can be encoded.
[0019] It should be noted that the present application does not limit the encoding order of the QP of the privacy CU and the QP of the non-privacy CU by the encoding end.
[0020] It should be noted that the encoding of the QP of the privacy CU in this application can rely on the encoded privacy CU or the encoded non-privacy CU. Since the decoding end with high user authority can decode the QP of the privacy CU or the QP of the non-privacy CU, the decoding process of the QP of the privacy CU at the decoding end and the encoding process of the QP of the privacy CU at the encoding end can be kept consistent.
[0021] According to the first aspect, or any implementation manner of the first aspect above, determining a QP prediction value of a to-be-encoded privacy CU in a CU QP group according to a QP reconstruction value of an encoded CU in the CU QP group includes: determining a QP prediction value of the to-be-encoded privacy CU according to a QP reconstruction value of an encoded privacy CU in the CU QP group; and determining a context model corresponding to a QP residual of the to-be-encoded privacy CU according to the number of encoded CUs in the CU QP group, including: determining a context model corresponding to a QP residual of the to-be-encoded privacy CU according to the number of encoded privacy CUs in the CU QP group.
[0022] In this way, the encoding process of the QP of the non-privacy CU and the QP of the privacy CU can be completely decoupled, and the decoding process of the QP of the non-privacy CU and the QP of the privacy CU can be completely decoupled to ensure that the decoding process of the QP of the non-privacy CU and the QP of the privacy CU at the decoding end is consistent with the encoding process of the QP of the non-privacy CU and the QP of the privacy CU at the encoding end.
[0023] In addition, for terminal devices with high user rights, the QP decoding of the privacy CU does not depend on the QP of the non-privacy CU; in this way, whether the QP of the non-privacy CU is lost or not, it will not affect the QP of the decoded privacy CU; in addition, when the QP of the non-privacy CU is inaccurate, it will not affect the accuracy of the QP of the privacy CU.
[0024] According to the first aspect, or any implementation manner of the first aspect above, determining a QP prediction value of a to-be-encoded private CU in a CU QP group according to a QP reconstruction value of an encoded CU in the CU QP group includes: determining a QP prediction value of the to-be-encoded private CU according to QP reconstruction values of all encoded CUs in the CU QP group; and determining a context model corresponding to a QP residual of the to-be-encoded private CU according to the number of encoded CUs in the CU QP group, including: determining a context model corresponding to a QP residual of the to-be-encoded private CU according to the number of all encoded CUs in the CU QP group.
[0025] In this way, the encoding process of the QP of the non-privacy CU and the QP of the privacy CU can be partially decoupled, and the decoding process of the QP of the non-privacy CU and the QP of the privacy CU can be partially decoupled to ensure that the decoding process of the QP of the non-privacy CU and the QP of the privacy CU at the decoding end is consistent with the encoding process of the QP of the non-privacy CU and the QP of the privacy CU at the encoding end.
[0026] In addition, the predicted value of the QP of the to-be-encoded private CU depends on the encoded non-private CU and / or the encoded private CU; thus, the information used to determine the predicted value of the to-be-encoded private CU is more comprehensive; thus, the predicted value of the QP 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, determining the QP prediction value of the to-be-encoded private CU according to the QP reconstruction value of the encoded private CU in the CU QP group includes: when the to-be-encoded private CU is not the first CU of the CU QP group, using the QP reconstruction value of the previous encoded private CU of the to-be-encoded private CU as the QP prediction value of the to-be-encoded private CU.
[0028] According to the first aspect, or any implementation of the first aspect, determining the QP prediction value of the to-be-encoded private CU according to the QP reconstruction value of the encoded private CU in the CU QP group includes: when the to-be-encoded private CU is the first CU in the CU QP group, using the QP reconstruction value of the encoded private CU on the left side of the to-be-encoded private CU in the CU QP group as the QP prediction value of the to-be-encoded private CU.
[0029] According to the first aspect, or any implementation of the first aspect above, determining the QP prediction value of the to-be-encoded private CU according to the QP reconstruction values of all the encoded CUs in the CU QP group includes: when the to-be-encoded private CU is not the first CU of the CU QP group, using the QP reconstruction value of the previous encoded CU of the to-be-encoded private CU as the QP prediction value of the to-be-encoded private CU.
[0030] According to the first aspect, or any implementation of the first aspect above, determining the 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 includes: when the to-be-encoded private CU is the first CU of the CU QP group, using the QP reconstruction value of the encoded CU on the left side of the to-be-encoded private CU in the CU QP group as the QP prediction value of the to-be-encoded private CU.
[0031] According to the first aspect, or any implementation of the first aspect above, determining the QP prediction value of the non-private CU to be encoded in the CU QP group according to the QP reconstruction value of the encoded non-private CU in the coding unit quantization parameter CU QP group, including: when the non-private CU to be encoded is not the first CU of the CU QP group, using the QP reconstruction value of the previous 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 the QP prediction value of the non-private CU to be encoded in the CU QP group according to the QP reconstruction value of the encoded non-private CU in the coding unit quantization parameter CU QP group, including: when the non-private CU to be encoded is the first CU of the CU QP group, using the QP reconstruction value of the encoded non-private CU on the left side 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, and the first identifier indicates the number of encoded non-private CUs in the CU QP group; after entropy encoding 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, and the second identifier indicates the number of encoded privacy CUs in the CU QP group; after entropy encoding the QP residual of the encoded privacy CU, 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, and the third identifier indicates the number of all encoded CUs in the CU QP group; after entropy encoding the QP residual of the non-privacy CU to be encoded, the value of the third identifier is increased by 1; after entropy encoding the QP residual of the privacy CU to be encoded, the value of the third identifier is increased by 1.
[0038] Exemplarily, 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, which includes: first, receiving a bitstream, the bitstream including QP residual coding data of a non-private CU in a coding unit quantization parameter CU QP group; then, determining a context model corresponding to the 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; then, 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 coding data of the non-private CU to be decoded to obtain the QP residual of the non-private CU to be decoded; then, according to the QP reconstruction value of the decoded non-private CU in the CU QP group, determining the QP prediction value of the non-private CU to be decoded; 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 the QP reconstruction value of the non-private CU to be decoded.
[0041] According to the second aspect, the bitstream also includes QP residual coding data of the private CU in the CU QP group. The method also includes: determining the context model corresponding to the QP residual of the private CU to be decoded in the CU QP group according to the number of decoded CUs in the CU QP group; performing entropy decoding on the QP residual coding 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; determining the QP prediction value of the private CU to be decoded according to the QP reconstruction value of the decoded CU in the CU QP group; 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 the QP reconstruction value of the private CU to be decoded.
[0042] According to the second aspect, or any implementation manner of the second aspect above, determining a QP prediction value of a to-be-decoded private CU in the CU QP group according to a QP reconstruction value of a decoded CU in the CU QP group includes: determining a QP prediction value of the to-be-decoded private CU according to a QP reconstruction 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 according to the number of decoded CUs in the CU QP group, including: determining a context model corresponding to a QP residual of the to-be-decoded private CU according to the number of decoded private CUs in the CU QP group.
[0043] According to the second aspect, or any implementation manner of the second aspect above, determining a QP prediction value of a to-be-decoded private CU in the CU QP group according to a QP reconstruction value of a decoded CU in the CU QP group includes: determining 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; and determining a context model corresponding to a QP residual of the to-be-decoded private CU according to the number of decoded CUs in the CU QP group, including: determining a context model corresponding to a QP residual of the to-be-decoded private CU according to the number of all decoded CUs in the CU QP group.
[0044] According to the second aspect, or any implementation of the second aspect, determining the 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 includes: when the to-be-decoded private CU is not the first CU of the CU QP group, using the QP reconstruction value of the previous decoded private CU of 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, determining the 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 includes: when the to-be-decoded private CU is the first CU in the CU QP group, using the QP reconstruction value of the decoded private CU on the left side 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, the QP prediction value of the to-be-decoded private CU is determined according to the QP reconstruction values of all decoded CUs in the CU QP group, including: when the to-be-decoded private CU is not the first CU of the CU QP group, the QP reconstruction value of the previous decoded CU of the to-be-decoded private CU is used 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, the QP prediction value of the to-be-decoded private CU is determined according to the QP reconstruction values of all decoded CUs in the CU QP group, including: when the to-be-decoded private CU is the first CU in the CU QP group, the QP reconstruction value of the decoded CU on the left side of the to-be-decoded private CU in the CU QP group is used 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 the QP prediction value of the non-private CU to be decoded in the CU QP group according to the QP reconstruction value of the decoded non-private CU in the decoding unit quantization parameter CU QP group, including: when the non-private CU to be decoded is not the first CU of the CU QP group, using the QP reconstruction value of the previous decoded non-private CU of 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 the QP prediction value of the non-private CU to be decoded in the CU QP group according to the QP reconstruction value of the decoded non-private CU in the decoding unit quantization parameter CU QP group, including: when the non-private CU to be decoded is the first CU of the CU QP group, using the QP reconstruction value of the decoded non-private CU on the left side 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 also includes a first identifier, and the method also includes: determining the number of decoded non-private CUs in the CU QP group according to the value of the first identifier; after entropy decoding the QP residual coding 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 code stream also includes a second identifier, and the method also includes: determining the number of decoded privacy CUs in the CU QP group according to the value of the second identifier; after entropy decoding the QP residual coding data of the privacy CU to be decoded, adding 1 to the value of the second identifier.
[0052] According to the second aspect, or any implementation manner of the second aspect above, the bitstream also includes a third identifier, and the method also includes: determining the number of all decoded CUs in the CU QP group according to the value of the third identifier; after entropy decoding the QP residual coding data of the non-privacy CU to be decoded, adding 1 to the value of the third identifier; after entropy decoding the QP residual coding data of the privacy CU to be decoded, adding 1 to the value of the third identifier.
[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 refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which 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, configured to determine a QP prediction value of a non-privacy CU to be encoded in a CU QP group according to a QP reconstruction value of an encoded non-privacy CU in a coding unit quantization parameter CU QP group;
[0056] A residual module, used to determine a QP residual of the non-private CU to be encoded according to the QP original value of the non-private CU to be encoded and the QP predicted value of the non-private CU to be encoded;
[0057] A first model determination module, configured to determine a context model corresponding to a QP residual of a 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 in 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 refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which 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 bitstream receiving module, used for receiving a bitstream, wherein the bitstream includes 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 used to determine a context model corresponding to a QP residual of a non-privacy CU to be decoded in the CU QP group according to the number of decoded non-privacy CUs in the CU QP group;
[0064] An entropy decoding module, configured to perform entropy decoding on the QP residual coded data of the non-private CU to be decoded according to a 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, configured to determine a QP prediction value of a non-privacy CU to be decoded according to a QP reconstruction value of a decoded non-privacy CU in a 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 reconstruction 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 in 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 refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which 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 refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
[0071] In a sixth 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 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 refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which 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 method 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 refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which 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 method 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 refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which 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, the computer or the processor executes 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 refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which 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, the computer or the processor executes 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 refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which 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 refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which 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 refer to the technical effects corresponding to the above-mentioned second aspect and any implementation of the second aspect, which 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 CUQP 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 bitstream further includes QP residual coding data of the privacy CU in the CU QP group and a second identifier, where the second identifier indicates the number of encoded privacy CUs in the CU QP group.
[0088] According to the fourteenth aspect, or any implementation of the fourteenth aspect above, the bitstream also includes QP residual coding data of the privacy CU in the CU QP group and a third identifier, and 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 a code stream of the thirteenth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] Figure 1A is a schematic diagram of an application scenario shown as an example;
[0091] Figure 1B is a schematic diagram of a compression framework shown as an example;
[0092] Figure 2A is a schematic diagram of an exemplary coding framework;
[0093] Figure 2B is a schematic diagram of an exemplary decoding framework;
[0094] Figure 3The encoding process of the quantization parameter QP is shown as an example;
[0095] Figure 4 The decoding process of the quantization parameter QP is shown as an example;
[0096] Figure 5 The encoding process of the quantization parameter QP is shown as an example;
[0097] Figure 6 The decoding process of the quantization parameter QP is shown as an example;
[0098] Figure 7 The encoding process of the quantization parameter QP is shown as an example;
[0099] Figure 8 The decoding process of the quantization parameter QP is shown as an example;
[0100] Fig. 9 Schematic diagram of the structure of the device shown as an example. DETAILED DESCRIPTION
[0101] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work 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 of 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] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0104] In the embodiments of the present application, the words "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 the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0105] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0106] Figure 1A Schematic diagram of an exemplary application scenario. Figure 1A The application scenario shown is a video surveillance scenario; it should be understood that the present application can also be applied to any scenario that requires video (or image) privacy protection, and the present application does not limit this.
[0107] Reference Figure 1A , exemplarily, image acquisition devices can be deployed at intersections, shopping mall entrances and exits, school gates and other locations, 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] Exemplarily, the image acquisition device may compress (or encode) the acquired video data to obtain a code stream (also referred to as a bit stream), and then transmit the code stream to the terminal device to reduce the amount of data transmitted and reduce bandwidth requirements.
[0110] Figure 1B A schematic diagram of a compression framework is shown as an example.
[0111] Reference Figure 1B , exemplarily, 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, which is not limited in the present application embodiment. It should be understood that, Figure 1B This is only an example of an image acquisition device. In other embodiments of the present application, the image acquisition device has a Figure 1BMore modules are shown, and the embodiments of the present application are not limited to this.
[0112] Reference Figure 1B , exemplarily, 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 the present application embodiment. It should be understood that, Figure 1B This is only an example of a terminal device. The terminal devices in other embodiments of the present application have Figure 1B More modules are shown, and the embodiments of the present application are not limited to this.
[0113] Continue to refer to Figure 1B , exemplarily, the process of the image acquisition device sending the raw video data collected by the camera to the terminal device for display is as follows: the camera can output the collected raw video data to the encoding module; then, the encoding module can encode the raw video data to obtain a code stream, and output the encoded code stream to the sending module; then, the sending module can send the code stream to the terminal device. Subsequently, the receiving module of the terminal device can receive the code stream; then, the code stream is output to the decoding module; then, the decoding module can decode the code stream to obtain reconstructed video data and output the reconstructed video data to the display module, and the display module displays the reconstructed video data.
[0114] For example, the following Figure 1B The image acquisition device is called the encoding end, and can Figure 1B The terminal device is called a decoding end; the encoding process of the encoding end and the decoding process of the decoding end can refer to the description of the subsequent embodiments.
[0115] Figure 2A A schematic diagram of the encoding framework of an encoder shown as an example. Figure 2A The dotted line in represents the data flow of the control parameters. For example, the control parameters may include but are not limited to: mode decision results, division information of coding units (CU), transform parameters and quantization parameters (QP), etc., which are not limited in the present application.
[0116] Reference Figure 2A For example, a frame of video data (which may be referred to as the original image of the current frame) may be input to the block module, and the block module may divide the original image of the current frame into multiple CUs according to the division information of the CU, and then encode each CU in turn. The following is an example of encoding a CU (referred to as the current CU).
[0117] Exemplarily, it can be determined whether to perform inter-frame prediction or intra-frame prediction for the current CU based on the mode decision result. When it is determined that intra-frame prediction is performed for 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 (also referred to as 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 bitstream of the current CU.
[0118] Exemplarily, when it is determined that the current CU is to be inter-frame predicted, 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, determine the residual between the current CU and the prediction block of the current CU. After that, 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 bitstream 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 in the process of encoding the original image of the current frame to generate a reconstructed image of the current frame. Exemplarily, the dequantization module can dequantize the transformed and quantized residuals according to the quantization parameters to obtain the transformed residuals; the inverse transformation module can inversely transform the transformed residuals according to the transformation parameters to obtain the residuals of the current CU (wherein, the residuals obtained by dequantization and inverse transformation 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 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. 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] Figure 2B FIG. 1 is a schematic diagram of a decoding process of a decoder shown as an example. Figure 2BThe dotted line in represents the data flow of the control parameters. For example, the control parameters may include but are not limited to: mode decision results, division information of coding units (CU), transform parameters and quantization parameters (QP), etc., which are not limited in the present application.
[0122] Reference Figure 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 it is determined that the prediction mode of the current CU is 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 the control parameters and the transformed and quantized residuals from the bitstream; then, the dequantization module can dequantize the transformed and quantized residuals according to the quantization parameters to obtain the transformed residuals; the inverse transformation module can inversely transform the transformed residuals according to the transformation 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 encoding and decoding process of the quantization parameter QP is described below.
[0125] Exemplarily, for video data that needs to be privacy protected, each frame of the video data may include one or more privacy CUs and / or one or more non-privacy CUs.
[0126] Exemplarily, the privacy CU contains privacy information, and the non-privacy CU does not contain privacy information.
[0127] Among them, private information may refer to secrets that are not willing to be disclosed or known to others (people outside a certain range), and this secret is irrelevant to other people and social interests. In some scenarios, private information can also be called user information, and user information can refer to information that directly or indirectly describes the identity of the user. For example, user information includes but is not limited to: user name, date of birth, ID number, address, telephone number, face, license plate number, sports posture, clothing, etc., and this application does not limit this.
[0128] The encoding and decoding processes of the quantization parameter QP of the privacy CU and the quantization parameter QP of the non-privacy CU are described below.
[0129] Figure 3 FIG. 1 is an exemplary encoding process of the quantization parameter QP. Figure 3 In the above, the encoding process of the quantization parameter QP of the non-privacy CU is described.
[0130] S301 , determining 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] Generally, in order to protect the privacy information in the video data, only the decoding end with low user authority (such as the user authority is lower than the preset authority) is allowed to decode the non-privacy CU, and the decoding end with low user authority is not allowed to decode the privacy CU. Furthermore, the present application can determine the QP prediction value of the non-privacy CU to be encoded in the CU QP group according to the QP reconstruction value of the encoded non-privacy 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 non-privacy CU to be decoded in the CU QP group during the decoding process; without relying on the privacy CU.
[0133] S302 : Determine a QP residual of the non-private CU to be encoded according to the QP original value of the non-private CU to be encoded and the QP predicted value of the non-private CU to be encoded.
[0134] In a possible manner, the QP original value of the non-private CU to be encoded may be subtracted from the QP prediction value of the non-private CU to be encoded to obtain the QP residual of the non-private CU to be encoded.
[0135] In a possible manner, the QP residual of the non-private CU to be encoded may be obtained by subtracting the QP original value of the non-private CU to be encoded from the QP prediction value of the non-private CU to be encoded.
[0136] The QP original 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 QP original value of the non-private CU to be encoded may also be referred to as the QP target value of the non-private CU to be encoded.
[0137] For example, the QP residual of the non-privacy CU may be referred to as the deltaQP of the non-privacy 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] Exemplarily, the encoding end may pre-store multiple context models (also referred to as probability models); each context model may be set to a corresponding context model index. In the process of encoding the QP of the non-private CU to be encoded, the first context model index may be determined according to the number of encoded non-private CUs in the CU QP group; then, according to 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, and the context model indexes of the four context models (which can be represented by ctxIdxInc) are 0, 1, 2, and 3. According to the number of encoded non-private CUs in the CU QP group (which can be represented by 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 is selected from the number of encoded non-private CUs in the CU QP group and 2 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-privacy CU to be encoded can be established according to the first context model index. This application does not limit 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 , entropy coding is performed 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 is quantized to obtain a first quantization value; then, the first quantization value is entropy encoded according to 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 sign) 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] Figure 4 FIG. 4 is an exemplary decoding process of the quantization parameter QP. Figure 4 In the decoding process of the quantization parameter QP of the non-privacy CU is described. Figure 4 The decoding process and Figure 3 The encoding process corresponds to .
[0147] S401, receiving 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] Exemplarily, the decoding end may pre-store multiple context models (also referred to as probability models); each context model may be set to a corresponding context model index. It should be noted that the context model stored in the decoding end is the same as the context model stored in the encoding end, and the context model index of the same context model in the decoding end and the encoding end is also the same.
[0151] Exemplarily, the first context model index can be determined according to the number of decoded non-private CUs in the CU QP group; then, according to the first context model index, the 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 4 context models, and the context model indexes of these 4 context models (which can be represented by ctxIdxInc) are 0, 1, 2 and 3. According to the number of decoded non-private CUs in the CU QP group (which can be represented by NumDeltaQp), one way to determine the context model index corresponding to the QP residual of the non-private CU to be decoded can be: ctxIdxInc = min(NumDeltaQp, 2); that is, the minimum value is selected from the number of decoded non-private CUs in the CU QP group and 2 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-privacy 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, so as 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; the QP residual of the non-private CU to be decoded is determined according to 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 may refer to the description of S301, which is not repeated here. That is, the decoding end determines the QP prediction value of the non-private CU to be decoded in the same manner 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 reconstruction 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 to obtain the QP reconstruction value of the non-private CU to be decoded.
[0164] For the decoding end with only low user rights, 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 decoding end is consistent with the QP encoded by the encoding end. And 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, thereby ensuring that the context model used in the decoding process of the QP residual of the non-private CU and the context model used in the encoding process of the QP residual of the non-private CU by the encoding end are the same; in this way, the decoding process of the QP of the non-private CU by the decoding end and the encoding process of the QP of the non-private CU by the encoding end can be consistent, thereby improving the reconstruction quality of the reconstructed block 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 a high user authority (eg, the user authority is higher than the preset authority) decoding the QP of the non-privacy CU.
[0166] In one possible approach, the encoding process of the QP of the non-privacy CU and the QP of the privacy CU can be completely decoupled, and the decoding process of the QP of the non-privacy CU and the QP of the privacy CU can be completely decoupled to ensure that the decoding process of the QP of the non-privacy CU and the QP of the privacy CU at the decoding end is consistent with the encoding process of the QP of the non-privacy CU and the QP of the privacy CU at the encoding end.
[0167] Figure 5 FIG. 1 is a schematic diagram of an exemplary encoding process of a quantization parameter QP. Figure 5 In the above, the encoding process of the quantization parameter QP of the non-privacy CU and the quantization parameter QP of the privacy CU is described.
[0168] S501 , determining 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] Exemplarily, when the non-private CU to be encoded is not the first CU of the CU QP group, the QP reconstruction value of the previous 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 of the CU QP group, the QP reconstruction value of the encoded non-private CU on 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 QP original value of the non-private CU to be encoded and the QP predicted 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 encoded non-private CUs in the CU QP group); and then the number of encoded non-private CUs in the CU QP group may be determined according to the value of the first identifier.
[0173] Exemplarily, S502 to S503 may refer to the description of S302 to S303 above, which will not be repeated here.
[0174] S504 , entropy coding is performed 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.
[0175] For example, the absolute value of the QP residual of the non-private CU to be encoded may be calculated first, and then the absolute value of the QP residual of the non-private CU to be encoded may be quantized to obtain a first quantization value. The first quantization value may include multiple bits, and different context models may be used for entropy encoding of 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-privacy 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 a context model with a context model index ctxIdxInc=3.
[0178] Exemplarily, 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] Exemplarily, after S504 is executed, the value of the first identifier 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 identifier.
[0180] S505 : Determine a QP prediction value of a to-be-encoded private CU in the CU QP group according to a QP reconstruction value of an encoded private CU in the CU QP group.
[0181] Generally, for a decoding end with high user rights, both non-privacy CU and privacy CU can be decoded. In order to decouple the encoding and decoding process of QP of non-privacy CU and QP of privacy CU, the application can determine the QP prediction value of the to-be-encoded privacy CU in the CU QP group only based on the QP reconstruction value of the encoded privacy CU in the CU QP group; in this way, the decoding end can also determine the QP prediction value of the to-be-encoded privacy CU in the CU QP group in the same way during the decoding process, without relying on the non-privacy CU.
[0182] Exemplarily, when the privacy CU to be encoded is not the first CU of the CU QP group, the QP reconstruction value of the previously encoded privacy CU of the privacy CU to be encoded is used as the QP prediction value of the privacy CU to be encoded. When the privacy CU to be encoded is the first CU of the CU QP group, the QP reconstruction value of the encoded privacy CU to the left of the privacy CU to be encoded in the CU QP group is used as the QP prediction value of the privacy CU to be encoded.
[0183] S506 : Determine a QP residual of the privacy CU to be encoded according to the QP original value of the privacy CU to be encoded and the QP predicted value of the privacy CU to be encoded.
[0184] In a possible manner, the QP original value of the privacy CU to be encoded may be subtracted from the QP prediction value of the privacy CU to be encoded to obtain the QP residual of the privacy CU to be encoded.
[0185] In a possible manner, the QP residual of the privacy CU to be encoded may be obtained by subtracting the QP original value of the privacy CU to be encoded from the QP prediction value of the privacy CU to be encoded.
[0186] The QP original value of the privacy CU to be encoded may refer to the QP value used to quantize the privacy CU to be encoded, and the QP original value of the privacy CU to be encoded may also be called the QP target value of the privacy CU to be encoded.
[0187] S507 : Determine, according to the number of coded privacy CUs in the CU QP group, a context model corresponding to the QP residual of the to-be-coded privacy CU in the CU QP group.
[0188] Exemplarily, 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; the second context model index may 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 privacy CU to be encoded is selected from the multiple context models.
[0189] For example, the encoder stores four context models, and the context model indexes of the four context models (which can be represented by ctxIdxInc) are 0, 1, 2, and 3. According to the number of encoded privacy CUs in the CU QP group (which can be represented by NumDeltaQpPrivacy), one way to determine the context model index corresponding to the QP residual of the privacy CU to be encoded can be: ctxIdxInc = min(NumDeltaQpPrivacy, 2); that is, the minimum value is selected from the number of encoded privacy CUs in the CU QP group and 2 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 privacy CU to be encoded can be established according to 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 to-be-decoded private CU in this way without relying on the non-private CU.
[0192] Exemplarily, the bitstream includes a second identifier (which may be NumDeltaQpPrivacy, and the second identifier may indicate the number of encoded privacy CUs in the CUQP group); and then the number of encoded privacy CUs in the CU QP group may be determined according to the value of the second identifier.
[0193] S508 , entropy coding is performed on the QP residual of the privacy CU to be coded according to the context model corresponding to the QP residual of the privacy CU to be coded.
[0194] For example, the absolute value of the QP residual of the privacy CU to be encoded can be calculated first, and then the absolute value of the QP residual of the privacy CU to be encoded can be quantized to obtain a second quantization value. The second quantization value can include multiple bits, and different context models can be used for entropy coding for the multiple bits of the first quantization value.
[0195] Exemplarily, 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] Exemplarily, a unary code may be used to entropy encode the QP residual of the privacy CU to be encoded according to the context model corresponding to the QP residual of the privacy 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 identifier may be increased by 1. Thus, when S507 is executed for the next privacy CU to be encoded, the number of encoded privacy CUs in the CU QP group may be determined according to the value of the second identifier.
[0198] The following is a brief description of the encoding process of the non-privacy CU.
[0199] Intra-frame mode and inter-frame motion information derivation :
[0200] When deriving the intra prediction mode for a non-privacy CU, if the reference position is a privacy area, the position is set to be unavailable;
[0201] When deriving inter-frame motion information for a non-privacy CU, if the referenced spatial position or temporal position (TMVP) is a privacy region, the position is set to be unavailable.
[0202] Intra-frame prediction and inter-frame prediction :
[0203] When performing intra prediction on a non-privacy CU, if the reference pixel position is located in the privacy area, the reference pixel is set to be unavailable;
[0204] When inter-frame prediction is performed on a non-privacy CU, if the reference pixel position is located in a privacy area, the reference pixel is set to a median value, where the median value may refer to the average of the maximum and minimum pixel values.
[0205] Loop Filter :
[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-privacy CU, if the reference pixel of the pixel to be filtered exists in the privacy area, the pixel filtering is skipped. The boundary between the non-privacy 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 in the privacy area, the pixel filtering 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-privacy CU (for example, the image residual of the CU) to obtain a non-privacy 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 privacy CU (or the image residual of the privacy CU) to obtain a privacy 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] Exemplarily, the bitstream obtained by encoding according to the encoding method of S501 to S508 may include a non-privacy VCLNALU (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 encoding data, such as some high-level syntax (such as sequence parameter set (Sequence Parameter Set, SPS) image 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] Exemplarily, the privacy VCL NALU may include image residual encoding data of the privacy CU (obtained by encoding the image residual of the privacy CU), QP residual encoding data of the privacy CU (such as cu_qp_delta_abs of the privacy CU and cu_qp_delta_sign of the privacy CU), and a second identifier.
[0217] For example, different non-private CUs belonging to the same CU QP group may be located in different non-private VCLNALUs.
[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 QP residual coding data of the CU and the image residual coding data of the CU. The non-privacy VCL NALU also includes a fifth identifier, wherein the fifth identifier indicates whether the CU is located in a privacy area. In addition, the non-privacy VCL NALU may also include parameters such as filtering parameters, which may be specifically referred to the description in the AVS 3 standard, and this application does not limit this.
[0221] Exemplarily, the definition of the coding tree in the bitstream obtained by encoding according to the encoding method of S501 to S508 may be as shown in the following Table 1:
[0222] Table 1 Coding tree definition
[0223]
[0224] NumDeltaQp
[0225] It can be called a first flag, indicating the number of coded non-privacy CUs in a CU QP group.
[0226] NumDeltaQpPrivacy
[0227] It can be called a second flag, indicating the number of coded privacy CUs in a CU QP group.
[0228] 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.
[0229] 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.
[0230] Exemplarily, the definition of the coding unit in the code stream obtained by encoding according to the encoding method of S501 to S508 may be as shown in the following Table 2:
[0231] Table 2 Coding unit definition
[0232]
[0233] cu_qp_delta_abs
[0234] Indicates the absolute value of the QP residual of the CU.
[0235] cu_qp_delta_sign
[0236] Indicates the sign of the QP residual of the CU
[0237] NumDeltaQpPrivacy
[0238] It can be called a second flag, indicating the number of coded privacy CUs in a CU QP group.
[0239] NumDeltaQp
[0240] It can be called a first flag, indicating the number of coded non-privacy CUs in a CU QP group.
[0241] 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.
[0242] It should be noted that, compared with the coding unit in the prior art, the coding unit in Table 2 of the present application adds NumDeltaQpPrivacy.
[0243] Exemplarily, the method of determining ctxIndexInc of cu_qp_delta_abs may be as follows:
[0244] If binIndex is 0 and PrivacyLevel is 0, then ctxIndexInc = min(NumDeltaQp, 2);
[0245] Otherwise, if binIndex is 0 and PrivacyLevel is not 0, then ctxIndexInc = min(NumDeltaQpPrivacy, 2);
[0246] Otherwise, ctxIndexInc is equal to 3.
[0247] The definitions of binIndex and PrivacyLevel can refer to the description in the AVS 3 standard and will not be repeated here.
[0248] Figure 6 FIG. 1 is a schematic diagram of an exemplary decoding process of a quantization parameter QP. Figure 6 In the decoding process of the quantization parameter QP of the non-privacy CU and the decoding process of the quantization parameter QP of the privacy CU are described. Figure 6 The decoding process and Figure 5 The encoding process corresponds to .
[0249] S601, receiving a bitstream, where the bitstream includes QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group.
[0250] Exemplarily, after receiving the code stream, the decoder can first parse the NON-VCL NALU to obtain the high-level syntax such as SPS, PPS, and PH, and parse the NALU header of the VCL NALU to obtain the fourth identifier; then, according to the fourth identifier, determine the privacy VCL NALU and non-privacy VCL NALU in the code stream.
[0251] Exemplarily, a first entropy decoder may be used to parse a non-privacy VCL NALU to obtain a Slice / Tile / Patch Header.
[0252] Exemplarily, a first entropy decoder may be used to parse the non-privacy VCL NALU to obtain filtering parameters of the coding tree (eg, adaptive loop filter (ALF) parameters, sampling adaptive offset (SAO) parameters, etc.).
[0253] Exemplarily, a first entropy decoder can be used to parse the non-privacy VCL NALU to obtain the partition information until the partition is stopped (leaf node (i.e., CU)); then a fifth identifier is parsed from the non-privacy VCL NALU to determine whether the CU to be decoded is a non-privacy CU to be decoded.
[0254] If the CU is located in the privacy area and the current permission is a high user permission, switch to the second entropy decoder, parse the privacy VCLNALU to obtain the information of the privacy CU, and then execute S606 to S609.
[0255] If the CU is located in the privacy area and the current permission is low user permission, the CU parsing is skipped.
[0256] If the CU is not located in the privacy area, the first entropy decoder is used again to parse the non-privacy VCL NALU to obtain the information of the non-privacy CU, and then S602 to S605 are executed.
[0257] 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.
[0258] 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.
[0259] Exemplarily, if the CU is not located in the privacy area, the information of the non-privacy CU obtained by parsing the non-privacy VCL NALU using the first entropy decoder may include a first identifier (NumDeltaQp); then, the number of decoded non-privacy CUs in the CU QP group may be determined according to the value of the first identifier.
[0260] The number of decoded non-privacy CUs in the CU QP group is the value of NumDeltaQp.
[0261] Exemplarily, after determining the context model corresponding to the QP residual of the non-privacy CU to be decoded, the first entropy decoder may perform the following S603 to S605, and the details may refer to the description of S403 to S405 above, which will not be repeated here.
[0262] S603 , 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, so as to obtain the QP residual of the non-private CU to be decoded.
[0263] 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.
[0264] 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 reconstruction value of the non-private CU to be decoded.
[0265] Exemplarily, after S605 is executed, the value of the first identifier may be increased by 1. Thus, when S602 is executed 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 identifier.
[0266] 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.
[0267] Exemplarily, if the CU is located in the privacy area and the decoding end has high user authority, it switches to the second entropy decoder, parses the privacy VCL NALU to obtain the information of 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 according to the value of the second identifier.
[0268] The number of decoded privacy CUs in the CU QP group is the value of NumDeltaQpPrivacy.
[0269] Exemplarily, after determining the context model corresponding to the QP residual of the to-be-decoded privacy CU, the second entropy decoder may perform the following S607 to S609, for which reference may be made to the description of S407 to S409 above, which will not be repeated herein.
[0270] S607 , entropy decoding is performed on the QP residual coded data of the to-be-decoded private CU according to the context model corresponding to the QP residual of the to-be-decoded private CU to obtain the QP residual of the to-be-decoded private CU.
[0271] 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.
[0272] S609 , adding 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 reconstruction value of the to-be-decoded private CU.
[0273] Exemplarily, after S609 is executed, the value of the second identifier may be increased by 1. Thus, when S606 is executed for the next privacy CU to be decoded, the number of encoded privacy CUs in the CU QP group may be determined according to the value of the second identifier.
[0274] 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 mentioned above, and will not be repeated here.
[0275] Exemplarily, the decoding process of the non-privacy CU also includes an entropy decoding process and inverse quantization, inverse transformation and reconstruction for illustration.
[0276] Dequantization, inverse transformation and reconstruction:
[0277] If the decoding end has low user authority, the reconstructed pixels in the privacy area are set to default values.
[0278] Entropy decoding process:
[0279] The first entropy encoder is used to entropy decode the non-privacy VCL NALU to obtain a reconstructed block of the non-privacy CU; when the decoding end has high user authority, the second entropy encoder can also be used to decode the privacy VCL NALU to obtain a reconstructed block of the privacy CU.
[0280] Exemplarily, 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:
[0281] Exemplarily, the determined quantization parameter of the CU to be encoded / decoded is QPx (X is Y, Cb or Cr).
[0282] Step 1: Determine the quantization parameter CurrentQp of the CU to be encoded / decoded, and its value range should be 0 to (63+8×(BitDepth–8)).
[0283] -- If FixedQP is 0 and CuDeltaQpFlag is 1, and the coordinates of the upper left corner of the CU to be encoded 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 encoded belongs), the predicted quantization parameter (i.e., the QP prediction value of the non-privacy CU) PreviousCuQp is initialized to the luminance quantization parameter (QP reconstruction value) QPY of the coding unit A (the encoded non-privacy CU) to the left of the CU to be encoded that contains the luminance component. Set the PrivacyLevel of the CU to be encoded to 0, and determine whether coding unit A is available. If coding unit A is "unavailable", the value of PreviousCuQp is equal to PatchQp. Initialize the predicted quantization parameter (i.e., the QP prediction value of the privacy CU) PreviousCuQpPrivacy to the luminance quantization parameter QPY of the coding unit A (the encoded privacy CU) to the left of the CU to be encoded that contains the luminance component. 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.
[0284] ——If the PrivacyLevel of the CU to be encoded is 0, predCuQp is equal to PreviousCuQp; otherwise, predCuQp is equal to PreviousCuQpPrivacy.
[0285] - If FixedQP is 1 or CuDeltaQpFlag is 0, CurrentQp = ((PreviousQp + LCuDeltaQp + 64 + 8 * (BitDepth - 8)) % (64 + 8 * (BitDepth - 8))) CurrentQp.
[0286] ——Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and the CU to be encoded contains only chrominance components, CurrentQp is equal to the quantization parameter of the luma coding unit corresponding to the 4×4 sub-block at the lower right corner of the CU to be encoded.
[0287] —— Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and CuCtp is 0, then CurrentQp is equal to PreviousCuQPpredCuQp.
[0288] ——Otherwise, CurrentQp=((PreviousCuQPpredCuQp+CuDeltaQp+64+8*(BitDepth–8))%(64+8*(BitDepth–8))).
[0289] ——If PrivacyLevel is 0, set the value of PriviousCuQp to CurrentQp; otherwise, set the value of PreviousCuQpPrivacy to CurrentQp. [Update for the next CU]
[0290] The value of PreviousQp is equal to the quantization parameter QPY of the last decoded maximum coding unit. If the last decoded maximum coding unit is "unavailable" or FixedQP is equal to 1, the value of PreviousQp is equal to PatchQp. If the last decoded maximum coding unit and the CU to be encoded do not belong to the same slice, the last decoded maximum coding unit is "unavailable".
[0291] Among them, the syntax elements involved in the specific implementation process of the quantization parameter QP can refer to the description in the AVS 3 standard and will not be repeated here.
[0292] 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 ensured that the QP decoded by the decoder is consistent with the QP encoded by the encoder. And 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, thereby ensuring that the context model used in the decoding process of the QP residual of the non-private CU and the context model used in the encoding process of the QP residual of the non-private CU by the encoder are the same; 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 can be consistent, thereby improving the reconstruction quality of the reconstructed block of the non-private CU.
[0293] For terminal devices with high user rights, 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.
[0294] In one possible approach, the encoding process of the QP of the non-privacy CU and the QP of the privacy CU can be partially decoupled, and the decoding process of the QP of the non-privacy CU and the QP of the privacy CU can be partially decoupled to ensure that the decoding process of the QP of the non-privacy CU and the QP of the privacy CU at the decoding end is consistent with the encoding process of the QP of the non-privacy CU and the QP of the privacy CU at the encoding end.
[0295] Figure 7 FIG. 1 is a schematic diagram of an exemplary encoding process of a quantization parameter QP. Figure 7 In the above, the encoding process of the quantization parameter QP of the non-privacy CU and the quantization parameter QP of the privacy CU is described.
[0296] S701 , determining 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.
[0297] S702 : Determine a QP residual of the non-private CU to be encoded according to the QP original value of the non-private CU to be encoded and the QP predicted value of the non-private CU to be encoded.
[0298] 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.
[0299] S704 , entropy coding is performed 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.
[0300] Exemplarily, S701 to S704 may refer to the description of S501 to S504 above, which will not be repeated here.
[0301] S705 , determining a QP prediction value of the to-be-encoded privacy CU according to the QP reconstruction values of all the encoded CUs in the CU QP group.
[0302] Generally, for a decoding end with high user authority, both non-privacy CU and privacy CU can be decoded; therefore, the present application determines the QP prediction value of the to-be-encoded privacy CU in the CU QP group according to the QP reconstruction values of all encoded CUs (including the encoded privacy CU and the encoded non-privacy CU) in the CU QP group at the encoding end; in this way, the decoding end can also determine the QP prediction value of the to-be-decoded privacy CU in the CU QP group in the same way during the decoding process.
[0303] In this case, the predicted value of the QP of the to-be-encoded private CU depends on the encoded non-private CU and / or the encoded private CU; thus, the information used to determine the predicted value of the to-be-encoded private CU is more comprehensive; thus, the predicted value of the QP of the determined private CU can be made more accurate, thereby improving the reconstruction quality of the reconstructed block of the private CU.
[0304] Exemplarily, when the privacy CU to be encoded is not the first CU of the CU QP group, the QP reconstruction value of the previous encoded CU (which may be an encoded privacy CU or an encoded non-privacy CU) of the privacy CU to be encoded is used as the QP prediction value of the privacy CU to be encoded. When the privacy CU to be encoded is the first CU of the CU QP group, the QP reconstruction value of the encoded CU (which may be an encoded privacy CU or an encoded non-privacy CU) to the left of the privacy CU to be encoded in the CU QP group is used as the QP prediction value of the privacy CU to be encoded.
[0305] S706 : Determine a QP residual of the privacy CU to be encoded according to the QP original value of the privacy CU to be encoded and the QP predicted value of the privacy CU to be encoded.
[0306] Exemplarily, S706 may refer to the description of 506 above, which will not be repeated here.
[0307] S707 : Determine a context model corresponding to the QP residual of the to-be-encoded privacy CU according to the number of all encoded CUs in the CU QP group.
[0308] Exemplarily, 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); then, based on the third context model index, a context model corresponding to the QP residual of the privacy CU to be encoded is selected from multiple context models.
[0309] For example, the encoder stores four context models, and the context model indexes of the four context models (which can be represented by ctxIdxInc) are 0, 1, 2, and 3. According to the number of encoded CUs in the CU QP group (which can be represented by NumDeltaQpPrivacy), one way to determine the context model index corresponding to the QP residual of the privacy CU to be encoded can be: ctxIdxInc = min(NumDeltaQpPrivacy, 2); that is, the minimum value is selected from the number of encoded CUs in the CU QP group and 2 as the third context model index.
[0310] Exemplarily, the bitstream includes a third identifier (which may be NumDeltaQpPrivacy, and the third identifier may indicate the number of encoded CUs in the CUQP group); and then the number of encoded CUs in the CU QP group may be determined according to the value of the third identifier.
[0311] 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 privacy CU to be encoded can be established according to the third context model index. This is not limited in the present application.
[0312] S708 , entropy encoding the QP residual of the privacy CU to be encoded according to the context model corresponding to the QP residual of the privacy CU to be encoded.
[0313] For example, the absolute value of the QP residual of the privacy CU to be encoded can be calculated first, and then the absolute value of the QP residual of the privacy CU to be encoded can be quantized to obtain a third quantization value. The third quantization value can include multiple bits, and different context models can be used for entropy coding for the multiple bits of the first quantization value.
[0314] Exemplarily, the first bit of the third quantized value may be entropy encoded according to a 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 bitstream.
[0315] Exemplarily, a unary code may be used to entropy encode the QP residual of the privacy CU to be encoded according to the context model corresponding to the QP residual of the privacy CU to be encoded. It should be understood that the present application does not limit the algorithm used for entropy encoding the QP residual of the privacy CU.
[0316] Exemplarily, after S708 is executed, the value of the third identifier may be increased by 1. Thus, when S707 is executed for the next privacy CU to be encoded, the number of encoded CUs in the CU QP group may be determined according to the value of the third identifier.
[0317] Exemplarily, the definition of the coding tree in the bitstream obtained by encoding according to the encoding method of S701 to S708 may be as shown in the following Table 3:
[0318] Table 3 Coding tree definition
[0319]
[0320]
[0321] Among them, the definition of the syntax elements in Table 3 can refer to the description in Table 1, and will not be repeated here.
[0322] 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.
[0323] Exemplarily, the definition of the coding unit in the code stream obtained by encoding according to the encoding method of S701 to S708 may be as shown in the following Table 4:
[0324] Table 4 Coding unit definition
[0325]
[0326] Among them, the definition of the syntax elements in Table 4 can refer to the description in Table 2, and will not be repeated here.
[0327] It should be noted that, compared with the coding unit in the prior art, the coding unit in Table 4 of the present application adds NumDeltaQpPrivacy.
[0328] also, Figure 7 The encoding process of the non-private CU corresponding to the embodiment is similar to the encoding process of the non-private CU described above, and will not be repeated here.
[0329] Figure 8 FIG. 1 is a schematic diagram of an exemplary decoding process of a quantization parameter QP. Figure 8 In the decoding process of the quantization parameter QP of the non-privacy CU and the decoding process of the quantization parameter QP of the privacy CU are described. Figure 8 The decoding process and Figure 7 The encoding process corresponds to .
[0330] S801, receiving a bitstream, where the bitstream includes QP residual coding data of a non-privacy CU in a coding unit quantization parameter CU QP group.
[0331] 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.
[0332] 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, so as to obtain the QP residual of the non-private CU to be decoded.
[0333] S804 , determining a QP prediction value of a non-private CU to be decoded according to a QP reconstruction value of a decoded non-private CU in the CU QP group.
[0334] S805 , 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 reconstruction value of the non-private CU to be decoded.
[0335] Exemplarily, S801 to S805 may specifically refer to the description of S601 to S605 above, which will not be repeated here.
[0336] S806 , determining 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.
[0337] Exemplarily, if the CU is located in the privacy area and the decoding end has high user authority, it switches to the second entropy decoder, parses the privacy VCL NALU to obtain the information of 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 according to the value of the third identifier.
[0338] The number of decoded privacy CUs in the CU QP group is the value of NumDeltaQpPrivacy.
[0339] Exemplarily, after determining the context model corresponding to the QP residual of the to-be-decoded privacy 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.
[0340] S807 , entropy decoding is performed on the QP residual coded data of the to-be-decoded private CU according to the context model corresponding to the QP residual of the to-be-decoded private CU to obtain the QP residual of the to-be-decoded private CU.
[0341] S808 : Determine a QP prediction value of the to-be-decoded privacy CU according to the QP reconstruction values of all decoded CUs in the CU QP group.
[0342] S809 , adding 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 reconstruction value of the to-be-decoded private CU.
[0343] Exemplarily, after S809 is executed, the value of the third identifier may be increased by 1. Thus, when S806 is executed for the next privacy CU to be decoded, the number of encoded privacy CUs in the CU QP group may be determined according to the value of the third identifier.
[0344] It should be noted that Figure 8 The decoding process of the non-privacy CU corresponding to the embodiment is the same as that described above. Figure 6 The decoding process of the non-privacy CU in the embodiment is similar and will not be repeated here.
[0345] Exemplarily, 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:
[0346] Exemplarily, the determined quantization parameter of the CU to be encoded / decoded is QPx (X is Y, Cb or Cr).
[0347] Step 1: Determine the quantization parameter CurrentQp of the current coding unit, which should range from 0 to (63+8×(BitDepth-8)).
[0348] 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 brightness quantization parameter QPY of the coding unit A to the left of the current coding unit that contains the brightness 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 brightness quantization parameter QPY of the coding unit A to the left of the current coding unit that contains the brightness 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.
[0349] If the PrivacyLevel of the current coding unit is 0, predCuQp is equal to PreviousCuQp; otherwise, predCuQp is equal to PreviousCuQpPrivacy.
[0350] If FixedQP is 1 or CuDeltaQpFlag is 0, CurrentQp=((PreviousQp+LCuDeltaQp+64+8*(BitDepth-8))%(64+8*(BitDepth-8)))CurrentQp.
[0351] Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and the current coding unit contains only chrominance components, CurrentQp is equal to the quantization parameter of the luma coding unit corresponding to the 4×4 sub-block at the lower right corner of the current coding unit.
[0352] Otherwise, if FixedQP is 0 and CuDeltaQpFlag is 1 and CuCtp is 0, CurrentQp is equal to predCuQp.
[0353] Otherwise, CurrentQp=((predCuQp+CuDeltaQp+64+8*(BitDepth−8))%(64+8*(BitDepth−8))).
[0354] Set the value of PreviousCuQpPrivacy to CurrentQp. If PrivacyLevel is 0, set the value of PriviousCuQp to CurrentQp.
[0355] The value of PreviousQp is equal to the quantization parameter QPY of the last decoded maximum coding unit. If the last decoded maximum coding unit is "unavailable" or FixedQP is equal to 1, the value of PreviousQp is equal to PatchQp. If the last decoded maximum coding unit and the current coding unit do not belong to the same slice, the last decoded maximum coding unit is "unavailable".
[0356] It should be noted that this application only encodes cu_qp_delta_abs for a CU with QP residual and containing brightness (it may be a CU containing brightness and chrominance, any component has a residual, or if it is a CU containing brightness, the brightness component has a residual); and when cu_qp_delta_abs is not 0, cu_qp_delta_sign is encoded again.
[0357] It should also be noted that the CU QP involved in this application can be understood as the CU-level brightness QP.
[0358] It should also be noted that the present application does not limit the encoding order of the QP of the privacy CU and the QP of the non-privacy CU.
[0359] In one example, Fig. 9 A schematic block diagram of a device 900 according to an embodiment of the present application is shown. The device 900 may include: a processor 901 and a transceiver / transceiver pin 902 , and optionally, a memory 903 .
[0360] The components of the device 900 are coupled together via a bus 904, wherein the bus 904 includes a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, all buses are referred to as bus 904 in the figure.
[0361] Optionally, the memory 903 may be used to store instructions in the aforementioned method embodiment. The processor 901 may be used to execute instructions in the memory 903, and control the receiving pin to receive a signal, and control the sending pin to send a signal.
[0362] The apparatus 900 may be the electronic device or a chip of the electronic device in the above method embodiment.
[0363] 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.
[0364] The embodiment of 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 through the one or more interface circuits, and when the one or more processors execute computer instructions, the above-mentioned related method steps implement the steps of the method in the above-mentioned embodiment. The interface circuit is a transceiver / transceiver pin 902.
[0365] 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.
[0366] 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.
[0367] In addition, an embodiment of the present application also provides a device, which may 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 may execute the computer-executable instructions stored in the memory so that the chip executes the methods in the above-mentioned method embodiments.
[0368] 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.
[0369] 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 assigned to 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.
[0370] In the several embodiments provided in the present 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 only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, 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.
[0371] The units described as separate components may or may not be physically separated, and the 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 different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0372] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0373] Any content of each embodiment of the present 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 the present application.
[0374] 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, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0375] 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 disk (CD-ROM) or any other form of storage medium 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.
[0376] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with 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 the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0377] 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 the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present 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 decoding 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 CUQP 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 CUQP 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 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
Video coding method and device, electronic equipment and storage medium
CN113489990A
Video coding method and device, video coding equipment and storage medium
CN113489991A
Image processing method, encoding device, decoding device and storage medium
CN116800965A
Coding and decoding method of coefficient, encoder, decoder and computer storage medium
CN116998149A
Method of encoding an image including a privacy mask
US20180174414A1
Cited By
Coding method and decoding method for quantization parameter, and electronic device
WO2025119315A1
