Video coding and decoding method, device, equipment, system and storage medium

CN118947120APending Publication Date: 2024-11-12GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280094243.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In existing video coding methods, the quantization process results in high coding costs and low coding efficiency.

Method used

By hiding the parity of the quantization coefficients and using the target context model for encoding and decoding, the number of bits required for encoding is reduced, thus improving encoding efficiency.

Benefits of technology

It effectively reduces encoding costs and improves the encoding efficiency of video compression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118947120A_ABST
    Figure CN118947120A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a video coding and decoding method and device, equipment, a system and a storage medium, and the method comprises the steps: hiding part or all parity of a second quantization coefficient in a current region through P quantization coefficients in the current region, obtaining a first quantization coefficient, and coding the first quantization coefficient, thereby reducing the number of bits required for coding, and improving the coding efficiency. And the video compression cost is reduced. In addition, the target context model is re-determined for the first quantization coefficient for encoding and decoding, so that accurate decoding of the first quantization coefficient with hidden parity can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Video encoding and decoding method, device, equipment, system and storage medium Technical Field

[0001] The present application relates to the field of video coding and decoding technology, and in particular to a video coding and decoding method, apparatus, device, system and storage medium. Background Art

[0002] Digital video technology can be incorporated into a variety of video devices, such as digital televisions, smartphones, computers, e-readers, or video players. With the development of video technology, the amount of video data included has increased. To facilitate the transmission of video data, video devices implement video compression technology to enable more efficient transmission or storage of video data.

[0003] In the video compression process, transform coefficients are quantized to facilitate encoding. The purpose of quantization is to scale the transform coefficients, thereby reducing the number of bits consumed when encoding the coefficients. However, current quantization methods have a high encoding cost.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a video encoding and decoding method, apparatus, device, system and storage medium to reduce encoding costs.

[0006] In a first aspect, the present application provides a video decoding method, comprising:

[0007] Decoding the bitstream to obtain P quantization coefficients in a current region, where the current region is a region in the current block including at least one non-zero quantization coefficient, and P is a positive integer;

[0008] determining, based on the P quantization coefficients, a parity of a parity-hidden portion of a first quantization coefficient, where the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on all or part of a second quantization coefficient in the current region;

[0009] Determining a target context model corresponding to the first quantization coefficient, and decoding the first quantization coefficient based on context coding using the target context model to obtain a decoded first quantization coefficient;

[0010] A second quantization coefficient having parity is determined according to the parity of the parity-hidden part and the decoded first quantization coefficient.

[0011] In a second aspect, an embodiment of the present application provides a video encoding method, including:

[0012] Divide the current block into N regions, where N is a positive integer;

[0013] Determine a second quantization coefficient in the current region, and perform parity hiding on part or all of the second quantization coefficient to obtain a first quantization coefficient, where the current region is a region among the N regions that includes at least one non-zero quantization coefficient;

[0014] Determine a target context model corresponding to the first quantization coefficient, use the target context model to encode the first quantization coefficient to obtain a code stream, the parity of the hidden part of the parity in the first quantization coefficient is indicated by P quantization coefficients in the current area, where P is a positive integer.

[0015] In a third aspect, the present application provides a video encoder configured to execute the method of the first aspect or its respective implementations. Specifically, the encoder includes a functional unit configured to execute the method of the first aspect or its respective implementations.

[0016] In a fourth aspect, the present application provides a video decoder for executing the method of the second aspect or its respective implementations. Specifically, the decoder includes a functional unit for executing the method of the second aspect or its respective implementations.

[0017] In a fifth aspect, a video encoder is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program, and the processor is configured to call and execute the computer program stored in the memory to execute the method of the first aspect or its respective implementations.

[0018] In a sixth aspect, a video decoder is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program, and the processor is configured to call and execute the computer program stored in the memory to perform the method of the second aspect or its respective implementations.

[0019] In a seventh aspect, a video encoding and decoding system is provided, comprising a video encoder and a video decoder. The video encoder is configured to execute the method of the first aspect or its respective implementations, and the video decoder is configured to execute the method of the second aspect or its respective implementations.

[0020] In an eighth aspect, a chip is provided for implementing the method described in any one of the first and second aspects above, or their respective implementations. Specifically, the chip includes a processor configured to load and execute a computer program from a memory, causing a device equipped with the chip to perform the method described in any one of the first and second aspects above, or their respective implementations.

[0021] In a ninth aspect, a computer-readable storage medium is provided for storing a computer program, which enables a computer to execute the method of any one of the first to second aspects or their respective implementations.

[0022] In a tenth aspect, a computer program product is provided, comprising computer program instructions, which enable a computer to execute the method of any one of the first to second aspects or their respective implementations.

[0023] In an eleventh aspect, a computer program is provided, which, when executed on a computer, enables the computer to execute the method in any one of the first to second aspects or their respective implementations.

[0024] In the twelfth aspect, a code stream is provided, including the code stream generated by any aspect of the second aspect.

[0025] Based on the above technical solution, the decoder decodes the code stream to obtain P quantization coefficients in the current area, where the current area is an area in the current block that includes at least one non-zero quantization coefficient, and P is a positive integer; based on the P quantization coefficients, the parity of the parity-hidden part of the first quantization coefficient is determined, where the first quantization coefficient is the quantization coefficient obtained after all or part of the parity of the second quantization coefficient in the current area is hidden; the target context model corresponding to the first quantization coefficient is determined, and the target context model is used to decode the first quantization coefficient based on context coding to obtain the decoded first quantization coefficient; based on the parity of the parity-hidden part and the decoded first quantization coefficient, the second quantization coefficient with parity is determined. In this embodiment of the present application, the parity of part or all of the parity of the second quantization coefficient in the current area is hidden through the P quantization coefficients in the current area to obtain the first quantization coefficient. When encoding, the first quantization coefficient is encoded, which can reduce the number of bits required for encoding and reduce the video compression cost. In addition, the embodiment of the present application re-determines the target context model for decoding the first quantization coefficient, which can achieve accurate decoding of the first quantization coefficient with parity hidden. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] FIG1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of the present application;

[0027] FIG2 is a schematic block diagram of a video encoder provided in an embodiment of the present application;

[0028] FIG3 is a schematic block diagram of a decoding framework provided in an embodiment of the present application;

[0029] 4A to 4D are schematic diagrams of the scanning sequence involved in this application;

[0030] 5A to 5C are schematic diagrams of decoded coefficients of the first quantization coefficient involved in this application;

[0031] 5D to 5F are schematic diagrams of another decoded coefficient of the first quantized coefficient involved in this application;

[0032] FIG6 is a flow chart of a video decoding method provided in an embodiment of the present application;

[0033] FIG7 is a schematic diagram of area division involved in an embodiment of the present application;

[0034] FIG8 is a schematic diagram of a scanning order of a transform block according to an embodiment of the present application;

[0035] 9A to 9C are schematic diagrams of decoded coefficients of the first quantization coefficient involved in this application;

[0036] 10A to 10C are schematic diagrams of another decoded coefficient of the first quantized coefficient involved in this application;

[0037] FIG11 is a flow chart of a video decoding method according to an embodiment of the present application;

[0038] FIG12 is a schematic diagram of a flow chart of a video encoding method provided in an embodiment of the present application;

[0039] FIG13 is a schematic diagram of a video encoding method according to an embodiment of the present application;

[0040] FIG14 is a schematic block diagram of a video decoding device provided in an embodiment of the present application;

[0041] FIG15 is a schematic block diagram of a video encoding apparatus according to an embodiment of the present application;

[0042] FIG16 is a schematic block diagram of an electronic device provided in an embodiment of the present application;

[0043] FIG17 is a schematic block diagram of a video encoding system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0045] The present application can be applied to the fields of image coding and decoding, video coding and decoding, hardware video coding and decoding, dedicated circuit video coding and decoding, real-time video coding and decoding, etc. Alternatively, the solution of the present application can be combined with other proprietary or industry standards and operate, such as ITU-TH.261, ISO / IEC MPEG-1 Visual, ITU-TH.262 or ISO / IEC MPEG-2 Visual, ITU-TH.263, ISO / IEC MPEG-4 Visual, ITU-TH.264 (also known as ISO / IEC MPEG-4 AVC), including Scalable Video Coding (SVC) and Multi-View Video Coding (MVC) extensions. It should be understood that the technology of the present application is not limited to any specific codec standard or technology.

[0046] For ease of understanding, the video encoding and decoding system involved in the embodiment of the present application is first introduced with reference to FIG1 .

[0047] FIG1 is a schematic block diagram of a video encoding and decoding system involved in an embodiment of the present application. It should be noted that FIG1 is only an example, and the video encoding and decoding system of the embodiment of the present application includes but is not limited to that shown in FIG1. ​​As shown in FIG1, the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120. The encoding device is used to encode (which can be understood as compressing) the video data to generate a code stream, and transmit the code stream to the decoding device. The decoding device decodes the code stream generated by the encoding device to obtain decoded video data.

[0048] The encoding device 110 of the embodiment of the present application can be understood as a device with a video encoding function, and the decoding device 120 can be understood as a device with a video decoding function, that is, the embodiment of the present application includes a wider range of devices for the encoding device 110 and the decoding device 120, such as smartphones, desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, car computers, etc.

[0049] In some embodiments, the encoding device 110 may transmit the encoded video data (eg, a code stream) to the decoding device 120 via a channel 130. The channel 130 may include one or more media and / or devices capable of transmitting the encoded video data from the encoding device 110 to the decoding device 120.

[0050] In one example, the channel 130 includes one or more communication media that enable the encoding device 110 to transmit the encoded video data directly to the decoding device 120 in real time. In this example, the encoding device 110 can modulate the encoded video data according to a communication standard and transmit the modulated video data to the decoding device 120. The communication media includes wireless communication media, such as radio frequency spectrum. Optionally, the communication media may also include wired communication media, such as one or more physical transmission lines.

[0051] In another example, channel 130 includes a storage medium that can store the video data encoded by encoding device 110. The storage medium includes various locally accessible data storage media, such as optical disks, DVDs, and flash memories. In this example, decoding device 120 can retrieve the encoded video data from the storage medium.

[0052] In another example, the channel 130 may include a storage server that can store the video data encoded by the encoding device 110. In this example, the decoding device 120 can download the stored encoded video data from the storage server. Alternatively, the storage server can store the encoded video data and transmit the encoded video data to the decoding device 120, such as a web server (e.g., for a website), a file transfer protocol (FTP) server, etc.

[0053] In some embodiments, the encoding device 110 includes a video encoder 112 and an output interface 113. The output interface 113 may include a modulator / demodulator (modem) and / or a transmitter.

[0054] In some embodiments, the encoding device 110 may further include a video source 111 in addition to the video encoder 112 and the input interface 113 .

[0055] The video source 111 may include at least one of a video acquisition device (eg, a video camera), a video archive, a video input interface, and a computer graphics system, wherein the video input interface is used to receive video data from a video content provider, and the computer graphics system is used to generate video data.

[0056] The video encoder 112 encodes the video data from the video source 111 to generate a bitstream. The video data may include one or more pictures or a sequence of pictures. The bitstream contains the coding information of the picture or picture sequence in the form of a bitstream. The coding information may include the coded picture data and associated data. The associated data may include a sequence parameter set (SPS), a picture parameter set (PPS), and other syntax structures. The SPS may contain parameters that apply to one or more sequences. The PPS may contain parameters that apply to one or more pictures. The syntax structure refers to a set of zero or more syntax elements arranged in a specified order in the bitstream.

[0057] The video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113. The encoded video data may also be stored in a storage medium or a storage server for subsequent reading by the decoding device 120.

[0058] In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122 .

[0059] In some embodiments, the decoding device 120 may further include a display device 123 in addition to the input interface 121 and the video decoder 122 .

[0060] The input interface 121 includes a receiver and / or a modem and can receive the encoded video data via the channel 130 .

[0061] The video decoder 122 is configured to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123 .

[0062] The decoded video data is displayed on the display device 123. The display device 123 may be integrated with the decoding device 120 or external to the decoding device 120. The display device 123 may include various display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.

[0063] In addition, Figure 1 is only an example, and the technical solution of the embodiment of the present application is not limited to Figure 1. For example, the technology of the present application can also be applied to unilateral video encoding or unilateral video decoding.

[0064] The following is an introduction to the video encoder involved in the embodiments of the present application.

[0065] FIG2 is a schematic block diagram of a video encoder according to an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression or lossless compression on an image. The lossless compression can be visually lossless or mathematically lossless.

[0066] The video encoder 200 can be applied to image data in a luminance and chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents brightness (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) for describing color and saturation. For example, in terms of color format, 4:2:0 means that every 4 pixels have 4 luminance components and 2 chrominance components (YYYYCbCr), 4:2:2 means that every 4 pixels have 4 luminance components and 4 chrominance components (YYYYCbCrCbCr), and 4:4:4 represents full pixel display (YYYYCbCrCbCrCbCrCbCr).

[0067] For example, the video encoder 200 reads video data, and for each frame of the video data, divides the frame into a number of coding tree units (CTUs). In some examples, CTB may be referred to as a "tree block", "largest coding unit" (LCU) or "coding tree block" (CTB). Each CTU may be associated with a pixel block of equal size within the image. Each pixel may correspond to a luminance (luminance or luma) sample and two chrominance (chroma) samples. Therefore, each CTU may be associated with a luminance sample block and two chroma sample blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU can be further divided into a number of coding units (CUs) for encoding. The CU may be a rectangular block or a square block. A CU can be further divided into prediction units (PUs) and transform units (TUs), allowing for separation of coding, prediction, and transform, and greater flexibility in processing. In one example, a CTU is divided into CUs using a quadtree, and a CU is divided into TUs and PUs using a quadtree.

[0068] The video encoder and video decoder can support various PU sizes. Assuming that the size of a particular CU is 2N×2N, the video encoder and video decoder can support PU sizes of 2N×2N or N×N for intra-frame prediction, and support symmetric PUs of 2N×2N, 2N×N, N×2N, N×N, or similar sizes for inter-frame prediction. The video encoder and video decoder can also support asymmetric PUs of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter-frame prediction.

[0069] In some embodiments, as shown in FIG2 , the video encoder 200 may include a prediction unit 210, a residual unit 220, a transform / quantization unit 230, an inverse transform / quantization unit 240, a reconstruction unit 250, a loop filter unit 260, a decoded image buffer 270, and an entropy coding unit 280. It should be noted that the video encoder 200 may include more, fewer, or different functional components.

[0070] Optionally, in this application, the current block may be referred to as a current coding unit (CU) or a current prediction unit (PU), etc. A prediction block may also be referred to as a predicted image block or an image prediction block, and a reconstructed image block may also be referred to as a reconstructed block or an image reconstructed image block.

[0071] In some embodiments, the prediction unit 210 includes an inter-frame prediction unit 211 and an intra-frame prediction unit 212. Because there is a strong correlation between adjacent pixels in a video frame, intra-frame prediction is used in video coding and decoding technologies to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent frames in a video, inter-frame prediction is used in video coding and decoding technologies to eliminate temporal redundancy between adjacent frames, thereby improving coding efficiency.

[0072] The inter-frame prediction unit 211 can be used for inter-frame prediction. Inter-frame prediction can refer to image information from different frames. Inter-frame prediction uses motion information to find a reference block from a reference frame and generate a prediction block based on the reference block to eliminate temporal redundancy. The frames used for inter-frame prediction can be P frames and / or B frames. P frames refer to forward-predicted frames, and B frames refer to bidirectionally predicted frames. Motion information includes the reference frame list in which the reference frame is located, the reference frame index, and the motion vector. The motion vector can be integer pixel or fractional pixel. If the motion vector is fractional pixel, interpolation filtering is required to generate the required fractional pixel block in the reference frame. Here, the integer pixel or fractional pixel block in the reference frame found based on the motion vector is called a reference block. Some technologies directly use the reference block as the prediction block, while others further process the reference block to generate a prediction block. Reprocessing the reference block to generate a prediction block can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.

[0073] The intra-frame prediction unit 212 only refers to the information of the same frame image to predict the pixel information within the current code image block to eliminate spatial redundancy. The frame used for intra-frame prediction can be an I frame. For example, as shown in Figure 5, the white 4×4 block is the current block, and the gray pixels in the left row and the upper column of the current block are the reference pixels of the current block. Intra-frame prediction uses these reference pixels to predict the current block. These reference pixels may all be available, that is, all have been encoded and decoded. Some may also be unavailable, for example, if the current block is the leftmost part of the entire frame, then the reference pixels on the left of the current block are unavailable. Or when encoding and decoding the current block, the lower left part of the current block has not been encoded and decoded, then the reference pixels on the lower left are also unavailable. For the case where reference pixels are unavailable, available reference pixels or certain values ​​or certain methods can be used for filling, or no filling can be performed.

[0074] In some embodiments, the intra prediction method further includes a multiple reference line (MRL) intra prediction method. MRL can use more reference pixels to improve coding efficiency.

[0075] There are multiple intra-frame prediction modes. H.264 uses nine intra-frame prediction modes for 4×4 blocks. Mode 0 copies the pixels above the current block vertically to the current block as the prediction value; Mode 1 copies the reference pixels to the left horizontally to the current block as the prediction value; Mode 2 (DC) uses the average of the eight points A to D and I to L as the prediction value for all points; Modes 3 to 8 copy the reference pixels to the corresponding positions in the current block at a specific angle. Because some positions in the current block cannot correspond exactly to the reference pixels, it may be necessary to use a weighted average of the reference pixels, or interpolated sub-pixels of the reference pixels.

[0076] HEVC uses planar, DC, and 33 angle modes for intra-frame prediction, for a total of 35 prediction modes. VVC uses planar, DC, and 65 angle modes for intra-frame prediction, for a total of 67 prediction modes. AVS3 uses DC, Plane, Bilinear, and 63 angle modes for intra-frame prediction, for a total of 66 prediction modes.

[0077] It should be noted that with the increase of angle modes, intra-frame prediction will be more accurate and more in line with the needs of high-definition and ultra-high-definition digital video development.

[0078] The residual unit 220 may generate a residual block for the CU based on the pixel blocks of the CU and the prediction blocks of the PUs of the CU. For example, the residual unit 220 may generate the residual block for the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel blocks of the CU and the corresponding sample in the prediction blocks of the PUs of the CU.

[0079] The transform / quantization unit 230 may quantize the transform coefficients. The transform / quantization unit 230 may quantize the transform coefficients associated with the TUs of a CU based on a quantization parameter (QP) value associated with the CU. The video encoder 200 may adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU.

[0080] The inverse transform / quantization unit 240 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.

[0081] Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to generate a reconstructed image block associated with the TU. By reconstructing the sample blocks of each TU of a CU in this manner, video encoder 200 can reconstruct the pixel blocks of the CU.

[0082] Loop filtering unit 260 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a CU.

[0083] In some embodiments, the loop filtering unit 260 includes a deblocking filtering unit, a sample adaptive offset (SAO) unit, and an adaptive loop filtering (ALF) unit.

[0084] The decoded image buffer 270 may store the reconstructed pixel blocks. The inter-prediction unit 211 may use a reference image containing the reconstructed pixel blocks to perform inter-prediction on PUs of other images. In addition, the intra-prediction unit 212 may use the reconstructed pixel blocks in the decoded image buffer 270 to perform intra-prediction on other PUs in the same image as the CU.

[0085] The entropy coding unit 280 may receive the quantized transform coefficients from the transform / quantization unit 230. The entropy coding unit 280 may perform one or more entropy coding operations on the quantized transform coefficients to generate entropy-coded data.

[0086] The basic process of video encoding involved in this application is as follows: At the encoding end, the current image is divided into blocks. For the current block, the prediction unit 210 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual unit 220 calculates a residual block based on the predicted block and the original block of the current block. This residual block is the difference between the predicted block and the original block of the current block. This residual block can also be referred to as residual information. This residual block undergoes transformation and quantization by the transform / quantization unit 230, removing information that is insensitive to the human eye and eliminating visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization unit 230 can be referred to as a time-domain residual block, and the time-domain residual block after transformation and quantization by the transform / quantization unit 230 can be referred to as a frequency residual block or a frequency-domain residual block. The entropy coding unit 280 receives the quantized transform coefficients output by the transform and quantization unit 230, performs entropy coding on the quantized transform coefficients, and outputs a bitstream. For example, the entropy coding unit 280 can eliminate character redundancy based on the target context model and probability information of the binary bitstream.

[0087] In addition, the video encoder dequantizes and inverse transforms the quantized transform coefficients output by the transform and quantization unit 230 to obtain a residual block for the current block. This residual block is then added to the prediction block for the current block to obtain a reconstructed block for the current block. As encoding progresses, reconstructed blocks corresponding to other image blocks in the current image are obtained. These reconstructed blocks are then spliced ​​together to obtain a reconstructed image of the current image. Because errors are introduced during the encoding process, the reconstructed image is filtered to reduce them. For example, ALF filtering is used to reduce the difference between the pixel values ​​of the reconstructed image and the original pixel values ​​of the pixels in the current image. The filtered reconstructed image is stored in the decoded image buffer 270 and can be used as a reference frame for inter-frame prediction for subsequent frames.

[0088] It should be noted that the block division information determined by the encoder, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, etc., are carried in the bitstream when necessary. The decoder parses the bitstream and analyzes the existing information to determine the same block division information, prediction, transform, quantization, entropy coding, loop filtering, etc. mode information or parameter information as the encoder, thereby ensuring that the decoded image obtained by the encoder and the decoder are identical.

[0089] FIG3 is a schematic block diagram of a video decoder provided in an embodiment of the present application.

[0090] 3 , the video decoder 300 includes an entropy decoding unit 310, a prediction unit 320, an inverse quantization / transformation unit 330, a reconstruction unit 340, a loop filter unit 350, and a decoded picture buffer 360. It should be noted that the video decoder 300 may include more, fewer, or different functional components.

[0091] The video decoder 300 may receive a bitstream. The entropy decoding unit 310 may parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, the entropy decoding unit 310 may parse the entropy-encoded syntax elements in the bitstream. The prediction unit 320, the inverse quantization / transform unit 330, the reconstruction unit 340, and the loop filter unit 350 may decode the video data based on the syntax elements extracted from the bitstream, thereby generating decoded video data.

[0092] In some embodiments, the prediction unit 320 includes an inter-frame prediction unit 321 and an intra-frame prediction unit 322 .

[0093] The inter-frame prediction unit 321 may perform intra-frame prediction to generate a prediction block for the PU. The inter-frame prediction unit 321 may use an intra-frame prediction mode to generate a prediction block for the PU based on the pixel blocks of spatially neighboring PUs. The inter-frame prediction unit 321 may also determine the intra-frame prediction mode of the PU based on one or more syntax elements parsed from the codestream.

[0094] The intra-frame prediction unit 322 may construct a first reference picture list (List 0) and a second reference picture list (List 1) based on syntax elements parsed from the codestream. In addition, if the PU is encoded using inter-frame prediction, the entropy decoding unit 310 may parse the motion information of the PU. The intra-frame prediction unit 322 may determine one or more reference blocks for the PU based on the motion information of the PU. The intra-frame prediction unit 322 may generate a prediction block for the PU based on the one or more reference blocks of the PU.

[0095] The inverse quantization / transform unit 330 may inversely quantize (ie, dequantize) the transform coefficients associated with the TU. The inverse quantization / transform unit 330 may use the QP value associated with the CU of the TU to determine the degree of quantization.

[0096] After inverse quantizing the transform coefficients, the inverse quantization / transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients in order to generate a residual block associated with the TU.

[0097] The reconstruction unit 340 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the pixel block of the CU. For example, the reconstruction unit 340 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.

[0098] The loop filtering unit 350 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a CU.

[0099] In some embodiments, the loop filtering unit 350 includes a deblocking filtering unit, a sample adaptive offset (SAO) unit, and an adaptive loop filtering (ALF) unit.

[0100] The video decoder 300 may store the reconstructed image of the CU in the decoded image buffer 360. The video decoder 300 may use the reconstructed image in the decoded image buffer 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.

[0101] The basic process of video decoding involved in this application is as follows: the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block, and the prediction unit 320 uses intra-frame prediction or inter-frame prediction for the current block based on the prediction information to generate a prediction block of the current block. The inverse quantization / transformation unit 330 uses the quantization coefficient matrix obtained from the code stream to inverse quantize and inverse transform the quantization coefficient matrix to obtain a residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks constitute a reconstructed image, and the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or block to obtain a decoded image. The decoded image can also be called a reconstructed image. On the one hand, the reconstructed image can be displayed by a display device, and on the other hand, it can be stored in the decoded image cache 360 ​​as a reference frame for inter-frame prediction for subsequent frames.

[0102] The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. This application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.

[0103] The following is an introduction to the quantization-related technologies involved in this application.

[0104] Quantization and inverse quantization are closely related to the coefficient coding part. The purpose of quantization is to scale the transform coefficients so as to reduce the number of bits consumed when encoding the coefficients.

[0105] In some embodiments, there is a case where transformation is skipped, and in this case, the object of quantization is the residual, that is, the residual is directly scaled and then encoded.

[0106] For example, the quantization can be achieved using the following formula (1):

[0107]

[0108] Among them, t i is the transform coefficient, qstep is the quantization step size, which is related to the quantization parameter set in the configuration file, i is the quantization coefficient, round is the rounding process, which is not limited to rounding up or rounding down, etc. The quantization process is controlled by the encoder.

[0109] For example, the following formula (2) can be used to implement inverse quantization:

[0110] t′i =q i qstep (2)

[0111] Where t′ i is the reconstructed transform coefficient. Due to the loss of accuracy caused by the rounding process, t′ i With t i are different.

[0112] Quantization reduces the precision of transform coefficients, and the loss of precision is irreversible. Encoders usually measure the cost of quantization through a rate-distortion cost function.

[0113] For example, the quantization cost is determined using the following formula (3):

[0114] J=D+λ·R=(t i -t′ i ) 2 +λ·B(q i ) (3)

[0115] Among them, B() is the encoder's estimated coding quantization coefficient q i The bits consumed.

[0116] In theory, no matter how the encoder determines q i The value of q is constant, so the encoder can decide q more freely. i Usually, the encoder will take the principle of minimizing the total cost of the current block as the basis for each q i Adjustments are made to achieve overall cost optimization. This process is called rate-distortion optimized quantization and is also widely used in video coding.

[0117] In some embodiments, the quantization coefficients can be encoded or decoded using multi-symbol arithmetic coding. Each quantization coefficient can be indicated by one or more multi-symbol identifiers. Specifically, according to the size of the quantization coefficient, it can be segmented and represented by the following multi-symbol identifiers.

[0118] Identifier 1: represents the part from 0 to 3, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identifier 1 is 3, identifier 2 needs to be further encoded / decoded.

[0119] Identifier 2: represents the part from 3 to 6, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identifier 2 is 3, identifier 3 needs to be further encoded / decoded.

[0120] Identifier 3: represents the part from 6 to 9, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identifier 3 is 3, identifier 4 needs to be further encoded / decoded.

[0121] Identifier 4: represents the part from 9 to 12, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identifier 4 is 3, identifier 5 needs to be further encoded / decoded.

[0122] ID 5: indicates the portion from 12 to 15, which consists of four symbols (0, 1, 2, 3). When the symbol of ID 5 is 3, further encoding / decoding is required for the portion greater than or equal to 15.

[0123] The portion greater than or equal to 15 uses Exponential Golomb coding / decoding and does not rely on the context model. However, identifiers 1 to 5 use the context model, with identifier 1 having a separate context model and identifiers 2-5 sharing a common context model. Furthermore, if the current coefficient is non-zero, the sign must be encoded / decoded. The encoding / decoding process for each identifier in the transform block is as follows:

[0124] First, in the scanning order from the last non-zero coefficient to the upper left corner of the transform block, the identifiers 1-5 are encoded / decoded.

[0125] Next, the signs of the non-zero coefficients and the part exceeding 15 coefficients are encoded / decoded in the order from the upper left corner of the transform block to the last non-zero coefficient. If the coefficient in the upper left corner is non-zero, the encoding / decoding of its sign is coded using the context model, and the encoding / decoding of the non-zero coefficients in the remaining positions is coded using the equal probability model.

[0126] For example, the encoding syntax is shown in Table 1 below:

[0127] Table 1

[0128]

[0129]

[0130]

[0131] In the above Table 1, S() is the multi-symbol context model coding, and L(1) is the bypass coding.

[0132] In some embodiments, as shown in Figures 4A to 4D, four scanning orders, namely Zig-Zag scan, Diagonal scan, Column scan, and Row scan, are used when encoding and decoding coefficients. The numbers in the figures represent the index of the scanning order. Since the transform can concentrate the energy in the upper left corner of the transform block, the actual coefficient decoding order is defined as the reverse scanning order, that is, starting from the first non-zero coefficient in the lower right corner of the transform block, sequential decoding is performed in the decoding order. For example, the Zig-Zag scanning order of Figure 4A is from 0, 1..., 15..., and the corresponding decoding order is... 15, 14..., 1, 0. If the first non-zero coefficient position in the decoding order is index 12, the actual decoding order of the coefficients is 12, 11,..., 1, 0.

[0133] During the coefficient decoding process, the surrounding decoded coefficient parts will be selected as references according to the different scanning orders to select the context model of the current coefficient. Taking the three scanning methods of Zig-Zag scan, Column scan and Row scan as examples, when decoding the symbol of the identification 1 part of the current coefficient, as shown in Figures 5A to 5C, the context model corresponding to identification 1 is determined based on the absolute value of the decoded coefficients around the current system that is less than or equal to 3, and the context model corresponding to the determined identification 1 is used to decode the identification 1 part of the current coefficient. For another example, when decoding the identification 2 to 5 parts of the current coefficient, as shown in Figures 5D to 5F, different surrounding coefficients are also selected according to the different scanning orders, and the context model corresponding to the identification 2 to 5 parts is determined based on the absolute value of the selected surrounding coefficients that is less than or equal to 15, so as to use the context model corresponding to the determined identification 2 to 5 parts to decode the identification 2 to 5 parts of the current coefficient.

[0134] At the same time, when determining the context model corresponding to the current coefficient, it is also necessary to consider whether the current coefficient is the last non-zero coefficient, the distance between the position of the current coefficient and the upper left corner of the transform block, the size of the transform block, and other conditions.

[0135] In some embodiments, when the codec identifier is 1, a model needs to be selected from 4 QP segments, 5 transform block sizes, brightness or color components, 42 position distances, and the sum of the absolute values ​​of the surrounding encoded and decoded coefficients less than or equal to 3 parts, a total of 4X5X2X42, or 1680 context models, for encoding and decoding and updating of the model probability value based on the quantization parameter QP.

[0136] In some embodiments, when the codec identifier is 2 to 5, a model needs to be selected from 4 QP segments, 5 transform block sizes, luminance or chrominance components, 21 position distances, and the sum of the parts of the surrounding coded coefficients with absolute values ​​less than or equal to 15, a total of 4X5X2X21, or 840 context models, for coding and updating of the model probability value.

[0137] Currently, the encoding method of quantization coefficients is usually to completely encode the positive and negative signs and absolute values ​​of the quantization coefficients, which occupies many bits and has a high encoding cost.

[0138] In an embodiment of the present application, during the encoding process of the quantization coefficients, at least one quantization coefficient in the current region is hidden according to the parity of the quantization coefficients in the current region, so as to reduce the encoding cost.

[0139] The technical solutions provided in the embodiments of the present application are described in detail below in conjunction with specific embodiments.

[0140] First, referring to FIG6 , the decoding end is taken as an example for introduction.

[0141] FIG6 is a flow chart of a video decoding method provided by an embodiment of the present application, which is applied to the video decoders shown in FIG1 and FIG3. As shown in FIG6, the method of the embodiment of the present application includes:

[0142] S401: Decode the code stream to obtain P quantization coefficients in the current area.

[0143] The current area is an area in the current block that includes at least one non-zero quantized coefficient.

[0144] In an embodiment of the present application, the current block is divided into one or more regions, for example, into N regions, where N is a positive integer, and the current region is a region including at least one non-zero quantization coefficient among the N regions of the current block.

[0145] In order to reduce the coding cost, the encoding end can hide the parity of one or more quantization coefficients in the same region based on the parity related to the quantization coefficients in the same region, for example, based on the parity of the sum of the absolute values ​​of the quantization coefficients in the region, so as to reduce the quantization coefficients whose parity is hidden. For example, the second quantization coefficient whose parity is to be hidden is a1, and the parity of all or part of the second quantization coefficient is hidden to obtain the first quantization coefficient a2, and a2 is smaller than a1. In this way, encoding a2 uses fewer bits than encoding a1, thereby reducing the coding cost.

[0146] As can be seen from the above, in the embodiment of the present application, the encoder hides part or all of the parity of the second quantization coefficient to obtain the first quantization coefficient. In this case, the first quantization coefficient includes the parity-hidden portion. In the embodiment of the present application, the parity of the parity-hidden portion of the first quantization coefficient is indicated by the P quantization coefficients in the current region, and the decoder reconstructs the parity-hidden portion based on the parity of the parity-hidden portion of the first quantization coefficient to obtain a reconstructed second quantization coefficient. Based on this, when decoding the first quantization coefficient, the decoder first decodes the bitstream to obtain the P quantization coefficients in the current region.

[0147] In an example, the P quantization coefficients are all quantization coefficients in the current region except the first quantization coefficient.

[0148] In another example, the P quantization coefficients are part of the quantization coefficients in the current region.

[0149] Optionally, the above P quantization coefficients do not include the first quantization coefficient in the current area.

[0150] In some embodiments, the above-mentioned quantization coefficients are obtained by quantizing the transform coefficients. For example, the encoding end predicts the current block to obtain the predicted value of the current block, and subtracts the original value of the current block from the predicted value to obtain the residual value of the current block. The encoding end transforms the residual value to obtain the transform coefficient of the current block, then quantizes the transform coefficient to obtain the quantization coefficient, and then encodes the quantization coefficient to obtain the code stream. In this way, the decoding end receives the code stream, decodes the code stream, obtains the quantization coefficient, dequantizes the quantization coefficient to obtain the transform coefficient of the current block, and then de-transforms the transform coefficient to obtain the residual value of the current block. Optionally, in this example, the above-mentioned current block can also be referred to as the current transform block.

[0151] In some embodiments, the quantization coefficients are obtained by quantizing the residual values. For example, the encoder predicts the current block to obtain a predicted value for the current block, then subtracts the predicted value from the original value of the current block to obtain the residual value for the current block. The encoder quantizes the residual value to obtain quantization coefficients, which are then encoded to obtain a bitstream. Thus, the decoder receives the bitstream, decodes the bitstream, obtains the quantization coefficients, and dequantizes the quantization coefficients to obtain the residual value for the current block.

[0152] In some embodiments, the quantization coefficient can be understood as a numerical value consisting of an absolute value and a positive and negative sign decoded from the bit stream. The absolute value includes the value of the identification bit corresponding to the quantization coefficient. If the value of the quantization coefficient exceeds 15, it also includes the absolute value of the part exceeding 15.

[0153] In an embodiment of the present application, the current block may be divided into N regions, and the sizes of these N regions may be the same or different.

[0154] In the embodiment of the present application, the decoding end and the encoding end use the same region division method to divide the current block into N regions.

[0155] In some embodiments, both the decoding end and the encoding end adopt a default region division method to divide the current block into N regions.

[0156] In some embodiments, the encoder can indicate the region division method of the current block to the decoder. For example, a flag A can be included in the bitstream to indicate the region division method of the current block. The decoder then decodes the bitstream to obtain flag A and determines the region division method of the current block based on flag A.

[0157] Optionally, the flag A may be a sequence-level flag, used to indicate that all decoding blocks in the sequence may adopt the region division method to divide the decoding blocks into N regions.

[0158] Optionally, the flag A may be a frame-level flag, used to indicate that all decoding blocks in the image frame may adopt the region division method to divide the decoding blocks into N regions.

[0159] Optionally, the flag A may be a slice-level flag, used to indicate that all decoding blocks in the image slice may adopt the region division method to divide the decoding blocks into N regions.

[0160] Optionally, the flag A may be a block-level flag, used to indicate that the current block may be divided into N regions using the region division method.

[0161] In the embodiment of the present application, the process of determining the P quantization coefficients in the current region at the decoding end includes but is not limited to the following examples:

[0162] In Example 1, the decoding end decodes region by region to obtain the quantization coefficients whose parity is not concealed in each region. For example, after decoding the quantization coefficients whose parity is not concealed in a region, the decoding end determines P quantization coefficients in the region. Then, the decoding end decodes the quantization coefficients whose parity is not concealed in the next region and determines P quantization coefficients in the next region. That is, in this embodiment, the decoding end can determine the P quantization coefficients in the current region without completely decoding all the quantization coefficients whose parity is not concealed in the current block. For example, the region is divided into K pixels in the scanning direction as a region. In this way, when the decoding end decodes the quantization coefficients whose parity is not concealed among the K quantization coefficients, it determines P quantization coefficients from the quantization coefficients whose parity is not concealed among these K quantization coefficients.

[0163] Example 2: After determining all the quantization coefficients of the current block whose parity is not hidden, the decoding end determines P quantization coefficients in the current area. Specifically, the steps include:

[0164] S401-A1, decode the code stream to obtain decoded information of the current block;

[0165] S401-A2, dividing the current block into N regions, where N is a positive integer;

[0166] S401-A3. Obtain P quantization coefficients in the current region from the decoded information of the current block.

[0167] In Example 2, the decoder first decodes the bitstream to obtain decoded information for the current block, which includes the quantization coefficients for different regions within the current block. Next, the current block is divided into N regions based on the region division method. Assuming the current region is the kth region among these N regions, the decoded information corresponding to the kth region in the decoded information of the current block is determined as the decoded information for the current region. The decoded information for the current region includes the P quantization coefficients for the current region.

[0168] Specific methods of dividing the current block into N regions in S401-A2 include but are not limited to the following:

[0169] Method 1: divide the current block into N areas according to the scanning order.

[0170] Optionally, at least two of the N regions include the same number of quantization coefficients.

[0171] Optionally, at least two of the N regions include different numbers of quantization coefficients.

[0172] In one example, every M non-zero quantized coefficients in the current block are divided into a region according to the scanning direction, resulting in N regions. Each of the N regions includes M non-zero quantized coefficients. At least one of the N regions includes one or more hidden coefficients. In this example, if the last region does not include M non-zero quantized coefficients, the last region is divided into a separate region, or the last region is merged with the previous region into one region.

[0173] In another example, every K pixels in the current block are divided into a region according to the scanning direction, resulting in N regions. For example, for an 8x8 transform block using a reverse ZigZag scan order, when each region is of equal size, that is, each region contains 16 coefficients, the current block is divided into 4 regions as shown in FIG7 . In this example, the N regions obtained by division are of the same size, each region includes K pixels, and among these N regions, there may be regions where the quantization coefficients are all 0, or there may be regions where no hidden coefficients are included. That is, at least one region among the N regions includes one or more hidden coefficients. In this example, if the quantization coefficient included in the last region is not K, then the last region is divided into a separate region, or the last region is merged with the previous region into one region.

[0174] Method 2: divide the current block into N regions according to spatial positions.

[0175] In one example, the N regions are sub-blocks of the current block. For example, the current block is evenly divided into N sub-blocks. Exemplarily, each sub-block is 4*4 in size. In this example, the N regions may include regions with all quantized coefficients being zero, or regions that do not include hidden coefficients. In other words, at least one of the N regions includes one or more hidden coefficients.

[0176] In another example, based on the spatial position relationship of the pixels in the current block, a plurality of spatially adjacent pixels are divided into a sub-block, and each sub-block includes at least one non-zero quantization coefficient.

[0177] In the embodiment of the present application, the method of dividing the current block into N areas may include other methods in addition to the above examples, and the embodiment of the present application does not limit this.

[0178] The current region of the embodiment of the present application includes at least one first quantization coefficient. In some embodiments, the first quantization coefficient is also called a hidden coefficient.

[0179] In an example, the first quantization coefficient may be any non-zero quantization coefficient in the current region that is set by default by the codec.

[0180] In another example, the first quantization coefficient may be a non-zero quantization coefficient with the largest absolute value in the current region.

[0181] In another example, the first quantization coefficient is a non-zero quantization coefficient at the Kth position in the scanning order in the current region, where K is less than or equal to the number of non-zero quantization coefficients in the current region. For example, as shown in FIG7 , the current region includes 16 coefficients, and the 16th non-zero quantization coefficient and / or the 15th non-zero quantization coefficient in the scanning order can be used as the first quantization coefficient of the current region.

[0182] In some embodiments, a flag may be used to indicate whether the current block allows the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application. Optionally, the quantization coefficient parity hiding technology provided by the embodiment of the present application is also called parity hiding technology.

[0183] Exemplarily, the at least one flag that is set may be a flag of a different level, used to indicate whether the corresponding level allows the parity of the quantization coefficient to be hidden.

[0184] Optionally, the at least one flag includes at least one of a sequence-level flag, a picture-level flag, a slice-level flag, a unit-level flag, and a block-level flag.

[0185] For example, the at least one flag includes a sequence-level flag, which is used to indicate whether the current sequence allows the parity of the quantized coefficients to be concealed. For example, if the value of the sequence-level flag is 1, it indicates that the current sequence allows the parity of the quantized coefficients to be concealed; if the value of the sequence-level flag is 0, it indicates that the current sequence does not allow the parity of the quantized coefficients to be concealed.

[0186] Optionally, if the at least one flag includes a sequence-level flag, the sequence-level flag may be located in a sequence header.

[0187] For another example, the at least one flag includes a picture-level flag, and the picture-level flag is used to indicate whether the parity of the quantization coefficients of the current picture is allowed to be concealed. For example, if the value of the picture-level flag is 1, it indicates that the parity of the quantization coefficients of the current picture is allowed to be concealed; if the value of the picture-level flag is 0, it indicates that the parity of the quantization coefficients of the current picture is not allowed to be concealed.

[0188] Optionally, if the at least one flag includes a picture-level flag, the picture-level flag may be located in a picture header.

[0189] For another example, the at least one flag includes a slice-level flag, and the slice-level flag is used to indicate whether the parity of the quantization coefficients is allowed to be concealed for the current slice. For example, if the value of the slice-level flag is 1, it indicates that the parity of the quantization coefficients is allowed to be concealed for the current slice; if the value of the slice-level flag is 0, it indicates that the parity of the quantization coefficients is not allowed to be concealed for the current slice.

[0190] Optionally, if the at least one flag includes a slice-level flag, the slice-level flag may be located in a slice header.

[0191] For another example, the at least one flag includes a unit-level flag, and the unit-level flag is used to indicate whether the current CTU allows the parity of the quantization coefficient to be hidden. For example, if the value of the unit-level flag is 1, it indicates that the current CTU allows the parity of the quantization coefficient to be hidden; if the value of the unit-level flag is 0, it indicates that the current CTU does not allow the parity of the quantization coefficient to be hidden.

[0192] For another example, the at least one flag includes a block-level flag, and the block-level flag is used to indicate whether the parity of the quantization coefficients of the current block is allowed to be hidden. For example, if the value of the block-level flag is 1, it indicates that the parity of the quantization coefficients of the current block is allowed to be hidden, and if the value of the block-level flag is 0, it indicates that the parity of the quantization coefficients of the current block is not allowed to be hidden.

[0193] In this way, the decoding end first decodes the bitstream to obtain the at least one flag, and then determines whether the parity of the quantized coefficients of the current block is allowed to be hidden based on the at least one flag. If the at least one flag determines that the parity of the quantized coefficients of the current block is not allowed to be hidden, the method of the embodiment of the present application is skipped and the decoded quantized coefficients are directly dequantized to obtain the transform coefficients. If the at least one flag determines that the parity hiding technology provided by the embodiment of the present application is allowed to be used in the current block, the method of the embodiment of the present application is executed.

[0194] For example, if the at least one flag includes a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag. At this time, the decoding end first decodes the code stream to obtain a sequence-level flag. If the sequence-level flag indicates that the current sequence does not allow the use of the quantization coefficient parity hiding technology provided in the embodiment of the present application, the method of the embodiment of the present application is skipped and the traditional method is used to dequantize the current block. If the sequence-level flag indicates that the current sequence allows the use of the quantization coefficient parity hiding technology provided in the embodiment of the present application, the code stream is continued to be decoded to obtain an image-level flag. If the image-level flag indicates that the current image does not allow the use of the quantization coefficient parity hiding technology provided in the embodiment of the present application, the method of the embodiment of the present application is skipped and the traditional method is used to dequantize the current block. If the image-level flag indicates that the current image allows the use of the quantization coefficient parity hiding technology provided in the embodiment of the present application, the code stream is continued to be decoded to obtain a slice-level flag. If the slice-level flag indicates that the current slice does not allow the use of the quantization coefficient parity hiding technology provided in the embodiment of the present application, the method of the embodiment of the present application is skipped and the traditional method is used to dequantize the current block. If the slice-level flag indicates that the current slice allows the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application, then continue to decode the code stream to obtain the unit-level flag. If the unit-level flag indicates that the current CTU does not allow the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application, then skip the method of the embodiment of the present application and use the traditional method to dequantize the current block. If the unit-level flag indicates that the current CTU allows the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application, then continue to decode the code stream to obtain the block-level flag. If the block-level flag indicates that the current block does not allow the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application, then skip the method of the embodiment of the present application and use the traditional method to dequantize the current block. If the block-level flag indicates that the current block allows the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application, then execute the embodiment of the present application.

[0195] In some embodiments, the quantization coefficient parity hiding technique provided by the embodiments of the present application is mutually exclusive with a target transform method, where the target transform method includes a secondary transform or multiple transforms. In this case, if the decoder determines that the current block is transformed using the target transform method, it skips the technical solution provided by the embodiments of the present application, for example, skipping step S402 below.

[0196] S402: Determine the parity of the parity-hidden portion of the first quantization coefficient according to the P quantization coefficients.

[0197] The first quantization coefficient is a quantization coefficient obtained by performing parity hiding on all or part of the second quantization coefficient in the current region, for example, performing parity hiding on the part of the absolute value of the second quantization coefficient that is greater than n.

[0198] For example, assuming the second quantized coefficient is 45, parity hiding is performed on the portion of the second quantized coefficient greater than 10 (i.e., 35). Exemplarily, parity hiding is performed on the portion of the second quantized coefficient 35 to obtain 17. In this case, the first quantized coefficient is the sum of the parity-unhidden portion (i.e., 10) and the parity-hidden portion (i.e., 17) of the second quantized coefficient, that is, the first quantized coefficient is 27. In other words, the parity-unhidden portion of the first quantized coefficient is 10, and the parity-hidden portion is 17. When reconstructing the parity-hidden portion of the first quantized coefficient, reconstruction needs to be performed based on the parity of the parity-hidden portion.

[0199] In this embodiment of the present application, the P quantized coefficients in the current region are used to indicate the parity of the parity-hidden portion. Thus, after the decoder obtains the P quantized coefficients in the current region according to the above steps, it can determine the parity of the parity-hidden portion based on the P quantized coefficients in the current region, and then accurately reconstruct the parity-hidden portion based on the parity of the parity-hidden portion.

[0200] The embodiment of the present application does not limit the method of determining the parity of the parity-hidden portion of the first quantization coefficient according to the P quantization coefficients in the current region in the above S402.

[0201] For example, the parity of the parity-hidden portion of the first quantized coefficient is determined using a binary characteristic (0 or 1) of the P quantized coefficients in the current region.

[0202] In some embodiments, the above S402 includes the following S402-A:

[0203] S402-A: Determine the parity of the parity-hidden part according to the parities corresponding to the P quantized coefficients.

[0204] The implementation of S402-A includes but is not limited to the following situations:

[0205] Case 1: If the parity corresponding to the P quantization coefficients is indicated by the parity of the sum of the first absolute values ​​of the P quantization coefficients, then the above S402-A includes: determining the parity of the parity-hidden part according to the parity of the sum of the first absolute values ​​of the P quantization coefficients.

[0206] The first absolute value of the quantization coefficient is part or all of the absolute value of the quantization coefficient. For example, the first absolute value is the part of the absolute value of the quantization coefficient that is less than 15.

[0207] In the embodiment of the present application, the absolute value of the quantization coefficient is indicated by one or more identifiers. If the absolute value of the quantization coefficient is greater than 15, the absolute value of the quantization coefficient also includes the part exceeding 15.

[0208] Based on this, in the embodiment of the present application, the entire absolute value of the quantization coefficient refers to the entire absolute value of the quantization coefficient decoded, including the value of each identification bit. If the absolute value of the quantization coefficient is greater than 15, it also includes the value exceeding 15.

[0209] Optionally, part of the absolute value of the absolute value of the quantization coefficient refers to the value of all or part of the identification bits in the identification bits. For example, the decoding end determines the parity of the parity-hidden part based on the parity of the sum of the identification 1s of P quantization coefficients.

[0210] For example, if the sum of the first absolute values ​​of the P quantized coefficients is an even number, it is determined that the parity concealed portion is an even number.

[0211] It should be noted that in case 1, if the parity of the portion of the second quantization coefficient whose parity is hidden is inconsistent with the parity of the sum of the first absolute values ​​of the P quantization coefficients, the encoding end modifies the parity of at least one of the P quantization coefficients. For example, if the portion of the second quantization coefficient whose parity is hidden is an odd number, and the sum of the first absolute values ​​of the P quantization coefficients is an even number, then the smallest quantization coefficient among the P quantization coefficients is increased by 1 or decreased by 1 to modify the sum of the first absolute values ​​of the P quantization coefficients to an odd number. For another example, if the portion of the second quantization coefficient whose parity is hidden is an even number, and the sum of the first absolute values ​​of the P quantization coefficients is an odd number, then the smallest quantization coefficient among the P quantization coefficients is increased by 1 or decreased by 1 to modify the sum of the first absolute values ​​of the P quantization coefficients to an even number.

[0212] Case 2: If the parity corresponding to the P quantization coefficients is the parity of the number of target quantization coefficients in the P quantization coefficients, then the above S402-A includes: determining the target quantization coefficient in the P quantization coefficients, and determining the parity of the hidden part of the parity based on the parity of the number of target quantization coefficients in the P quantization coefficients.

[0213] The target quantization coefficient is any one of the non-zero quantization coefficient, the non-zero quantization coefficient with an even value, the quantization coefficient with an even value, and the quantization coefficient with an odd value among the P quantization coefficients.

[0214] In one example, if the target quantization coefficient is a non-zero quantization coefficient among P quantization coefficients, the parity of the parity-hidden portion may be determined based on the parity of the number of non-zero quantization coefficients among the P quantization coefficients.

[0215] For example, if the number of non-zero quantized coefficients in the P quantized coefficients is an odd number, it is determined that the parity-hidden portion is an odd number.

[0216] For example, if the number of non-zero quantized coefficients in the P quantized coefficients is an even number, it is determined that the parity-hidden portion is an even number.

[0217] It should be noted that in this example, if the parity of the parity-hidden portion of the second quantized coefficient is inconsistent with the parity of the number of non-zero quantized coefficients in the P quantized coefficients, the encoder modifies at least one of the P quantized coefficients. For example, if the parity-hidden portion of the second quantized coefficient is an odd number and the number of non-zero quantized coefficients in the P quantized coefficients is an even number, then one of the zero quantized coefficients in the P quantized coefficients may be adjusted to 1, or the value of the smallest non-zero quantized coefficient in the P quantized coefficients may be adjusted to 0, so that the number of non-zero quantized coefficients in the P quantized coefficients is an odd number. For another example, if the parity-hidden portion of the second quantized coefficient is an even number and the number of non-zero quantized coefficients in the P quantized coefficients is an odd number, then one of the zero quantized coefficients in the P quantized coefficients may be adjusted to 1, or the value of the smallest non-zero quantized coefficient in the P quantized coefficients may be adjusted to 0, so that the number of non-zero quantized coefficients in the P quantized coefficients is an even number.

[0218] In another example, if the target quantization coefficient is a non-zero quantization coefficient with an even value among P quantization coefficients, the parity of the hidden part of the parity can be determined based on the parity of the number of non-zero quantization coefficients with an even value among the P quantization coefficients.

[0219] For example, if the number of non-zero quantized coefficients with even values ​​among the P quantized coefficients is odd, it is determined that the parity-hidden portion is an odd number.

[0220] For example, if the number of non-zero quantized coefficients with even values ​​among the P quantized coefficients is even, it is determined that the parity-hidden portion is an even number.

[0221] It should be noted that in this example, if the parity of the portion whose parity is hidden in the second quantization coefficient is inconsistent with the parity of the number of non-zero quantization coefficients that are even among the P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the portion whose parity is hidden in the second quantization coefficient is odd, and the number of non-zero quantization coefficients that are even among the P quantization coefficients is even, the quantization coefficient that is zero among the P quantization coefficients may be adjusted to 2, or the value of the smallest non-zero quantization coefficient among the P quantization coefficients may be increased or decreased by 1, so that the number of non-zero quantization coefficients that are even among the P quantization coefficients is odd. For another example, if the parity-hidden part of the second quantization coefficient is an even number, and the number of non-zero quantization coefficients with even values ​​in the P quantization coefficients is an odd number, then one of the zero quantization coefficients in the P quantization coefficients can be adjusted to 2, or the value of the smallest non-zero quantization coefficient in the P quantization coefficients can be added or subtracted by 1 to make the number of non-zero quantization coefficients in the P quantization coefficients an even number.

[0222] In another example, if the target quantization coefficient is an even-numbered quantization coefficient among the P quantization coefficients, the parity of the portion whose parity is hidden can be determined based on the parity of the number of even-numbered quantization coefficients among the P quantization coefficients, where the even-numbered quantization coefficients include quantization coefficients with a value of 0.

[0223] For example, if the number of quantized coefficients with even values ​​among the P quantized coefficients is odd, it is determined that the parity-hidden portion is an odd number.

[0224] For example, if the number of quantized coefficients having even values ​​among the P quantized coefficients is even, it is determined that the parity-hidden portion is an even number.

[0225] It should be noted that in this example, if the parity of the parity-hidden portion of the second quantized coefficient is inconsistent with the parity of the number of even-numbered quantized coefficients among the P quantized coefficients, the encoder modifies at least one of the P quantized coefficients. For example, if the parity-hidden portion of the second quantized coefficient is odd and the number of even-numbered quantized coefficients among the P quantized coefficients is even, then one of the zero quantized coefficients among the P quantized coefficients may be adjusted to 1, or the smallest non-zero quantized coefficient among the P quantized coefficients may be adjusted to 0, so that the number of even-numbered quantized coefficients among the P quantized coefficients is odd. For another example, if the parity-hidden portion of the second quantized coefficient is even and the number of even-numbered quantized coefficients among the P quantized coefficients is odd, then one of the zero quantized coefficients among the P quantized coefficients may be adjusted to 1, or the smallest non-zero quantized coefficient among the P quantized coefficients may be adjusted to 0, so that the number of even-numbered quantized coefficients among the P quantized coefficients is even.

[0226] In another example, if the target quantization coefficient is an odd-numbered quantization coefficient among P quantization coefficients, the parity of the parity-hidden part can be determined based on the parity of the number of odd-numbered quantization coefficients among the P quantization coefficients.

[0227] For example, if the number of quantization coefficients having an odd value among the P quantization coefficients is an odd number, it is determined that the parity-hidden portion is an odd number.

[0228] For example, if the number of quantization coefficients with odd values ​​among the P quantization coefficients is even, it is determined that the parity-hidden portion is an even number.

[0229] It should be noted that in this example, if the parity of the portion whose parity is hidden in the second quantization coefficient is inconsistent with the parity of the number of odd quantization coefficients among the P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the portion whose parity is hidden in the second quantization coefficient is odd, and the number of odd quantization coefficients among the P quantization coefficients is even, then one of the zero quantization coefficients among the P quantization coefficients may be adjusted to 1, or the smallest non-zero quantization coefficient among the P quantization coefficients may be adjusted to 0, plus 1, or minus 1, so that the number of odd quantization coefficients among the P quantization coefficients is odd. For another example, if the parity-hidden part of the second quantization coefficient is an even number, and the number of odd quantization coefficients among the P quantization coefficients is an odd number, then one of the zero quantization coefficients among the P quantization coefficients can be adjusted to 1, or the smallest non-zero quantization coefficient among the P quantization coefficients can be adjusted to 0 or added 1 or subtracted 1, so that the number of quantization coefficients among the P quantization coefficients is an even number.

[0230] Optionally, the encoding end adjusts at least one coefficient among the P quantization coefficients using an adjustment method with minimal rate-distortion cost.

[0231] As can be seen from the above, in the embodiment of the present application, the parity of the part where the parity is hidden is determined according to the parities corresponding to other quantized coefficients in the current region.

[0232] S403: Determine a target context model corresponding to the first quantization coefficient, and use the target context model to decode the first quantization coefficient based on context coding to obtain a decoded first quantization coefficient.

[0233] It should be noted that there is no strict order between the above S403 and the above S402 during the implementation process, that is, the above S403 can be executed before the above S402, or after the above S402, or can be executed synchronously with the above S402, and the embodiment of the present application does not limit this.

[0234] In the embodiment of the present application, the first quantization coefficient is a quantization coefficient obtained by hiding the parity of all or part of the second quantization coefficient in the current area, and the first quantization coefficient includes the part with the parity hidden.

[0235] Before decoding the first quantization coefficient, the decoding end first needs to determine the context model corresponding to the first quantization coefficient.

[0236] In some embodiments, the decoding end may use the same context model as used to decode the quantized coefficients whose parity is not hidden to decode the first quantized coefficients.

[0237] In other embodiments, since the quantized coefficients after the parity is hidden are usually smaller than the quantized coefficients under the same circumstances where the parity is not hidden, it is no longer reasonable to use the same set of context models to encode two coefficients with different distribution probabilities (i.e., coefficients with parity hidden and coefficients with parity not hidden). Based on this, in an embodiment of the present application, the decoding end uses different context models for decoding the quantized coefficients with parity hidden and the quantized coefficients with parity not hidden. That is, the context model corresponding to the first quantized coefficient is different from the context model corresponding to other quantized coefficients whose parity is not hidden.

[0238] The first quantization coefficient of the embodiment of the present application is represented by one or more identifiers, for example, identifier 1 represents the part from 0 to 3, identifier 2 represents the part from 3 to 6, identifier 3 represents the part from 6 to 9, identifier 4 represents the part from 9 to 12, and identifier 5 represents the part from 12 to 15.

[0239] In the embodiment of the present application, a context model may be determined for one or more of the identifiers of the first quantized coefficient, and decoding may be performed using the one or more identifiers. In other words, the embodiment of the present application may determine a target context model for the target identifier in the first quantized coefficient, and use the target context model to decode the target identifier in the first quantized coefficient.

[0240] Optionally, the target identifier of the first quantization coefficient can be identifier 1, or the target identifier can be any one of identifiers 2 to 5. In this way, the decoding end can determine two context models, one of which is an upper and lower model for decoding identifier 1, and the other context model is used to decode identifiers 2 to 5.

[0241] In some embodiments, the present application creates multiple new context models for coefficients whose parity is hidden. In this case, the above S403 includes the following steps S403-A to S403-C:

[0242] S403-A, obtaining multiple context models corresponding to the target identifier of the first quantization coefficient;

[0243] S403-B, determining a target context model from multiple context models;

[0244] S403-C: Use the target context model to decode the target identifier and obtain a first quantization coefficient.

[0245] In an embodiment of the present application, to improve decoding accuracy for parity-hidden coefficients (here, parity-hidden coefficients include coefficients with partially or fully hidden parity), multiple context models are created for target identifiers in the parity-hidden coefficients. These multiple context models differ at least in part from the context models corresponding to coefficients whose parity is not hidden. For example, R context models are created for identifier 1 in the parity-hidden coefficients, and Q context models are created for identifiers 2 through 5 in the parity-hidden coefficients, where R and Q are both positive integers.

[0246] In this way, when decoding the first quantized coefficient whose parity is hidden, multiple context models corresponding to the target identifier of the first quantized coefficient are first obtained, and then the target context model corresponding to the target identifier is determined from these multiple context models, and the target context model is used to decode the target identifier in the first quantized coefficient. For example, if the target identifier is identifier 1, it is assumed that identifier 1 corresponds to R context models. In this way, the decoding end selects a context model from these R upper and lower models as the target context model corresponding to identifier 1, and uses this target context model to decode identifier 1 in the first quantized coefficient. Similarly, if the target identifier is any one of identifiers 2 to 5, it is assumed that identifiers 2 to 5 correspond to Q context models. In this way, the decoding end selects a context model from these Q upper and lower models as the target context model corresponding to identifiers 2 to 5, and uses this target context model to decode identifiers 2 to 5 in the first quantized coefficient.

[0247] The implementation methods for determining the target context model from the multiple context models in S403-B include but are not limited to the following:

[0248] Method 1: any one of the above-mentioned multiple context models is determined as the target context model.

[0249] Mode 2: The above S403-B includes the following steps S403-B1 and S403-B2:

[0250] S403-B1, determining the index of the target context model;

[0251] S403-B2. Determine a target context model from multiple context models according to the index.

[0252] In method 2, each of the multiple context models corresponding to the first quantization coefficient includes an index, so that the decoding end can determine the index of the target context model and then select the target context model corresponding to the index from the multiple context models corresponding to the first quantization coefficient.

[0253] The embodiments of the present application do not limit the specific implementation method of determining the index of the context model.

[0254] In a possible implementation, the index of the target context model is determined through the following steps S403-B11 to S403-B13:

[0255] S403-B11. Determine a basic index corresponding to the first quantization coefficient.

[0256] The manner of determining the basic index corresponding to the first quantization coefficient in S403-B11 includes but is not limited to the following examples:

[0257] Example 1: Determine a base index according to a position of the first quantization coefficient in the corresponding transform block.

[0258] During transformation, coefficients with high energy are usually concentrated in the upper left corner of the transformation block. Therefore, the basic index can be determined according to the position of the first quantization coefficient in the transformation block to which it belongs. For example, if the first quantization coefficient is in the upper left corner of the transformation block to which it belongs, the basic index is determined to be 0. If the first quantization coefficient is in any position other than the upper left corner of the transformation block to which it belongs, the basic index is determined to be 1.

[0259] In a possible implementation of Example 1, the base index is determined according to the distance from the position of the first quantization coefficient in the corresponding transform block to the upper left corner of the corresponding transform block.

[0260] For example, if the distance between the position of the first quantized coefficient in the transform block to which it belongs and the upper left corner position of the transform block to which it belongs is less than or equal to a threshold, the base index is determined to be the first value.

[0261] For another example, if the distance between the position of the first quantized coefficient in the transform block to which it belongs and the upper left corner position of the transform block to which it belongs is greater than the threshold, the base index is determined to be the second value.

[0262] The embodiment of the present application does not limit the specific values ​​of the first and second values.

[0263] Optionally, the first value is 0.

[0264] Optionally, the second value is G, where G is a preset value.

[0265] The embodiment of the present application does not limit the size of the above threshold.

[0266] Optionally, the threshold is 0, or a positive number greater than 0 and less than m, where m is a smaller value.

[0267] In this example 1, the basic index is determined according to the position of the first quantization coefficient in the corresponding transform block. The method is simple and the data processing speed is fast.

[0268] Example 2: Determine a base index according to a position index of the first quantized coefficient in a scanning order and a size of a current region.

[0269] For example, for the coefficient decoding order in AVM, since the transform block size in AVM is usually a multiple of sixteen, the coefficients are divided into an area for every sixteen coefficients in the decoding order starting from the first one in the lower right corner. For example, as shown in Figure 8, an 8x8 transform block using Zig-Zag scanning has a decoding order from 63 to 0. The transform block can be divided into four areas, namely scan indexes 48-63, 32-47, 16-31, and 0-15. For example, the parity of the coefficients at the four positions of index 48, 32, 16, and 0 is hidden. The actual decoding starts from the first non-zero coefficient in the decoding order, assuming that index 21 is the first non-zero coefficient in the transform block in the decoding order. The coefficient decoding will skip the positions with indices greater than 21 and default them to zero, and decode the context model identifier in the order of 21, 20, ..., 0.

[0270] Assume that the first quantization coefficient is the coefficient at index 21 in Figure 8, and the size of the current area where the first quantization coefficient is located is 16. In this way, the basic index can be determined according to the position index of the first quantization coefficient in the scanning order (i.e. 21) and the size of the current area (e.g. 16).

[0271] The embodiment of the present application does not limit the specific method of determining the basic index in Example 2 based on the position index of the first quantization coefficient in the scanning order and the size of the current area.

[0272] In a possible implementation, a ratio of a position index of the first quantized coefficient in the scanning order to a size of the current region is determined as the base index.

[0273] In another possible implementation, a ratio between a position index of the first quantized coefficient in the scanning order and a size of the current region is determined; and a product of the ratio and a second value is determined as a base index.

[0274] Exemplarily, the basic index is determined according to the following formula (4):

[0275] baseIdx=(scanIdx / / Rsize)×G (4)

[0276] Among them, baseIdx is the base index, scanIdx is the position index of the first quantization coefficient in the scanning order, Rsize is the size of the current area, G is the second value, which is a preset value, and " / / " means rounding, for example 15 / / 8=1, 17 / / 8=2.

[0277] After the base index is determined according to Example 1 or Example 2 above, the offset index is determined.

[0278] S403-B12. Determine an offset index based on decoded quantization coefficients around the first quantization coefficient.

[0279] The embodiment of the present application does not limit the specific method of determining the offset index based on the decoded quantization coefficients around the first quantization coefficient.

[0280] In some embodiments, the offset index is determined based on absolute values ​​of decoded quantized coefficients surrounding the first quantized coefficient.

[0281] For example, the offset index is determined according to the sum of the entire absolute values ​​of the decoded quantization coefficients around the first quantization coefficient.

[0282] For another example, the offset index is determined according to the sum of partial absolute values ​​of decoded quantization coefficients around the first quantization coefficient, wherein the partial absolute value of the decoded quantization coefficient is the portion of the absolute value of the decoded quantization coefficient that is smaller than the preset value K.

[0283] In one example, the bias index is determined according to the following formulas (5) and (6):

[0284]

[0285] offset=min(G-1,sum / 2) (6)

[0286] Among them, L is the number of decoded quantization coefficients around the first quantization coefficient, which is a preset value, IciI is the absolute value of the i-th quantization coefficient among the L decoded quantization coefficients around the first quantization coefficient, K is a preset value, sum is the sum of the partial absolute values ​​of the decoded quantization coefficients around the first quantization coefficient, and offset is the offset index.

[0287] S403-B13. Determine the sum of the base index and the bias index as the index of the target context model.

[0288] According to the above steps, after determining the base index and the bias index corresponding to the first quantization coefficient, the sum of the bias index and the base index is determined as the index of the target context model.

[0289] For example, the index of the target context model is determined according to the following formula (7):

[0290] ctxId=baseIdx+offset (7)

[0291] Where ctxId is the index of the target context model.

[0292] After the index of the target context model is determined according to the above steps, the target context model is determined from the corresponding multiple context models based on the index.

[0293] From the above, it can be seen that the above-mentioned multiple context models include context models with different indexes under multiple QP segments (for example, 4 QP segments) and 2 components (for example, luminance component and chrominance component). In this way, the above-mentioned S403-B determines the target context model from the multiple context models according to the index, including: selecting at least one context model from the above-mentioned multiple context models according to at least one of the quantization parameter, transform type, transform block size and color component corresponding to the first quantization coefficient; then, determining the context model corresponding to the index in at least one lower context model as the target context model.

[0294] For example, according to the above steps, it is determined that the index corresponding to identifier 1 in the first quantization coefficient is index 1, the QP segment corresponding to the first quantization coefficient is QP segment 1, and the first quantization coefficient is a quantization coefficient for the luma component. Assuming that there are S context models corresponding to identifier 1, T context models for QP segment 1 and the luma component are first selected from these S context models. Then, the context model corresponding to index 1 among these T context models is determined as the target context model corresponding to identifier 1 in the first quantization coefficient, and identifier 1 in the first quantization coefficient is decoded using this target context model.

[0295] For another example, according to the above steps, it is determined that the index corresponding to identifiers 2 to 5 in the first quantization coefficient is index 2, the QP segment corresponding to the first quantization coefficient is QP segment 1, and the first quantization coefficient is a quantization coefficient for the luma component. Assuming that there are U context models corresponding to identifiers 2 to 5, first, from these U context models, V context models for QP segment 1 and the luma component are selected. Then, the context model corresponding to index 2 among these V context models is determined as the target context model corresponding to identifiers 2 to 5 in the first quantization coefficient. Then, identifiers 2 to 5 in the first quantization coefficient are decoded using this target context model.

[0296] In some embodiments, before determining a target context model from a plurality of context models, the decoding end needs to initialize the plurality of context models, and then determine the target context model from the initialized plurality of context models.

[0297] For example, multiple context models corresponding to identifier 1 are initialized, and then a target context model corresponding to identifier 1 is selected from the initialized multiple context models.

[0298] For another example, multiple context models corresponding to identifiers 2 to 5 are initialized, and then target context models corresponding to identifiers 2 to 5 are selected from these initialized multiple context models.

[0299] That is, in order to enable faster convergence of the probability values ​​in the context models corresponding to the parity-hidden coefficients, the embodiments of the present application may have a set of corresponding initial values ​​for each model based on the probability of each symbol appearing. In AVM, the probability of each context model is calculated based on the number of symbols in the model, the probability of each symbol appearing, and the cumulative distribution function (CDF). The probability of a symbol appearing in the context model being less than a certain value is calculated, and the probability value is normalized to be represented by a 16-bit integer.

[0300] In the embodiment of the present application, the methods for initializing multiple context models include but are not limited to the following:

[0301] Method 1 initializes multiple context models using equal probability values. For example, in a 4-symbol context model, the probability of symbols 0, 1, 2, and 3 all appearing is 0.25. The probability of a symbol less than 1 is 0.25, the probability of a symbol less than 2 is 0.5, the probability of a symbol less than 3 is 0.75, and the probability of a symbol less than 4 is 1. Rounding the probabilities to 16 bits, the probability of a symbol less than 1 is 8192, the probability of a symbol less than 2 is 16384, the probability of a symbol less than 3 is 24576, and the probability of a symbol less than 4 is 32768. These four integer values ​​constitute the initial probability values ​​for the context model.

[0302] Method 2 initializes multiple context models using convergence probability values, where the convergence probability values ​​are the corresponding convergence probability values ​​of the context models when encoding a test video using the context models. For example, first, an initial probability value, such as equal probability, is set for each context model. Next, a series of test videos are encoded using quantization coefficients corresponding to a target bitrate, and the final convergence probability values ​​of these context models are used as the initial values ​​for these context models. Repeating these steps will yield new convergence values, and an appropriate convergence value is selected as the final initial value.

[0303] The following further describes the process of determining the target upper and lower models corresponding to the first quantization coefficient in an embodiment of the present application through specific examples.

[0304] In one example, assume that the number of context models corresponding to identifier 1 is 4×2×10=80, where 4 represents 4 quantization parameter (QP) segments, 2 represents the two components, luma and chroma, and 10 represents 10 different models for each component in each QP segment. The decoder first initializes these 80 models. The initialized 80 context models are shown in Representation 2:

[0305] Table 2

[0306]

[0307]

[0308] Table 2 above shows the initial cumulative distribution values ​​(Default_Coeff_Base_PH_Cdf) of 80 context models, where COEFF_CDF_Q_CTXS equals 4 corresponding to 4 QP segments, PLANE_TYPES equals 2 corresponding to luminance and chrominance components, and SIG_COEFF_PH_CONTEXTS equals 10 corresponding to ctxId (ctxId=baseIdx+offset).

[0309] Based on Table 2, the decoder determines the base index corresponding to identifier 1 in the first quantized coefficient according to the above steps. For example, if the second value is 5, if the first quantized coefficient is the coefficient in the upper left corner of the corresponding transform block, then the base index corresponding to identifier 1 is 0; otherwise, the base index corresponding to identifier 1 is 5.

[0310] Next, determine the offset index corresponding to the identifier 1. For example, determine the offset index based on the sum of the decoded quantization coefficients around the first quantization coefficient. The partial absolute value of the decoded quantization coefficient is the portion of the absolute value of the decoded quantization coefficient that is less than the preset value.

[0311] In some embodiments, when determining the offset index corresponding to identifier 1, the offset index is determined according to the sum of the absolute values ​​of the J decoded quantization coefficients around the first quantization coefficient.

[0312] In one example, assuming that J is 5, taking the three scanning methods of Zig-Zag scan, Column scan, and Row scan as examples, the five decoded quantization coefficients around the first quantization coefficient are shown in Figures 9A to 9C, where the first quantization coefficient is the black part in the figure, and the five decoded quantization coefficients around the first quantization coefficient are the gray part.

[0313] Assuming that K is equal to 3, the offset index corresponding to the identifier 1 is determined according to the sum of the absolute values ​​of the five decoded quantization coefficients around the first quantization coefficient that are less than 3.

[0314] For example, the offset index offset1 corresponding to identifier 1 can be determined according to the following formulas (8) and (9):

[0315]

[0316] offset1=min(4,(sum1+1)>>1) (9)

[0317] According to the above part, the bias index corresponding to the identifier 1 is determined, and the sum of the basic index and the bias index corresponding to the identifier 1 is determined as the index CtxId1 of the target context model corresponding to the identifier 1.

[0318] Then, based on at least one of the quantization parameter, transform type, transform block size and color component corresponding to the first quantization coefficient, at least one context model is selected from the multiple context models shown in Table 2 above, and then, the context model corresponding to CtxId1 in the at least one context model is determined as the target context model corresponding to identifier 1.

[0319] In another example, assuming that J is 5, in order to simplify the complexity, if the current scanning mode is ZigZag scanning or diagonal scanning, the coefficient parity hiding technology is used for the current transform block. At this time, the initial value shown in Table 3 is used to initialize the context model used by identifier 1.

[0320] Table 3

[0321]

[0322]

[0323] The above Table 3 shows the initial cumulative distribution values ​​(Default_Coeff_Base_PH_Cdf) of the 80 context models corresponding to identifier 1 under ZigZag scanning or diagonal scanning mode, where COEFF_CDF_Q_CTXS is equal to 4 corresponding to 4 QP segments, PLANE_TYPES is equal to 2 corresponding to luminance and chrominance components, and SIG_COEFF_PH_CONTEXTS is equal to 10 corresponding to ctxId (ctxId=baseIdx+offset).

[0324] Exemplarily, five decoded quantization coefficients around the first quantization coefficient are shown in FIG9A .

[0325] Assuming that K is equal to 3, the offset index corresponding to the identifier 1 is determined according to the sum of the absolute values ​​of the five decoded quantization coefficients around the first quantization coefficient that are less than 3.

[0326] Exemplarily, the offset index offset1 corresponding to identifier 1 may be determined according to the above formulas (8) and (9).

[0327] According to the above part, the bias index corresponding to the identifier 1 is determined, and the sum of the basic index and the bias index corresponding to the identifier 1 is determined as the index CtxId1 of the target context model corresponding to the identifier 1.

[0328] Then, based on at least one of the quantization parameter, transform type, transform block size and color component corresponding to the first quantization coefficient, at least one context model is selected from the multiple context models shown in Table 3 above, and then, the context model corresponding to CtxId1 in the at least one context model is determined as the target context model corresponding to identifier 1.

[0329] In another example, assume that the number of context models corresponding to identifiers 2 to 5 is 4×2×14=112, where 4 represents four quantization parameter (QP) segments, 2 represents two components, the luma component and the chroma component, and 14 represents 14 different models for each component in each QP segment. The decoder first initializes these 112 models. The initialized 112 context models are shown in Figure 3:

[0330] Table 4

[0331]

[0332]

[0333] Table 4 above shows the initial cumulative distribution values ​​(Default_Coeff_Base_PH_Cdf) of 112 context models, where COEFF_CDF_Q_CTXS is equal to 4 corresponding to 4 QP segments, PLANE_TYPES is equal to 2 corresponding to luminance and chrominance components, and SIG_COEFF_PH_CONTEXTS is equal to 14 corresponding to ctxId (ctxId=baseIdx+offset).

[0334] Based on Table 4, the decoder determines the base indexes corresponding to identifiers 2 to 5 in the first quantized coefficient according to the above steps. For example, if the second value is 7, and the first quantized coefficient is the coefficient in the upper left corner of the corresponding transform block, the base indexes corresponding to identifiers 2 to 5 are 0; otherwise, the base index corresponding to identifier 1 is 7.

[0335] Next, determine the offset index corresponding to identifier 2 to identifier 5. For example, determine the offset index based on the sum of the partial absolute values ​​of the decoded quantization coefficients around the first quantization coefficient. The partial absolute value of the decoded quantization coefficient is the part of the absolute value of the decoded quantization coefficient that is less than the preset value.

[0336] In some embodiments, when determining the offset index corresponding to identifiers 2 to 5, the offset index is determined according to the sum of the absolute values ​​of the J decoded quantization coefficients around the first quantization coefficient.

[0337] In one example, assuming that J is 3, assuming that J is 5, taking the three scanning methods of Zig-Zag scan, Column scan and Row scan as examples, the three decoded quantization coefficients around the first quantization coefficient are shown in Figures 10A to 10C, where the first quantization coefficient is the black part in the figure, and the five decoded quantization coefficients around the first quantization coefficient are the gray part.

[0338] Assuming that K is equal to 15, the offset indexes corresponding to identifiers 2 to 5 are determined based on the sum of the absolute values ​​of the three decoded quantization coefficients around the first quantization coefficient that are less than 15.

[0339] For example, the offset index offset2 corresponding to identifier 1 can be determined according to the following formulas (10) and (11):

[0340]

[0341] offset2=min(6,(sum2+1)>>1) (11)

[0342] According to the above part, the bias index corresponding to identifier 2 to identifier 5 is determined, and the sum of the basic index and bias index corresponding to identifier 2 to identifier 5 is determined as the index CtxId2 of the target context model corresponding to identifier 2 to identifier 5.

[0343] Then, based on at least one of the quantization parameter, transform type, transform block size and color component corresponding to the first quantization coefficient, at least one context model is selected from the multiple context models shown in Table 3 above, and then, the context model corresponding to CtxId2 in the at least one context model is determined as the target context model corresponding to identifiers 2 to 5.

[0344] According to the above method, after determining the target context model corresponding to the target identifier in the first quantization coefficient, the target identifier is decoded using the target context model. For example, identifier 1 in the first quantization coefficient is decoded using the target context model corresponding to identifier 1, and identifiers 2 to 5 in the first quantization coefficient are decoded using the context models corresponding to identifiers 2 to 5.

[0345] In another example, assuming that J is 3, in order to simplify the complexity, if the current scanning mode is ZigZag scanning or diagonal scanning, the coefficient parity hiding technology is used for the current transform block. At this time, the initial values ​​shown in Table 5 are used to initialize the context models used by identifiers 2 to 5.

[0346] Table 5

[0347]

[0348]

[0349]

[0350] Table 5 above shows the cumulative distribution initial values ​​(Default_Coeff_Base_PH_Cdf) of 80 context models corresponding to identifiers 2 to 5 under ZigZag scanning or diagonal scanning.

[0351] Illustratively, the three decoded quantization coefficients around the first quantization coefficient are shown in FIG10A .

[0352] Assuming that K is equal to 15, the offset indexes corresponding to identifiers 2 to 5 are determined based on the sum of the absolute values ​​of the three decoded quantization coefficients around the first quantization coefficient that are less than 15.

[0353] Exemplarily, the offset index offset2 corresponding to identifier 1 may be determined according to the above formulas (10) and (11).

[0354] According to the above part, the bias index corresponding to identifier 2 to identifier 5 is determined, and the sum of the basic index and bias index corresponding to identifier 2 to identifier 5 is determined as the index CtxId2 of the target context model corresponding to identifier 2 to identifier 5.

[0355] Then, based on at least one of the quantization parameter, transform type, transform block size and color component corresponding to the first quantization coefficient, at least one context model is selected from the multiple context models shown in Table 5 above, and then, the context model corresponding to CtxId2 in the at least one context model is determined as the target context model corresponding to identifier 2 to identifier 5.

[0356] According to the above method, after determining the target context model corresponding to the target identifier in the first quantization coefficient, the target identifier is decoded using the target context model. For example, identifier 1 in the first quantization coefficient is decoded using the target context model corresponding to identifier 1, and identifiers 2 to 5 in the first quantization coefficient are decoded using the target context models corresponding to identifiers 2 to 5.

[0357] In one example, the decoding process of the first quantized coefficient is:

[0358] Decode identifier 1. Here, a represents the value of identifier 1, and the value of a ranges from 0 to 3. If the decoded identifier 1 is 3, then decode identifier 2. Otherwise, the default identifier 2 is 0. Here, b represents the value of identifier 2, and the value of b ranges from 0 to 3.

[0359] If the decoded flag 2 is 3, the flag 3 is decoded; otherwise, the default flag 3 is 0. Here, c represents the value of the flag 3, and the value of c ranges from 0 to 3.

[0360] If the decoded identifier 3 is 3, then the identifier 4 is decoded. Otherwise, the default identifier 4 is 0. Here, d represents the value of the identifier 4, and the value of d ranges from 0 to 3.

[0361] If the decoded flag 4 is 3, the decoded flag 5 is decoded, otherwise the default flag 5 is 0. Here, e represents the value of flag 5, and the value of e ranges from 0 to 3.

[0362] If the decoded flag 5 is 3, the remainder part is decoded.

[0363] If flag 1 is not 0 or the parity is odd, the sign of the first quantized coefficient is decoded.

[0364] According to the values ​​of remainders and the following formula (1), the absolute value of the first quantized coefficient can be restored:

[0365] Abslevel=(a+b+c+d+e+remainder)

[0366] Abslevel is the absolute value of the first quantization coefficient, and remainder is the portion of the absolute value of the first quantization coefficient that exceeds 15.

[0367] The first quantization coefficient is determined according to the above S403, the parity of the parity-hidden portion of the first quantization coefficient is determined according to the above S402, and then the following step S404 is performed.

[0368] S404: Determine a second quantization coefficient having parity according to the parity of the parity-hidden part and the decoded first quantization coefficient.

[0369] As can be seen from the above, in an embodiment of the present application, in order to reduce the coding cost, the encoding end hides the parity of all or part of the second quantization coefficient in the current region to obtain the first quantization coefficient. Since the parity of all or part of the second quantization coefficient is hidden, it is indicated by the P quantization coefficients in the current region. In this way, when decoding the current region, the decoding end first decodes the code stream to obtain the P quantization coefficients in the current region, and determines the parity of the parity-hidden part of the first quantization coefficient based on these P quantization coefficients. Then, the target context model corresponding to the first quantization coefficient is determined, and the target context model is used to decode the first quantization coefficient based on context coding to obtain the first quantization coefficient. Finally, the decoding end can reconstruct the second quantization coefficient with parity based on the decoded first quantization coefficient and the parity of the parity-hidden part of the first quantization coefficient, that is, to achieve reconstruction of the coefficient with parity hidden.

[0370] In some embodiments, the decoding end reconstructs the second quantized coefficient in different ways according to the different parities of the parity-hidden part.

[0371] Mode 1: If the parity-hidden part is an odd number, a first operation mode is used to operate on the parity-hidden part to obtain a first operation result, and a second quantization coefficient is obtained according to the first operation result and the first quantization coefficient.

[0372] The first operation mode adopted by the decoding end corresponds to the third operation mode used by the encoding end to determine the first quantization coefficient.

[0373] The embodiments of the present application do not limit the specific forms of the above-mentioned first operation mode and third operation mode, wherein the first operation mode can be understood as the inverse operation of the third operation mode.

[0374] For example, for a non-zero quantized coefficient, if the third operation adopted by the encoder is to add one to the value of the parity-to-be-hidden portion of the second quantized coefficient and divide it by two, the corresponding first operation adopted by the decoder is to multiply the parity-to-be-hidden portion of the first quantized coefficient by two minus one.

[0375] Mode 2: If the second quantization coefficient is an even number, a second operation mode is used to operate on the parity hidden part to obtain a first operation result, and a second quantization coefficient is obtained according to the first operation result and the first quantization coefficient.

[0376] The second operation method adopted by the decoding end corresponds to the fourth operation method used by the encoding end to determine the first quantization coefficient.

[0377] The embodiment of the present application does not limit the specific forms of the above-mentioned second operation mode and fourth operation mode, wherein the second operation mode can be understood as the inverse operation of the fourth operation mode.

[0378] In one possible implementation, if the fourth operation adopted by the encoder is to divide the value of the portion of the second quantized coefficient to be concealed by two, the second operation adopted by the decoder is to multiply the portion of the first quantized coefficient to be concealed by two.

[0379] In some embodiments, the decoding end may determine the second quantization coefficient in the following manner, that is, the above S404 includes the following steps:

[0380] S404-A1, using a preset operation method to operate on the parity hidden part to obtain a first operation result;

[0381] S404-A2, processing the first operation result according to the parity to obtain a second operation result;

[0382] S404-A3: Obtain a second quantization coefficient according to the second operation result and the first quantization coefficient.

[0383] For example, the encoder performs parity hiding on the portion of the second quantized coefficient that exceeds 10, resulting in a first quantized coefficient of 25. The portion of 10 in this first quantized coefficient is not parity hidden, and the remaining portion of 15 is the parity-hidden portion. Assume that, according to the above method, the parity-hidden portion is determined to be an odd number. In this way, the decoder first uses a preset operation method to operate on the 15-part parity-hidden portion to obtain a first operation result. Then, based on the parity of the 15-part parity-hidden portion, the decoder processes the first operation result, such as adding a value to or subtracting a value from the first operation result, corresponding to the parity hiding method of the encoder, to obtain a second operation result. Finally, the second operation result and the first quantized coefficient are combined to obtain the final second quantized coefficient.

[0384] The embodiment of the present application does not limit the specific form of the above-mentioned preset operation method.

[0385] In some embodiments, the preset operation method includes multiplying the parity-hidden portion by two, that is, multiplying the value of the parity-hidden portion in the first quantization coefficient by two to obtain the first operation result.

[0386] Then, a second operation result is obtained based on the parity of the parity-hidden part and the above-mentioned first operation result. For example, the sum of the first operation result and the parity value is determined as the value of the second operation result, where if the parity-hidden part is an odd number, the parity value is 1, and if the parity-hidden part is an even number, the parity value is 0.

[0387] Finally, a second quantization coefficient is obtained according to the second operation result and the first quantization coefficient.

[0388] In some embodiments, if the encoding end hides the parity of all the second quantization coefficients to obtain the first quantization coefficients, that is, the parity-hidden part is the entire first quantization coefficients, then the second operation result is determined as the second quantization coefficient.

[0389] In some embodiments, if the encoding end hides the parity of part of the second quantization coefficient to obtain the first quantization coefficient, that is, the above-mentioned first quantization coefficient also includes the parity unhidden part, at this time, the sum of the parity unhidden part and the second operation result is determined as the second quantization coefficient.

[0390] Exemplarily, the decoding end may determine the second quantization coefficient according to the following formula (12):

[0391]

[0392] Where C is the second quantized coefficient, qIdx is the first quantized coefficient, and parity is the parity value of the parity-hidden portion. If the parity-hidden portion is an odd number, parity = 1; if the parity-hidden portion is an odd number, parity = 0. (qIdx-n) is the parity-hidden portion of the first quantized coefficient, (qIdx-n)×2 is the result of the first operation, and (qIdx-n)×2+parity is the result of the second operation.

[0393] As can be seen from the above formula (12), the encoder performs parity hiding on the portion of the second quantization coefficient greater than n, and does not perform parity hiding on the portion less than n. At this time, after the decoder decodes the first quantization coefficient qIdx, if the first quantization coefficient qIdx is less than n, it means that the first quantization coefficient does not include the parity-hidden portion, and the first quantization coefficient qIdx is determined as the second quantization coefficient C.

[0394] If the first quantization coefficient qIdx is greater than n, it means that the first quantization coefficient includes a parity-hidden part. The parity-hidden part (qIdx-n) in the first quantization coefficient is processed to obtain a second operation result (qIdx-n)×2+parity. Then, the sum of the second operation result and the parity-unhidden part n in the first quantization coefficient is determined as the second quantization coefficient.

[0395] The decoding end, using the above method, can determine the second quantization coefficients corresponding to the first quantization coefficients of other regions in the current block. The second quantization coefficients of each region in the current block, along with other quantization coefficients whose parity is not concealed, constitute the quantization coefficients of the current block. Then, based on the quantization coefficients of the current block, a reconstructed value of the current block is determined.

[0396] In some embodiments, if the encoder skips the transformation step and directly quantizes the residual value of the current block, the decoder correspondingly dequantizes the quantized coefficients of the current block to obtain the residual value of the current block. Alternatively, intra-frame prediction and / or inter-frame prediction methods are used to determine a predicted value for the current block, which is then added to the reconstructed value to obtain a reconstructed value for the current block.

[0397] In some embodiments, if the encoder does not skip the transformation step, that is, the encoder transforms the residual values ​​of the current block to obtain transform coefficients, and then quantizes the transform coefficients. Correspondingly, the decoder inversely quantizes the quantized coefficients of the current block to obtain transform coefficients for the current block, and inversely transforms the transform coefficients to obtain residual values ​​for the current block. Furthermore, intra-frame prediction and / or inter-frame prediction methods are used to determine a predicted value for the current block, and the predicted value for the current block is added to a reconstructed value to obtain a reconstructed value for the current block.

[0398] The video decoding method provided by the embodiment of the present application is as follows: the decoder decodes the code stream to obtain P quantization coefficients in the current area, where the current area is an area in the current block that includes at least one non-zero quantization coefficient, and P is a positive integer; based on the P quantization coefficients, the parity of the parity-hidden part of the first quantization coefficient is determined, where the first quantization coefficient is the quantization coefficient obtained after all or part of the parity of the second quantization coefficient in the current area is hidden; the target context model corresponding to the first quantization coefficient is determined, and the target context model is used to decode the first quantization coefficient based on context coding to obtain the decoded first quantization coefficient; based on the parity of the parity-hidden part of the first quantization coefficient and the first quantization coefficient, a second quantization coefficient with parity is determined. In the embodiment of the present application, by using the P quantization coefficients in the current area, the parity of part or all of the second quantization coefficient in the current area is hidden to obtain the first quantization coefficient, and the first quantization coefficient is encoded, which can reduce the number of bits required for encoding and reduce the video compression cost. In addition, the embodiment of the present application re-determines the target context model for decoding the first quantization coefficient, which can achieve accurate decoding of the first quantization coefficient with parity hidden.

[0399] Based on the embodiment shown in FIG. 6 above, the video decoding method provided in the embodiment of the present application is further described below in conjunction with FIG. 11 .

[0400] FIG11 is a flow chart of a video decoding method according to an embodiment of the present application. As shown in FIG6 , the method according to the embodiment of the present application includes:

[0401] S601: Decode a code stream to obtain at least one flag.

[0402] The at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.

[0403] Optionally, the at least one flag includes at least one of a sequence-level flag, a picture-level flag, a slice-level flag, a unit-level flag, and a block-level flag.

[0404] Specifically, the decoding end first decodes the code stream to obtain the at least one flag, and determines whether the parity of the quantization coefficient of the current block is allowed to be hidden according to the at least one flag.

[0405] If it is determined based on at least one of the above-mentioned flags that the parity of the quantization coefficients of the current block is not allowed to be hidden, the following steps S602 and S609 are executed, that is, the code stream is decoded to obtain decoded information of the current block, which includes the quantization coefficients of the current block. At this time, since the parity of the quantization coefficients in the current block is not hidden, the subsequent inverse quantization process is performed.

[0406] If it is determined according to the at least one flag that the parity of the quantization coefficients of the current block is allowed to be hidden, the following steps S602 to S608 are executed.

[0407] S602: Decode the code stream to obtain decoded information of the current block.

[0408] The decoded information of the current block includes the quantization coefficients in the current block.

[0409] Exemplarily, the decoding end first decodes identifiers 1 to 5, and then decodes the part of each quantization coefficient whose absolute value exceeds 15 in the scanning order from the last non-zero coefficient to the upper left corner of the transform block, and finally obtains the quantization coefficients in the current block.

[0410] S603: Divide the current block into N areas.

[0411] The embodiments of the present application do not limit the region division method of the current block. For example, the current block is divided into N regions according to the decoding scanning order, or the current block is divided into N regions according to the spatial positions of the pixels in the current block.

[0412] The sizes of the above-mentioned N areas can be the same or different, and this embodiment of the application does not limit this.

[0413] The specific implementation process of the above S603 can refer to the relevant description of the above S401-A2, which will not be repeated here.

[0414] S604: Obtain P quantization coefficients in the current region from the decoded information of the current block.

[0415] The current region is a region to be decoded among the N regions of the current block.

[0416] The decoded information of the current block includes the quantization coefficients in the current block, so the P quantization coefficients included in the current area can be obtained from the decoded information of the current block.

[0417] In some embodiments, the P quantization coefficients are all quantization coefficients of the current region.

[0418] In some embodiments, the P quantization coefficients are partial quantization coefficients of the current region.

[0419] The specific implementation process of the above S604 can refer to the relevant description of the above S401-A3, which will not be repeated here.

[0420] S605: Determine whether the current area meets the conditions.

[0421] The condition includes at least one of the following preset conditions and a parity hiding technology enabling condition.

[0422] In the embodiments of this application, the parity hiding technology proposed in this application is limited. Specifically, if the current region meets the set conditions, it means that the parity hiding technology provided in the embodiments of this application can achieve significant beneficial effects in the current region. In this case, steps S606 to S609 are executed. If the current region does not meet the set conditions, it means that the parity hiding technology provided in the embodiments of this application cannot achieve significant beneficial effects in the current region. In this case, step S6010 is executed.

[0423] The following describes the conditions for enabling parity hiding technology.

[0424] In some embodiments, different conditions for enabling the parity hiding technique may be preset according to at least one of a quantization parameter, a transform type, a transform block size, a scan type, and a color component.

[0425] For example, if the quantization coefficient is greater than or equal to a preset value, the parity hiding technology is enabled; if the quantization coefficient is less than the preset value, the parity hiding technology is disabled.

[0426] For another example, if the transform type is a preset transform type, the parity hiding technology is enabled; if the transform type is not a preset transform type, the parity hiding technology is not enabled.

[0427] For another example, if the transform block size is greater than or equal to a preset size, the parity hiding technology is enabled; if the transform block size is smaller than the preset size, the parity hiding technology is disabled.

[0428] For another example, if the color component is U, the parity hiding technology is enabled, and if the color component is V, the parity hiding technology is not enabled.

[0429] For another example, if the transform block uses a preset scan type, the parity hiding technique is enabled, and if the transform block does not apply to the preset scan type, the parity hiding technique is not enabled. This application does not limit the preset scan type, for example, the preset scan type is ZigZag scan or diagonal scan.

[0430] It should be noted that the above examples are merely illustrative, and the above examples can be used in the same combination as the conditions for enabling the parity hiding technology.

[0431] The following describes the pre-conditions.

[0432] The embodiments of the present application do not limit the specific contents of the above-mentioned preset conditions, which can be set according to actual needs.

[0433] In a possible implementation, the above-mentioned preset conditions include at least one of the following conditions:

[0434] Condition 1: the number of non-zero quantized coefficients in the current region is greater than a first preset value;

[0435] Condition 2: In the current region, the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the decoding scan order is greater than a second preset value;

[0436] Condition 3: In the current region, the distance between the first non-zero quantized coefficient and the last quantized coefficient in the decoding scan order is greater than a third preset value;

[0437] Condition 4: In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth preset value.

[0438] In some embodiments, the above four conditions can also be combined with each other to form new constraints.

[0439] The embodiment of the present application does not limit the specific values ​​of the first to fourth preset values, as long as the first to fourth preset values ​​are all positive integers.

[0440] In one example, at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a fixed value.

[0441] In another example, at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, that is, a value determined by the encoding end according to current encoding information.

[0442] In some embodiments, if at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, the encoder writes the non-fixed value into the bitstream.

[0443] In some embodiments, the decoding end may first determine whether the current area meets the above preset conditions based on at least one of the quantization parameter, transform type, transform block size and color component corresponding to the first quantization coefficient, and when determining that the first quantization coefficient allows the parity of the quantization coefficient to be hidden.

[0444] In some embodiments, when determining that the current region meets the above-mentioned preset conditions, the decoding end may determine whether the first quantization coefficient meets the conditions for starting the parity hiding technology.

[0445] That is to say, the above-mentioned preset conditions and the above-mentioned conditions for enabling the parity hiding technology can be used alone or in combination with each other.

[0446] S606: Determine the parity of the parity-hidden portion of the first quantization coefficient according to the P quantization coefficients.

[0447] For example, the parity of the parity-hidden part is determined according to the parities corresponding to the P quantized coefficients.

[0448] For example, the parity of the parity-hidden part is determined according to the parity of the sum of the first absolute values ​​of the P quantized coefficients.

[0449] For example, the parity of the parity-hidden portion is determined according to the parity of the number of target quantized coefficients in the P quantized coefficients.

[0450] The target quantization coefficient is any one of the non-zero quantization coefficient, the non-zero quantization coefficient with an even value, the quantization coefficient with an even value, and the quantization coefficient with an odd value among the P quantization coefficients.

[0451] The specific implementation process of the above S606 can refer to the relevant description of the above S402 and will not be repeated here.

[0452] S607: Determine a target context model corresponding to the first quantization coefficient, and use the target context model to decode the first quantization coefficient based on context coding to obtain the first quantization coefficient.

[0453] The implementation process of the above S607 refers to the detailed description of the above S403 and will not be repeated here.

[0454] S608: Determine a second quantization coefficient having parity according to the parity of the parity-hidden part and the decoded first quantization coefficient.

[0455] The implementation process of the above S608 refers to the detailed description of the above S404 and will not be repeated here.

[0456] S609: Determine a quantization coefficient of the current block according to the second quantization coefficient.

[0457] According to the above method, the quantized coefficients of each region of the current block whose parity is hidden are determined, and the quantized coefficients of the current block are obtained by combining them with other quantized coefficients of the current block whose parity is not hidden.

[0458] S610: Determine a quantization coefficient of the current block according to decoded information of the current block.

[0459] If the current area does not include quantization coefficients with hidden parity, the quantization coefficients decoded from the bitstream are used as the final quantization coefficients of the current block.

[0460] S611 . Obtain a reconstructed value of the current block according to the quantization coefficient of the current block.

[0461] According to the above method, the quantization coefficient of the current block is determined, and the reconstructed value of the current block is determined in the following two ways.

[0462] In Method 1, if the encoder skips the transformation step and directly quantizes the residual value of the current block, the decoder dequantizes the quantized coefficients of the current block to obtain the residual value of the current block. In addition, intra-frame prediction and / or inter-frame prediction methods are used to determine the predicted value of the current block. This predicted value is then added to the reconstructed value to obtain the reconstructed value of the current block.

[0463] In Method 2, if the encoder does not skip the transformation step, it transforms the residual value of the current block to obtain transform coefficients, and then quantizes these transform coefficients. Correspondingly, the decoder dequantizes the quantized coefficients of the current block to obtain transform coefficients for the current block, and then de-transforms the transform coefficients to obtain the residual value of the current block. In addition, intra-frame prediction and / or inter-frame prediction methods are used to determine the predicted value of the current block, which is then added to the reconstructed value to obtain the reconstructed value of the current block.

[0464] In an embodiment of the present application, conditions are set for the parity hiding technology. When the current area meets the conditions, it is determined that the parity of at least one quantization coefficient in the current area is hidden, and then the parity hiding technology proposed in the present application is used to decode the first quantization coefficient in the current area to improve decoding accuracy.

[0465] For example, the detailed decoding process of the embodiment of the present application is shown in Table 6 and Table 7 below:

[0466] Table 6

[0467]

[0468] Table 6 above shows that a flag is added to the sequence header to control whether the parity hiding technology is enabled for the current sequence.

[0469] enable_parityhiding equal to 1 indicates that the parity hiding technology is enabled, and enable_parityhiding equal to 0 indicates that the parity hiding technology is disabled. If this syntax element does not appear, its default value is zero.

[0470] Table 7

[0471]

[0472]

[0473]

[0474] Table 7 above shows the process of coefficient decoding. The value of the variable enable_ph is determined according to the value of enable_parityhiding in the sequence header, and at least one of the currently used quantization parameter QP size, the current transform block size, the color component of the current transform block, the scan type of the current transform block, and the transform type of the current transform block. The decoding end determines whether to use the parity hiding technology based on the value of the variable enable_ph.

[0475] It should be noted that the above Table 7 is an example, which shows the process of determining the 16th quantization coefficient (ie, the first quantization coefficient) in the current area based on the first 15 quantization coefficients (ie, P quantization coefficients) in the current area.

[0476] The decoding process shown in Table 7 above mainly includes the steps shown in Table 8:

[0477] Table 8

[0478] Loop 1: Decode the identifiers 1-5 of the first 15 coefficients in each region. Determine whether the 16th coefficient has hidden parity based on the number of non-zero coefficients in the first 15 coefficients. Decode the 16th coefficient. Loop 2: Decode the sign of the non-zero coefficient and the part greater than 15 (if the coefficient has hidden parity, decode the part greater than 30).

[0479] In an embodiment of the present application, when decoding the current area of ​​the code, the decoding end first determines whether the current area meets the conditions to determine whether the current area can bring significant beneficial technical effects when decoding the current area using the parity hiding technology provided by the present application. When it is determined that the use of the parity hiding technology has significant beneficial effects, the technical solution of the present application is used to decode the current area to improve decoding reliability.

[0480] The above describes the video decoding method involved in the embodiment of the present application. On this basis, the following describes the video decoding method involved in the present application for the encoding end.

[0481] Figure 12 is a flow chart of a video encoding method provided by an embodiment of the present application. The execution subject of the embodiment of the present application may be the encoder shown in Figures 1 and 2 above.

[0482] As shown in FIG12 , the method of the embodiment of the present application includes:

[0483] S701. Divide the current block into N regions, where N is a positive integer.

[0484] In an embodiment of the present application, the current block is divided into one or more regions, for example, into N regions, where N is a positive integer. To reduce the coding cost, the parity of one or more quantization coefficients in the same region can be hidden based on the parity associated with the quantization coefficients in the region, for example, based on the parity of the sum of the absolute values ​​of the quantization coefficients in the region, to reduce the number of quantization coefficients whose parity is hidden. For example, if the value of the second quantization coefficient is a1, the parity of all or part of the second quantization coefficient is hidden to obtain a first quantization coefficient a2, where a2 is smaller than a1. In this way, encoding a2 uses fewer bits than encoding a1, thereby reducing the coding cost.

[0485] The embodiment of the present application does not limit the area division method of the current block.

[0486] Optionally, at least two of the N regions include the same number of quantization coefficients.

[0487] Optionally, at least two of the N regions include different numbers of quantization coefficients.

[0488] In some embodiments, specific methods of dividing the current block into N regions in S701 include but are not limited to the following:

[0489] Method 1: divide the current block into N areas according to the scanning order.

[0490] In one example, every M non-zero quantized coefficients in the current block are divided into a region according to the scanning direction, resulting in N regions. Each of the N regions includes M non-zero quantized coefficients. At least one of the N regions includes one or more second quantized coefficients whose parity can be concealed. In this example, if the last region does not include M non-zero quantized coefficients, the last region is divided into a separate region, or the last region is merged with the previous region into one region.

[0491] In another example, every K pixels in the current block are divided into a region according to the scanning direction, resulting in N regions. For example, for an 8x8 transform block using a reverse ZigZag scan order, when each region is of equal size, that is, each region contains 16 coefficients, the current block is divided into four regions as shown in Figure 7. In this example, if the last region does not contain K quantized coefficients, the last region is divided into a separate region, or the last region is merged with the previous region into one region.

[0492] Method 2: divide the current block into N regions according to spatial positions.

[0493] In an example, the N regions are sub-blocks of the current block. For example, the current block is evenly divided into N sub-blocks. Exemplarily, the size of each sub-block is 4*4.

[0494] In another example, based on the spatial position relationship of the pixels in the current block, a plurality of spatially adjacent pixels are divided into a sub-block, and each sub-block includes at least one non-zero quantization coefficient.

[0495] In the embodiment of the present application, the method of dividing the current block into N areas may include other methods in addition to the above examples, and the embodiment of the present application does not limit this.

[0496] In some embodiments, a flag may be used to indicate whether the current block allows the use of the quantization coefficient parity hiding technology provided by the embodiment of the present application. In some embodiments, the quantization coefficient parity hiding technology provided by the embodiment of the present application is also called parity hiding technology.

[0497] Exemplarily, the at least one flag that is set may be a flag of a different level, used to indicate whether the corresponding level allows the parity of the quantization coefficient to be hidden.

[0498] Optionally, the at least one flag includes at least one of a sequence-level flag, a picture-level flag, a slice-level flag, a unit-level flag, and a block-level flag.

[0499] For example, the at least one flag includes a sequence-level flag, and the sequence-level flag is used to indicate whether the current sequence allows the parity of the quantization coefficient to be hidden.

[0500] Optionally, if the at least one flag includes a sequence-level flag, the sequence-level flag may be located in a sequence header.

[0501] For another example, the at least one flag includes a picture-level flag, and the picture-level flag is used to indicate whether the parity of the quantization coefficients of the current picture is allowed to be hidden.

[0502] Optionally, if the at least one flag includes a picture-level flag, the picture-level flag may be located in a picture header.

[0503] For another example, the at least one flag includes a slice-level flag, and the slice-level flag is used to indicate whether the parity of the quantization coefficient is allowed to be hidden in the current slice.

[0504] Optionally, if the at least one flag includes a slice-level flag, the slice-level flag may be located in a slice header.

[0505] For another example, the at least one flag includes a unit-level flag, which is used to indicate whether the parity of the quantization coefficient of the current CTU is allowed to be hidden.

[0506] For another example, the at least one flag includes a block-level flag, and the block-level flag is used to indicate whether the parity of the quantization coefficients of the current block is allowed to be hidden.

[0507] Thus, the encoding end first obtains the at least one flag and, based on the at least one flag, determines whether the parity of the quantized coefficients of the current block is allowed to be hidden. If, based on the at least one flag, it is determined that the parity of the quantized coefficients of the current block is not allowed to be hidden, the method of the embodiment of the present application is skipped. If, based on the at least one flag, it is determined that the parity hiding technology provided by the embodiment of the present application is allowed to be used in the current block, the method of the embodiment of the present application is executed.

[0508] In some embodiments, the quantization coefficient parity hiding technique provided by the embodiments of the present application is mutually exclusive with a target transform method, where the target transform method includes a secondary transform or multiple transforms. In this case, if the encoder determines that the current block is to be transformed using the target transform method, it skips the technical solution provided by the embodiments of the present application.

[0509] S702 : Determine a second quantization coefficient in the current region, and perform parity hiding on part or all of the second quantization coefficient to obtain a first quantization coefficient.

[0510] The current region is a region among the N regions that includes at least one non-zero quantization coefficient.

[0511] In this embodiment of the present application, to reduce coding cost, parity hiding is performed on all or part of the second quantized coefficient to obtain a first quantized coefficient, which is then encoded into the bitstream instead of encoding the second quantized coefficient. Because the first quantized coefficient is typically smaller than the second quantized coefficient, encoding the first quantized coefficient requires fewer bits than encoding the second quantized coefficient, thereby reducing coding cost.

[0512] In the embodiment of the present application, the parity of all or part of the second quantization coefficient is hidden, and the method of obtaining the first quantization coefficient is not limited.

[0513] In some embodiments, different methods may be selected to determine the first quantization coefficient according to the parity of the second quantization coefficient, as shown in Case 1 and Case 2.

[0514] Case 1: If the second quantization coefficient is an odd number, a third operation method is used to operate on part or all of the second quantization coefficient to obtain the first quantization coefficient.

[0515] The specific form of the third operation method mentioned above in the embodiment of the present application is not limited.

[0516] Mode 1, the third operation mode includes the first quantization coefficient being equal to a part or all of the value of the second quantization coefficient plus one divided by two.

[0517] Case 2: If the second quantization coefficient is an even number, the fourth operation method is used to operate on part or all of the second quantization coefficient to obtain the first quantization coefficient.

[0518] The specific form of the fourth operation method mentioned above in the embodiment of the present application is not limited.

[0519] Exemplarily, the fourth operation manner includes the first quantization coefficient being equal to a part or all of the value of the second quantization coefficient divided by two.

[0520] In some embodiments, the encoding end uses a preset operation method to operate on part or all of the second quantization coefficients to obtain the first quantization coefficients.

[0521] The present application does not impose any restrictions on the specific value of the preset operation method. For example, the preset operation method is to divide part or all of the value of the second quantization coefficient by a positive integer greater than 1.

[0522] Exemplarily, the preset operation method includes dividing the value of the parity part to be hidden in the second quantization coefficient by two and rounding it off, where rounding can be understood as a quotient operation. For example, the value of the parity part to be hidden in the second quantization coefficient is 7, and 7 divided by 2 is 3.

[0523] For example, the encoding end may determine the first quantization coefficient according to the following formula (13):

[0524]

[0525] Wherein, C is the second quantization coefficient, qIdx is the first quantization coefficient, and (Cn) is the parity-hidden portion of the second quantization coefficient.

[0526] It can be seen from the above formula (13) that the encoding end performs parity hiding on the part of the second quantization coefficient greater than n, and does not perform parity hiding on the part less than n.

[0527] If the second quantization coefficient C is greater than n, it means that the second quantization coefficient includes a parity-to-be-hidden part. The parity-to-be-hidden part (Cn) in the second quantization coefficient is divided by 2 to obtain a parity-hidden part (Cn) / / 2. Then, the sum of the parity-hidden part (Cn) / / 2 and the parity-unhidden part n in the second quantization coefficient is determined as the first quantization coefficient.

[0528] S703: Determine a target context model corresponding to the first quantization coefficient, and use the target context model to encode the first quantization coefficient to obtain a bitstream.

[0529] In the embodiment of the present application, the first quantization coefficient is a quantization coefficient obtained by hiding the parity of all or part of the second quantization coefficient in the current area, and the first quantization coefficient includes the part with the parity hidden.

[0530] Before encoding the first quantization coefficient, the encoder first needs to determine the context model corresponding to the first quantization coefficient.

[0531] In some embodiments, the encoder may encode the first quantized coefficient using the same context model as that used to encode the quantized coefficient whose parity is not hidden.

[0532] In other embodiments, the encoder uses different context models for decoding quantized coefficients whose parity is concealed and quantized coefficients whose parity is not concealed. In other words, the context model corresponding to the first quantized coefficient is different from the context models corresponding to other quantized coefficients whose parity is not concealed.

[0533] The first quantization coefficient of the embodiment of the present application is represented by one or more identifiers, for example, identifier 1 represents the part from 0 to 3, identifier 2 represents the part from 3 to 6, identifier 3 represents the part from 6 to 9, identifier 4 represents the part from 9 to 12, and identifier 5 represents the part from 12 to 15.

[0534] In the embodiment of the present application, a context model may be determined for one or more of the identifiers of the first quantized coefficient, and decoding may be performed using the one or more identifiers. In other words, the embodiment of the present application may determine a target context model for the target identifier in the first quantized coefficient, and use the target context model to decode the target identifier in the first quantized coefficient.

[0535] Optionally, the target identifier of the first quantization coefficient can be identifier 1, or identifier 2 to identifier 5. In this way, the decoding end can determine two context models, one of which is an upper and lower model for decoding identifier 1, and the other context model is used to decode identifiers 2 to 5.

[0536] In some embodiments, the present application creates multiple new context models for coefficients whose parity is hidden. In this case, the above S703 includes the following steps S703-A to S703-C:

[0537] S703-A, obtaining multiple context models corresponding to the target identifier of the first quantization coefficient;

[0538] S703-B, determining a target context model from multiple context models;

[0539] S703-C: Use the target context model to encode the target identifier to obtain a bitstream.

[0540] In an embodiment of the present application, in order to improve the decoding accuracy of parity-hidden coefficients (the parity-hidden coefficients here include coefficients with partially or fully hidden parity), multiple context models are created for target identifiers in the parity-hidden coefficients, and these multiple context models are at least partially different from the context models corresponding to the coefficients with non-hidden parity.

[0541] In this way, when decoding the first quantization coefficient whose parity is hidden, multiple context models corresponding to the target identifier of the first quantization coefficient are first obtained, and then the target context model corresponding to the target identifier is determined from these multiple context models, and the target identifier in the first quantization coefficient is encoded using the target context model.

[0542] The implementation methods for determining the target context model from the multiple context models in S703-B include but are not limited to the following:

[0543] Method 1: any one of the above-mentioned multiple context models is determined as the target context model.

[0544] Mode 2: The above S703-B includes the following steps S703-B1 and S703-B2:

[0545] S703-B1. Determine the index of the target context model;

[0546] S703-B2. Determine a target context model from multiple context models according to the index.

[0547] In method 2, each of the multiple context models corresponding to the first quantization coefficient includes an index, so that the decoding end can determine the index of the target context model and then select the target context model corresponding to the index from the multiple context models corresponding to the first quantization coefficient.

[0548] The embodiments of the present application do not limit the specific implementation method of determining the index of the context model.

[0549] In a possible implementation, the index of the target context model is determined through the following steps S703 - B11 to S703 - B13:

[0550] S703-B11. Determine a basic index corresponding to the first quantization coefficient.

[0551] The method of determining the basic index corresponding to the first quantization coefficient in S703-B11 includes but is not limited to the following examples:

[0552] Example 1: Determine a base index according to a position of the first quantization coefficient in the corresponding transform block.

[0553] In a possible implementation of Example 1, the base index is determined according to the distance from the position of the first quantization coefficient in the corresponding transform block to the upper left corner of the corresponding transform block.

[0554] For example, if the distance between the position of the first quantized coefficient in the transform block to which it belongs and the upper left corner position of the transform block to which it belongs is less than or equal to a threshold, the base index is determined to be the first value.

[0555] For another example, if the distance between the position of the first quantized coefficient in the transform block to which it belongs and the upper left corner position of the transform block to which it belongs is greater than the threshold, the base index is determined to be the second value.

[0556] The embodiment of the present application does not limit the specific values ​​of the first and second values.

[0557] Optionally, the first value is 0.

[0558] Optionally, the second value is G, where G is a preset value.

[0559] The embodiment of the present application does not limit the size of the above threshold.

[0560] Optionally, the threshold is 0, or a positive number greater than 0 and less than m, where m is a smaller value.

[0561] In this example 1, the basic index is determined according to the position of the first quantization coefficient in the corresponding transform block. The method is simple and the data processing speed is fast.

[0562] Example 2: Determine a base index according to a position index of the first quantized coefficient in a scanning order and a size of a current region.

[0563] Assume that the first quantization coefficient is the coefficient at index 21 in Figure 8, and the size of the current area where the first quantization coefficient is located is 16. In this way, the basic index can be determined according to the position index of the first quantization coefficient in the scanning order (i.e. 21) and the size of the current area (e.g. 16).

[0564] The embodiment of the present application does not limit the specific method of determining the basic index in Example 2 based on the position index of the first quantization coefficient in the scanning order and the size of the current area.

[0565] In a possible implementation, a ratio of a position index of the first quantized coefficient in the scanning order to a size of the current region is determined as the base index.

[0566] In another possible implementation, a ratio between a position index of the first quantized coefficient in the scanning order and a size of the current region is determined; and a product of the ratio and a second value is determined as a base index.

[0567] After the base index is determined according to Example 1 or Example 2 above, the offset index is determined.

[0568] S703-B12. Determine an offset index based on decoded quantization coefficients around the first quantization coefficient.

[0569] The embodiment of the present application does not limit the specific method of determining the offset index based on the decoded quantization coefficients around the first quantization coefficient.

[0570] In some embodiments, the offset index is determined based on absolute values ​​of decoded quantized coefficients surrounding the first quantized coefficient.

[0571] For example, the offset index is determined according to the sum of the entire absolute values ​​of the decoded quantization coefficients around the first quantization coefficient.

[0572] For another example, the offset index is determined according to the sum of partial absolute values ​​of decoded quantization coefficients around the first quantization coefficient, wherein the partial absolute value of the decoded quantization coefficient is the portion of the absolute value of the decoded quantization coefficient that is smaller than the preset value K.

[0573] S703-B13. Determine the sum of the base index and the bias index as the index of the target context model.

[0574] According to the above steps, after determining the base index and the bias index corresponding to the first quantization coefficient, the sum of the bias index and the base index is determined as the index of the target context model.

[0575] After the index of the target context model is determined according to the above steps, the target context model is determined from the corresponding multiple context models based on the index.

[0576] From the above, it can be seen that the above-mentioned multiple context models include context models with different indexes under multiple QP segments (for example, 4 QP segments) and 2 components (for example, luminance component and chrominance component). In this way, the above-mentioned S403-B determines the target context model from the multiple context models according to the index, including: selecting at least one context model from the above-mentioned multiple context models according to at least one of the quantization parameter, transform type, transform block size, scan type and color component corresponding to the first quantization coefficient; then, determining the context model corresponding to the index in at least one lower context model as the target context model.

[0577] For example, according to the above steps, it is determined that the index corresponding to identifier 1 in the first quantization coefficient is index 1, the QP segment corresponding to the first quantization coefficient is QP segment 1, and the first quantization coefficient is a quantization coefficient for the luma component. Assuming that there are S context models corresponding to identifier 1, T context models for QP segment 1 and the luma component are first selected from these S context models. Then, the context model corresponding to index 1 among these T context models is determined as the target context model corresponding to identifier 1 in the first quantization coefficient, and identifier 1 in the first quantization coefficient is decoded using this target context model.

[0578] For another example, according to the above steps, it is determined that the index corresponding to identifiers 2 to 5 in the first quantization coefficient is index 2, the QP segment corresponding to the first quantization coefficient is QP segment 1, and the first quantization coefficient is a quantization coefficient for the luma component. Assuming that there are U context models corresponding to identifiers 2 to 5, first, from these U context models, V context models for QP segment 1 and the luma component are selected. Then, the context model corresponding to index 2 among these V context models is determined as the target context model corresponding to identifiers 2 to 5 in the first quantization coefficient. Then, identifiers 2 to 5 in the first quantization coefficient are decoded using this target context model.

[0579] In some embodiments, before determining a target context model from a plurality of context models, the encoding end needs to initialize the plurality of context models, and then determine the target context model from the initialized plurality of context models.

[0580] For example, multiple context models corresponding to identifier 1 are initialized, and then a target context model corresponding to identifier 1 is selected from the initialized multiple context models.

[0581] For another example, multiple context models corresponding to identifiers 2 to 5 are initialized, and then target context models corresponding to identifiers 2 to 5 are selected from these initialized multiple context models.

[0582] That is, in order to enable faster convergence of the probability values ​​in the context models corresponding to the parity-hidden coefficients, the embodiments of the present application may have a set of corresponding initial values ​​for each model based on the probability of each symbol appearing. In AVM, the probability of each context model is calculated based on the number of symbols in the model, the probability of each symbol appearing, and the cumulative distribution function (CDF). The probability of a symbol appearing in the context model being less than a certain value is calculated, and the probability value is normalized to be represented by a 16-bit integer.

[0583] In the embodiment of the present application, the methods for initializing multiple context models include but are not limited to the following:

[0584] Method 1: Initialize multiple context models using equal probability values.

[0585] In method 2, multiple context models are initialized using convergence probability values, where the convergence probability values ​​are convergence probability values ​​corresponding to the context models when the context models are used to encode a test video.

[0586] After determining the target context model corresponding to the first quantization coefficient according to the above, the target context model is used to encode a quantization coefficient to obtain a bit stream.

[0587] For example, the target context model corresponding to identifier 1 is used to encode identifier 1 in the first quantization coefficient.

[0588] For another example, identifiers 2 to 5 in the first quantization coefficient are encoded using the target context models corresponding to identifiers 2 to 5.

[0589] In this embodiment of the present application, the parity of the parity-hidden portion of the first quantization coefficient is indicated by using P quantization coefficients in the current region.

[0590] For example, a binary characteristic (0 or 1) of the P quantized coefficients in the current region is used to indicate the parity of the portion where the parity is to be concealed.

[0591] In some embodiments, the parity of the parity-hidden portion is indicated by the parity corresponding to the P quantized coefficients in the current region.

[0592] In one example, the P quantization coefficients are all quantization coefficients in the current region.

[0593] In another example, the P quantization coefficients are part of the quantization coefficients in the current region.

[0594] Exemplarily, the parity corresponding to the P quantization coefficients may be the parity of the minimum quantization coefficient among the P quantization coefficients, the maximum quantization coefficient among the P quantization coefficients, the sum of the absolute values ​​of the P quantization coefficients, the number of target quantization coefficients among the P quantization coefficients, and so on.

[0595] An embodiment of the present application uses the parity corresponding to the P quantization coefficients in the current area to indicate the parity of the parity-hidden part. For example, the parity corresponding to the P quantization coefficients is an odd number to indicate that the parity-hidden part is an odd number, and the parity corresponding to the P quantization coefficients is an even number to indicate that the parity-hidden part is an even number.

[0596] In some embodiments, if the parity corresponding to the P quantized coefficients is inconsistent with the parity of the parity-hidden portion, the method of the embodiment of the present application further includes the following step 1:

[0597] Step 1: Adjust the P quantization coefficients so that the parities corresponding to the P quantization coefficients are consistent with the parity of the parity-hidden part.

[0598] Case 1: If the parity of the parity-hidden part is indicated by the parity of the sum of the first absolute values ​​of the P quantization coefficients, then the above step 1 includes: adjusting the values ​​of the P quantization coefficients so that the parity of the sum of the first absolute values ​​of the P quantization coefficients is consistent with the parity of the parity-hidden part.

[0599] The first absolute value of the quantization coefficient is a partial or complete absolute value of the quantization coefficient. For example, the first absolute value of the quantization coefficient is an absolute value of a part smaller than 15.

[0600] The above situation 1 includes the following two examples:

[0601] Example 1: If the parity-hidden portion is an odd number and the sum of the first absolute values ​​of the P quantization coefficients is an even number, the values ​​of the P quantization coefficients are adjusted so that the sum of the first absolute values ​​of the adjusted P quantization coefficients is an odd number.

[0602] For example, if the parity-hidden part is an odd number, and the sum of the first absolute values ​​of the P quantization coefficients is an even number, then the smallest quantization coefficient among the P quantization coefficients is added by 1 or subtracted by 1 to modify the sum of the first absolute values ​​of the P quantization coefficients to an odd number.

[0603] Example 2: If the parity-hidden part is an even number and the sum of the first absolute values ​​of the P quantization coefficients is an odd number, the values ​​of the P quantization coefficients are adjusted so that the sum of the first absolute values ​​of the adjusted P quantization coefficients is an even number.

[0604] For example, the part where the parity is hidden is an even number, and the sum of the first absolute values ​​of the P quantization coefficients is an odd number. At this time, the smallest quantization coefficient among the P quantization coefficients is added by 1 or subtracted by 1 to modify the sum of the first absolute values ​​of the P quantization coefficients to an even number.

[0605] In case 2, if the parity of the parity-hidden portion is indicated by the parity of the number of target quantization coefficients in the P quantization coefficients, then the above-mentioned step 1 includes: adjusting the values ​​of the P quantization coefficients so that the parity of the number of target quantization coefficients in the P quantization coefficients is consistent with the parity of the parity-hidden portion.

[0606] Example 2 above includes at least the following two examples:

[0607] Example 1: If the parity-hidden portion is an odd number, and the number of target quantization coefficients in the P quantization coefficients is an even number, the values ​​of the P quantization coefficients are adjusted so that the number of target quantization coefficients in the adjusted P quantization coefficients is an odd number.

[0608] Example 2: If the parity-hidden part is an even number, and the number of target quantization coefficients in the P quantization coefficients is an odd number, the values ​​of the P quantization coefficients are adjusted so that the number of target quantization coefficients in the adjusted P quantization coefficients is an even number.

[0609] The target quantization coefficient is any one of the non-zero quantization coefficient, the non-zero quantization coefficient with an even value, the quantization coefficient with an even value, and the quantization coefficient with an odd value among the P quantization coefficients.

[0610] In one example, if the target quantization coefficient is a non-zero quantization coefficient among P quantization coefficients, the encoder modifies at least one coefficient among the P quantization coefficients. For example, if the parity-hidden portion is an odd number, and the number of non-zero quantization coefficients among the P quantization coefficients is an even number, then one of the zero quantization coefficients among the P quantization coefficients may be adjusted to 1, or the value of the smallest quantization coefficient among the P quantization coefficients may be adjusted to 0, so that the number of non-zero quantization coefficients among the P quantization coefficients is an odd number.

[0611] For another example, if the part whose parity is hidden is an even number, and the number of non-zero quantization coefficients in the P quantization coefficients is an odd number, then one of the zero quantization coefficients in the P quantization coefficients can be adjusted to 1, or the value of the smallest non-zero quantization coefficient in the P quantization coefficients can be adjusted to 0, so that the number of non-zero quantization coefficients in the P quantization coefficients is an even number.

[0612] In another example, if the target quantization coefficient is a non-zero quantization coefficient with an even value among P quantization coefficients, the encoder modifies at least one coefficient among the P quantization coefficients. For example, if the parity-hidden portion is an odd number, and the number of non-zero quantization coefficients with even values ​​among the P quantization coefficients is an even number, then the zero quantization coefficient among the P quantization coefficients may be adjusted to 2, or the value of the smallest non-zero quantization coefficient among the P quantization coefficients may be increased or decreased by 1 so that the number of non-zero quantization coefficients with even values ​​among the P quantization coefficients is an odd number.

[0613] For another example, if the parity-hidden portion is an even number, and the number of even-numbered non-zero quantized coefficients among the P quantized coefficients is an odd number, then one of the zero quantized coefficients among the P quantized coefficients may be adjusted to 2, or the value of the smallest non-zero quantized coefficient among the P quantized coefficients may be increased or decreased by 1 to make the number of non-zero quantized coefficients among the P quantized coefficients an even number. The encoder adjusts at least one of the P quantized coefficients using an adjustment method that minimizes rate-distortion cost.

[0614] In another example, if the target quantization coefficient is an even-numbered quantization coefficient among P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the parity-hidden portion is an odd number, and the number of even-numbered quantization coefficients among the P quantization coefficients is an even number, then one of the zero quantization coefficients among the P quantization coefficients may be adjusted to 1, or the smallest non-zero quantization coefficient among the P quantization coefficients may be adjusted to 0, so that the number of even-numbered quantization coefficients among the P quantization coefficients is an odd number.

[0615] For another example, if the part whose parity is hidden is an even number, and the number of quantization coefficients with even values ​​among the P quantization coefficients is an odd number, then one of the zero quantization coefficients among the P quantization coefficients can be adjusted to 1, or the smallest non-zero quantization coefficient among the P quantization coefficients can be adjusted to 0, so that the number of quantization coefficients among the P quantization coefficients is an even number.

[0616] In another example, if the target quantization coefficient is an odd-numbered quantization coefficient among P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the parity-hidden portion is an odd number, and the number of odd-numbered quantization coefficients among the P quantization coefficients is an even number, then one of the zero quantization coefficients among the P quantization coefficients may be adjusted to 1, or the smallest non-zero quantization coefficient among the P quantization coefficients may be adjusted to 0, plus 1, or minus 1, so that the number of odd-numbered quantization coefficients among the P quantization coefficients is an odd number.

[0617] For another example, if the part whose parity is hidden is an even number, and the number of quantization coefficients with odd values ​​among the P quantization coefficients is an odd number, then one of the zero quantization coefficients among the P quantization coefficients can be adjusted to 1, or the smallest non-zero quantization coefficient among the P quantization coefficients can be adjusted to 0 or added 1 or subtracted 1, so that the number of quantization coefficients among the P quantization coefficients is an even number.

[0618] Furthermore, the parity hiding technology proposed in this application is implemented on the AVM reference software, the region size used is set to 16, and the threshold for the number of non-zero coefficients for parity hiding is 4. When the parity hiding technology of this application is turned on for the current region, the absolute value sum of the non-zero coefficients in the current region that are less than or equal to 15 is an odd number, which means that the last coefficient in the scanning order of the region (i.e., the second quantization coefficient) is an odd number, and an even number means that the last coefficient in the scanning order of the region (i.e., the second quantization coefficient) is an even number. Under the general test conditions CTC of AVM, sequences with resolutions ranging from 270p to 4K are tested under all intra (full frame) and random access (random access) configurations, and the codec performance changes and time changes are shown in Table 9:

[0619] Table 9: all intra

[0620]

[0621]

[0622] The PSNR in Table 9 above stands for Peak Signal-to-Noise Ratio (PSNR), which represents the ratio of the maximum possible signal power to the destructive noise power that affects its representation accuracy. Because many signals have a very wide dynamic range, PSNR is often expressed in logarithmic decibels. In video encoding and decoding, PSNR is used to evaluate the quality of a compressed image compared to the original image. The higher the PSNR, the less distortion after compression. Enc-time is encoding time, and Dec-time is decoding time.

[0623] As can be seen from Table 9 above, under the AVM general test conditions, by adopting the parity hiding technology of the embodiment of the present application, the full-frame intra-frame coding performance is improved by 0.29%, 0.97% and 0.98% on the YUV3 component.

[0624] In the video encoding method provided by the embodiment of the present application, the encoding end divides the current block into N regions, determines the second quantization coefficient in the current region, and hides the parity of part or all of the second quantization coefficient to obtain the first quantization coefficient, where the current region is a region of the N regions that includes at least one non-zero quantization coefficient; then, the target context model corresponding to the first quantization coefficient is determined, and the first quantization coefficient is encoded using the target context model to obtain a bitstream, where the parity of the parity-hidden part of the first quantization coefficient is indicated by the P quantization coefficients in the current region. That is, in the embodiment of the present application, the encoding end hides the parity of part or all of the second quantization coefficient to obtain the first quantization coefficient. Since the absolute value of the first quantization coefficient is smaller than the second quantization coefficient, encoding the first quantization coefficient in this way can reduce the number of encoding bits compared to the second quantization coefficient, thereby reducing the encoding cost. In addition, by separately determining the target context model corresponding to the first quantization coefficient to encode the first quantization coefficient, the encoding accuracy of the first quantization coefficient is improved.

[0625] FIG13 is a flow chart of a video encoding method provided in an embodiment of the present application.

[0626] Based on the embodiment shown in FIG. 12 above, the video encoding method provided in the embodiment of the present application is further described below in conjunction with FIG. 13 .

[0627] FIG13 is a flow chart of a video encoding method according to an embodiment of the present application. As shown in FIG13 , the method according to the embodiment of the present application includes:

[0628] S801. Obtain at least one flag.

[0629] The at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.

[0630] Optionally, the at least one flag includes at least one of a sequence level flag, a picture level flag, a slice level flag, a unit level flag and a block level flag.

[0631] If it is determined according to at least one flag that the parity of the quantization coefficients of the current block is allowed to be hidden, the following step S802 is executed.

[0632] If it is determined according to at least one flag that the parity of the quantization coefficients of the current block is not allowed to be hidden, the following step S806 is executed.

[0633] S802: Divide the current block into N areas.

[0634] The embodiment of the present application does not limit the region division method of the current block. For example, the current block is divided into N regions according to the scanning order, or the current block is divided into N regions according to the spatial position of the pixels in the current block.

[0635] The sizes of the above-mentioned N areas can be the same or different, and this embodiment of the application does not limit this.

[0636] The specific implementation process of the above S802 can refer to the relevant description of the above S701 and will not be repeated here.

[0637] S803: Determine whether the current area meets the conditions.

[0638] The condition includes at least one of the following preset conditions and a parity hiding technology enabling condition.

[0639] In the embodiment of the present application, the parity hiding technology proposed in the present application is limited. Specifically, if the current region meets the conditions, it means that the current region can obtain significant beneficial effects by using the parity hiding technology provided in the embodiment of the present application. In this case, the following step S804 is executed.

[0640] If the current region does not meet the conditions, it means that the parity hiding technology provided by the embodiment of the present application cannot achieve significant beneficial effects in the current region. In this case, the following step S806 is executed.

[0641] The following describes the conditions for enabling parity hiding technology.

[0642] In some embodiments, different conditions for enabling the parity hiding technique may be preset according to at least one of a quantization parameter, a transform type, a transform block size, a scan type, and a color component.

[0643] For example, if the quantization coefficient is greater than or equal to a preset value, the parity hiding technology is enabled; if the quantization coefficient is less than the preset value, the parity hiding technology is disabled.

[0644] For another example, if the transform type is a preset transform type, the parity hiding technology is enabled; if the transform type is not a preset transform type, the parity hiding technology is not enabled.

[0645] For another example, if the transform block size is greater than or equal to a preset size, the parity hiding technology is enabled; if the transform block size is smaller than the preset size, the parity hiding technology is disabled.

[0646] For another example, if the color component is U, the parity hiding technology is enabled, and if the color component is V, the parity hiding technology is not enabled.

[0647] For another example, if the transform block uses the preset scan type, the parity hiding technology is enabled; if the transform block does not apply to the preset scan type, the parity hiding technology is disabled.

[0648] It should be noted that the above examples are merely illustrative, and the above examples can be used in the same combination as the conditions for enabling the parity hiding technology.

[0649] The following describes the pre-conditions.

[0650] In a possible implementation, the above-mentioned preset conditions include at least one of the following conditions:

[0651] Condition 1: the number of non-zero quantized coefficients in the current region is greater than a first preset value;

[0652] Condition 2: In the current region, the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the encoding scan order is greater than a second preset value;

[0653] Condition 3: In the current region, the distance between the first non-zero quantized coefficient and the last quantized coefficient in the encoding scan order is greater than a third preset value;

[0654] Condition 4: In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth preset value.

[0655] In some embodiments, the above four conditions can also be combined with each other to form new constraints.

[0656] The embodiment of the present application does not limit the specific values ​​of the first to fourth preset values, as long as the first to fourth preset values ​​are all positive integers.

[0657] In one example, at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a fixed value.

[0658] In another example, at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, that is, a value determined by the encoding end according to current encoding information.

[0659] In some embodiments, if at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, the encoder writes the non-fixed value into the bitstream, and the decoder parses the non-fixed value from the bitstream.

[0660] In some embodiments, the encoding end may first determine whether the current area meets the above-mentioned preset conditions when determining that the first quantization coefficient allows the parity of the quantization coefficient to be hidden based on at least one of the quantization parameter, transform type, transform block size, scan type and color component corresponding to the first quantization coefficient.

[0661] In some embodiments, when determining that the current region meets the above-mentioned preset conditions, the encoder may determine whether the first quantization coefficient meets the conditions for starting the parity hiding technology.

[0662] That is to say, the above-mentioned preset conditions and the above-mentioned conditions for enabling the parity hiding technology can be used alone or in combination with each other.

[0663] S804: Determine a second quantization coefficient in the current region, and perform parity hiding on all or part of the second quantization coefficient to obtain a first quantization coefficient.

[0664] S805: Determine a target context model corresponding to the first quantization coefficient, and use the target context model to encode the first quantization coefficient to obtain a bitstream.

[0665] The above steps S804 and S805 can refer to the description of the above steps S702 and S703, and will not be repeated here.

[0666] S806: Encode the second quantized coefficient to obtain a code stream.

[0667] In an embodiment of the present application, when encoding the current area, the encoding end first determines whether the current area meets the conditions to determine whether the current area can bring significant beneficial technical effects when encoded using the parity hiding technology provided by the present application. When it is determined that the use of the parity hiding technology has significant beneficial effects, the technical solution of the present application is used to encode the current area to improve encoding reliability.

[0668] It should be understood that Figures 6 to 13 are merely examples of the present application and should not be understood as limiting the present application.

[0669] The preferred embodiments of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above embodiments. Within the technical concept of the present application, a variety of simple modifications can be made to the technical solution of the present application, and these simple modifications all fall within the scope of protection of the present application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner unless there is any contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different embodiments of the present application can also be arbitrarily combined, and as long as they do not violate the ideas of the present application, they should also be regarded as the contents disclosed in the present application.

[0670] It should also be understood that in the various method embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. In addition, in the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three types of relationships can exist. Specifically, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the related objects before and after are in an "or" relationship.

[0671] The above describes in detail the method embodiment of the present application in conjunction with Figures 6 to 13, and the following describes in detail the device embodiment of the present application in conjunction with Figures 14 to 17.

[0672] FIG14 is a schematic block diagram of a video decoding device according to an embodiment of the present application.

[0673] As shown in FIG14 , the video decoding apparatus 10 includes:

[0674] A decoding unit 11 is configured to decode a bitstream to obtain P quantization coefficients in a current region, where the current region is a region in a current block including at least one non-zero quantization coefficient, and P is a positive integer;

[0675] a parity determination unit 12, configured to determine, based on the P quantization coefficients, the parity of a parity-hidden portion of a first quantization coefficient, where the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on all or part of the second quantization coefficient in the current region;

[0676] a processing unit 13, configured to determine a target context model corresponding to the first quantization coefficient, and decode the first quantization coefficient based on context encoding using the target context model to obtain a decoded first quantization coefficient;

[0677] The determining unit 14 is configured to determine a second quantized coefficient having parity according to the parity of the parity-hidden part and the decoded first quantized coefficient.

[0678] In some embodiments, the context model corresponding to the first quantization coefficient is different from the context models corresponding to other quantization coefficients whose parity is not hidden.

[0679] In some embodiments, the processing unit 13 is specifically used to obtain multiple context models corresponding to the target identifier of the first quantization coefficient; determine the target context model from the multiple context models; use the target context model to decode the target identifier to obtain the first quantization coefficient.

[0680] In some embodiments, the processing unit 13 is specifically configured to determine the target context model from the multiple context models according to the index.

[0681] In some embodiments, the processing unit 13 is specifically used to determine a base index corresponding to the first quantization coefficient; determine a bias index based on the decoded quantization coefficients around the first quantization coefficient; and determine the sum of the base index and the bias index as the index of the target context model.

[0682] In some embodiments, the processing unit 13 is specifically configured to determine the basic index according to a position of the first quantization coefficient in the corresponding transform block.

[0683] In some embodiments, the processing unit 13 is specifically used to determine the basic index according to the distance from the position of the first quantization coefficient in the corresponding transform block to the upper left corner position of the corresponding transform block.

[0684] In some embodiments, the processing unit 13 is specifically configured to determine that the base index is a first value if the distance is less than or equal to a threshold; and to determine that the base index is a second value if the distance is greater than the threshold.

[0685] In some embodiments, the processing unit 13 is specifically configured to determine the basic index according to a position index of the first quantization coefficient in a scanning order and a size of the current region.

[0686] In some embodiments, the processing unit 13 is specifically configured to determine a ratio between a position index of the first quantization coefficient in a scanning order and a size of the current region; and determine a product of the ratio and a second value as the base index.

[0687] In some embodiments, the processing unit 13 is specifically configured to determine the offset index according to absolute values ​​of decoded quantization coefficients around the first quantization coefficient.

[0688] In some embodiments, the processing unit 13 is specifically used to determine the bias index based on the sum of partial absolute values ​​of the decoded quantization coefficients around the first quantization coefficient, and the partial absolute value of the decoded quantization coefficient is the part of the absolute value of the decoded quantization coefficient that is less than a preset value.

[0689] In some embodiments, the processing unit 13 is specifically used to select at least one context model from the multiple context models based on at least one of the quantization parameter, transform type, transform block size, scan type and color component corresponding to the first quantization coefficient; and determine the context model corresponding to the index in the at least one lower context model as the target context model.

[0690] Optionally, the target identifier is identifier 1, or the target identifier is any one of identifiers 2 to 5.

[0691] In some embodiments, the processing unit 13 is further configured to initialize the multiple context models; and determine the target context model from the initialized multiple context models.

[0692] In some embodiments, the processing unit 13 is specifically used to initialize the multiple context models using equal probability values; or, to initialize the multiple context models using convergence probability values, wherein the convergence probability value is the convergence probability value corresponding to the context model when the context model is used to encode the test video.

[0693] In some embodiments, the parity determination unit 12 is specifically configured to determine the parity of the parity-hidden part according to the parities corresponding to the P quantized coefficients.

[0694] In some embodiments, the parity determination unit 12 is specifically configured to determine the parity of the parity-hidden part based on the parity of the sum of the first absolute values ​​of the P quantization coefficients, where the first absolute value of the quantization coefficient is all or part of the absolute value of the quantization coefficient.

[0695] In some embodiments, the parity determination unit 12 is specifically used to determine that the parity hidden part is an odd number if the sum of the first absolute values ​​of the P quantization coefficients is an odd number; if the sum of the first absolute values ​​of the P quantization coefficients is an even number, then determine that the parity hidden part is an even number.

[0696] In some embodiments, the parity determination unit 12 is specifically configured to determine a target quantization coefficient among the P quantization coefficients; and determine the parity of the parity-hidden portion according to the parity of the number of the target quantization coefficients among the P quantization coefficients.

[0697] In some embodiments, the parity determination unit 12 is specifically used to determine that the parity hidden part is an odd number if the number of the target quantization coefficients in the P quantization coefficients is an odd number; if the number of the target quantization coefficients in the P quantization coefficients is an even number, then determine that the parity hidden part is an even number.

[0698] In some embodiments, the target quantization coefficient is any one of a non-zero quantization coefficient, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value among the P quantization coefficients.

[0699] In some embodiments, the determination unit 14 is specifically configured to perform an operation on the parity-hidden part using a preset operation method to obtain a first operation result; process the first operation result according to the parity to obtain a second operation result; and obtain the second quantization coefficient according to the second operation result and the first quantization coefficient.

[0700] In some embodiments, the preset operation method includes multiplying the hidden part of the parity by two, and the determination unit 14 is specifically configured to multiply the hidden part of the parity by two to obtain the first operation result.

[0701] In some embodiments, the determination unit 14 is specifically used to add the first operation result and the parity value to obtain a second operation result, wherein if the hidden part of the parity is an odd number, the parity value is 1; if the hidden part of the parity is an even number, the parity value is 0.

[0702] In some embodiments, the determining unit 14 is specifically configured to determine the second operation result as the second quantization coefficient if the parity hidden portion is the entire first quantization coefficient.

[0703] In some embodiments, the determining unit 14 is specifically configured to determine the second quantization coefficient as the sum of the parity unhidden portion and the second operation result if the first quantization coefficient also includes a parity unhidden portion.

[0704] In some embodiments, the parity determination unit 12 is specifically configured to determine the parity of the parity-hidden portion according to the P quantization coefficients if the current region meets a preset condition.

[0705] In some embodiments, the preset condition includes at least one of the following:

[0706] The number of non-zero quantized coefficients in the current region is greater than a first preset value;

[0707] In the current region, a distance between a first non-zero quantized coefficient and a last non-zero quantized coefficient in a decoding scan order is greater than a second preset value;

[0708] In the current region, a distance between a first non-zero quantized coefficient and a last quantized coefficient in a decoding scan order is greater than a third preset value;

[0709] In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth preset value.

[0710] Optionally, at least one of the first preset value, the second preset value, the third preset value and the fourth preset value is a fixed value.

[0711] Optionally, at least one of the first preset value, the second preset value, the third preset value and the fourth preset value is a non-fixed value.

[0712] In some embodiments, if at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, the decoding unit 11 is further configured to decode the code stream to obtain the non-fixed value.

[0713] In some embodiments, the parity determination unit 12 is further configured to skip the step of determining the parity of the parity-hidden portion based on the P quantization coefficients if the current block is transformed using a target transformation method.

[0714] Optionally, the target transformation method includes secondary transformation or multiple transformations.

[0715] In some embodiments, the parity determination unit 12 is further used to decode the code stream to obtain at least one flag, where the at least one flag is used to indicate whether the parity of the quantization coefficient is allowed to be hidden; if it is determined based on the at least one flag that the parity of at least one quantization coefficient in the current block is allowed to be hidden, the parity of the parity-hidden part is determined based on the P quantization coefficients.

[0716] Optionally, the at least one flag includes at least one of a sequence level flag, a picture level flag, a slice level flag, a unit level flag and a block level flag.

[0717] In some embodiments, the parity determination unit 12 is further used to determine whether the first quantization coefficient allows the parity of the quantization coefficient to be hidden based on at least one of the quantization parameter, transform type, transform block size, scan type and color component corresponding to the first quantization coefficient; when determining that the parity of the first quantization coefficient is allowed to be hidden, determine the parity of the parity-hidden part based on the P quantization coefficients.

[0718] In some embodiments, the first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current region, and K is less than or equal to the number of non-zero quantization coefficients in the current region.

[0719] In some embodiments, the decoding unit 11 is specifically used to decode the code stream to obtain decoded information of the current block; divide the current block into N areas, where N is a positive integer; and obtain P quantization coefficients in the current area from the decoded information of the current block.

[0720] In some embodiments, the decoding unit 11 is specifically configured to divide the current block into N regions according to a scanning order.

[0721] In some embodiments, the decoding unit 11 is specifically configured to divide the current block into N regions according to spatial positions.

[0722] Optionally, at least two of the N regions include the same number of quantization coefficients.

[0723] Optionally, at least two of the N regions include different numbers of quantization coefficients.

[0724] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions can refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the video decoding device 10 shown in Figure 14 can correspond to the corresponding subject in the method of the embodiment of the present application, and the aforementioned and other operations and / or functions of the various units in the video decoding device 10 are respectively for implementing the corresponding processes in each method such as the method, and for the sake of brevity, no further description is given here.

[0725] FIG15 is a schematic block diagram of a video encoding device according to an embodiment of the present application.

[0726] As shown in FIG15 , the video encoding apparatus 20 includes:

[0727] A division unit 21 is configured to divide the current block into N regions, where N is a positive integer;

[0728] a processing unit 22 configured to determine a second quantization coefficient in the current region and perform parity hiding on part or all of the second quantization coefficient to obtain a first quantization coefficient, wherein the current region is a region among the N regions including at least one non-zero quantization coefficient;

[0729] The encoding unit 23 is used to determine the target context model corresponding to the first quantization coefficient, and use the target context model to encode the first quantization coefficient to obtain a code stream, wherein the parity of the hidden part of the parity in the first quantization coefficient is indicated by P quantization coefficients in the current area, where P is a positive integer.

[0730] In some embodiments, the context model corresponding to the first quantization coefficient is different from the context models corresponding to other quantization coefficients whose parity is not hidden.

[0731] In some embodiments, the encoding unit 23 is specifically used to obtain multiple context models corresponding to the target identifier of the first quantization coefficient; determine the target context model from the multiple context models; and use the target context model to encode the target identifier to obtain the code stream.

[0732] In some embodiments, the encoding unit 23 is specifically configured to determine an index of the target context model; and determine the target context model from the multiple context models according to the index.

[0733] In some embodiments, the encoding unit 23 is specifically used to determine a basic index corresponding to the first quantization coefficient; determine a bias index based on the decoded quantization coefficients around the first quantization coefficient; and determine the sum of the basic index and the bias index as the index of the target context model.

[0734] In some embodiments, the encoding unit 23 is specifically configured to determine the basic index according to a position of the first quantization coefficient in the corresponding transform block.

[0735] In some embodiments, the encoding unit 23 is specifically configured to determine the base index according to a distance from a position of the first quantization coefficient in the corresponding transform block to a position of an upper left corner of the corresponding transform block.

[0736] In some embodiments, the encoding unit 23 is specifically configured to determine that the base index is a first value if the distance is less than or equal to a threshold; and to determine that the base index is a second value if the distance is greater than the threshold.

[0737] In some embodiments, the encoding unit 23 is specifically configured to determine the basic index according to a position index of the first quantization coefficient in a scanning order and a size of the current region.

[0738] In some embodiments, the encoding unit 23 is specifically configured to determine a ratio between a position index of the first quantization coefficient in a scanning order and a size of the current region; and determine a product of the ratio and a second value as the base index.

[0739] In some embodiments, the encoding unit 23 is specifically configured to determine the offset index according to absolute values ​​of decoded quantization coefficients around the first quantization coefficient.

[0740] In some embodiments, the encoding unit 23 is specifically used to determine the bias index based on the sum of the partial absolute values ​​of the encoded quantization coefficients around the first quantization coefficient, and the partial absolute value of the decoded quantization coefficient is the part of the absolute value of the encoded quantization coefficient that is less than a preset value.

[0741] In some embodiments, the encoding unit 23 is specifically used to select at least one context model from the multiple context models based on at least one of the quantization parameter, transform type, transform block size, scan type and color component corresponding to the first quantization coefficient; and determine the context model corresponding to the index in the at least one lower context model as the target context model.

[0742] Optionally, the target identifier is identifier 1, or the target identifier is any one of identifiers 2 to 5.

[0743] In some embodiments, the encoding unit 23 is specifically configured to initialize the multiple context models; and determine the target context model from the initialized multiple context models.

[0744] In some embodiments, the encoding unit 23 is specifically used to initialize the multiple context models using equal probability values; or, to initialize the multiple context models using convergence probability values, wherein the convergence probability value is the convergence probability value corresponding to the context model when the context model is used to encode the test video.

[0745] In some embodiments, the parity of the parity-hidden portion is indicated by the parities corresponding to the P quantized coefficients in the current region.

[0746] In some embodiments, if the parity corresponding to the P quantization coefficients is inconsistent with the parity of the parity-hidden part, the encoding unit 23 is used to adjust the P quantization coefficients so that the parity corresponding to the P quantization coefficients is consistent with the parity of the parity-hidden part.

[0747] In some embodiments, if the parity of the parity-hidden part is indicated by the sum of the first absolute values ​​of the P quantization coefficients, and the first absolute value of the quantization coefficient is all or part of the absolute value of the quantization coefficient, then the encoding unit 23 is used to adjust the values ​​of the P quantization coefficients so that the parity of the sum of the first absolute values ​​of the P quantization coefficients is consistent with the parity of the parity-hidden part.

[0748] In some embodiments, the encoding unit 23 is specifically configured to, if the parity-hidden portion is an odd number and the sum of the first absolute values ​​of the P quantization coefficients is an even number, adjust the values ​​of the P quantization coefficients so that the sum of the first absolute values ​​of the P quantization coefficients after adjustment is an odd number;

[0749] If the parity hidden part is an even number and the sum of the first absolute values ​​of the P quantization coefficients is an odd number, the values ​​of the P quantization coefficients are adjusted so that the adjusted sum of the first absolute values ​​of the P quantization coefficients is an even number.

[0750] In some embodiments, if the parity of the parity-hidden portion is indicated by the number of target quantization coefficients in the P quantization coefficients, the encoding unit 23 is specifically configured to adjust the values ​​of the P quantization coefficients so that the parity of the target number of quantization coefficients in the P quantization coefficients is consistent with the parity of the parity-hidden portion.

[0751] In some embodiments, the encoding unit 23 is specifically configured to, if the parity-hidden portion is an odd number and the number of target quantization coefficients in the P quantization coefficients is an even number, adjust the values ​​of the P quantization coefficients so that the number of target quantization coefficients in the adjusted P quantization coefficients is an odd number;

[0752] If the parity-hidden portion is an even number and the number of target quantization coefficients in the P quantization coefficients is an odd number, the values ​​of the P quantization coefficients are adjusted so that the number of target quantization coefficients in the adjusted P quantization coefficients is an even number.

[0753] In some embodiments, the target quantization coefficient is any one of a non-zero quantization coefficient, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value among the P quantization coefficients.

[0754] In some embodiments, the processing unit 22 is specifically configured to operate on part or all of the second quantization coefficients using a preset operation method to obtain the first quantization coefficients.

[0755] In some embodiments, the preset operation method includes dividing part or all of the second quantization coefficients by two and rounding them up.

[0756] In some embodiments, the processing unit 22 is specifically configured to perform parity hiding on part or all of the second quantization coefficients to obtain first quantization coefficients if the current region meets the preset condition.

[0757] In some embodiments, the preset condition includes at least one of the following:

[0758] The number of non-zero quantized coefficients in the current region is greater than a first preset value;

[0759] In the current region, a distance between a first non-zero quantized coefficient and a last non-zero quantized coefficient in a scanning order is greater than a second preset value;

[0760] In the current region, a distance between a first non-zero quantized coefficient and a last quantized coefficient in a scanning order is greater than a third preset value;

[0761] In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth preset value.

[0762] Optionally, at least one of the first preset value, the second preset value, the third preset value and the fourth preset value is a fixed value.

[0763] Optionally, at least one of the first preset value, the second preset value, the third preset value and the fourth preset value is a non-fixed value.

[0764] In some embodiments, if at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, the encoding unit 23 is further configured to write the non-fixed value into the bitstream.

[0765] In some embodiments, the encoding unit 23 is further configured to skip parity hiding of part or all of the second quantization coefficients to obtain first quantization coefficients if the current block is transformed using a target transformation method.

[0766] Optionally, the target transformation method includes secondary transformation or multiple transformations.

[0767] In some embodiments, the processing unit 22 is further used to obtain at least one flag, where the at least one flag is used to indicate whether the parity of the quantization coefficient is allowed to be hidden; if it is determined based on the at least one flag that the parity of the quantization coefficient of the current block is allowed to be hidden, parity is hidden on part or all of the second quantization coefficient to obtain the first quantization coefficient.

[0768] Optionally, the at least one flag includes at least one of a sequence level flag, a picture level flag, a slice level flag, a unit level flag and a block level flag.

[0769] In some embodiments, the processing unit 22 is further used to determine whether the first quantization coefficient allows the parity of the quantization coefficient to be hidden based on at least one of the quantization parameter, transform type, transform block size, scan type and color component corresponding to the first quantization coefficient; when it is determined that the parity of the first quantization coefficient is allowed to be hidden, the parity of part or all of the second quantization coefficient is hidden to obtain the first quantization coefficient.

[0770] In some embodiments, the first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current region, and K is less than or equal to the number of non-zero quantization coefficients in the current region.

[0771] In some embodiments, the dividing unit 22 is specifically configured to divide the current block into N regions according to a scanning order.

[0772] In some embodiments, the dividing unit 22 is specifically configured to divide the current block into N regions according to spatial positions.

[0773] Optionally, at least two of the N regions include the same number of quantization coefficients.

[0774] Optionally, at least two of the N regions include different numbers of quantization coefficients.

[0775] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions can refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the video encoding device 20 shown in Figure 15 can correspond to the corresponding subject in the method of the embodiment of the present application, and the aforementioned and other operations and / or functions of each unit in the video encoding device 20 are respectively for implementing the corresponding processes in each method such as the method. For the sake of brevity, no further description is given here.

[0776] The above describes the apparatus and system of the embodiment of the present application from the perspective of functional units in conjunction with the accompanying drawings. It should be understood that the functional unit can be implemented in the form of hardware, can be implemented by instructions in the form of software, or can be implemented by a combination of hardware and software units. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software units in the decoding processor. Optionally, the software unit can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in conjunction with its hardware.

[0777] FIG16 is a schematic block diagram of an electronic device provided in an embodiment of the present application.

[0778] As shown in FIG16 , the electronic device 30 may be a video encoder or a video decoder as described in an embodiment of the present application. The electronic device 30 may include:

[0779] The memory 33 and the processor 32 are configured to store a computer program 34 and transmit the program code 34 to the processor 32. In other words, the processor 32 can call and run the computer program 34 from the memory 33 to implement the method in the embodiment of the present application.

[0780] For example, the processor 32 may be configured to execute the steps of the above method according to the instructions in the computer program 34 .

[0781] In some embodiments of the present application, the processor 32 may include but is not limited to:

[0782] General-purpose processor, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.

[0783] In some embodiments of the present application, the memory 33 includes but is not limited to:

[0784] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).

[0785] In some embodiments of the present application, the computer program 34 may be divided into one or more units, which are stored in the memory 33 and executed by the processor 32 to implement the method provided by the present application. The one or more units may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program 34 in the electronic device 30.

[0786] As shown in FIG16 , the electronic device 30 may further include:

[0787] The transceiver 33 may be connected to the processor 32 or the memory 33 .

[0788] The processor 32 can control the transceiver 33 to communicate with other devices. Specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 33 may include a transmitter and a receiver. The transceiver 33 may further include an antenna, and the number of antennas may be one or more.

[0789] It should be understood that the various components in the electronic device 30 are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.

[0790] FIG17 is a schematic block diagram of a video encoding and decoding system 40 provided in an embodiment of the present application.

[0791] As shown in Figure 17, the video encoding and decoding system 40 may include: a video encoder 41 and a video decoder 42, wherein the video encoder 41 is used to execute the video encoding method involved in the embodiment of the present application, and the video decoder 42 is used to execute the video decoding method involved in the embodiment of the present application.

[0792] The present application also provides a computer storage medium having a computer program stored thereon, which, when executed by a computer, enables the computer to perform the method of the above-mentioned method embodiment. In other words, the present application also provides a computer program product containing instructions, which, when executed by a computer, enables the computer to perform the method of the above-mentioned method embodiment.

[0793] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid state drive (SSD)).

[0794] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0795] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the unit is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, 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.

[0796] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, the functional units in the various embodiments of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0797] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A video decoding method, characterized in that: include: Decoding the bitstream to obtain P quantization coefficients in a current region, where the current region is a region in the current block including at least one non-zero quantization coefficient, and P is a positive integer; determining, based on the P quantization coefficients, a parity of a parity-hidden portion of a first quantization coefficient, where the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on all or part of a second quantization coefficient in the current region; Determining a target context model corresponding to the first quantization coefficient, and decoding the first quantization coefficient based on context encoding using the target context model to obtain a decoded first quantization coefficient; A second quantization coefficient having parity is determined according to the parity of the parity-hidden part and the decoded first quantization coefficient.

2. The method according to claim 1, characterized in that The context model corresponding to the first quantization coefficient is different from the context models corresponding to other quantization coefficients whose parity is not hidden.

3. The method according to claim 2, characterized in that The determining a target context model corresponding to the first quantization coefficient, and decoding the first quantization coefficient based on context coding using the target context model to obtain a decoded first quantization coefficient includes: Obtaining multiple context models corresponding to the target identifier of the first quantization coefficient; Determining the target context model from the multiple context models; The target context model is used to decode the target identifier to obtain the first quantization coefficient.

4. The method according to claim 3, characterized in that The determining the target context model from the multiple context models includes: Determining an index of the target context model; The target context model is determined from the multiple context models according to the index.

5. The method according to claim 4, characterized in that Determining the index of the target context model includes: Determining a basic index corresponding to the first quantization coefficient; Determining an offset index based on decoded quantization coefficients around the first quantization coefficient; The sum of the base index and the bias index is determined as the index of the target context model.

6. The method according to claim 5, characterized in that The determining a basic index corresponding to the first quantization coefficient includes: The basic index is determined according to a position of the first quantization coefficient in the corresponding transform block.

7. The method according to claim 6, characterized in that The determining the base index according to a position of the first quantization coefficient in the corresponding transform block includes: The basic index is determined according to a distance from a position of the first quantization coefficient in the corresponding transform block to a position of an upper left corner of the corresponding transform block.

8. The method according to claim 7, characterized in that The determining the base index according to a distance from a position of the first quantization coefficient in the transform block to which it belongs to to a position of an upper left corner of the transform block to which it belongs includes: If the distance is less than or equal to a threshold, determining that the basic index is a first value; If the distance is greater than the threshold, the basic index is determined to be a second value.

9. The method according to claim 5, characterized in that The determining a basic index corresponding to the first quantization coefficient includes: The basic index is determined according to a position index of the first quantization coefficient in a scanning order and a size of the current region.

10. The method according to claim 9, characterized in that The determining the base index according to the position index of the first quantization coefficient in the scanning order and the size of the current region includes: determining a ratio between a position index of the first quantized coefficient in a scanning order and a size of the current region; The product of the ratio and the second value is determined as the basic index.

11. The method according to any one of claims 5 to 10, characterized in that: The determining of the offset index based on decoded quantization coefficients around the first quantization coefficient includes: The offset index is determined according to absolute values ​​of decoded quantization coefficients around the first quantization coefficient.

12. The method according to claim 11, characterized in that The determining the offset index according to the absolute values ​​of the decoded quantization coefficients around the first quantization coefficient includes: The bias index is determined according to a sum of partial absolute values ​​of decoded quantization coefficients around the first quantization coefficient, where the partial absolute value of the decoded quantization coefficient is a portion of the absolute value of the decoded quantization coefficient that is smaller than a preset value.

13. The method according to any one of claims 4 to 10, characterized in that: The determining the target context model from the multiple context models according to the index includes: Selecting at least one context model from the plurality of context models according to at least one of a quantization parameter, a transform type, a transform block size, a scan type, and a color component corresponding to the first quantization coefficient; The context model corresponding to the index in the at least one context model is determined as the target context model.

14. The method according to any one of claims 3 to 10, characterized in that: The target identifier is identifier 1, or the target identifier is any one of identifiers 2 to 5.

15. The method according to any one of claims 3 to 10, characterized in that: The method further comprises: Initializing the multiple context models; The determining the target context model from the multiple context models includes: The target context model is determined from the multiple context models after initialization.

16. The method according to claim 15, characterized in that Initializing the multiple context models includes: Initializing the multiple context models using equal probability values; or, The multiple context models are initialized using convergence probability values, wherein the convergence probability values ​​are convergence probability values ​​corresponding to the context models when a test video is encoded using the context models.

17. The method according to any one of claims 1 to 10, characterized in that The determining, based on the P quantization coefficients, the parity of the parity-hidden portion of the first quantization coefficient comprises: The parity of the parity-hidden part is determined according to the parities corresponding to the P quantization coefficients.

18. The method according to claim 17, characterized in that The determining, based on the parities corresponding to the P quantized coefficients, the parity of the parity-hidden part includes: The parity of the parity-hidden portion is determined according to the parity of the sum of first absolute values ​​of the P quantized coefficients, wherein the first absolute value of the quantized coefficient is all or part of the absolute value of the quantized coefficient.

19. The method according to claim 18, characterized in that The determining, according to the parity of the sum of the first absolute values ​​of the P quantized coefficients, the parity of the parity-hidden part comprises: If the sum of the first absolute values ​​of the P quantized coefficients is an odd number, determining that the parity hidden part is an odd number; If the sum of the first absolute values ​​of the P quantization coefficients is an even number, it is determined that the parity hidden part is an even number.

20. The method according to claim 17, wherein The determining, based on the parities corresponding to the P quantized coefficients, the parity of the parity-hidden part includes: Determining a target quantization coefficient among the P quantization coefficients; The parity of the parity-hidden part is determined according to the parity of the number of target quantization coefficients in the P quantization coefficients.

21. The method according to claim 20, characterized in that The determining, based on the parity of the number of target quantization coefficients in the P quantization coefficients, the parity of the parity-hidden part includes: If the number of the target quantization coefficients in the P quantization coefficients is an odd number, determining that the parity-hidden part is an odd number; If the number of the target quantization coefficients in the P quantization coefficients is an even number, it is determined that the parity hidden part is an even number.

22. The method according to claim 20 or 21, characterized in that The target quantization coefficient is any one of a non-zero quantization coefficient, an even-valued non-zero quantization coefficient, an even-valued quantization coefficient, and an odd-valued quantization coefficient among the P quantization coefficients.

23. The method according to any one of claims 1 to 10, characterized in that The determining of a second quantization coefficient having parity according to the parity of the parity-hidden part and the decoded first quantization coefficient comprises: Performing an operation on the parity hidden portion using a preset operation method to obtain a first operation result; Processing the first operation result according to the parity to obtain a second operation result; The second quantization coefficient with parity is obtained according to the second operation result and the first quantization coefficient.

24. The method according to claim 23, wherein The preset operation method includes multiplying the parity hidden part by two, and performing the operation on the parity hidden part using the preset operation method to obtain a first operation result includes: The parity hidden part is multiplied by two to obtain the first operation result.

25. The method according to claim 24, characterized in that The processing of the first operation result according to the parity to obtain a second operation result includes: The first operation result and the parity value are added to obtain a second operation result, wherein if the parity hidden part is an odd number, the parity value is 1; if the parity hidden part is an even number, the parity value is 0.

26. The method according to claim 25, characterized in that Obtaining the second quantization coefficient according to the second operation result and the first quantization coefficient includes: If the parity-hidden portion is the entire first quantization coefficient, the second operation result is determined as the second quantization coefficient.

27. The method according to claim 25, characterized in that Obtaining the second quantization coefficient according to the second operation result and the first quantization coefficient includes: If the first quantization coefficient also includes a parity unhidden portion, the sum of the parity unhidden portion and the second operation result is determined as the second quantization coefficient.

28. The method according to any one of claims 1 to 10, characterized in that The determining, based on the P quantization coefficients, the parity of the parity-hidden portion of the first quantization coefficient comprises: If the current region meets a preset condition, the parity of the parity-hidden part is determined according to the P quantization coefficients.

29. The method according to claim 28, characterized in that The preset conditions include at least one of the following: The number of non-zero quantized coefficients in the current region is greater than a first preset value; In the current region, a distance between a first non-zero quantized coefficient and a last non-zero quantized coefficient in a decoding scan order is greater than a second preset value; In the current region, a distance between a first non-zero quantized coefficient and a last quantized coefficient in a decoding scan order is greater than a third preset value; In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth preset value.

30. The method according to claim 29, wherein At least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a fixed value.

31. The method according to claim 29, wherein At least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value.

32. The method according to claim 31, characterized in that If at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, the method further includes: The code stream is decoded to obtain the non-fixed value.

33. The method according to any one of claims 1 to 10, characterized in that The method further comprises: If the current block is transformed using the target transformation method, the step of determining the parity of the parity-hidden portion of the first quantization coefficient according to the P quantization coefficients is skipped.

34. The method according to claim 33, wherein The target transformation method includes secondary transformation or multiple transformations.

35. The method according to any one of claims 1 to 10, characterized in that The method further comprises: Decoding the code stream to obtain at least one flag, wherein the at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden; The determining, based on the P quantization coefficients, the parity of the parity-hidden portion of the first quantization coefficient comprises: If it is determined, based on the at least one flag, that the parity of at least one quantization coefficient in the current block is allowed to be concealed, the parity of the parity-concealed portion is determined based on the P quantization coefficients.

36. The method according to claim 35, characterized in that The at least one flag includes at least one of a sequence level flag, a picture level flag, a slice level flag, a unit level flag, and a block level flag.

37. The method according to any one of claims 1 to 10, characterized in that The method further comprises: determining, based on at least one of a quantization parameter, a transform type, a transform block size, a scan type, and a color component corresponding to the first quantization coefficient, whether the first quantization coefficient allows parity of the quantization coefficient to be hidden; The determining, based on the P quantization coefficients, the parity of the parity-hidden portion of the first quantization coefficient comprises: When it is determined that the parity of the first quantization coefficient is allowed to be concealed, the parity of the parity-concealed portion is determined based on the P quantization coefficients.

38. The method according to any one of claims 1 to 10, characterized in that The first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current region, and K is less than or equal to the number of non-zero quantization coefficients in the current region.

39. The method according to any one of claims 1 to 10, characterized in that The decoding bit stream obtains P quantization coefficients in the current region, including: Decoding the code stream to obtain decoded information of the current block; Divide the current block into N regions, where N is a positive integer; P quantization coefficients in the current region are obtained from decoded information of the current block.

40. The method according to claim 39, wherein The dividing the current block into N regions includes: The current block is divided into N regions according to a scanning order.

41. The method according to claim 39, wherein The dividing the current block into N regions includes: The current block is divided into N regions according to spatial positions.

42. The method according to claim 39, wherein At least two of the N regions include the same number of quantized coefficients.

43. The method according to claim 39, wherein At least two of the N regions include different numbers of quantized coefficients.

44. A video encoding method, characterized in that include: Divide the current block into N regions, where N is a positive integer; Determine a second quantization coefficient in the current region, and perform parity hiding on part or all of the second quantization coefficient to obtain a first quantization coefficient, where the current region is a region among the N regions that includes at least one non-zero quantization coefficient; Determine a target context model corresponding to the first quantization coefficient, use the target context model to encode the first quantization coefficient to obtain a code stream, the parity of the hidden part of the parity in the first quantization coefficient is indicated by P quantization coefficients in the current area, where P is a positive integer.

45. The method according to claim 44, wherein The context model corresponding to the first quantization coefficient is different from the context models corresponding to other quantization coefficients whose parity is not hidden.

46. ​​The method according to claim 45, characterized in that The determining a target context model corresponding to the first quantization coefficient, and encoding the first quantization coefficient using the target context model to obtain a bitstream includes: Obtaining multiple context models corresponding to the target identifier of the first quantization coefficient; Determining the target context model from the multiple context models; The target identifier is encoded using the target context model to obtain the code stream.

47. The method according to claim 46, wherein The determining the target context model from the multiple context models includes: Determining an index of the target context model; The target context model is determined from the multiple context models according to the index.

48. The method according to claim 47, wherein Determining the index of the target context model includes: Determining a basic index corresponding to the first quantization coefficient; Determining an offset index based on encoded quantized coefficients around the first quantized coefficient; The sum of the base index and the bias index is determined as the index of the target context model.

49. The method according to claim 48, characterized in that determining a basic index corresponding to the first quantization coefficient The basic index is determined according to a position of the first quantization coefficient in the corresponding transform block.

50. The method according to claim 49, wherein The determining the base index according to a position of the first quantization coefficient in the corresponding transform block includes: The basic index is determined according to a distance from a position of the first quantization coefficient in the corresponding transform block to a position of an upper left corner of the corresponding transform block.

51. The method according to claim 50, characterized in that The determining the base index according to a distance from a position of the first quantization coefficient in the transform block to which it belongs to to a position of an upper left corner of the transform block to which it belongs includes: If the distance is less than or equal to a threshold, determining that the basic index is a first value; If the distance is greater than the threshold, the basic index is determined to be a second value.

52. The method according to claim 48, wherein The determining a basic index corresponding to the first quantization coefficient includes: The basic index is determined according to a position index of the first quantization coefficient in a scanning order and a size of the current region.

53. The method according to claim 52, characterized in that The determining the base index according to the position index of the first quantization coefficient in the scanning order and the size of the current region includes: determining a ratio between a position index of the first quantized coefficient in a scanning order and a size of the current region; The product of the ratio and the second value is determined as the basic index.

54. The method according to any one of claims 48 to 53, wherein: The determining of the offset index based on the encoded quantization coefficients around the first quantization coefficient includes: The offset index is determined according to absolute values ​​of encoded quantization coefficients around the first quantization coefficient.

55. The method according to claim 54, characterized in that The determining the offset index according to the absolute values ​​of the encoded quantization coefficients around the first quantization coefficient includes: The bias index is determined according to a partial sum of absolute values ​​of coded quantized coefficients around the first quantized coefficient, where the partial absolute value of the coded quantized coefficient is a portion of the absolute value of the coded quantized coefficient that is smaller than a preset value.

56. The method according to any one of claims 47 to 53, wherein: The determining the target context model from the multiple context models according to the index includes: Selecting at least one context model from the plurality of context models according to at least one of a quantization parameter, a transform type, a transform block size, a scan type, and a color component corresponding to the first quantization coefficient; The context model corresponding to the index in the at least one context model is determined as the target context model.

57. The method according to any one of claims 46 to 53, wherein: The target identifier is identifier 1, or the target identifier is any one of identifiers 2 to 5.

58. The method according to any one of claims 46 to 53, wherein: The method further comprises: Initializing the multiple context models; Determining the context model of the target from the multiple context models includes: The target context model is determined from the multiple context models after initialization.

59. The method according to claim 58, characterized in that Initializing the multiple context models includes: Initializing the multiple context models using equal probability values; or, The multiple context models are initialized using convergence probability values, wherein the convergence probability values ​​are convergence probability values ​​corresponding to the context models when a test video is encoded using the context models.

60. The method according to any one of claims 44 to 53, characterized in that The parity of the parity-hidden part is indicated by the parities corresponding to the P quantized coefficients in the current region.

61. The method according to claim 60, characterized in that If the parities corresponding to the P quantized coefficients are inconsistent with the parity of the parity-hidden portion, the method further includes: The P quantization coefficients are adjusted so that parities corresponding to the P quantization coefficients are consistent with the parity of the parity-hidden portion.

62. The method according to claim 61, characterized in that If the parity of the parity-hidden part is indicated by a sum of first absolute values ​​of the P quantization coefficients, and the first absolute value is all or part of the absolute value of the quantization coefficients, adjusting the P quantization coefficients includes: The values ​​of the P quantization coefficients are adjusted so that the parity of the sum of the first absolute values ​​of the P quantization coefficients is consistent with the parity of the parity-hidden part.

63. The method according to claim 62, characterized in that The adjusting the values ​​of the P quantization coefficients so that the parity of the sum of the first absolute values ​​of the P quantization coefficients is consistent with the parity of the parity-hidden part includes: If the parity-hidden portion is an odd number and the sum of the first absolute values ​​of the P quantization coefficients is an even number, adjusting the values ​​of the P quantization coefficients so that the sum of the first absolute values ​​of the P quantization coefficients after adjustment is an odd number; If the parity hidden part is an even number and the sum of the first absolute values ​​of the P quantization coefficients is an odd number, the values ​​of the P quantization coefficients are adjusted so that the adjusted sum of the first absolute values ​​of the P quantization coefficients is an even number.

64. The method according to claim 61, wherein If the parity of the parity-hidden portion is indicated by the number of target quantization coefficients in the P quantization coefficients, adjusting the P quantization coefficients includes: The values ​​of the P quantized coefficients are adjusted so that the parity of the target number of quantized coefficients in the P quantized coefficients is consistent with the parity of the parity-hidden portion.

65. The method according to claim 64, characterized in that The adjusting the values ​​of the P quantized coefficients so that the parity of the target number of quantized coefficients in the P quantized coefficients is consistent with the parity of the parity-hidden portion includes: If the parity-hidden portion is an odd number and the number of target quantization coefficients in the P quantization coefficients is an even number, adjusting the values ​​of the P quantization coefficients so that the number of target quantization coefficients in the adjusted P quantization coefficients is an odd number; If the parity-hidden portion is an even number and the number of target quantization coefficients in the P quantization coefficients is an odd number, the values ​​of the P quantization coefficients are adjusted so that the number of target quantization coefficients in the adjusted P quantization coefficients is an even number.

66. The method according to claim 64, characterized in that The target quantization coefficient is any one of a non-zero quantization coefficient, an even-valued non-zero quantization coefficient, an even-valued quantization coefficient, and an odd-valued quantization coefficient among the P quantization coefficients.

67. The method according to any one of claims 44 to 53, wherein: The performing parity hiding on part or all of the second quantization coefficients to obtain first quantization coefficients includes: A preset operation method is used to process part or all of the second quantization coefficient to obtain the first quantization coefficient.

68. The method according to claim 67, characterized in that The preset operation method includes dividing part or all of the second quantization coefficients by two and rounding them up.

69. The method according to any one of claims 44 to 53, wherein: The performing parity hiding on part or all of the second quantization coefficients to obtain first quantization coefficients includes: If the current region meets a preset condition, parity hiding is performed on part or all of the second quantization coefficients to obtain first quantization coefficients.

70. The method according to claim 69, wherein The preset conditions include at least one of the following: The number of non-zero quantized coefficients in the current region is greater than a first preset value; In the current region, a distance between a first non-zero quantized coefficient and a last non-zero quantized coefficient in a scanning order is greater than a second preset value; In the current region, a distance between a first non-zero quantized coefficient and a last quantized coefficient in a scanning order is greater than a third preset value; In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth preset value.

71. The method according to claim 70, characterized in that At least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a fixed value.

72. The method according to claim 70, wherein At least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value.

73. The method according to claim 72, characterized in that If at least one of the first preset value, the second preset value, the third preset value, and the fourth preset value is a non-fixed value, the method further includes: The non-fixed value is written into the code stream.

74. The method according to any one of claims 44 to 53, wherein: The method further comprises: If the current block is transformed using a target transformation method, parity hiding of part or all of the second quantization coefficients is skipped to obtain the first quantization coefficients.

75. The method according to claim 74, wherein The target transformation method includes secondary transformation or multiple transformations.

76. The method according to any one of claims 44 to 53, wherein: The method further comprises: Obtain at least one flag, the at least one flag being used to indicate whether to allow the parity of the quantized coefficient to be hidden; The performing parity hiding on part or all of the second quantization coefficients to obtain first quantization coefficients includes: If it is determined, based on the at least one flag, that the parity of the quantization coefficient of the current block is allowed to be hidden, parity hiding is performed on part or all of the second quantization coefficient to obtain a first quantization coefficient.

77. The method according to claim 76, characterized in that The at least one flag includes at least one of a sequence level flag, a picture level flag, a slice level flag, a unit level flag, and a block level flag.

78. The method according to any one of claims 44 to 53, wherein: The method further comprises: determining, based on at least one of a quantization parameter, a transform type, a transform block size, a scan type, and a color component corresponding to the first quantization coefficient, whether the first quantization coefficient allows parity of the quantization coefficient to be hidden; The performing parity hiding on part or all of the second quantization coefficients to obtain first quantization coefficients includes: When it is determined that the parity of the first quantization coefficient is allowed to be hidden, parity hiding is performed on part or all of the second quantization coefficient to obtain the first quantization coefficient.

79. The method according to any one of claims 44 to 53, wherein: The first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current region, and K is less than or equal to the number of non-zero quantization coefficients in the current region.

80. The method according to any one of claims 44 to 53, wherein: The current block is divided into N regions, including: The current block is divided into N regions according to a scanning order.

81. The method according to any one of claims 44 to 53, wherein: The current block is divided into N regions, including: The current block is divided into N regions according to spatial positions.

82. The method according to claim 44, wherein At least two of the N regions include the same number of quantized coefficients.

83. The method according to claim 44, characterized in that At least two of the N regions include different numbers of quantized coefficients.

84. A video decoding device, characterized in that include: a decoding unit, configured to decode a bitstream to obtain P quantization coefficients in a current region, where the current region is a region in a current block including at least one non-zero quantization coefficient, and P is a positive integer; a parity determination unit, configured to determine, based on the P quantization coefficients, the parity of a parity-hidden portion of a first quantization coefficient, where the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on all or part of the second quantization coefficient in the current region; a processing unit, configured to determine a target context model corresponding to the first quantization coefficient, and decode the first quantization coefficient based on context encoding using the target context model to obtain a decoded first quantization coefficient; The determining unit is configured to determine a second quantization coefficient having parity according to the parity of the parity-hidden part and the decoded first quantization coefficient.

85. A video encoding device, characterized in that include: A division unit, configured to divide the current block into N regions, where N is a positive integer; a processing unit, configured to determine a second quantization coefficient in the current region, and perform parity hiding on part or all of the second quantization coefficient to obtain a first quantization coefficient, wherein the current region is a region among the N regions including at least one non-zero quantization coefficient; The coding unit is configured to determine a target context model corresponding to the first quantization coefficient, encode the first quantization coefficient using the target context model, and obtain a code stream, wherein the parity of the hidden part of the parity in the first quantization coefficient is indicated by P quantization coefficients in the current area, where P is a positive integer.

86. A video encoding and decoding system, characterized in that Including video encoder and video decoder; The video decoder is configured to perform the video decoding method according to any one of claims 1 to 43; The video encoder is used to execute the video encoding method as described in any one of claims 44-83.

87. An electronic device, characterized in that include: Memory, processor; The memory is used to store computer programs; The processor is configured to execute the computer program to implement the method according to any one of claims 1 to 43 or 44 to 83.

88. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method according to any one of claims 1 to 43 or 44 to 83.

89. A code stream, characterized in that Including a code stream obtained by the method according to any one of claims 44 to 83.