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

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

Patent Information

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

AI Technical Summary

Technical Problem

In existing video coding technology, quantized coding is expensive, which affects the transmission and storage efficiency of video data.

Method used

In the video decoding method, parity hiding is performed based on the quantization coefficient in the current area to reduce the coding cost. The specific steps include decoding the code stream to obtain the quantization coefficient and the first quantization coefficient in the current area, and determining the parity of the second quantization coefficient. property, and determine the second quantization coefficient with parity according to the parity of the first quantization coefficient and the second quantization coefficient.

Benefits of technology

It effectively reduces the encoding cost of video compression and improves the transmission and storage efficiency of video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118947119A_ABST
    Figure CN118947119A_ABST
Patent Text Reader

Abstract

Provided are a video encoding and decoding method, apparatus, device, system and storage medium, obtaining P quantization coefficients and a first quantization coefficient in a current region by decoding a code stream (S401), the current region being a region comprising at least one non-zero quantization coefficient in a current block, the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on a second quantization coefficient in the current region; next, the parity of the second quantization coefficient is determined on the basis of the P quantization coefficients (S402), and the second quantization coefficient having parity is determined on the basis of the parity of the first quantization coefficient and the second quantization coefficient (S403). According to the invention, the parity of the second quantization coefficient in the current region is hidden through the P quantization coefficients in the current region, so that the video compression cost is reduced.
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 the cost of quantization encoding.

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

[0007] Decoding a bitstream to obtain P quantization coefficients and a first quantization coefficient in a current region, where the current region is a region in the current block including at least one non-zero quantization coefficient, the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on the second quantization coefficient in the current region, and P is a positive integer;

[0008] Determining the parity of the second quantization coefficient according to the P quantization coefficients;

[0009] A second quantization coefficient having parity is determined according to the parity of the first quantization coefficient and the second quantization coefficient.

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

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

[0012] Determining a second quantization coefficient in a current region, where the current region is a region among the N regions including at least one non-zero quantization coefficient;

[0013] performing parity hiding on the second quantization coefficient to obtain a first quantization coefficient;

[0014] The quantized value of the first quantized coefficient is encoded to obtain a code stream, and the parity of the second quantized coefficient is indicated by P quantized 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 bitstream to obtain P quantization coefficients and the first quantization coefficient in the current region. Then, based on the P quantization coefficients, the parity of the second quantization coefficient is determined, and based on the parity of the first quantization coefficient and the second quantization coefficient, a second quantization coefficient with parity is determined. In this embodiment of the present application, the parity of the second quantization coefficient in the current region is hidden using the P quantization coefficients in the current region to reduce the video compression cost. 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] FIG5 is a flow chart of a video decoding method provided in an embodiment of the present application;

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

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

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

[0034] 9A and 9B are schematic diagrams of decoded coefficients of the first quantized coefficient involved in this application;

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

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

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

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

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

[0040] FIG15 is a schematic block diagram of a video encoding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] 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.

[0042] 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.

[0043] 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 .

[0044] 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.

[0045] 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.

[0046] 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.

[0047] 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.

[0048] 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.

[0049] 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.

[0050] 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.

[0051] 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 .

[0052] 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.

[0053] 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.

[0054] 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.

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

[0056] 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 .

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

[0058] 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 .

[0059] 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.

[0060] 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.

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

[0062] 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.

[0063] 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).

[0064] 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.

[0065] 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.

[0066] 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.

[0067] 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.

[0068] 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.

[0069] 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.

[0070] 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.

[0071] 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.

[0072] 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.

[0073] 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.

[0074] 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 the development of high-definition and ultra-high-definition digital videos.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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.

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

[0080] 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.

[0081] 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.

[0082] 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.

[0083] 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.

[0084] 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.

[0085] 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.

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

[0087] 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.

[0088] 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.

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

[0090] 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.

[0091] 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.

[0092] 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.

[0093] 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.

[0094] 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.

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

[0096] 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.

[0097] 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.

[0098] 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.

[0099] 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.

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

[0101] 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.

[0102] 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.

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

[0104]

[0105] 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.

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

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

[0108] 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.

[0109] 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.

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

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

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

[0113] 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.

[0114] 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.

[0115] 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.

[0116] 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.

[0117] 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.

[0118] 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.

[0119] 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.

[0120] Exponential Golomb encoding / decoding is used for values ​​greater than or equal to 15 and is independent of the context model. However, values ​​1 through 5 use the context model, with value 1 having a unique context model, while values ​​2 through 5 share a common context model. Furthermore, if the current coefficient is nonzero, the sign must be encoded / decoded.

[0121] The coding and decoding coefficients marked 1 to 5 are scanned in reverse order, while the coding and decoding signs and the absolute values ​​of the coefficients exceeding 15 are scanned in forward order. The scanning order is selected according to the different transform modes selected by the transform block. In AVM, as shown in Figures 4A to 4D, the scanning orders include Zig-Zag scan, Diagonal scan, Column scan, and Row scan. As shown in Figures 4A to 4D of the scanning order, the order of continuous scanning from the index 0 in the upper left corner of the transform to the index 15 in the lower right corner of the transform block, such as the index 15 in the figure, is 0, 1, 2...14, 15.

[0122] When encoding and decoding coefficients indexed 1 through 5 using a reverse scan order, encoding and decoding begins with the first non-zero coefficient. However, when encoding and decoding the coefficients whose signs and absolute values ​​exceed 15 using a forward scan order, encoding and decoding also stops at the last non-zero coefficient. For example, in the cases shown in Figures 4A through 4D, the first non-zero coefficient could be any position between indexes 0 and 15.

[0123] The encoding / decoding process of 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] 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.

[0133] 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.

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

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

[0136] FIG5 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 FIG5, the method of the embodiment of the present application includes:

[0137] S401 : Decode a code stream to obtain P quantization coefficients and a first quantization coefficient in a current region.

[0138] The current region is a region in the current block including at least one non-zero quantization coefficient, and the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on the second quantization coefficient in the current region.

[0139] For ease of description, in this embodiment of the present application, the quantization coefficient whose parity is hidden is referred to as the first quantization coefficient.

[0140] In some embodiments, the first quantized coefficient whose parity is hidden is also referred to as a hidden coefficient.

[0141] 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 quantized coefficients in the same region can be hidden based on the parity associated with the quantized coefficients, for example, based on the parity of the sum of the absolute values ​​of the quantized coefficients in the region, to reduce the number of quantized coefficients whose parity is hidden. For example, if the second quantized coefficient whose parity is to be hidden is a1, and a1 is an odd number, a1 is processed using a processing method corresponding to an odd number to obtain a first quantized coefficient a2 corresponding to a1, and a2 is smaller than a1. In this way, encoding a2 uses fewer bits than encoding a1, thereby reducing the coding cost.

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

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

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

[0145] 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.

[0146] 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.

[0147] 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.

[0148] 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.

[0149] 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.

[0150] 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.

[0151] 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.

[0152] 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.

[0153] 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.

[0154] 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.

[0155] 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.

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

[0157] In Example 1, the decoding end decodes region by region to obtain the quantization coefficients of each region. For example, after decoding the quantization coefficients of a region, the decoding end determines the P quantization coefficients and the first quantization coefficient of the region. Then, the quantization coefficients of the next region are decoded, and the P quantization coefficients and the first quantization coefficient of the next region are determined based on the quantization coefficients of the next region. That is, in this embodiment, the decoding end can determine the P quantization coefficients and the first quantization coefficient in the current region when all the quantization coefficients of the current block have not been completely decoded. 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 K quantization coefficients, it determines the P quantization coefficients and the first quantization coefficient among the K quantization coefficients based on the K quantization coefficients.

[0158] Example 2: After determining all quantization coefficients of the current block, the decoding end determines P quantization coefficients and the first quantization coefficient in the current region. Specifically, the steps include:

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

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

[0161] S401-A3. Obtain P quantization coefficients and a first quantization coefficient in the current region from the decoded information of the current block.

[0162] In Example 2, the decoder first decodes the bitstream to obtain decoded information for the current block, which includes 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, as well as the first quantization coefficient.

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

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

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

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

[0167] 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.

[0168] 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 FIG6 . 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.

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

[0170] 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.

[0171] 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.

[0172] 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.

[0173] The current region in this embodiment of the present application includes at least one first quantization coefficient, ie, a hidden coefficient.

[0174] 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.

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

[0176] 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 FIG6 , 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.

[0177] 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.

[0178] 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.

[0179] 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.

[0180] 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.

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

[0182] 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.

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

[0184] 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.

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

[0186] 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.

[0187] 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.

[0188] 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.

[0189] 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.

[0190] 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.

[0191] In the embodiment of the present application, according to the above steps, after decoding to obtain P quantization coefficients in the current area and the first quantization coefficient, the following step S402 is performed.

[0192] S402: Determine the parity of the second quantization coefficient according to the P quantization coefficients.

[0193] In the embodiment of the present application, to reduce coding costs, the encoder hides the parity of the second quantized coefficient based on the parity of the second quantized coefficient in the current region to obtain the first quantized coefficient, encodes the first quantized coefficient, and uses the P quantized coefficients in the current region to indicate the parity of the second quantized coefficient. 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 second quantized coefficient based on the P quantized coefficients in the current region.

[0194] The embodiment of the present application does not limit the manner of determining the parity of the second quantization coefficient in the current region according to the P quantization coefficients in the current region in S402 .

[0195] For example, the parity of the second quantization coefficient in the current region is determined using a binary characteristic (0 or 1) of the P quantization coefficients in the current region.

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

[0197] S402-A: Determine the parity of the second quantization coefficient according to the parities corresponding to the P quantization coefficients.

[0198] Example 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 second quantization coefficient based on the parity of the sum of the first absolute values ​​of the P quantization coefficients.

[0199] 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.

[0200] 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.

[0201] 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.

[0202] 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 bit. For example, the decoding end determines the parity of the second quantization coefficient based on the parity of the sum of the absolute values ​​of the values ​​of identification 1 of P quantization coefficients.

[0203] For example, if the sum of the first absolute values ​​of the P quantization coefficients is an even number, the second quantization coefficient is determined to be an even number.

[0204] It should be noted that in Example 1, if the parity of the second quantization coefficient 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 second quantization coefficient 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 second quantization coefficient 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.

[0205] Example 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 second quantization coefficient based on the parity of the number of target quantization coefficients in the P quantization coefficients.

[0206] 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.

[0207] In an example, if the target quantization coefficient is a non-zero quantization coefficient among the P quantization coefficients, the parity of the second quantization coefficient may be determined according to the parity of the number of non-zero quantization coefficients among the P quantization coefficients.

[0208] For example, if the number of non-zero quantization coefficients in the P quantization coefficients is an odd number, the second quantization coefficient is determined to be an odd number.

[0209] For example, if the number of non-zero quantization coefficients in the P quantization coefficients is an even number, the second quantization coefficient is determined to be an even number.

[0210] It should be noted that in this example, if the parity of the second quantization coefficient is inconsistent with the parity of the number of non-zero quantization coefficients in the P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the second quantization coefficient is an odd number and the number of non-zero quantization coefficients in the P quantization coefficients is an even number, then one of the zero quantization coefficients in the P quantization coefficients may be adjusted to 1, or the value of the smallest quantization coefficient in the P quantization coefficients may be adjusted to 0, so that the number of non-zero quantization coefficients in the P quantization coefficients is an odd number. For another example, if the second quantization coefficient 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 may be adjusted to 1, or the value of the smallest quantization coefficient in the P quantization coefficients may be adjusted to 0, so that the number of non-zero quantization coefficients in the P quantization coefficients is an even number.

[0211] 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 second quantization coefficient can be determined based on the parity of the number of non-zero quantization coefficients with an even value among the P quantization coefficients.

[0212] For example, if the number of non-zero quantized coefficients with even values ​​among the P quantized coefficients is odd, the second quantized coefficient is determined to be an odd number.

[0213] For example, if the number of non-zero quantized coefficients with even values ​​among the P quantized coefficients is even, then the second quantized coefficient is determined to be an even number.

[0214] It should be noted that in this example, if the parity of the second quantization coefficient is inconsistent with the parity of the number of even-numbered non-zero quantization coefficients among the P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the second quantization coefficient is odd and the number of even-numbered non-zero quantization coefficients among the P quantization coefficients is even, 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 even-numbered non-zero quantization coefficients among the P quantization coefficients is odd. For another example, if the second quantization coefficient is even and the number of even-numbered non-zero quantization coefficients among the P quantization coefficients is odd, 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 among the P quantization coefficients is even.

[0215] In another example, if the target quantization coefficient is an even-numbered quantization coefficient among the P quantization coefficients, the parity of the second quantization coefficient may be determined based on the parity of the number of even-numbered quantization coefficients among the P quantization coefficients. The even-numbered quantization coefficients include a quantization coefficient with a value of 0.

[0216] For example, if the number of quantization coefficients with even values ​​among the P quantization coefficients is odd, the second quantization coefficient is determined to be an odd number.

[0217] For example, if the number of quantization coefficients with even values ​​among the P quantization coefficients is an even number, the second quantization coefficient is determined to be an even number.

[0218] It should be noted that in this example, if the parity of the second quantization coefficient is inconsistent with the parity of the number of even-numbered quantization coefficients among the P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the second quantization coefficient is odd and the number of even-numbered 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, so that the number of even-numbered quantization coefficients among the P quantization coefficients is odd. For another example, if the second quantization coefficient is even and the number of even-numbered quantization coefficients among the P quantization coefficients is odd, 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 quantization coefficients among the P quantization coefficients is even.

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

[0220] For example, if the number of quantization coefficients with odd values ​​among the P quantization coefficients is an odd number, the second quantization coefficient is determined to be an odd number.

[0221] For example, if the number of odd-valued quantization coefficients among the P quantization coefficients is an even number, the second quantization coefficient is determined to be an even number.

[0222] It should be noted that in this example, if the parity of 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 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, or increased by 1, or decreased by 1, so that the number of odd quantization coefficients among the P quantization coefficients is odd. For another example, if the second quantization coefficient is even and the number of odd quantization coefficients among the P quantization coefficients is odd, 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, or increased by 1, or decreased by 1, so that the number of odd quantization coefficients among the P quantization coefficients is even.

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

[0224] As can be seen from the above, in the embodiment of the present application, the parity of the second quantization coefficient is determined according to the parity of the preset features corresponding to other quantization coefficients in the current region.

[0225] After the parity of the second quantization coefficient in the current region is determined according to the above methods, the following step S403 is performed.

[0226] S403 : Determine a second quantization coefficient with parity according to the parity of the first quantization coefficient and the second quantization coefficient.

[0227] As can be seen from the above, in the embodiment of the present application, in order to reduce the coding cost, the encoding end hides the parity of the second quantization coefficient in the current region to obtain the first quantization coefficient. Since the parity 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 the first quantization coefficient. Then, based on the P quantization coefficients, the parity of the second quantization coefficient is determined. In this way, based on the parity of the first quantization coefficient and the second quantization coefficient, the second quantization coefficient with parity can be reconstructed, that is, the coefficient with hidden parity can be reconstructed.

[0228] In some embodiments, the decoding end reconstructs the second quantization coefficient in different ways according to the parity of the second quantization coefficient.

[0229] Case 1: If the second quantization coefficient is an odd number, the first quantization coefficient is operated using the first operation method to obtain the second quantization coefficient.

[0230] 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.

[0231] 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.

[0232] In mode 1, for a non-zero quantized coefficient, if the third operation mode adopted by the encoder is to add one to the value of the second quantized coefficient and divide it by two to obtain the first quantized coefficient, then the first operation mode adopted by the decoder is to obtain the value of the second quantized coefficient equal to the first quantized coefficient multiplied by two minus one.

[0233] Exemplarily, the first operation method is shown in formula (4):

[0234] C=2*val-1 (4)

[0235] Wherein, C is the second quantization coefficient, and val is the first quantization coefficient.

[0236] In the first method, if the second quantization coefficient is an odd number, the second quantization coefficient is determined according to the first operation method shown in the above formula (4).

[0237] For example, assuming that the current region includes 6 pixels, and by decoding the code stream, the quantization coefficients corresponding to these 6 pixels are obtained as follows: 5, 6, 3, 2, 2, 0, respectively. The last 5 quantization coefficients located at the scanning position in the current region are determined as P quantization coefficients. At this time, the P quantization coefficients in the current region are 6, 3, 2, 2, 0, respectively, of which the first quantization coefficient is 5. Exemplarily, the parity of the second quantization coefficient is determined based on the parity of the sum of the first absolute values ​​of the P quantization coefficients. The sum of the first absolute values ​​of the P quantization coefficients is 13, which is an odd number, so the second quantization coefficient is determined to be an odd number. In this way, the decoding end can reconstruct the value of the second quantization coefficient as 5*2-1=9 according to the above formula (4).

[0238] As can be seen from the above example, the second quantization coefficient, which originally has a value of 9, is hidden as 5 through the parity hiding technology of the embodiment of the present application, which can reduce the number of bits required for encoding and greatly reduce the encoding cost.

[0239] It should be noted that the above formula (4) is only an example of the first operation method involved in the embodiment of the present application. The first operation method of the embodiment of the present application includes but is not limited to the above formula (4).

[0240] Case 2: If the second quantization coefficient is an even number, the first quantization coefficient is operated using the second operation method to obtain the second quantization coefficient.

[0241] 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.

[0242] 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.

[0243] In one possible implementation, if the fourth operation adopted by the encoder is to divide the value of the second quantization coefficient by two to obtain the first quantization coefficient, then the second operation adopted by the decoder is to obtain the value of the second quantization coefficient equal to the first quantization coefficient multiplied by two.

[0244] Exemplarily, the second operation method is shown in formula (5):

[0245] C=2*val (5)

[0246] Wherein, C is the second quantization coefficient, and val is the first quantization coefficient.

[0247] In this example, if the second quantization coefficient is an even number, the current second quantization coefficient is determined according to the second operation method shown in the above formula (5).

[0248] For example, assuming that the current region includes 6 pixels, and by decoding the code stream, the quantization coefficients corresponding to these 6 pixels are obtained as follows: 4, 3, 3, 2, 2, 0, respectively. The last 5 quantization coefficients located at the scanning position in the current region are determined as P quantization coefficients. At this time, the P quantization coefficients in the current region are 3, 3, 2, 2, 0, respectively, of which the first quantization coefficient is 4. For example, the parity of the current second quantization coefficient can be determined based on the parity of the sum of the first absolute values ​​of the P quantization coefficients. The sum of the first absolute values ​​of the P quantization coefficients is 10, which is an even number, and the current second quantization coefficient is determined to be an even number. In this way, the decoding end can reconstruct the value of the second quantization coefficient as 4*2=8 according to the above formula (5).

[0249] As can be seen from the above example, by processing the second quantization coefficient whose original value is 8 into the first quantization coefficient whose value is 4 through the method of the embodiment of the present application, the number of bits required for encoding can be reduced, thereby reducing the encoding cost.

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

[0251] S404-A1, performing operation on the first quantization coefficient using a preset operation method to obtain an operation result;

[0252] S404-A2: Obtain a second quantization coefficient according to the parity of the second quantization coefficient and the operation result.

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

[0254] In some embodiments, the preset operation method includes multiplying the first quantization coefficient by two, that is, multiplying the value of the first quantization coefficient by 2 to obtain an operation result.

[0255] Then, based on the parity of the second quantization coefficient and the above-mentioned operation result, the second quantization coefficient is obtained. For example, the sum of the operation result and the preset value is determined as the value of the second quantization coefficient, where if the second quantization coefficient is an odd number, the preset value is 1, and if the second quantization coefficient is an even number, the preset value is 0.

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

[0257] Quant[pos]=Quant[pos]*2+parity (6)

[0258] Among them, Quant[pos] on the right side of the equal sign is the first quantization coefficient at the current position, Quant[pos] on the left side of the equal sign is the reconstructed second quantization coefficient, and parity is a preset value. If the second quantization coefficient is an odd number, then the parity=1; if the second quantization coefficient is an odd number, then the parity=0.

[0259] From the above formula (6), it can be seen that the quantization coefficient Quant[pos] of the current position is obtained by decoding the code stream. If the quantization coefficient of the current position is the first quantization coefficient, the second quantization coefficient of the current position is equal to Quant[pos] multiplied by 2 plus the value corresponding to the parity.

[0260] 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.

[0261] 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.

[0262] In some embodiments, if the encoder does not skip the transformation step, that is, the encoder transforms the residual value 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 the residual value of the current block. In addition, 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 the reconstructed value to obtain the reconstructed value for the current block.

[0263] In a video decoding method provided by an embodiment of the present application, a decoder decodes a bitstream to obtain P quantization coefficients and a first quantization coefficient in a current region. Then, based on the P quantization coefficients, the parity of a second quantization coefficient is determined, and based on the parity of the first quantization coefficient and the second quantization coefficient, a second quantization coefficient having parity is determined. In an embodiment of the present application, the parity of the second quantization coefficient in the current region is hidden using the P quantization coefficients in the current region to obtain the first quantization coefficient. Encoding the first quantization coefficient during encoding can reduce the number of bits required for encoding and lower the cost of video compression.

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

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

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

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

[0268] 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.

[0269] 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.

[0270] 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.

[0271] 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.

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

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

[0274] 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.

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

[0276] 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.

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

[0278] 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.

[0279] S604: Obtain P quantization coefficients and a first quantization coefficient in the current region from the decoded information of the current block.

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

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

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

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

[0284] If the above-mentioned P quantization coefficients are partial quantization coefficients of the current region, these P quantization coefficients may include the quantization coefficients of the current region whose parity is hidden, or may not include the quantization coefficients of the current region whose parity is hidden. For example, the above-mentioned P quantization coefficients are other quantization coefficients in the current region except the first quantization coefficient whose parity is hidden.

[0285] 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.

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

[0287] In the embodiments of this application, the parity hiding technology proposed in this application is limited. Specifically, if the current region meets the preset 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 S608 are performed. If the current region does not meet the preset 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 S609 is performed.

[0288] 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.

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

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

[0291] 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 the second value;

[0292] 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 value;

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

[0294] In this implementation, if the current area meets at least one of the above four conditions, the following steps S606 to S608 are executed.

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

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

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

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

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

[0300] According to the above preset conditions, when it is determined that the current region meets the above preset conditions, it means that there are quantization coefficients with hidden parity in the current region, that is, there are first quantization coefficients in the current region, and the following step S606 is executed.

[0301] S606: Determine the parity of the second quantization coefficient according to the P quantization coefficients.

[0302] For example, the parity of the second quantization coefficient is determined according to the parities corresponding to the P quantization coefficients.

[0303] For example, the parity of the second quantization coefficient is determined according to the parity of the sum of the first absolute values ​​of the P quantization coefficients.

[0304] For example, the parity of the second quantization coefficient is determined according to the parity of the number of target quantization coefficients in the P quantization coefficients.

[0305] 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.

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

[0307] S607 : Determine a second quantization coefficient according to the parity of the first quantization coefficient and the second quantization coefficient.

[0308] For example, if the second quantization coefficient is an odd number, the first quantization coefficient is multiplied by a value of two plus one to determine the value of the second quantization coefficient.

[0309] For another example, if the second quantization coefficient is an odd number, the first quantization coefficient is multiplied by a value of two minus one to determine the value of the first quantization coefficient.

[0310] For another example, if the second quantization coefficient is an even number, the first quantization coefficient is multiplied by two to determine the value of the first quantization coefficient.

[0311] S608: Determine a quantization coefficient of the current block according to the second quantization coefficient.

[0312] 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.

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

[0314] 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.

[0315] S610: Obtain a reconstructed value of the current block according to the quantization coefficient of the current block.

[0316] 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.

[0317] 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.

[0318] 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.

[0319] In an embodiment of the present application, a preset condition is set for the parity hiding technology. When the current area meets the preset condition, 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.

[0320] For example, the encoding and decoding syntax corresponding to the embodiment of the present application is shown in Table 3:

[0321] Table 3

[0322]

[0323]

[0324] The variables SUBSIZE and HPCTHRESH are added to the above Table 3, where SUBSIZE is used to identify the size of each region of the current block, and HPCTHRESH is used to identify the region where the number of non-zero coefficients required to enable the parity hiding technology is greater than a certain threshold.

[0325] 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 preset conditions to determine whether the current area can bring significant beneficial technical effects when decoding 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.

[0326] In some embodiments, when decoding a transform block, the current transform block (i.e., the current block) is treated as the current region, i.e., the transform block is considered as an entire region, i.e., the transform block is not divided into multiple regions. When the current transform block meets certain set conditions, the current transform block is instructed to use the parity hiding technology provided in the embodiments of the present application. That is, if the current transform block meets the set conditions, the parity of the second quantization coefficient is determined based on the P quantization coefficients.

[0327] The embodiment of the present application does not limit the specific position of the quantization coefficient whose parity is hidden in the current transform block.

[0328] In some embodiments, the first quantized coefficient is the last quantized coefficient in the current transform block in the scanning order. In other words, the parity of the last coefficient in the current transform block in the scanning order (i.e., the DC coefficient, i.e., the coefficient in the upper left corner of the transform block) can be considered hidden.

[0329] For example, if the current transform block is an 8x8 transform block as shown in FIG8 , the transform block uses a Zig-Zag scan order, that is, scanning from index 0 to index 63, and decoding of the coefficients starts from the last non-zero coefficient (e.g., index 21). When the set conditions are met from index 21 to index 1, the coefficient at index 0 is determined to be a coefficient with hidden parity, that is, the coefficient at index 0 is determined to be the first quantized coefficient. At this time, the absolute value of the coefficient (abs_qcoeff) should be obtained by multiplying the decoded value by 2 and adding the hidden parity value (parity).

[0330] The parity value (parity) can be understood as the preset value in the above embodiment. If the quantization coefficient with the parity hidden is an odd number, the parity value is 1; if the quantization coefficient with the parity hidden is an even number, the parity value is 0.

[0331] The embodiments of the present application do not limit the specific contents of the above-mentioned setting conditions.

[0332] In one example, the above-mentioned setting conditions include at least one of the following:

[0333] Condition 11: the number of non-zero quantized coefficients in the current transform block (i.e., the transform block) is greater than the first value;

[0334] Condition 12: the current sequence of the current transform block allows the parity of the quantized coefficients to be hidden, that is, the sequence corresponding to the current transform block allows the use of parity hiding technology;

[0335] Condition 13: The transform mode used by the current transform block is the identity transform mode in both horizontal and vertical directions;

[0336] Condition 14: The current transform block is a luminance block.

[0337] For ease of explanation, identifier 1 is also referred to as Base Range (BR), identifiers 2 to 5 are referred to as Low Range (LR), and the portion exceeding 15 is referred to as High Range (HR). In one example, the absolute value of the coefficient whose parity is hidden (abs_qcoeff) can be determined according to the following formula (7):

[0338] abs_qcoeff=(BR+LR+HR)×2+parity (7)

[0339] In one example, the parity value is determined by the parity of the sum of identifiers 1 to 5 decoded from indexes 21 to 1. That is, if the sum of identifiers 1 to 5 decoded from indexes 21 to 1 is an odd number, it indicates that the quantized coefficient with parity concealed at index 0 is an odd number, and the corresponding parity value is 1. If the sum of identifiers 1 to 5 decoded from indexes 21 to 1 is an even number, it indicates that the quantized coefficient with parity concealed at index 0 is an even number, and the corresponding parity value is 0.

[0340] For example, the parity value can be determined by the following formula (8):

[0341]

[0342] Among them, "%" represents the remainder symbol, BR i is the value of the identifier 1 decoded at the index i position in the transform block, LR i The values ​​of identifiers 2 to 5 obtained by decoding at the index i position in the transform block are P=21 in the 8x8 transform block shown in FIG8 .

[0343] In some embodiments, the decoding syntax of the transform block is as shown in Table 4:

[0344] Table 4

[0345]

[0346]

[0347]

[0348] In the above Table 4, SBBSIZE corresponds to SUBSIZE in the above Table 3, and SBBTHRESH corresponds to HPCTHRESH in the above Table 3.

[0349] The decoding and inverse quantization process involved in the embodiment of the present application in Table 4 above is a similar representation method of the present application in the AV1 standard text. It can be seen that since the decoding of BR and LR is in two different loops and the decoding of HR is in two different loops, for a coefficient with hidden parity, the operation process in the above table is to first multiply the BR+LR part by 2 in the first loop and add the obtained parity value, and then add the possible HR part and multiply by 2 in the second loop to obtain the absolute value of the quantized coefficient. The absolute value of the quantized coefficient is subsequently adjusted according to the positive and negative signs obtained by decoding to obtain the quantized coefficient.

[0350] In this embodiment, the current region size (SBBSIZE) is set to the size of a complete transform block, so that a transform block is used only as a region.

[0351] In some embodiments, the first value (SBBTHRESH) may be set to 4, but this value may also be variable, and may be a predefined value or a value parsed from the bitstream.

[0352] In some embodiments, the method according to conditions 11 to 14 above may not be used to determine whether to hide the parity.

[0353] For example, if only the above conditions 11, 12, and 13 are met, it means that the parity hiding technique can be applied to both the luminance block and the chrominance block at the same time.

[0354] For example, if only the above conditions 11, 12, and 14 are satisfied, it means that the parity hiding technique can be applied to a transform mode in which one direction is transform-skipped.

[0355] For example, if only conditions 11, 12, and 13 are met, it means that although both luminance and chrominance can use parity hiding, different SBBSIZE values ​​can be selected as threshold conditions.

[0356] Compared to dividing a transform block into multiple regions, each region may hide the parity of a coefficient, treating each transform block as a region has the following advantages:

[0357] First, there are more coefficients that can be used for adjustment, and it is easier to select coefficients that will result in lower costs after adjustment.

[0358] Second, the context model only needs to be prepared for the coefficients of the hidden parity at the DC position.

[0359] Third, the encoding end can reduce computational complexity.

[0360] In some embodiments, when the transform block is regarded as a region, the required number of context models and initial values ​​is shown in Table 5:

[0361] Table 5

[0362] Hidden parity coefficients Number of additional context models Number of initial probability values ​​for additional context models BR520 for luminance component LR728 for luminance BR520 for chrominance component LR728 for chrominance component

[0363] As can be seen from Table 5 above, an additional context model requires four additional initial probability values. This is because in AVM, the initial value of the context model is related to the quantization parameter used in the current encoding. Depending on the quantization parameter, there are four groups of initial values.

[0364] In this embodiment, if the parity hiding technique is applied only to the luma component, the number of additional context models is 5+7=12, and the number of additional initial probability values ​​is 20+28=48. If the parity hiding technique is also applied to the chroma components, the number of context models and the number of initial value sets are doubled, to 5+5+7+7=24 context models and 20+20+28+28=96 initial probability values, respectively.

[0365] For each coefficient with hidden parity, the context model selected when encoding and decoding BR and LR is which of the additional context models is related to the size of the decoded coefficients around the current coefficient.

[0366] As shown in Figures 9A and 9B, dark gray indicates the position of the current parity hidden coefficient, and light gray indicates the position of the decoded coefficient that needs to be referenced when selecting the context model. When selecting the context model, the calculation formula of the index is obtained from the following Table 6:

[0367] Table 6

[0368]

[0369] In Table 6 above, Θ and Φ indicate the coefficient positions around BR and LR, respectively. In the table, the index values ​​of BR range from 0 to 4, representing a context model at the corresponding index position in the newly added context model for the corresponding color component. The index values ​​of LR range from 0 to 6, representing a context model at the corresponding index position in the newly added context model for the corresponding color component.

[0370] 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.

[0371] Figure 10 is a flow chart of a video encoding method according to an embodiment of the present application. The embodiment of the present application may be performed by the encoders shown in Figures 1 and 2 above.

[0372] As shown in FIG10 , the method of the embodiment of the present application includes:

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

[0374] In an embodiment of the present application, a 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 quantized coefficients in the same region can be hidden based on the parity associated with the quantized coefficients, for example, based on the parity of the sum of the absolute values ​​of the quantized coefficients in the region, to reduce the number of quantized coefficients whose parity is hidden. For example, if the value of the second quantized coefficient whose parity is to be hidden is a1, and a1 is an odd number, a1 is processed using a processing method corresponding to an odd number to obtain a first quantized coefficient a2 corresponding to a1, and a2 is smaller than a1. In this way, encoding a2 uses fewer bits than encoding a1, thereby reducing the coding cost.

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

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

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

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

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

[0380] 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.

[0381] 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 6. 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.

[0382] Method 2: Divide the current block into N regions based on spatial location

[0383] 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.

[0384] 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.

[0385] 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.

[0386] 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.

[0387] 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.

[0388] 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.

[0389] 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 hidden.

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

[0391] 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.

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

[0393] 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.

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

[0395] 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.

[0396] 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.

[0397] 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.

[0398] 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.

[0399] In some embodiments, the current transform block (ie, the current block) is divided into a region.

[0400] In some embodiments, when the current block is divided into one region, the second quantization coefficient is the last quantization coefficient in the current transform block in a scanning order.

[0401] In some embodiments, if the current block meets a set condition, the current block is divided into a region.

[0402] Exemplarily, the setting conditions include at least one of the following:

[0403] The number of non-zero quantized coefficients in the current block is greater than the first value;

[0404] The current sequence in which the current block is located allows the parity of the quantized coefficients to be hidden;

[0405] The transform mode used by the current block is the identity transform mode in both horizontal and vertical directions;

[0406] The current block is a luminance block.

[0407] S702: Determine a second quantization coefficient in the current region, and perform parity hiding on the second quantization coefficient to obtain a first quantization coefficient.

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

[0409] In this embodiment of the present application, to reduce coding cost, the parity of the second quantized coefficient is hidden to obtain the first quantized coefficient, and the first quantized coefficient is encoded into the bitstream instead of encoding the second quantized coefficient. Because the first quantized coefficient is usually smaller than the second quantized coefficient, encoding the first quantized coefficient requires fewer bits than encoding the second quantized coefficient, thereby reducing coding cost.

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

[0411] 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.

[0412] Case 1: If the second quantization coefficient is an odd number, the third operation method is used to operate on the second quantization coefficient to obtain the first quantization coefficient.

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

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

[0415] Exemplarily, the third operation method is shown in formula (9):

[0416] val=(A+1) / 2 (9)

[0417] Wherein, A is the second quantization coefficient, and val is the first quantization coefficient.

[0418] In mode 1, if the second quantization coefficient is an odd number, the parity of the second quantization coefficient is hidden according to the third operation mode shown in formula (9) above to obtain the first quantization coefficient. For example, if the value of the second quantization coefficient is 9, the value of the first quantization coefficient is determined to be 5 according to formula (9). Compared with the encoding value of 9, the encoding value of 5 can reduce the number of bits and reduce the encoding cost.

[0419] It should be noted that the above formula (9) is only an example of the third operation method involved in the embodiment of the present application. The third operation method of the embodiment of the present application includes but is not limited to the above formula (9).

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

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

[0422] Exemplarily, the fourth operation includes the first quantization coefficient being equal to the value of the second quantization coefficient divided by two.

[0423] For example, the fourth operation method is shown in formula (10):

[0424] val=A / 2 (10)

[0425] In case 2, if the second quantization coefficient is an even number, the parity of the second quantization coefficient is hidden according to the fourth operation method shown in formula (10) above to obtain the first quantization coefficient. For example, if the value of the second quantization coefficient is 10, then according to formula (10) above, the value of the first quantization coefficient is determined to be 5. Compared with the encoding value of 10, the encoding value of 5 can reduce the number of bits and reduce the encoding cost.

[0426] It should be noted that the above formula (10) is only an example of the fourth operation method involved in the embodiment of the present application. The fourth operation method of the embodiment of the present application includes but is not limited to the above formula (10).

[0427] In some embodiments, the encoding end may operate on the second quantization coefficient using a preset operation method according to the parity of the second quantization coefficient to obtain the first quantization coefficient.

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

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

[0430] For example, the encoder determines the first quantization coefficient using the following formula (11):

[0431] Q b =Q / / 2 (11)

[0432] Among them, Q represents the second quantization coefficient, Q b Represents the first quantized coefficient, and “ / / ” represents the rounding operation.

[0433] As can be seen from the above formula (11), for the second quantization coefficient, after the above operation and parity hiding, the first quantization coefficient is obtained. The absolute value of the first quantization coefficient is smaller than the absolute value of the second quantization coefficient, and the number of bits required for encoding is small, thereby reducing the encoding cost. For example, when the second quantization coefficient is 10, only 5 needs to be encoded. For another example, when the second quantization coefficient is 21, only 10 needs to be encoded, which greatly reduces the number of bits required for encoding.

[0434] S703: Encode the first quantization coefficient to obtain a code stream.

[0435] According to the above method, after the first quantization coefficient in the current area is determined, the first quantization coefficient is encoded to obtain a code stream.

[0436] In this embodiment of the present application, the parity of the second quantization coefficient is indicated by P quantization coefficients in the current area.

[0437] For example, a binary characteristic (0 or 1) of the P quantization coefficients in the current region is used to indicate the parity of the second quantization coefficient in the current region.

[0438] In some embodiments, the parity of the second quantized coefficient is indicated by the parity corresponding to the P quantized coefficients in the current region.

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

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

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

[0442] 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.

[0443] 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 second quantization coefficient. For example, the parity corresponding to the P quantization coefficients is an odd number to indicate that the current second quantization coefficient is an odd number, and the parity corresponding to the P quantization coefficients is an even number to indicate that the current second quantization coefficient is an even number.

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

[0445] Step 1: Adjust the P quantization coefficients so that the parities corresponding to the P quantization coefficients are consistent with the parity of the second quantization coefficient.

[0446] Case 1: If the parity of the second quantization coefficient 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 second quantization coefficient.

[0447] 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.

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

[0449] Example 1: If the second quantization coefficient 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.

[0450] For example, if the second quantization coefficient 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 or subtracted by 1 to modify the sum of the first absolute values ​​of the P quantization coefficients to an odd number.

[0451] Example 2: If the second quantization coefficient 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.

[0452] For example, the second quantization coefficient 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.

[0453] Case 2: If the parity of the second quantization coefficient is indicated by the parity of the number of target quantization coefficients in the P quantization coefficients, then the above 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 second quantization coefficient.

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

[0455] Example 1: If the second quantization coefficient 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.

[0456] Example 2: If the second quantization coefficient 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.

[0457] 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.

[0458] In one example, if the target quantization coefficient is a non-zero quantization coefficient among the P quantization coefficients, the encoder modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient is an odd number and the number of non-zero quantization coefficients among the P quantization coefficients is an even number, then the quantization coefficient that is zero 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.

[0459] For another example, if the second quantization coefficient 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.

[0460] In another example, if the target quantization coefficient is a non-zero quantization coefficient with an even value among the P quantization coefficients, the encoder modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient is an odd number and the number of non-zero quantization coefficients with an even value among the P quantization coefficients is an even number, 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 with an even value among the P quantization coefficients is an odd number.

[0461] For another example, if the second quantization coefficient is an even number, and the number of even-numbered non-zero quantization coefficients among the P quantization coefficients is an odd number, then one of the zero quantization coefficients 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 to make the number of non-zero quantization coefficients among the P quantization coefficients an even number. The encoder adjusts at least one of the P quantization coefficients using an adjustment method that minimizes rate-distortion cost.

[0462] In another example, if the target quantization coefficient is an even-numbered quantization coefficient among the P quantization coefficients, the encoder modifies at least one of the P quantization coefficients. For example, if the second quantization coefficient 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.

[0463] For another example, if the second quantization coefficient 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.

[0464] In another example, if the target quantization coefficient is an odd-numbered quantization coefficient among the P quantization coefficients, the encoder modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient 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.

[0465] For another example, if 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.

[0466] Furthermore, the parity hiding technique proposed in this application was implemented on the AVM reference software, with the region size used set to 16 and the threshold for the number of non-zero coefficients for enabling parity hiding set to 4. When the parity hiding technique of this application is enabled for the current region, if the absolute value sum of the non-zero coefficients in the current region that is less than or equal to 15 is an odd number, it means that the last coefficient in the scanning order of the region (i.e., the second quantized coefficient) is an odd number; if the absolute value sum is an even number, it means that the last coefficient in the scanning order of the region (i.e., the second quantized coefficient) is an even number. The specific test results are shown in Table 7:

[0467] Table 7

[0468]

[0469] The PSNR in Table 7 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 codecs, PSNR is used to evaluate the quality of a compressed image compared to the original. The higher the PSNR, the less distortion after compression.

[0470] As can be seen from Table 7 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.10%, 0.75% and 0.79% on the YUV3 component.

[0471] In some embodiments, the transform block is regarded as a region, and the parity hiding technique proposed in this application is implemented on the AVM reference software. For each transform block, only the parity of the coefficient at the DC position is hidden. The parity hiding technique is used when the above conditions 11, 12, 13, and 14 are met. When SBBSIZE is set to 4, the results of all intra, random access, and low delay configurations are measured under the AVM general test conditions CTC v3 and the reference software research-v3.0.0, as shown in Tables 8, 9, and 10:

[0472] Table 8: all intra

[0473]

[0474] Table 9: Random access

[0475]

[0476] Table 10:low delay

[0477]

[0478] As shown in Tables 8 to 10 above, when the transform block is treated as a region and parity hiding technology is enabled, the performance is significantly improved when tested under the all intra (full frame), random access (random access) and low delay (low delay) configurations respectively.

[0479] In another example, the transform block is regarded as a region, and the parity hiding technique proposed in this application is implemented on the AVM reference software. For each transform block, only the parity of the coefficient at the DC position is hidden. The parity hiding technique is used when the above conditions 11, 12, and 13 are met. When SBBSIZE is set to 4, the results of the all intra configuration measured under the AVM general test conditions CTC v3 and the reference software research-v3.0.0 are shown in Table 11:

[0480] Table 11: all intra

[0481]

[0482] As shown in Table 11, when parity hiding technology is enabled for luminance transform blocks or chrominance transform blocks other than identity transform blocks, the performance is significantly improved when tested under the all intra configuration.

[0483] 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 the second quantization coefficient to obtain the first quantization coefficient; then, the first quantization coefficient is encoded to obtain a bitstream, and the parity of the second 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 the second quantization coefficient in the current region 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. At the same time, the parity of the second quantization coefficient is indicated by the P quantization coefficients in the current region, so that the decoding end determines the parity of the second quantization coefficient based on the P quantization coefficients in the current region, and then accurately reconstructs the second quantization coefficient based on the parity of the second quantization coefficient and the first quantization coefficient.

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

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

[0486] S801. Obtain at least one flag.

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

[0488] 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.

[0489] 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.

[0490] 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.

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

[0492] 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.

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

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

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

[0496] 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 preset conditions, it means that the parity hiding technology provided in the embodiment of the present application can achieve significant beneficial effects in the current region. At this time, the following step S804 is executed.

[0497] If the current region does not meet the preset 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.

[0498] 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.

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

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

[0501] 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 the second value;

[0502] 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 value;

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

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

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

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

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

[0508] In some embodiments, if at least one of the first value, the second value, the third value, and the fourth 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.

[0509] S804: Determine a second quantization coefficient in the current region, and perform parity hiding on the second quantization coefficient to obtain a first quantization coefficient.

[0510] S805: Encode the first quantization coefficient to obtain a code stream.

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

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

[0513] In an embodiment of the present application, when encoding the current area, the encoding end first determines whether the current area meets the preset 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 the coding reliability.

[0514] It should be understood that Figures 5 to 11 are merely examples of the present application and should not be construed as limiting the present application.

[0515] 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.

[0516] 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.

[0517] The above describes in detail the method embodiment of the present application in conjunction with Figures 5 to 11, and the following describes in detail the device embodiment of the present application in conjunction with Figures 12 to 15.

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

[0519] As shown in FIG12 , the video decoding apparatus 10 includes:

[0520] A decoding unit 11 is configured to decode a bitstream to obtain P quantization coefficients in a current region and a first quantization coefficient, where the current region is a region in a current block including at least one non-zero quantization coefficient, the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on a second quantization coefficient in the current region, and P is a positive integer;

[0521] a parity determination unit 12, configured to determine the parity of the second quantization coefficient according to the P quantization coefficients;

[0522] The coefficient determination unit 13 is configured to determine a second quantization coefficient having parity according to the parity of the first quantization coefficient and the second quantization coefficient.

[0523] In some embodiments, the parity determination unit 12 is specifically configured to determine the parity of the second quantization coefficient according to the parities corresponding to the P quantization coefficients.

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

[0525] In some embodiments, the parity determination unit 12 is specifically used to determine that the second quantization coefficient 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 second quantization coefficient is an even number.

[0526] 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 second quantization coefficient according to the parity of the number of the target quantization coefficients among the P quantization coefficients.

[0527] In some embodiments, the parity determination unit 12 is specifically used to determine that the second quantization coefficient 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 second quantization coefficient is an even number.

[0528] 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.

[0529] In some embodiments, the coefficient determination unit 13 is specifically configured to operate the first quantization coefficient using a preset operation method to obtain an operation result; and obtain the second quantization coefficient according to the parity of the second quantization coefficient and the operation result.

[0530] In some embodiments, the predetermined operation includes multiplying the value of the first quantization coefficient by two.

[0531] In some embodiments, the coefficient determination unit 13 is specifically used to determine the sum of the operation result and a preset value as the second quantization coefficient, wherein if the second quantization coefficient is an odd number, the preset value is 1, and if the second quantization coefficient is an even number, the preset value is 0.

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

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

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

[0535] 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 value;

[0536] 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 value;

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

[0538] In some embodiments, at least one of the first value, the second value, the third value, and the fourth value is a fixed value.

[0539] In some embodiments, at least one of the first value, the second value, the third value, and the fourth value is a non-fixed value.

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

[0541] In some embodiments, the decoding unit 11 is further configured to skip the step of determining the parity of the first quantization coefficient in the current area based on the quantization values ​​of the P quantization coefficients if the current block is transformed using a target transformation method.

[0542] In some embodiments, the target transformation method includes secondary transformation or multiple transformations.

[0543] 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.

[0544] In some embodiments, the decoding unit 11 is further 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 the P quantization coefficients and the first quantization coefficient from the decoded information of the current block.

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

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

[0547] In some embodiments, at least two of the N regions include the same number of quantized coefficients.

[0548] In some embodiments, at least two of the N regions include different numbers of quantized coefficients.

[0549] In some embodiments, the decoding unit 11 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 current block is divided into N regions.

[0550] In some embodiments, the at least one flag comprises 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.

[0551] In some embodiments, the current region is the current block.

[0552] In some embodiments, the first quantized coefficient is the last quantized coefficient in the current block in a scanning order.

[0553] In some embodiments, the parity determination unit 12 is specifically configured to determine the parity of the second quantization coefficient according to the P quantization coefficients if the current block meets a set condition.

[0554] In some embodiments, the set condition includes at least one of the following:

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

[0556] The current sequence in which the current block is located allows the parity of the quantized coefficients to be hidden;

[0557] The transform mode used by the current block is a non-transform skip mode in both horizontal and vertical directions;

[0558] The current block is a luminance block.

[0559] 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 12 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.

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

[0561] As shown in FIG13 , the video encoding apparatus 20 includes:

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

[0563] a processing unit 22 configured to determine a second quantization coefficient in a current region, and perform parity hiding on 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;

[0564] The encoding unit 23 is configured to encode the first quantization coefficient to obtain a code stream, wherein the parity of the second quantization coefficient is indicated by P quantization coefficients in the current region, where P is a positive integer.

[0565] In some embodiments, the parity of the second quantization coefficient is indicated by the parity corresponding to the P quantization coefficients in the current region.

[0566] In some embodiments, if the parity corresponding to the P quantization coefficients is inconsistent with the parity of the second quantization coefficient, the processing unit 22 is further used to adjust the P quantization coefficients so that the parity corresponding to the P quantization coefficients is consistent with the parity of the second quantization coefficient.

[0567] In some embodiments, if the parity of the second quantization coefficient is indicated by the parity of the sum of the first absolute values ​​of the P quantization coefficients, the processing unit 22 is also 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 second quantization coefficient.

[0568] In some embodiments, the processing unit 22 is specifically used to 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 if the second quantization coefficient is an odd number and the sum of the first absolute values ​​of the P quantization coefficients is an even number; if the second quantization coefficient is an even number and the sum of the first absolute values ​​of the P quantization coefficients is an odd 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 even number.

[0569] In some embodiments, if the parity of the second quantization coefficient is indicated by the parity of the number of target quantization coefficients in the P quantization coefficients, the processing unit 22 is specifically used to adjust 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 second quantization coefficient.

[0570] In some embodiments, the processing unit 22 is specifically configured to, if the second quantization coefficient 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 P quantization coefficients after adjustment is an odd number; and if the second quantization coefficient is an even number and the number of target quantization coefficients in the P quantization coefficients is an odd number, adjust the values ​​of the P quantization coefficients so that the number of target quantization coefficients in the P quantization coefficients after adjustment is an even number.

[0571] 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.

[0572] In some embodiments, the processing unit 22 is configured to perform an operation on the second quantization coefficient using a preset operation method according to the parity of the second quantization coefficient to obtain the first quantization coefficient.

[0573] In some embodiments, the preset operation method includes dividing the value of the second quantization coefficient by two and rounding it up.

[0574] In some embodiments, the processing unit 22 is specifically configured to perform parity hiding on the second quantization coefficient to obtain a first quantization coefficient if the current region meets the preset condition.

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

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

[0577] 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 value;

[0578] 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 value;

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

[0580] In some embodiments, at least one of the first value, the second value, the third value, and the fourth value is a fixed value.

[0581] In some embodiments, at least one of the first value, the second value, the third value, and the fourth value is a non-fixed value.

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

[0583] 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.

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

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

[0586] In some embodiments, at least two of the N regions include the same number of quantized coefficients.

[0587] In some embodiments, at least two of the N regions include different numbers of quantized coefficients.

[0588] 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, the current block is divided into N areas.

[0589] In some embodiments, the at least one flag comprises 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.

[0590] In some embodiments, the processing unit 22 is further configured to skip dividing the current block into N regions if the current block is transformed using a target transformation method.

[0591] In some embodiments, the target transformation method includes secondary transformation or multiple transformations.

[0592] In some embodiments, the dividing unit 21 is specifically configured to divide the current block into a region.

[0593] In some embodiments, the second quantized coefficient is the last quantized coefficient in the current block in a scanning order.

[0594] In some embodiments, the dividing unit 21 is specifically configured to divide the current block into a region if the current block meets a set condition.

[0595] In some embodiments, the set condition includes at least one of the following:

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

[0597] The current sequence in which the current block is located allows the parity of the quantized coefficients to be hidden;

[0598] The transform mode used by the current block is a non-transform skip mode in both horizontal and vertical directions;

[0599] The current block is a luminance block.

[0600] 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 13 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.

[0601] 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.

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

[0603] As shown in FIG14 , 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:

[0604] 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.

[0605] 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 .

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

[0607] 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.

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

[0609] 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).

[0610] 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.

[0611] As shown in FIG14 , the electronic device 30 may further include:

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

[0613] 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.

[0614] 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.

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

[0616] As shown in Figure 15, 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.

[0617] 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.

[0618] The present application also provides a code stream, which is obtained by the above-mentioned video encoding method.

[0619] 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)).

[0620] 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.

[0621] 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.

[0622] 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.

[0623] 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 a bitstream to obtain P quantization coefficients and a first quantization coefficient in a current region, where the current region is a region in the current block including at least one non-zero quantization coefficient, the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on the second quantization coefficient in the current region, and P is a positive integer; Determining the parity of the second quantization coefficient according to the P quantization coefficients; A second quantization coefficient having parity is determined according to the parity of the first quantization coefficient and the second quantization coefficient.

2. The method according to claim 1, characterized in that Determining the parity of the second quantization coefficient according to the P quantization coefficients includes: The parity of the second quantization coefficient is determined according to the parities corresponding to the P quantization coefficients.

3. The method according to claim 2, characterized in that The determining the parity of the second quantization coefficient according to the parities corresponding to the P quantization coefficients includes: The parity of the second quantization coefficient is determined according to the parity of the sum of first absolute values ​​of the P quantization coefficients, where the first absolute value is part or all of the absolute values ​​of the quantization coefficients.

4. The method according to claim 3, characterized in that The determining the parity of the second quantization coefficient according to the parity of the sum of the first absolute values ​​of the P quantization coefficients includes: If the sum of the first absolute values ​​of the P quantization coefficients is an odd number, determining that the second quantization coefficient is an odd number; If the sum of the first absolute values ​​of the P quantization coefficients is an even number, then the second quantization coefficient is determined to be an even number.

5. The method according to claim 3, characterized in that The determining the parity of the second quantization coefficient according to the parities corresponding to the P quantization coefficients includes: Determining a target quantization coefficient among the P quantization coefficients; The parity of the second quantization coefficient is determined according to the parity of the number of target quantization coefficients in the P quantization coefficients.

6. The method according to claim 5, characterized in that The determining the parity of the second quantization coefficient according to the parity of the number of target quantization coefficients in the P quantization coefficients includes: If the number of the target quantization coefficients in the P quantization coefficients is an odd number, determining that the second quantization coefficient 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 second quantization coefficient is an even number.

7. The method according to claim 5, 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.

8. The method according to any one of claims 1 to 7, characterized in that The determining, according to the parity of the first quantization coefficient and the second quantization coefficient, a second quantization coefficient having parity includes: Performing an operation on the first quantization coefficient using a preset operation method to obtain an operation result; The second quantization coefficient is obtained according to the parity of the second quantization coefficient and the operation result.

9. The method according to claim 8, characterized in that The preset operation method includes multiplying the value of the first quantization coefficient by two.

10. The method according to claim 9, characterized in that Obtaining the second quantization coefficient according to the parity of the second quantization coefficient and the operation result includes: The sum of the operation result and a preset value is determined as the second quantization coefficient, wherein if the second quantization coefficient is an odd number, the preset value is 1; if the second quantization coefficient is an even number, the preset value is 0.

11. The method according to any one of claims 1 to 7, characterized in that: Determining the parity of the second quantization coefficient according to the P quantization coefficients includes: If the current region meets a preset condition, the parity of the second quantization coefficient is determined according to the P quantization coefficients.

12. The method according to claim 11, 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 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 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 value; In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth value.

13. The method according to claim 12, characterized in that At least one of the first value, the second value, the third value, and the fourth value is a fixed value.

14. The method according to claim 12, characterized in that At least one of the first value, the second value, the third value, and the fourth value is a non-fixed value.

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

16. The method according to any one of claims 1 to 7, characterized in that The method further comprises: If the current block is transformed using a target transformation method, the step of determining the parity of the second quantization coefficient according to the P quantization coefficients is skipped.

17. The method according to claim 16, characterized in that The target transformation method includes secondary transformation or multiple transformations.

18. The method according to any one of claims 1 to 7, 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.

19. The method according to any one of claims 1 to 7, characterized in that The decoding bit stream obtains P quantization coefficients and a first quantization coefficient 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; The P quantization coefficients and the first quantization coefficient are obtained from decoded information of the current block.

20. The method according to claim 19, characterized in that The dividing the current block into N regions includes: The current block is divided into N regions according to a scanning order.

21. The method according to claim 19, wherein The dividing the current block into N regions includes: The current block is divided into N regions according to spatial positions.

22. The method according to claim 19, wherein At least two of the N regions include the same number of quantized coefficients.

23. The method according to claim 19, wherein At least two of the N regions include different numbers of quantized coefficients.

24. The method according to claim 19, wherein 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 dividing the current block into N regions includes: 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 current block is divided into N regions.

25. The method according to claim 24, 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.

26. The method according to any one of claims 1 to 7, characterized in that The current region is the current block.

27. The method according to claim 26, characterized in that The first quantization coefficient is the last quantization coefficient in the current block in a scanning order.

28. The method according to claim 26, characterized in that Determining the parity of the second quantization coefficient according to the P quantization coefficients includes: If the current block meets a set condition, the parity of the second quantization coefficient is determined according to the P quantization coefficients.

29. The method according to claim 28, characterized in that The setting conditions include at least one of the following: The number of non-zero quantized coefficients in the current block is greater than a first value; The current sequence in which the current block is located allows the parity of the quantized coefficients to be hidden; The transform mode used by the current block is a non-transform skip mode in both horizontal and vertical directions; The current block is a luminance block.

30. A video encoding method, characterized in that: include: Divide the current block into N regions, where N is a positive integer; Determining a second quantization coefficient in a current region, where the current region is a region among the N regions including at least one non-zero quantization coefficient; performing parity hiding on the second quantization coefficient to obtain a first quantization coefficient; The first quantization coefficient is encoded to obtain a code stream, and the parity of the second quantization coefficient is indicated by P quantization coefficients in the current area, where P is a positive integer.

31. The method according to claim 30, wherein The parity of the second quantization coefficient is indicated by the parity corresponding to the P quantization coefficients in the current region.

32. The method according to claim 31, characterized in that If the parities corresponding to the P quantization coefficients are inconsistent with the parity of the second quantization coefficient, 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 second quantization coefficient.

33. The method according to claim 32, characterized in that If the parity of the second quantization coefficient is indicated by the parity of the sum of first absolute values ​​of the P quantization coefficients, and the first absolute value is a partial or complete absolute value of the quantization coefficient, 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 second quantization coefficient.

34. The method according to claim 33, wherein The adjusting 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 second quantization coefficient includes: If the second quantization coefficient 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 second quantization coefficient 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 P quantization coefficients after adjustment is an even number.

35. The method according to claim 32, wherein If the parity of the second quantization coefficient is indicated by the parity of 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 second quantized coefficients.

36. The method according to claim 35, characterized in that The 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 second quantization coefficients includes: If the second quantization coefficient 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 P quantization coefficients after adjustment is an odd number; If the second quantization coefficient 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.

37. The method according to claim 35, 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.

38. The method according to any one of claims 30 to 37, characterized in that The performing parity hiding on the second quantization coefficient to obtain the first quantization coefficient includes: According to the parity of the second quantization coefficient, a preset operation method is used to operate the second quantization coefficient to obtain the first quantization coefficient.

39. The method according to claim 38, characterized in that The preset operation method includes dividing the value of the second quantization coefficient by two and rounding it up.

40. The method according to any one of claims 30 to 37, characterized in that The performing parity hiding on the second quantization coefficient to obtain the first quantization coefficient includes: If the current region meets a preset condition, parity hiding is performed on the second quantization coefficient to obtain a first quantization coefficient.

41. The method according to claim 40, 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 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 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 value; In the current region, the sum of the absolute values ​​of the non-zero quantization coefficients is greater than a fourth value.

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

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

44. The method according to claim 43, wherein If at least one of the first value, the second value, the third value, and the fourth value is a non-fixed value, the method further includes: The non-fixed value is written into the code stream.

45. The method according to any one of claims 30 to 37, 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.

46. ​​The method according to any one of claims 30 to 37, wherein: The current block is divided into N regions, including: The current block is divided into N regions according to a scanning order.

47. The method according to any one of claims 30 to 37, wherein: The current block is divided into N regions, including: The current block is divided into N regions according to spatial positions.

48. The method according to any one of claims 30 to 37, wherein: At least two of the N regions include the same number of quantized coefficients.

49. The method according to any one of claims 30 to 37, wherein: At least two of the N regions include different numbers of quantized coefficients.

50. The method according to any one of claims 30 to 37, 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 current block is divided into N regions, including: 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 current block is divided into N regions.

51. The method according to claim 50, 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.

52. The method according to any one of claims 30 to 37, wherein: The method further comprises: If the current block is transformed using the target transformation method, then dividing the current block into N regions is skipped.

53. The method according to claim 52, characterized in that The target transformation method includes secondary transformation or multiple transformations.

54. The method according to any one of claims 30 to 37, wherein: The current block is divided into N regions, including: The current block is divided into a region.

55. The method according to claim 54, characterized in that The second quantization coefficient is the last quantization coefficient in the current block in a scanning order.

56. The method according to claim 54, wherein The current block is divided into N regions, including: If the current block meets the set condition, the current block is divided into a region.

57. The method according to claim 56, characterized in that The setting conditions include at least one of the following: The number of non-zero quantized coefficients in the current block is greater than a first value; The current sequence in which the current block is located allows the parity of the quantized coefficients to be hidden; The transform mode used by the current block is a non-transform skip mode in both horizontal and vertical directions; The current block is a luminance block.

58. 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 and a first quantization coefficient, wherein the current region is a region in a current block including at least one non-zero quantization coefficient, the first quantization coefficient is a quantization coefficient obtained by performing parity hiding on the second quantization coefficient in the current region, and P is a positive integer; a parity determination unit, configured to determine the parity of the second quantization coefficient according to the P quantization coefficients; The coefficient determination unit is configured to determine a second quantization coefficient having parity according to the parity of the first quantization coefficient and the second quantization coefficient.

59. 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 a current region, and perform parity hiding on 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 encoding unit is configured to encode the first quantization coefficient to obtain a code stream, wherein the parity of the second quantization coefficient is indicated by P quantization coefficients in the current area, where P is a positive integer.

60. A video encoding and decoding system, characterized in that: Includes video encoder and video decoder; The video decoder is configured to execute the video decoding method according to any one of claims 1 to 29; The video encoder is used to execute the video encoding method according to any one of claims 30-57.

61. 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 29 or 30 to 57.

62. 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 29 or 30 to 57.

63. A code stream, characterized in that The code stream is obtained by the method according to any one of claims 30 to 57.