Video coding and decoding method, device, equipment, system and storage medium
Patent Information
- Application Number
- CN202280096699.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2025-02-14
AI Technical Summary
In existing video coding methods, quantization coding is costly, resulting in low coding efficiency.
By hiding the characteristics of the second quantization coefficient in the current block, the first quantization coefficient is generated and encoded to reduce the number of bits required for encoding and lower the encoding cost.
It effectively reduces the bit count requirement for video encoding and improves encoding efficiency.
Smart Images

Figure CN119452656A_ABST
Abstract
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, determining N first quantization coefficients of a current block, where an i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained by hiding a first characteristic of an i-th second quantization coefficient in the current block, where N is a positive integer and i is a positive integer less than or equal to N;
[0008] Determining a region corresponding to the i-th first quantization coefficient in the current block;
[0009] determining, according to a second characteristic of a region corresponding to the i-th first quantization coefficient in the current block, a first characteristic of the i-th second quantization coefficient;
[0010] The i-th second quantization coefficient is determined according to first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient.
[0011] In a second aspect, an embodiment of the present application provides a video encoding method, including:
[0012] Determine N second quantization coefficients of the current block, where N is a positive integer;
[0013] For an i-th second quantization coefficient among the N second quantization coefficients, hiding the first characteristic of the i-th second quantization coefficient to obtain an i-th first quantization coefficient, where i is a positive integer less than or equal to N;
[0014] The i-th first quantization coefficient is encoded to obtain a code stream, and the first characteristic of the i-th second quantization coefficient is identified by the second characteristic of the area corresponding to the i-th second quantization coefficient in the current block.
[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 bitstream is decoded, and N first quantization coefficients in the current block are determined. The i-th first quantization coefficient among the N first quantization coefficients is the quantization coefficient obtained by hiding the first characteristic of the i-th second quantization coefficient in the current block. Then, the region corresponding to the i-th first quantization coefficient in the current block is determined; the first characteristic of the i-th second quantization coefficient is determined based on the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block; and the i-th second quantization coefficient is determined based on the first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient. That is, in the embodiment of the present application, the first characteristics of the N second quantization coefficients in the current block are hidden to obtain N first quantization coefficients. When encoding, the N first quantization coefficients are encoded, which can reduce the number of bits required for encoding and reduce the cost of video compression. 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] FIG4A is a schematic diagram of a scanning method according to an embodiment of the present application;
[0030] FIG4B is a schematic diagram of another scanning method according to an embodiment of the present application;
[0031] FIG5 is a flow chart of a video decoding method provided in an embodiment of the present application;
[0032] FIG6 is a schematic diagram showing the distribution of N first quantization coefficients in an embodiment of the present application;
[0033] FIG7 is a schematic diagram showing the distribution of N first quantization coefficients and corresponding regions in an embodiment of the present application;
[0034] FIG8 is a schematic diagram showing the distribution of N first quantization coefficients and corresponding regions in another embodiment of the present application;
[0035] FIG9 is a flow chart of a video decoding method according to an embodiment of the present application;
[0036] FIG10 is a schematic diagram of a flow chart of a video encoding method provided in an embodiment of the present application;
[0037] FIG11 is a flow chart of a video encoding method according to an embodiment of the present application;
[0038] FIG12 is a schematic block diagram of a video decoding device provided in an embodiment of the present application;
[0039] FIG13 is a schematic block diagram of a video encoding apparatus according to an embodiment of the present application;
[0040] FIG14 is a schematic block diagram of an electronic device provided in an embodiment of the present application;
[0041] FIG15 is a schematic block diagram of a video encoding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] 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.
[0043] 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.
[0044] 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 .
[0045] 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.
[0046] 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.
[0047] 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.
[0048] 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.
[0049] 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.
[0050] 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.
[0051] 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.
[0052] 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 .
[0053] 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.
[0054] 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.
[0055] 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.
[0056] In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122 .
[0057] 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 .
[0058] The input interface 121 includes a receiver and / or a modem and can receive the encoded video data via the channel 130 .
[0059] 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 .
[0060] 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.
[0061] 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.
[0062] The following is an introduction to the video encoder involved in the embodiments of the present application.
[0063] 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.
[0064] 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).
[0065] 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.
[0066] 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.
[0067] 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.
[0068] 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.
[0069] 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.
[0070] 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.
[0071] 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 50, 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.
[0072] 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.
[0073] There are multiple intra-frame prediction modes, such as the nine modes for intra-frame prediction of 4×4 blocks in H.264. 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.
[0074] 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.
[0075] It should be noted that with the increase of angle modes, intra-frame prediction will be more accurate and more in line with the needs of high-definition and ultra-high-definition digital video development.
[0076] 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.
[0077] 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.
[0078] 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.
[0079] 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.
[0080] Loop filtering unit 260 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a CU.
[0081] 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.
[0082] 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.
[0083] 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.
[0084] The basic process of video coding 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.
[0085] 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.
[0086] 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.
[0087] FIG3 is a schematic block diagram of a video decoder provided in an embodiment of the present application.
[0088] 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.
[0089] 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.
[0090] In some embodiments, the prediction unit 320 includes an inter-frame prediction unit 321 and an intra-frame prediction unit 322 .
[0091] 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.
[0092] 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.
[0093] 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.
[0094] 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.
[0095] 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.
[0096] The loop filtering unit 350 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a CU.
[0097] 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.
[0098] 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.
[0099] 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.
[0100] 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.
[0101] The following is an introduction to the quantization-related technologies involved in this application.
[0102] 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.
[0103] 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.
[0104] For example, the quantization can be achieved using the following formula (1):
[0105]
[0106] 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.
[0107] For example, the following formula (2) can be used to implement inverse quantization:
[0108] t′ i =q i qstep (2)
[0109] 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.
[0110] 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.
[0111] For example, the quantization cost is determined using the following formula (3):
[0112] J=D+λ·R=(t i -t′ i ) 2 +λ·B(q i ) (3)
[0113] Among them, J is the quantization cost, D is the distortion, R is the bit rate, λ is the function of the quantization parameter QP, and B() is the encoder's estimated coding quantization coefficient q i The bits consumed.
[0114] 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 iAdjustments are made to achieve overall cost optimization. This process is called rate-distortion optimized quantization and is also widely used in video coding.
[0115] 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.
[0116] 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.
[0117] 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.
[0118] 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.
[0119] 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.
[0120] 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.
[0121] The portion greater than or equal to 15 uses Exponential Golomb coding / decoding and does not rely on the context model. However, identifiers 1 to 5 use the context model, with identifier 1 having a separate context model and identifiers 2-5 sharing a common context model. Furthermore, if the current coefficient is non-zero, the sign must be encoded / decoded. The encoding / decoding process for each identifier in the transform block is as follows:
[0122] 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.
[0123] 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.
[0124] For example, the encoding syntax is shown in Table 1 below:
[0125] Table 1
[0126]
[0127]
[0128] In the above Table 1, S() is the multi-symbol context model coding, and L(1) is the bypass coding.
[0129] In some embodiments, when encoding and decoding coefficients, a diagonal scan as shown in FIG4A is generally adopted, or a zig-zag scan as shown in FIG4B is adopted. In some embodiments, scanning methods such as Column scan and Row scan can also be adopted when encoding and decoding coefficients. The embodiment of the present application does not limit the specific scanning method of the transform block. As shown in FIG4A and FIG4B, each transform block can be divided into multiple regions with 16 coefficients as a group, and scanned with one region as a scanning unit. After the scanning of one region is completed, the other regions are scanned. Since the transform can concentrate the energy in the upper left corner of the transform block, the actual coefficient decoding order is defined as the reverse scanning order, that is, starting from the first non-zero coefficient in the lower right corner of the transform block, sequential decoding is performed in the decoding order. For example, as shown in FIG4A and FIG4B, starting from the first non-zero coefficient in the lower right corner of the transform block, decoding is performed in the decoding order to the upper left corner of the transform block.
[0130] Currently, the encoding method of the quantization coefficient is usually to fully encode the quantization coefficient, for example, to fully encode the absolute value of the quantization coefficient, which occupies more bits and has a high encoding cost.
[0131] In an embodiment of the present application, during the encoding process of the quantization coefficient, the first characteristic of the second quantization coefficient in the current block is hidden to obtain the first quantization coefficient, and the first quantization coefficient is encoded to reduce the number of bits required for encoding, thereby reducing the encoding cost.
[0132] The technical solutions provided in the embodiments of the present application are described in detail below in conjunction with specific embodiments.
[0133] First, referring to FIG5 , the decoding end is taken as an example for introduction.
[0134] 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:
[0135] S501: Decode a code stream and determine N first quantization coefficients of a current block.
[0136] Among them, the i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained after hiding the first characteristic of the i-th second quantization coefficient in the current block, N is a positive integer, and i is a positive integer less than or equal to N.
[0137] 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.
[0138] In some embodiments, the first quantized coefficient whose parity is hidden is also referred to as a hidden coefficient.
[0139] In some embodiments, the current block may also be referred to as a current transform block or a current decoding block, etc.
[0140] In an embodiment of the present application, to reduce coding costs, the coding end conceals the first characteristics of the N second quantization coefficients in the current block to obtain N first quantization coefficients. For example, the coding end conceals the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient. Thus, during encoding, the coding end encodes the N first quantization coefficients rather than the N second quantization coefficients. Because the N first quantization coefficients are obtained by concealing the first characteristics of the N second quantization coefficients, the encoded values of the N first quantization coefficients are smaller than those of the N second quantization coefficients. Therefore, when encoding the N first quantization coefficients with smaller encoded values, fewer bits can be used, thereby reducing coding costs.
[0141] The embodiment of the present application does not limit the first feature, which can be any characteristic of the second quantization coefficient that needs to be encoded.
[0142] In an example, the first characteristic is a positive or negative sign. In this case, the first quantization coefficient is a quantization coefficient obtained by hiding the positive or negative sign of the second quantization coefficient at the corresponding position.
[0143] In another example, the first characteristic is parity. In this case, the first quantization coefficient is a quantization coefficient obtained by hiding part of the absolute value of the second quantization coefficient according to the parity of the second quantization coefficient at the corresponding position.
[0144] 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.
[0145] 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.
[0146] In some embodiments, the quantization coefficient can be understood as a numerical value consisting of an absolute value and a positive or negative sign decoded from a bit stream.
[0147] In some embodiments, the absolute value of the quantization coefficient includes a portion of values less than or equal to 15, for example, decoding identifiers 1 to 5 obtains a portion of values with an absolute value less than or equal to 15.
[0148] In some embodiments, if the value of the quantization coefficient exceeds 15, the absolute value of the quantization coefficient also includes the value exceeding 15.
[0149] The embodiment of the present application does not limit the specific positions of the N first quantization coefficients in the current block. For example, as shown in FIG6 , the N first quantization coefficients are coefficients at four positions with indexes 48, 32, 16, and 0.
[0150] In some embodiments, the transformation causes the energy of the current block to be primarily concentrated in the upper left corner region. That is, the non-zero quantization coefficients of the current block are primarily concentrated in the upper left corner region of the current block, while the quantization coefficients in the lower right corner region of the current block are typically 0. Based on this, in order to effectively reduce the coding cost, the N first quantization parameters in the embodiment of the present application are located in the upper left corner region of the current block. For example, the N first quantization coefficients are quantization coefficients at position indices 0, 1, 2, 4, and so on.
[0151] In the above S501, the method of decoding the bitstream and determining the N first quantization coefficients of the current block includes but is not limited to the following:
[0152] In the first approach, the positions of the N first quantization coefficients in the current block are preset or defaulted. In this way, the decoding end decodes the bitstream to obtain the N first quantization coefficients.
[0153] In the second method, the N first quantization coefficients of the current block are determined through the following S501-A and S501-B:
[0154] S501-A: Decode the code stream to obtain the number of quantization coefficients of the current block.
[0155] S501-B. Determine N first quantization coefficients according to the number of quantization coefficients of the current block.
[0156] The number of quantized coefficients of the current block described in the embodiments of the present application refers to the number of all coefficients between the first decoded non-zero coefficient and the last decoded coefficient in the current block. For example, in Figure 5, for an 8×8 current block, the quantized coefficient at position index 21 in the current block is the first non-zero quantized coefficient in the scan order (i.e., the decoding order or decoding scan order). During decoding, the decoder starts from the quantized coefficient at position index 21 and decodes the quantized coefficient at position index 0 in the upper left corner of the current block along the scan order. The total number of quantized coefficients to be decoded is 22, that is, the number of quantized coefficients in the current block is 22.
[0157] In an embodiment of the present application, if the current block includes fewer quantization coefficients, the coding cost is relatively low. In this case, the encoder can directly encode the smaller number of quantization coefficients without hiding them. If the current block includes more quantization coefficients, the coding cost of the encoder is relatively high. In this case, in order to reduce the coding cost, the first characteristics of some quantization coefficients in the current block can be hidden to reduce the coding cost. It can be seen that the number of quantization coefficients included in the current block will affect the coding cost. Therefore, in this second method, the N first quantization coefficients in the current block are determined by the number of quantization coefficients included in the current block, further reducing the coding cost.
[0158] The embodiment of the present application does not limit the method of decoding the code stream in the above S501-A to obtain the number of quantization coefficients of the current block.
[0159] In a possible implementation, the encoder writes the number of quantization coefficients in the current block into the bitstream, so that the decoder can obtain the number of quantization coefficients in the current block by decoding the bitstream.
[0160] In another possible implementation, the decoding end obtains all quantization coefficients of the current block by decoding the bit stream, and then obtains the quantization coefficient of the current block therefrom.
[0161] After determining the number of quantization coefficients of the current block, the decoding end determines N first quantization coefficients of the current block according to the number of quantization coefficients of the current block.
[0162] For example, if the number of quantization coefficients of the current block is less than a preset value of 1, a quantization coefficient located at the upper left corner of the current block is determined as the first quantization coefficient.
[0163] For another example, if the number of quantization coefficients of the current block is less than a preset value of 2, two adjacent quantization coefficients located in the upper left corner of the current block are respectively determined as first quantization coefficients, thereby obtaining two first quantization coefficients. In one example, the two adjacent quantization coefficients may be spatially adjacent quantization coefficients. In another example, the two adjacent quantization coefficients are two adjacent quantization coefficients in a scanning order.
[0164] In some embodiments, N first quantization coefficients may be determined through the following steps S501-B1 to S501-B3:
[0165] S501-B1, determining a first threshold;
[0166] S501-B2, determining the number of first quantization coefficients in the current block according to the number of quantization coefficients of the current block and a first threshold;
[0167] S501-B3. According to the number of first quantization coefficients in the current block, determine the N quantization coefficients in the upper left corner area of the current block as N first quantization coefficients.
[0168] In this embodiment, the decoding end may calculate the number of first quantization coefficients in the current block according to the number of quantization coefficients of the current block, and further determine the N first quantization coefficients of the current block according to the number N of first quantization coefficients.
[0169] Specifically, the decoding end determines a first threshold, and then determines the number N of first quantization coefficients in the current block based on the first threshold and the number of quantization coefficients of the current block determined above, and then determines the N quantization coefficients in the upper left corner area of the current block as N first quantization coefficients.
[0170] The embodiment of the present application does not limit the method for determining the first threshold in the above S501-B1.
[0171] For example, the first threshold is a preset value or a default value, so the decoding end can determine the preset value or the default value as the first threshold.
[0172] For another example, the encoding end writes the first threshold into the bitstream, so that the decoding end can obtain the first threshold by decoding the bitstream.
[0173] The embodiment of the present application does not limit the specific value of the first threshold, for example, it can be 16, 8, 4, etc.
[0174] After the decoding end determines the first threshold, it executes S501-B2 to determine the number of first quantization coefficients in the current block based on the number of quantization coefficients in the current block and the first threshold. This embodiment of the application does not limit the specific implementation of S501-B2.
[0175] In an example, the integer part of the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of first quantization coefficients in the current block.
[0176] In another example, a rounded value of a ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of first quantization coefficients in the current block.
[0177] In yet another example, a value obtained by rounding up the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of first quantization coefficients in the current block.
[0178] For example, the number of first quantization coefficients in the current block is determined according to the following formula (4):
[0179]
[0180] Wherein, N is the number of the first quantized coefficients in the current block, M can be the first threshold, N coeff is the number of quantized coefficients of the current block, Indicates rounding up. For example, N coeff is 22, M is 16, then according to the above formula (4), N is 2.
[0181] According to the above method, after determining the number N of first quantization coefficients in the current block, execute the above S501-B3 to determine the N quantization coefficients in the upper left corner area of the current block as N first quantization coefficients according to the number of first quantization coefficients in the current block.
[0182] The embodiment of the present application does not limit the specific implementation method of the above S501-B3.
[0183] In one possible implementation, any N quantization coefficients in the upper left corner region of the current block are determined as N first quantization coefficients. For example, these N first quantization coefficients are N quantization coefficients that are spatially adjacent, partially adjacent, or not adjacent in the upper left corner region of the current block.
[0184] In another possible implementation, according to a scanning order, the N quantization coefficients in the upper left corner area of the current block are determined as N first quantization coefficients.
[0185] For example, N quantization coefficients adjacent to each other in the scanning order in the upper left corner area of the current block are determined as N first quantization coefficients.
[0186] For another example, the last N quantization coefficients in the current block in the scanning order are determined as the N first quantization coefficients. Assuming N=2, the two quantization coefficients corresponding to index 0 and index 1 in FIG6 are determined as the two first quantization coefficients.
[0187] In some embodiments, during decoding, the decoding end first decodes identifiers 1 to 5, that is, first decodes the absolute value of the portion less than or equal to 15, and then decodes the portion with an absolute value greater than 15. Based on this, in the embodiment of the present application, in order to improve the decoding effect, the above-mentioned first quantization coefficient can be understood as a partial quantization coefficient, for example, a quantization coefficient of the portion less than 16, that is, a quantization coefficient obtained by decoding identifiers 1 to 5.
[0188] That is, after determining that all quantization coefficients of the current block are less than the value of the portion 16, the decoding end determines the N first quantization coefficients of the current block. Exemplarily, the bitstream is decoded to obtain decoded information of the current block, and the N first quantization coefficients of the current block are determined from the decoded information of the current block.
[0189] Optionally, the decoded information of the current block includes quantization coefficients of a portion less than 16 in the current block, and then according to the number and position of the first quantization coefficients in the current block, the N first quantization coefficients of the current block are determined from the decoded information of the current block.
[0190] In some embodiments, at least one flag may be used to indicate whether the current block allows the use of the technology for hiding the first characteristic of the quantization coefficient provided in the embodiment of the present application. In some embodiments, the technology for hiding the first characteristic of the quantization coefficient provided in the embodiment of the present application is also called the first characteristic hiding technology.
[0191] Exemplarily, the at least one flag that is set may be a flag of different levels, used to indicate whether the corresponding level allows the first characteristic of the quantization coefficient to be hidden.
[0192] 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.
[0193] For example, the at least one flag includes a sequence-level flag, and the sequence-level flag is used to indicate whether the first characteristic of the quantization coefficient of the current sequence is allowed to be concealed. For example, if the value of the sequence-level flag is 1, it indicates that the first characteristic of the quantization coefficient of the current sequence is allowed to be concealed; if the value of the sequence-level flag is 0, it indicates that the first characteristic of the quantization coefficient of the current sequence is not allowed to be concealed.
[0194] Optionally, if the at least one flag includes a sequence-level flag, the sequence-level flag may be located in a sequence header.
[0195] For another example, the at least one flag includes a picture-level flag, and the picture-level flag is used to indicate whether the first characteristic of the quantization coefficient of the current image is allowed to be concealed. For example, if the value of the picture-level flag is 1, it indicates that the first characteristic of the quantization coefficient of the current image is allowed to be concealed; if the value of the picture-level flag is 0, it indicates that the first characteristic of the quantization coefficient of the current image is not allowed to be concealed.
[0196] Optionally, if the at least one flag includes a picture-level flag, the picture-level flag may be located in a picture header.
[0197] For another example, the at least one flag includes a slice-level flag, and the slice-level flag is used to indicate whether the first characteristic of the quantization coefficient 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 first characteristic of the quantization coefficient is allowed to be concealed for the current slice; if the value of the slice-level flag is 0, it indicates that the first characteristic of the quantization coefficient is not allowed to be concealed for the current slice.
[0198] Optionally, if the at least one flag includes a slice-level flag, the slice-level flag may be located in a slice header.
[0199] 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 first characteristic of the quantized coefficient to be concealed. For example, if the value of the unit-level flag is 1, it indicates that the current CTU allows the first characteristic of the quantized coefficient to be concealed; if the value of the unit-level flag is 0, it indicates that the current CTU does not allow the first characteristic of the quantized coefficient to be concealed.
[0200] For another example, the at least one flag includes a block-level flag, and the block-level flag is used to indicate whether the first characteristic of the quantization coefficient of the current block is allowed to be concealed. For example, if the value of the block-level flag is 1, it indicates that the first characteristic of the quantization coefficient of the current block is allowed to be concealed; if the value of the block-level flag is 0, it indicates that the first characteristic of the quantization coefficient of the current block is not allowed to be concealed.
[0201] In this way, the decoding end first decodes the bitstream to obtain the at least one flag, and then determines whether the first characteristic of the quantized coefficients of the current block is allowed to be concealed based on the at least one flag. If the at least one flag determines that the first characteristic of the quantized coefficients of the current block is not allowed to be concealed, the method of the embodiment of the present application is skipped and the decoded quantized coefficients are directly dequantized to obtain transform coefficients. If the at least one flag determines that the first characteristic concealment 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.
[0202] For example, if the at least one flag mentioned above 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 first feature 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 first feature 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 first feature 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 first feature 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 first feature 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 first feature hiding technology provided by the embodiment of the present application, then continue decoding 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 first feature 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 first feature hiding technology provided by the embodiment of the present application, then continue decoding 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 first feature 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 first feature hiding technology provided by the embodiment of the present application, then execute the embodiment of the present application.
[0203] In some embodiments, the first feature hiding technique provided by the embodiments of the present application is mutually exclusive with a target transformation method, where the target transformation method includes a secondary transformation or multiple transformations. In this case, when the decoder determines that the current block is transformed using the target transformation method, it skips the technical solution provided by the embodiments of the present application, for example, skipping step S501 above.
[0204] In the embodiment of the present application, according to the above steps, after decoding the code stream and determining the N first quantization coefficients of the current block, the following step S502 is performed.
[0205] S502: Determine the area corresponding to the i-th first quantization coefficient in the current block.
[0206] In an embodiment of the present application, to reduce coding costs, the encoder conceals the first characteristic of the second quantized coefficient based on certain characteristics of the region corresponding to the second quantized coefficient in the current block to obtain the first quantized coefficient. Thus, when the decoder reconstructs the first quantized coefficient to obtain the second quantized coefficient, it first determines the region corresponding to the i-th first quantized coefficient, and then reconstructs the first quantized coefficient based on the region corresponding to the first quantized coefficient to obtain the second quantized coefficient.
[0207] That is, in the embodiment of the present application, each of the N first quantization coefficients corresponds to a region in the current block. The regions corresponding to different first quantization coefficients in the current block may be the same or different, and this embodiment of the present application does not impose any limitation on this.
[0208] In an embodiment of the present application, the method for determining the area corresponding to each first quantization coefficient among the N first quantization coefficients in the current block is the same. For the sake of convenience of description, the i-th first quantization coefficient among the N first quantization coefficients is taken as an example for illustration, where the i-th first quantization coefficient is any first quantization coefficient among the N first quantization coefficients.
[0209] It should be noted that in the embodiment of the present application, since the i-th first quantization coefficient and the i-th second quantization coefficient are the processed quantization coefficient and the pre-processed quantization coefficient at the same position in the current block, the area corresponding to the i-th first quantization coefficient in the current block is the same area as the area corresponding to the i-th second quantization coefficient in the current block.
[0210] In the embodiment of the present application, there is no limitation on the method of determining the area corresponding to the i-th first quantization coefficient in the current block.
[0211] In some embodiments, the current block is divided into N regions, and the N regions obtained by division are allocated one by one to the N first quantization coefficients, thereby obtaining the region corresponding to each of the N first quantization coefficients in the current block.
[0212] In a possible implementation of this embodiment, the area corresponding to each of the N first quantization coefficients in the current block does not include the first quantization coefficient. For example, the area corresponding to the i-th first quantization coefficient in the current block does not include any first quantization coefficient among the N first quantization coefficients.
[0213] In another possible implementation of this embodiment, a region corresponding to at least one of the N first quantization coefficients includes the first quantization coefficient, and a region corresponding to at least one of the N first quantization coefficients does not include the first quantization coefficient. For example, a region corresponding to the i-th first quantization coefficient includes any one or more first quantization coefficients among the N first quantization coefficients, and a region corresponding to the j-th first quantization coefficient does not include any first quantization coefficient among the N first quantization coefficients. The j-th first quantization coefficient is any first quantization coefficient among the N first quantization coefficients except the i-th first quantization coefficient.
[0214] In some embodiments, the area of the current block excluding the N first quantization coefficients is divided into N areas, and the N areas obtained by the division are assigned one by one to the N first quantization coefficients, thereby obtaining an area corresponding to each of the N first quantization coefficients in the current block. In this embodiment, the area corresponding to each of the N first quantization coefficients in the current block does not include the first quantization coefficient. For example, the area corresponding to the i-th first quantization coefficient in the current block does not include any of the N first quantization coefficients.
[0215] The following describes a process of dividing the area except the N first quantization coefficients in the current block into N areas. For ease of description, in some embodiments, the area except the N first quantization coefficients in the current block is referred to as other areas.
[0216] In an embodiment of the present application, the areas other than the N first quantization coefficients in the current block are divided, and the sizes of the obtained N areas can be the same or different, and the embodiment of the present application does not impose any restrictions on this.
[0217] In the embodiment of the present application, the decoding end and the encoding end adopt the same region division method to divide the other regions except the N first quantization coefficients in the current block into N regions.
[0218] In some embodiments, both the decoding end and the encoding end adopt a default region division method to divide other regions of the current block into N regions.
[0219] In a possible implementation of this embodiment, the other regions of the current block are divided into N regions according to a decoding scanning order.
[0220] Optionally, at least two of the N regions include the same number of quantization coefficients.
[0221] Optionally, at least two of the N regions include different numbers of quantization coefficients.
[0222] In one example, every M non-zero quantized coefficients in other regions of the current block are divided into a region according to the decoding scan 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.
[0223] In another example, according to the decoding scan direction, every K pixels in other areas of the current block are divided into a region, 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 there may be regions in these N regions where the quantization coefficients are all 0. In this example, if the quantization coefficient included in the last region is not K, the last region is divided into a separate region, or the last region is merged with the previous region into one region.
[0224] In another possible implementation of this embodiment, the other areas of the current block are divided into N areas according to the spatial position.
[0225] In one example, the N regions are sub-blocks of the current block, for example, other regions of the current block are evenly divided into N sub-blocks, and each sub-block is illustratively 4*4 in size. In this example, there may be a region in the N regions where all quantization coefficients are 0.
[0226] In another example, based on the spatial position relationship of pixel points in other areas of the current block, a plurality of spatially adjacent pixel points are divided into a sub-block.
[0227] In the embodiment of the present application, the method of dividing other areas of 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.
[0228] 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 other regions 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.
[0229] 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.
[0230] 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.
[0231] 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.
[0232] Optionally, the flag A may be a block-level flag, used to indicate that the current block may adopt the region division method to divide other regions of the current block into N regions.
[0233] In this embodiment, the decoding end divides the other areas in the current block except the N first quantization coefficients into N areas through the above method, and then assigns these N areas to the N first quantization coefficients one by one, thereby obtaining the area corresponding to each of the N first quantization coefficients in the current block.
[0234] In some embodiments, the decoding end may further determine the region corresponding to the i-th first quantization coefficient in the current block through the following step S502-A:
[0235] S502-A. Determine, according to the number of first quantization coefficients in the current block, a region corresponding to the i-th first quantization coefficient in the current block.
[0236] In the embodiment of the present application, the area corresponding to the first quantization coefficient in the current block is related to the number of the first quantization coefficients in the current block. For example, when the number of the first quantization coefficients in the current block is large, the current block can be divided into multiple areas, so that the area corresponding to each first quantization coefficient in the current block is small. If the number of the first quantization coefficients in the current block is small, the current block can be divided into a small number of areas, so that the area corresponding to each first quantization coefficient in the current block is large.
[0237] The implementation methods of S502-A include but are not limited to the following:
[0238] Method 1: If the areas corresponding to each of the N first quantization coefficients in the current block are different, that is, the areas corresponding to any two first quantization coefficients in the current block do not intersect, the decoding end can divide the non-zero quantization area in the current block except the N first quantization coefficients into N areas, and then assign these N areas one by one to the N first quantization coefficients, and then obtain the area corresponding to each of the N first quantization coefficients in the current block.
[0239] Mode 2: Determine by calculation the area corresponding to each of the N first quantization coefficients in the current block. That is, the above S502-A includes the following steps S502-A1 and S502-A2:
[0240] S502-A1, determining a scanning index of the i-th first quantized coefficient;
[0241] S502-A2: Determine the area corresponding to the i-th first quantization coefficient in the current block according to the scan index and the number of first quantization coefficients in the current block.
[0242] In this approach 2, taking the i-th first quantization coefficient among the N first quantization coefficients as an example, the scan index of the i-th first quantization coefficient can be understood as the decoding scan sequence number of the i-th first quantization coefficient among the N first quantization coefficients. In the embodiment of the present application, the decoding end determines the scan index of the i-th first quantization coefficient, and then accurately determines the area corresponding to the i-th first quantization coefficient in the current block based on the scan index of the i-th first quantization coefficient and the number N of first quantization coefficients in the current block.
[0243] The embodiment of the present application does not limit the specific method for determining the scanning index of the i-th first quantization coefficient in S502-A1. For example, the position index of the i-th first quantization coefficient in the current block is determined as the scanning index of the i-th first quantization coefficient. For example, assuming that the i-th first quantization coefficient is the quantization coefficient at position index 2 in Figure 6, position index 2 can be determined as the scanning index of the i-th first quantization coefficient.
[0244] In a possible implementation, the scanning index of the i-th first quantization coefficient may also be determined according to the scanning order of the i-th first quantization coefficient among the N first quantization coefficients.
[0245] For example, the decoding sequence number of the i-th first quantization coefficient among the N first quantization coefficients is determined as the scanning index of the i-th first quantization coefficient. For example, the i-th first quantization coefficient is the second decoded quantization coefficient among the N first quantization coefficients, and therefore, the scanning index of the i-th first quantization coefficient can be determined to be 2.
[0246] For another example, if the i-th first quantization coefficient is the j-th scanned quantization coefficient among the N first quantization coefficients, the scan index of the i-th first quantization coefficient is determined to be Nj. For example, assuming that N is equal to 3, that is, the current block includes 3 first quantization coefficients, then the decoding scan order of the 3 first quantization coefficients is to first decode and scan the first quantization coefficient 3, then decode and scan the first quantization coefficient 2, and finally decode and scan the first quantization coefficient 1. Therefore, it can be determined that the scan index of the first quantization coefficient 1 is 0, the scan index of the first quantization coefficient 2 is 1, and the scan index of the first quantization coefficient 3 is 2. That is, in this embodiment of the present application, the scan indexes of the N first quantization coefficients are 0 to N-1 in the reverse direction of the scanning order.
[0247] According to the above method, after determining the scanning index of the i-th first quantization coefficient, the area corresponding to the i-th first quantization coefficient in the current block is determined based on the scanning index of the i-th first quantization coefficient and the number of first quantization coefficients in the current block.
[0248] In one example, the current block is divided into N regions based on the number of first quantization coefficients in the current block, wherein each of the N regions includes at least one non-zero quantization coefficient. Then, based on the scan index of each of the N first quantization coefficients, the N regions obtained by division are assigned to each first quantization coefficient one by one. For example, N=3, the scan indexes of the three first quantization coefficients are 1, 2, and 3, and the three regions are region 1, region 2, and region 3, respectively. In this way, region 1 can be determined as the region corresponding to the first quantization coefficient corresponding to scan index 1 in the current block, region 2 can be determined as the region corresponding to the first quantization coefficient corresponding to scan index 2 in the current block, and region 3 can be determined as the region corresponding to the first quantization coefficient corresponding to scan index 3 in the current block.
[0249] In another example, the above S502-A2 includes the following steps:
[0250] S502-A21, determining a first scanning index and a second scanning index according to the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and a first threshold;
[0251] S502-A22. According to the scanning order of the current block, determine the area within the first scanning index and the second scanning index in the current block as the area corresponding to the i-th first quantization coefficient in the current block.
[0252] In the example, the decoding end determines the two boundaries of the area corresponding to the i-th first quantization coefficient in the current block through the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold, and determines the area within the two boundaries as the area corresponding to the i-th first quantization coefficient in the current block, thereby improving the accuracy of determining the area corresponding to the i-th first quantization coefficient in the current block.
[0253] The first scan index START i and the second scan index END i It can be understood as the scanning index number interval of the area corresponding to the i-th first quantization coefficient in the current block.
[0254] The embodiment of the present application does not limit the specific method of determining the first scanning index and the second scanning index based on the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold in the above S502-A21, as long as the first scanning index and the second scanning index are different, and the area determined by the first scanning index and the second scanning index belongs to the current block and includes at least one non-zero quantization coefficient in the current block.
[0255] Exemplarily, the decoding end determines the first value according to the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold; and then determines the first scanning index according to the first value.
[0256] The embodiment of the present application does not limit the method for determining the first value based on the scan index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold. For example, the scan index of the i-th first quantization coefficient is added to a first preset value to obtain a first sum; the first threshold is subtracted from a second preset value to obtain a first difference; the first sum is multiplied by the first difference to obtain a first product; the first product is added to the number of first quantization coefficients in the current block, and then a third preset value is subtracted to obtain the first value.
[0257] The embodiment of the present application does not limit the specific values of the first preset value, the second preset value, and the third preset value. For example, at least one of the first preset value, the second preset value, and the third preset value is 1.
[0258] According to the above method, after the decoding end determines the first value, it determines the first scanning index according to the first value, for example, determines the first value as the first scanning index.
[0259] The first scan index START iThe value of should not exceed the scanning index of the first non-zero quantization coefficient in the scanning order in the current block. Therefore, in one possible implementation method, the decoding end determines the second value based on the number of quantization coefficients of the current block; and determines the minimum value between the first value and the second value as the first scanning index.
[0260] The embodiment of the present application does not limit the manner in which the decoding end determines the second value according to the number of quantization coefficients of the current block.
[0261] For example, the number of quantization coefficients of the current block is determined as the second value.
[0262] For another example, the difference between the number of quantization coefficients of the current block and the fourth preset value is determined as the second value. The embodiment of the present application does not limit the specific value of the fourth preset value, which is determined according to actual needs.
[0263] In a possible implementation, the decoding end determines the first scanning index START by the following formula (5): i :
[0264] START i =min((i+a)×(Mb)+Nc,N coeff -d) (5)
[0265] Where i is the scanning index of the i-th first quantization coefficient, M is the first threshold, N is the number of first quantization coefficients in the current block, N coeff is the number of quantization coefficients in the current block, a is the first preset value, b is the second preset value, c is the third preset value, and d is the fourth preset value.
[0266] In one example, if a, b, c, and d are all 1, the above formula (5) can be expressed as the following formula (6):
[0267] START i =min((i+1)×(M-1)+N-1,N coeff -1) (6)
[0268] The above describes the process of determining the first scanning index. The following describes the process of determining the second scanning index.
[0269] The embodiment of the present application does not limit the specific method of determining the second scanning index in the above S502-A21 based on the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold.
[0270] In one possible implementation, the decoding end subtracts the first threshold from the fifth preset value to obtain a second difference; multiplies the scanning index of the i-th first quantization coefficient by the second difference to obtain a second product; and adds the second product to the number of first quantization coefficients in the current block to obtain a second scanning index.
[0271] Exemplarily, the decoding end determines the second scan index END by the following formula (7): i :
[0272] END i =i×(Me)+N (7)
[0273] Wherein, e is the fifth preset value.
[0274] The embodiment of the present application does not limit the specific value of the fifth preset value.
[0275] Optionally, the fifth preset value e=1. In this case, the above formula (7) can be expressed as the following formula (8):
[0276] END i =i×(M-1)+N (8)
[0277] The decoding end determines the first scanning index START corresponding to the i-th first quantization coefficient according to the above method i and the second scan index END i Then, according to the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th first quantization coefficient in the current block.
[0278] In order to further introduce the technical solution of the embodiment of the present application, the above-mentioned determination of the N first quantization coefficients and the area corresponding to each of the N first quantization coefficients in the current block are introduced through a specific embodiment.
[0279] For example, assuming that the size of the current block is 8x8, the scanning method used for the current block is zig-zag, and assuming that index 21 is the first non-zero coefficient scanned in the current block in the decoding order, the coefficient decoding process is performed in the order of 21, 20, ..., 0. That is, in the embodiment of the present application, the number of quantization coefficients of the current block is 22, and assuming that the first threshold is 16, the number N of first quantization coefficients in the current block is determined based on the number 22 of quantization coefficients of the current block and the first threshold 16, assuming that N=2 is determined. Exemplarily, according to the scanning order, the two quantization coefficients in the upper left corner area of the current block are determined as the two first quantization coefficients. For example, as shown in Figure 7, these two first quantization coefficients are the two quantization coefficients at position index 0 and position index 1 in the current block.
[0280] Then, according to the above formulas (7) and (8), it is determined that the area corresponding to the first quantization coefficient 1 corresponding to the position index 0 in the current block is [2, 16], and the area corresponding to the first quantization coefficient 2 corresponding to the position index 1 in the current block is [17, 21].
[0281] As shown in Figure 7, in an embodiment of the present application, the N first quantization coefficients of the current block are located in the upper left corner area of the current block. Compared with what is shown in Figure 8, the N first quantization coefficients of the current block are scattered in the entire area of the current block. For example, the two first quantization coefficients in Figure 8 are the quantization coefficients at position index 0 and position index 1. In an embodiment of the present application, by concentrating the N first quantization coefficients of the current block in the upper left corner area of the current block, since the value of the quantization coefficient in the upper left corner area is larger, when hiding the quantization coefficient in the upper left corner area, the hiding effect of the first characteristic of the quantization coefficient can be effectively improved, thereby effectively reducing the encoding cost.
[0282] After the decoding end determines the region corresponding to each of the N first quantization coefficients in the current block according to the above method, it performs the following step S503.
[0283] S503 : Determine the first characteristic of the i th second quantization coefficient according to the second characteristic of the region corresponding to the i th first quantization coefficient in the current block.
[0284] In an embodiment of the present application, to reduce coding costs, the encoder hides the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient, and encodes the i-th first quantization coefficient to reduce coding costs. At the same time, the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block is used to indicate the first characteristic of the i-th second quantization coefficient. Thus, when decoding the i-th first quantization coefficient, the decoder first determines the region corresponding to the i-th first quantization coefficient in the current block according to the above method. Then, based on the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block, the decoder determines the hidden first characteristic of the i-th second quantization coefficient. Finally, based on the first characteristic of the i-th second quantization coefficient and the i-th first quantization coefficient, the decoder determines the i-th second quantization coefficient.
[0285] The above-mentioned second characteristic may be a binary characteristic, such as 0 or 1. That is, in the embodiment of the present application, the first characteristic of the i-th second quantization coefficient may be determined by the binary characteristic (0 or 1) of the region corresponding to the i-th first quantization coefficient in the current block. For example, as shown in FIG7 , the first characteristic of the second quantization coefficient at position index 0 is determined based on the binary characteristic corresponding to the region [2, 16], and the first characteristic of the second quantization coefficient at position index 1 is determined based on the binary characteristic corresponding to the region [17, 21].
[0286] The embodiments of the present application do not limit the first characteristic and the second characteristic.
[0287] In some embodiments, the first characteristic and the second characteristic may be the same.
[0288] In some embodiments, the first characteristic is different from the second characteristic.
[0289] In an example, the first characteristic is the sign of the i-th second quantization coefficient, and the second characteristic may be the sign or parity of the i-th second quantization coefficient in a corresponding region in the current block.
[0290] In another example, the first characteristic is the parity of the i-th second quantization coefficient, and the second characteristic may be the sign or parity of the i-th second quantization coefficient in the corresponding area in the current block.
[0291] In an embodiment of the present application, the second characteristic of a region can be understood as the second characteristic corresponding to the quantization coefficients included in the region. For example, when the second characteristic is parity, the parity of the region is the parity of the number of quantization coefficients in the region or the parity of the sum of absolute values, or the parity of other characteristics of the quantization coefficients in the region.
[0292] In some embodiments, if both the first characteristic and the second characteristic are odd or even, the above S503 includes the following S503-A:
[0293] S503-A: Determine the parity of the i-th second quantization coefficient according to the parity of the region.
[0294] The parity of a region can be understood as the parity of the number or the sum of the absolute values of the quantization coefficients in the region.
[0295] For ease of description, the region described in subsequent embodiments refers to the region corresponding to the i-th first quantization coefficient in the current block.
[0296] Example 1: If the parity of the i-th second quantization coefficient is identified by the parity of the sum of the first absolute values of the quantization coefficients included in the region, that is, the parity of the region is the parity of the sum of the first absolute values of the quantization coefficients in the region, then the above S503-A includes: determining the parity of the i-th second quantization coefficient according to the parity of the sum of the first absolute values of the quantization coefficients in the region.
[0297] 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 smaller than 16.
[0298] 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.
[0299] 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.
[0300] Optionally, part of the absolute value of the absolute value of the quantization coefficient refers to the value of all or part of the identification bits in the identification bits. For example, the decoding end determines the parity of the i-th second quantization coefficient based on the parity of the sum of the absolute values of the values of identification 1 to identification 5 of the quantization coefficients in the region.
[0301] For example, if the sum of the first absolute values of the quantization coefficients in the area corresponding to the i-th first quantization coefficient in the current block is an even number, then the i-th second quantization coefficient is determined to be an even number.
[0302] It should be noted that in Example 1, if the parity of the i-th second quantization coefficient is inconsistent with the parity of the sum of the first absolute values of the quantization coefficients in the region, the encoding end modifies the parity of at least one coefficient in the quantization coefficients in the region. For example, if the i-th second quantization coefficient is an odd number, and the sum of the first absolute values of the quantization coefficients in the region is an even number, then the minimum quantization coefficient in the quantization coefficients in the region is increased by 1 or decreased by 1 to modify the sum of the first absolute values of the quantization coefficients in the region to an odd number. For another example, if the i-th second quantization coefficient is an even number, and the sum of the first absolute values of the quantization coefficients in the region is an odd number, then the minimum quantization coefficient in the quantization coefficients in the region is increased by 1 or decreased by 1 to modify the sum of the first absolute values of the quantization coefficients in the region to an even number.
[0303] Example 2: If the parity of the region is the parity of the number of target quantization coefficients in the region, then the above S503-A includes: determining the target quantization coefficient in the region, and determining the parity of the i-th second quantization coefficient based on the parity of the number of target quantization coefficients in the region.
[0304] The target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value.
[0305] In an example, if the target quantization coefficient is a non-zero quantization coefficient in the region, the parity of the i-th second quantization coefficient may be determined according to the parity of the number of non-zero quantization coefficients in the region.
[0306] For example, if the number of non-zero quantized coefficients in the region is an odd number, the i-th second quantized coefficient is determined to be an odd number.
[0307] For example, if the number of non-zero quantized coefficients in the region is an even number, the i-th second quantized coefficient is determined to be an even number.
[0308] It should be noted that, in this example, if the parity of the i-th second quantization coefficient is inconsistent with the parity of the number of non-zero quantization coefficients in the region, the encoding end modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number and the number of non-zero quantization coefficients in the region is an even number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the value of the smallest quantization coefficient in the region can be adjusted to 0, so that the number of non-zero quantization coefficients in the region is an odd number. For another example, if the i-th second quantization coefficient is an even number and the number of non-zero quantization coefficients in the region is an odd number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the value of the smallest quantization coefficient in the region can be adjusted to 0, so that the number of non-zero quantization coefficients in the region is an even number.
[0309] In another example, if the target quantization coefficient is a non-zero quantization coefficient with an even value in the region, the parity of the i-th second quantization coefficient can be determined based on the parity of the number of non-zero quantization coefficients with even values in the region.
[0310] For example, if the number of non-zero quantized coefficients with even values in the region is odd, the i-th second quantized coefficient is determined to be an odd number.
[0311] For example, if the number of non-zero quantized coefficients with even values in the region is even, the i-th second quantized coefficient is determined to be an even number.
[0312] It should be noted that, in this example, if the parity of the i-th second quantization coefficient is inconsistent with the parity of the number of non-zero quantization coefficients with even values in the region, the encoding end modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is odd and the number of non-zero quantization coefficients with even values in the region is even, then one of the zero quantization coefficients in the region may be adjusted to 2, or the value of the smallest non-zero quantization coefficient in the region may be increased by 1 or decreased by 1 so that the number of non-zero quantization coefficients with even values in the region is odd. For another example, if the i-th second quantization coefficient is even and the number of non-zero quantization coefficients with even values in the region is odd, then one of the zero quantization coefficients in the region may be adjusted to 2, or the value of the smallest non-zero quantization coefficient in the region may be increased by 1 or decreased by 1 so that the number of non-zero quantization coefficients in the region is even.
[0313] In another example, if the target quantization coefficient is an even-valued quantization coefficient in the region, the parity of the i-th second quantization coefficient may be determined based on the parity of the number of even-valued quantization coefficients in the region. The even-valued quantization coefficients include a quantization coefficient with a value of 0.
[0314] For example, if the number of quantization coefficients with even values in the region is odd, the i-th second quantization coefficient is determined to be an odd number.
[0315] For example, if the number of quantization coefficients with even values in the region is even, the i-th second quantization coefficient is determined to be an even number.
[0316] It should be noted that, in this example, if the parity of the i-th second quantization coefficient is inconsistent with the parity of the number of quantization coefficients with even values in the region, the encoding end modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number, and the number of quantization coefficients with even values in the region is an even number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the smallest non-zero quantization coefficient in the region can be adjusted to 0, so that the number of quantization coefficients with even values in the region is an odd number. For another example, if the i-th second quantization coefficient is an even number, and the number of quantization coefficients with even values in the region is an odd number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the smallest non-zero quantization coefficient in the region can be adjusted to 0, so that the number of quantization coefficients in the region is an even number.
[0317] In another example, if the target quantization coefficient is an odd-valued quantization coefficient in the region, the parity of the i-th second quantization coefficient may be determined according to the parity of the number of odd-valued quantization coefficients in the region.
[0318] For example, if the number of quantization coefficients with odd values in the region is an odd number, the i-th second quantization coefficient is determined to be an odd number.
[0319] For example, if the number of quantization coefficients with odd values in the region is even, the i-th second quantization coefficient is determined to be an even number.
[0320] It should be noted that, in this example, if the parity of the i-th second quantization coefficient is inconsistent with the parity of the number of odd-valued quantization coefficients in the region, the encoding end modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number, and the number of odd-valued quantization coefficients in the region is an even number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the smallest non-zero quantization coefficient in the region can be adjusted to 0, or added by 1, or subtracted by 1, so that the number of odd-valued quantization coefficients in the region is an odd number. For another example, if the i-th second quantization coefficient is an even number, and the number of odd-valued quantization coefficients in the region is an odd number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the smallest non-zero quantization coefficient in the region can be adjusted to 0, or added by 1, or subtracted by 1, so that the number of quantization coefficients in the region is an even number.
[0321] Optionally, the encoding end adjusts at least one coefficient in the region using an adjustment method with minimal rate-distortion cost.
[0322] As can be seen from the above, in the embodiment of the present application, the parity of the i-th second quantization coefficient is determined according to the parity of the preset feature corresponding to the region.
[0323] After the parity of the i-th second quantization coefficient is determined according to the above methods, the following step S504 is performed.
[0324] S504 : Determine the i th second quantization coefficient according to the first characteristics of the i th first quantization coefficient and the i th second quantization coefficient.
[0325] As can be seen from the above, in the embodiment of the present application, to reduce the coding cost, the first characteristic of the i-th second quantization coefficient is hidden at the encoding end to obtain the i-th first quantization coefficient. Since the first characteristic of the i-th second quantization coefficient is hidden, it is identified by the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block. In this way, when decoding, the decoding end first decodes the bitstream to determine the N first quantization coefficients in the current block. For the i-th first quantization coefficient among the N first quantization coefficients, the region corresponding to the i-th first quantization coefficient in the current block is determined. Then, based on this region, the first characteristic of the i-th second quantization coefficient that is hidden can be determined. Finally, based on the first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient, a second quantization coefficient having the first characteristic can be reconstructed, that is, the coefficient whose first characteristic is hidden can be reconstructed.
[0326] In some embodiments, if the first characteristic is a positive or negative sign, the i-th second quantization coefficient with a positive or negative sign can be determined based on the decoded i-th first quantization coefficient and the positive or negative sign of the i-th second quantization coefficient.
[0327] In some embodiments, if the first characteristic is parity, the decoding end determines the i-th second quantization coefficient according to the parity of the i-th first quantization coefficient and the i-th second quantization coefficient.
[0328] The decoding end reconstructs the i-th second quantization coefficient in different ways according to the parity of the i-th second quantization coefficient.
[0329] Case 1: If the i-th second quantization coefficient is an odd number, the i-th first quantization coefficient is operated using the first operation method to obtain the i-th second quantization coefficient.
[0330] The first operation mode adopted by the decoding end corresponds to the third operation mode used by the encoding end to determine the i-th first quantization coefficient.
[0331] 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.
[0332] In mode 1, for a non-zero quantized coefficient, if the encoder uses the third operation mode of adding one to the value of the i-th second quantized coefficient and dividing it by two to obtain the i-th first quantized coefficient, the decoder uses the first operation mode of calculating the value of the i-th second quantized coefficient equal to the i-th first quantized coefficient multiplied by two minus one.
[0333] Exemplarily, the first operation method is shown in formula (9):
[0334] C=2*val-1 (9)
[0335] Wherein, C is the i-th second quantization coefficient, and val is the i-th first quantization coefficient.
[0336] In the first method, if the i-th second quantization coefficient is an odd number, the i-th second quantization coefficient is determined according to the first operation method shown in the above formula (9).
[0337] For example, assuming that the i-th first quantization coefficient is 5, the area corresponding to the i-th first quantization coefficient in the current block includes 5 pixels. By decoding the code stream, the quantization coefficients corresponding to these 5 pixels are: 6, 3, 2, 1, and 1, respectively. For example, the parity of the i-th second quantization coefficient is determined based on the parity of the sum of the first absolute values of the quantization coefficients in the area. The sum of the first absolute values of the 5 quantization coefficients in the area is 13, which is an odd number, so the i-th second quantization coefficient is determined to be an odd number. In this way, the decoding end can reconstruct the value of the i-th second quantization coefficient as 5*2-1=9 according to the above formula (9).
[0338] As can be seen from the above example, the i-th 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.
[0339] It should be noted that the above formula (9) 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 (9).
[0340] Case 2: If the i-th second quantization coefficient is an even number, the i-th first quantization coefficient is operated using the second operation method to obtain the i-th second quantization coefficient.
[0341] The second operation method adopted by the decoding end corresponds to the fourth operation method used by the encoding end to determine the i-th first quantization coefficient.
[0342] 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.
[0343] In one possible implementation, if the fourth operation method adopted by the encoder is to divide the value of the i-th second quantization coefficient by two to obtain the i-th first quantization coefficient, then the second operation method adopted by the decoder is to equal the value of the i-th second quantization coefficient to the i-th first quantization coefficient multiplied by two.
[0344] Exemplarily, the second operation method is shown in formula (10):
[0345] C=2*val (10)
[0346] Wherein, C is the i-th second quantization coefficient, and val is the i-th first quantization coefficient.
[0347] In this example, if the i-th second quantization coefficient is an even number, the i-th second quantization coefficient is determined according to the second operation method shown in the above formula (10).
[0348] For example, assuming the i-th first quantization coefficient is 4, the area corresponding to the i-th first quantization coefficient in the current block includes 5 pixels. By decoding the bitstream, the quantization coefficients corresponding to these 5 pixels are 6, 3, 1, 1, and 1, respectively. For example, the parity of the i-th second quantization coefficient is determined based on the parity of the sum of the first absolute values of the quantization coefficients in the area. The sum of the first absolute values of the 5 quantization coefficients in the area is 12, which is an even number, so the i-th second quantization coefficient is determined to be an even number. In this way, the decoder can reconstruct the value of the i-th second quantization coefficient as 4*2=8 according to the above formula (10).
[0349] As can be seen from the above example, by processing the i-th second quantization coefficient, which originally has a value of 8, into the i-th first quantization coefficient, which has a value of 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.
[0350] In some embodiments, the decoding end may determine the i-th second quantization coefficient in the following manner, that is, the above S504 includes the following steps:
[0351] S504-A1, performing an operation on the i-th first quantization coefficient using a preset operation method to obtain an operation result;
[0352] S504-A2: Obtain the i-th second quantization coefficient according to the parity of the i-th second quantization coefficient and the operation result.
[0353] The embodiment of the present application does not limit the specific form of the above-mentioned preset operation method.
[0354] In some embodiments, the preset operation method includes multiplying the i-th first quantization coefficient by two, that is, multiplying the value of the i-th first quantization coefficient by 2 to obtain an operation result.
[0355] Next, based on the parity of the i-th second quantization coefficient and the above calculation result, the i-th second quantization coefficient is obtained. For example, the sum of the calculation result and a preset value is determined as the value of the i-th second quantization coefficient. In some embodiments, the preset value is also referred to as the parity. If the i-th second quantization coefficient is an odd number, the preset value is 1; if the i-th second quantization coefficient is an even number, the preset value is 0.
[0356] Exemplarily, the decoding end may determine the i-th second quantization coefficient according to the following formula (11):
[0357] Quant[pos]=Quant[pos]*2+parity (11)
[0358] Among them, Quant[pos] on the right side of the equal sign is the i-th first quantization coefficient, Quant[pos] on the left side of the equal sign is the reconstructed i-th second quantization coefficient, and parity is a preset value. If the i-th second quantization coefficient is an odd number, then the parity = 1; if the i-th second quantization coefficient is an odd number, then the parity = 0.
[0359] From the above formula (11), it can be seen that when decoding the code stream, the quantization coefficient Quant[pos] is obtained. If the quantization coefficient is the i-th first quantization coefficient, then the i-th second quantization coefficient is equal to Quant[pos] multiplied by 2 plus the value corresponding to the parity.
[0360] At the decoding end, according to the above method, the second quantization coefficient corresponding to each of the N first quantization coefficients can be determined. The second quantization coefficients 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.
[0361] 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.
[0362] 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.
[0363] The video decoding method provided in an embodiment of the present application comprises: a decoding end decoding a bitstream, determining N first quantization coefficients in a current block, wherein the i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained by hiding the first characteristic of the i-th second quantization coefficient in the current block; then, determining the region corresponding to the i-th first quantization coefficient in the current block; determining the first characteristic of the i-th second quantization coefficient based on the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block; and determining the i-th second quantization coefficient based on the first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient. That is, in an embodiment of the present application, the first characteristics of the N second quantization coefficients in the current block are hidden to obtain N first quantization coefficients, and the N first quantization coefficients are encoded during encoding, which can reduce the number of bits required for encoding and reduce the cost of video compression.
[0364] 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. 9 .
[0365] FIG9 is a flow chart of a video decoding method according to an embodiment of the present application. In this embodiment, taking the first characteristic and the second characteristic as an example, as shown in FIG9 , the method according to the embodiment of the present application includes:
[0366] S601: Decode a code stream to obtain at least one flag.
[0367] The at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.
[0368] 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.
[0369] 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.
[0370] 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.
[0371] 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.
[0372] S602: Decode the code stream to obtain decoded information of the current block.
[0373] The decoded information of the current block includes the quantization coefficients in the current block.
[0374] Exemplarily, the decoding end first decodes identifiers 1 to 5, and then decodes the portion of each quantized coefficient whose absolute value exceeds 15 in a scanning order from the last non-zero coefficient to the upper left corner of the transform block, ultimately obtaining the quantized coefficients in the current block. Therefore, in some embodiments, in the embodiments of the present application, the decoded information of the current block includes the quantized coefficients whose absolute value does not exceed 15.
[0375] S603: Determine N first quantization coefficients of the current block according to the decoded information of the current block.
[0376] The embodiment of the present application does not limit the method for determining the N first quantization coefficients of the current block.
[0377] In some embodiments, the decoded information of the current block also includes the number of quantization coefficients of the current block. In this case, the decoding end can determine the N first quantization coefficients based on the number of quantization coefficients of the current block.
[0378] In some embodiments, the N first quantization parameters are located in the upper left corner area of the current block.
[0379] The specific implementation process of the above S603 can refer to the relevant description of the above S501, which will not be repeated here.
[0380] S604: Determine the area corresponding to the i-th first quantization coefficient in the current block.
[0381] Exemplarily, the area corresponding to the i-th first quantization coefficient in the current block is determined according to the number of first quantization coefficients in the current block.
[0382] For example, a scanning index of the i-th first quantization coefficient is determined; and based on the scanning index and the number of first quantization coefficients in the current block, a region corresponding to the i-th first quantization coefficient in the current block is determined.
[0383] In one example, the decoding end may determine the scanning index of the i-th first quantization coefficient based on the scanning order of the i-th first quantization coefficient among the N first quantization coefficients. For example, if the i-th first quantization coefficient is the j-th scanned quantization coefficient among the N first quantization coefficients, the scanning index of the i-th first quantization coefficient is determined to be Nj.
[0384] In one example, the first scanning index and the second scanning index are determined based on the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold; according to the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th first quantization coefficient in the current block.
[0385] The specific implementation process of the above S604 can refer to the relevant description of the above S502, which will not be repeated here.
[0386] S605: Determine whether the area corresponding to the i-th first quantization coefficient in the current block meets a preset condition.
[0387] In the embodiments of the present application, the parity hiding technique proposed in the present application is limited. Specifically, if the region corresponding to the i-th first quantized coefficient in the current block satisfies a preset condition, it indicates that the parity hiding technique provided in the embodiments of the present application can achieve significant beneficial effects in the region, and in this case, steps S606 to S608 are performed. If the region does not meet the preset condition, it indicates that the parity hiding technique provided in the embodiments of the present application cannot achieve significant beneficial effects in the region, and in this case, step S609 is performed.
[0388] 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.
[0389] In a possible implementation, the above-mentioned preset conditions include at least one of the following conditions:
[0390] Condition 1: the number of non-zero quantized coefficients in the region is greater than the first value;
[0391] Condition 2: In the region, the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the scanning order is greater than a second value;
[0392] Condition 3: in the region, the distance between the first non-zero quantized coefficient and the last quantized coefficient in the scanning order is greater than a third value;
[0393] Condition 4: In this region, the sum of the absolute values of the non-zero quantized coefficients is greater than a fourth value.
[0394] In this implementation, if the region satisfies at least one of the above four conditions, the following steps S606 to S608 are executed.
[0395] In some embodiments, the above four conditions can also be combined with each other to form new constraints.
[0396] 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.
[0397] In one example, at least one of the first value, the second value, the third value, and the fourth value is a fixed value.
[0398] 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.
[0399] 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.
[0400] According to the above preset conditions, when it is determined that the region meets the above preset conditions, it means that the first characteristic (eg, parity) of the quantization coefficient corresponding to the region is hidden, and the following step S606 is executed.
[0401] S606 : Determine the parity of the i th second quantization coefficient according to the parity of the region corresponding to the i th first quantization coefficient in the current block.
[0402] For example, the parity of the i-th second quantization coefficient is determined according to the parity of the sum of the first absolute values of the region.
[0403] For example, the parity of the i-th second quantization coefficient is determined according to the parity of the number of target quantization coefficients in the region.
[0404] The target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value.
[0405] The specific implementation process of the above S606 can refer to the relevant description of the above S503, which will not be repeated here.
[0406] S607 : Determine the i th second quantization coefficient according to the parity of the i th first quantization coefficient and the i th second quantization coefficient.
[0407] For example, if the i-th second quantization coefficient is an odd number, the i-th first quantization coefficient is multiplied by a value of two plus one to determine the value of the i-th second quantization coefficient.
[0408] For another example, if the i-th second quantization coefficient is an odd number, the i-th first quantization coefficient is multiplied by a value of two minus one to determine the value of the i-th second quantization coefficient.
[0409] For another example, if the i-th second quantization coefficient is an even number, the i-th first quantization coefficient is multiplied by a value of two to determine the value of the i-th second quantization coefficient.
[0410] S608 : Determine a quantization coefficient of the current block according to the i-th second quantization coefficient.
[0411] According to the above method, the quantized coefficients 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 obtained by decoding.
[0412] S609: Determine a quantization coefficient of the current block according to the decoded information of the current block.
[0413] 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.
[0414] S610: Obtain a reconstructed value of the current block according to the quantization coefficient of the current block.
[0415] 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.
[0416] 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.
[0417] 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.
[0418] In an embodiment of the present application, preset conditions are set for the parity hiding technology. During decoding, it is first determined whether the region meets the preset conditions. If the region meets the preset conditions, it is determined that the parity of the quantization coefficient corresponding to the region is hidden, and then the parity hiding technology proposed in the present application is used to decode the first quantization coefficient in the current block, thereby improving decoding accuracy.
[0419] For example, the encoding and decoding syntax corresponding to the embodiment of the present application is shown in Table 2:
[0420] Table 2
[0421]
[0422]
[0423]
[0424] In Table 2 above, SBBSIZE represents the size of each region. In the example, SBBSIZE is 16. Variables SUBSIZE and HPCTHRESH are used, where SUBSIZE is used to identify the size of each region of the current block, and HPCTHRESH is used to identify the region in which the number of non-zero coefficients required to enable parity hiding technology is greater than a certain threshold.
[0425] According to the above embodiment, the size of each region SBBSIZE is 16. SBBTHRESH is used to identify the region in which the number of non-zero coefficients required to enable parity hiding technology is greater than a certain threshold, and the exemplary threshold is 4. Remainder represents the portion of the quantized coefficients with an absolute value greater than 15, and sign represents the sign of the quantized coefficient, i.e., the positive or negative sign.
[0426] In an embodiment of the present application, when decoding a first quantization coefficient, the decoding end first determines whether the area corresponding to the first quantization coefficient meets a preset condition to determine whether decoding the second quantization coefficient corresponding to the area using the parity hiding technology provided by the present application can bring significant beneficial technical effects. When it is determined that the use of the parity hiding technology has a significant beneficial effect, the technical solution of the present application is used to decode the first quantization coefficient, thereby improving decoding reliability.
[0427] 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.
[0428] Figure 10 is a flow chart of a video encoding method provided by an embodiment of the present application. The execution subject of the embodiment of the present application may be the encoder shown in Figures 1 and 2 above.
[0429] As shown in FIG10 , the method of the embodiment of the present application includes:
[0430] S701. Determine N second quantization coefficients of the current block, where N is a positive integer.
[0431] In an embodiment of the present application, to reduce coding costs, the coding end conceals the first characteristics of the N second quantization coefficients in the current block to obtain N first quantization coefficients. For example, the coding end conceals the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient. Thus, during encoding, the coding end encodes the N first quantization coefficients rather than the N second quantization coefficients. Because the N first quantization coefficients are obtained by concealing the first characteristics of the N second quantization coefficients, the encoded values of the N first quantization coefficients are smaller than those of the N second quantization coefficients. Therefore, when encoding the N first quantization coefficients with smaller encoded values, fewer bits can be used, thereby reducing coding costs.
[0432] In some embodiments, the second quantization coefficient is obtained by quantizing the transform coefficient. For example, the encoder predicts the current block to obtain a predicted value for the current block, subtracts the predicted value from the original value of the current block to obtain a residual value for the current block. The encoder transforms the residual value to obtain a transform coefficient for the current block, and then quantizes the transform coefficient to obtain the second quantization coefficient.
[0433] In some embodiments, the second quantization coefficient is obtained by quantizing the residual value. For example, the encoder predicts the current block to obtain a predicted value of the current block, subtracts the original value of the current block from the predicted value, and obtains the residual value of the current block. The encoder quantizes the residual value to obtain the second quantization coefficient.
[0434] The embodiment of the present application does not limit the specific positions of the N second quantization coefficients in the current block. For example, as shown in FIG6 , the N second quantization coefficients are coefficients at four positions with indexes 48, 32, 16, and 0.
[0435] In some embodiments, the transformation causes the energy of the current block to be primarily concentrated in the upper left corner region. That is, the non-zero quantization coefficients of the current block are primarily concentrated in the upper left corner region of the current block, while the quantization coefficients in the lower right corner region of the current block are typically 0. Based on this, in order to effectively reduce the coding cost, the N second quantization parameters in the embodiment of the present application are located in the upper left corner region of the current block. For example, the N second quantization coefficients are quantization coefficients at position indices 0, 1, 2, 4, and so on.
[0436] In the above S701, methods for determining the N second quantization coefficients of the current block include but are not limited to the following:
[0437] In the first approach, the positions of the N second quantization coefficients in the current block are preset or default.
[0438] In the second method, the N second quantization coefficients of the current block are determined through the following S701-A and S701-B:
[0439] S701-A, determining the number of quantization coefficients of the current block;
[0440] S701-B. Determine N second quantization coefficients according to the number of quantization coefficients of the current block.
[0441] It should be noted that the number of quantization coefficients of the current block described in S701-A refers to the number of quantization coefficients that need to be encoded in the current block. For example, in Figure 5, the encoding end encodes the quantization coefficient at position index 21 in the current block to the quantization coefficient at position index 0 in the upper left corner. The total number of quantization coefficients that need to be encoded is 22. Therefore, it can be determined that the number of quantization coefficients of the current block is 22.
[0442] In an embodiment of the present application, if the current block includes fewer quantization coefficients, the coding cost is relatively low. In this case, the encoder can directly encode the smaller number of quantization coefficients without hiding them. If the current block includes more quantization coefficients, the coding cost of the encoder is relatively high. In this case, in order to reduce the coding cost, the first characteristics of some quantization coefficients in the current block can be hidden to reduce the coding cost. It can be seen that the number of quantization coefficients included in the current block will affect the coding cost. Therefore, in this second method, the N second quantization coefficients in the current block are determined by the number of quantization coefficients included in the current block, further reducing the coding cost.
[0443] In the second approach, after determining the number of quantization coefficients of the current block, the encoder determines N second quantization coefficients of the current block according to the number of quantization coefficients of the current block.
[0444] For example, if the number of quantization coefficients of the current block is less than a preset value of 1, a quantization coefficient located at the upper left corner of the current block is determined as the second quantization coefficient.
[0445] For another example, if the number of quantization coefficients of the current block is less than a preset value of 2, two adjacent quantization coefficients located in the upper left corner of the current block are respectively determined as second quantization coefficients, thereby obtaining two second quantization coefficients. In one example, the two adjacent quantization coefficients may be spatially adjacent quantization coefficients. In another example, the two adjacent quantization coefficients are two adjacent quantization coefficients in a scanning order.
[0446] In some embodiments, the encoder writes the number of quantization coefficients of the current block into the bitstream.
[0447] In some embodiments, N second quantization coefficients may be determined through the following steps S701-B1 to S701-B3:
[0448] S701-B1, determining a first threshold;
[0449] S701-B2, determining the number of second quantization coefficients in the current block according to the number of quantization coefficients of the current block and a first threshold;
[0450] S701-B3. According to the number of second quantization coefficients in the current block, determine the N quantization coefficients in the upper left corner area of the current block as N second quantization coefficients.
[0451] In this embodiment, the encoding end may calculate the number of second quantization coefficients in the current block according to the number of quantization coefficients of the current block, and further determine N second quantization coefficients of the current block according to the number N of second quantization coefficients.
[0452] Specifically, the encoding end determines a first threshold, and then determines the number N of second quantization coefficients in the current block based on the first threshold and the number of quantization coefficients of the current block determined above, and then determines the N quantization coefficients in the upper left corner area of the current block as N second quantization coefficients.
[0453] The embodiment of the present application does not limit the method for determining the first threshold in the above S701-B1.
[0454] For example, the first threshold is a preset value or a default value, so the encoding end can determine the preset value or the default value as the first threshold.
[0455] The embodiment of the present application does not limit the specific value of the first threshold, for example, it can be 16, 8, 4, etc.
[0456] After the encoder determines the first threshold, it executes S701-B2 to determine the number of second quantization coefficients in the current block based on the number of quantization coefficients in the current block and the first threshold. This embodiment of the application does not limit the specific implementation of S701-B2.
[0457] In an example, the integer part of the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of second quantization coefficients in the current block.
[0458] In another example, a rounded value of a ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of second quantization coefficients in the current block.
[0459] In yet another example, a value obtained by rounding up the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of second quantization coefficients in the current block.
[0460] For example, according to the above formula (4), the number of second quantization coefficients in the current block is determined.
[0461] According to the above method, after determining the number N of second quantization coefficients in the current block, execute the above S701-B3 to determine the N quantization coefficients in the upper left corner area of the current block as N second quantization coefficients according to the number of second quantization coefficients in the current block.
[0462] The embodiment of the present application does not limit the specific implementation method of the above S701-B3.
[0463] In one possible implementation, any N quantization coefficients in the upper left corner region of the current block are determined as N second quantization coefficients. For example, the N second quantization coefficients are N quantization coefficients that are spatially adjacent, partially adjacent, or not adjacent in the upper left corner region of the current block.
[0464] In another possible implementation, the N quantization coefficients in the upper left corner area of the current block are determined as N second quantization coefficients according to a scanning order.
[0465] For example, N quantization coefficients adjacent to each other in the decoding order in the upper left corner area of the current block are determined as N second quantization coefficients.
[0466] For another example, the last N quantization coefficients in the current block in the scanning order are determined as N second quantization coefficients. Assuming N=2, the two quantization coefficients corresponding to index 0 and index 1 in FIG6 are determined as two second quantization coefficients.
[0467] In some embodiments, at least one flag may be used to indicate whether the current block allows the use of the technology for hiding the first characteristic of the quantization coefficient provided in the embodiment of the present application. In some embodiments, the technology for hiding the first characteristic of the quantization coefficient provided in the embodiment of the present application is also called the first characteristic hiding technology.
[0468] Exemplarily, the at least one flag that is set may be a flag of different levels, used to indicate whether the corresponding level allows the first characteristic of the quantization coefficient to be hidden.
[0469] 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.
[0470] For example, the at least one flag includes a sequence-level flag, and the sequence-level flag is used to indicate whether the first characteristic of the quantization coefficient of the current sequence is allowed to be concealed. For example, if the value of the sequence-level flag is 1, it indicates that the first characteristic of the quantization coefficient of the current sequence is allowed to be concealed; if the value of the sequence-level flag is 0, it indicates that the first characteristic of the quantization coefficient of the current sequence is not allowed to be concealed.
[0471] Optionally, if the at least one flag includes a sequence-level flag, the sequence-level flag may be located in a sequence header.
[0472] For another example, the at least one flag includes a picture-level flag, and the picture-level flag is used to indicate whether the first characteristic of the quantization coefficient of the current image is allowed to be concealed. For example, if the value of the picture-level flag is 1, it indicates that the first characteristic of the quantization coefficient of the current image is allowed to be concealed; if the value of the picture-level flag is 0, it indicates that the first characteristic of the quantization coefficient of the current image is not allowed to be concealed.
[0473] Optionally, if the at least one flag includes a picture-level flag, the picture-level flag may be located in a picture header.
[0474] For another example, the at least one flag includes a slice-level flag, and the slice-level flag is used to indicate whether the first characteristic of the quantization coefficient 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 first characteristic of the quantization coefficient is allowed to be concealed for the current slice; if the value of the slice-level flag is 0, it indicates that the first characteristic of the quantization coefficient is not allowed to be concealed for the current slice.
[0475] Optionally, if the at least one flag includes a slice-level flag, the slice-level flag may be located in a slice header.
[0476] 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 first characteristic of the quantized coefficient to be concealed. For example, if the value of the unit-level flag is 1, it indicates that the current CTU allows the first characteristic of the quantized coefficient to be concealed; if the value of the unit-level flag is 0, it indicates that the current CTU does not allow the first characteristic of the quantized coefficient to be concealed.
[0477] For another example, the at least one flag includes a block-level flag, and the block-level flag is used to indicate whether the first characteristic of the quantization coefficient of the current block is allowed to be concealed. For example, if the value of the block-level flag is 1, it indicates that the first characteristic of the quantization coefficient of the current block is allowed to be concealed; if the value of the block-level flag is 0, it indicates that the first characteristic of the quantization coefficient of the current block is not allowed to be concealed.
[0478] In this way, the encoding end first obtains the at least one flag and, based on the at least one flag, determines whether the parity of the quantization coefficients of the current block is allowed to be concealed. If, based on the at least one flag, it is determined that the first characteristic of the quantization coefficients of the current block is not allowed to be concealed, the method of the embodiment of the present application is skipped. If, based on the at least one flag, it is determined that the first characteristic concealment 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.
[0479] In some embodiments, the first feature hiding technique provided by the embodiments of the present application is mutually exclusive with a target transformation method, where the target transformation method includes a secondary transformation or multiple transformations. In this case, when the encoder determines that the current block is to be transformed using the target transformation method, it skips the technical solution provided by the embodiments of the present application.
[0480] S702 : For an i-th second quantization coefficient among N second quantization coefficients, hide the first characteristic of the i-th second quantization coefficient to obtain an i-th first quantization coefficient, where i is a positive integer less than or equal to N.
[0481] In the embodiment of the present application, the first characteristic of each of the N second quantization coefficients is hidden, and the process of obtaining the corresponding first quantization coefficient is the same. For the sake of convenience of description, the i-th second quantization coefficient among the N second quantization coefficients is used as an example for illustration.
[0482] In an embodiment of the present application, to reduce coding cost, the first characteristic of the i-th second quantization coefficient is concealed to obtain the i-th first quantization coefficient, and the i-th first quantization coefficient is encoded into the bitstream, rather than encoding the i-th second quantization coefficient into the bitstream. Because the i-th first quantization coefficient is typically smaller than the i-th second quantization coefficient, encoding the i-th first quantization coefficient requires fewer bits than encoding the i-th second quantization coefficient, thereby reducing coding cost.
[0483] The embodiment of the present application does not limit the first characteristic of the second quantization coefficient.
[0484] In some embodiments, the first characteristic is the sign of the second quantized coefficient.
[0485] In some embodiments, the first characteristic is the parity of the second quantized coefficient. In this case, hiding the first characteristic of the i-th second quantized coefficient in S702 to obtain the i-th first quantized coefficient includes the following steps:
[0486] S702-A: Hide the parity of the i-th second quantization coefficient to obtain the i-th first quantization coefficient.
[0487] The parity of the i-th second quantization coefficient is identified by the parity corresponding to the area corresponding to the i-th second quantization coefficient in the current block.
[0488] In the embodiment of the present application, the parity of the i-th second quantization coefficient is hidden, and the method of obtaining the i-th first quantization coefficient is not limited.
[0489] In some embodiments, different methods may be selected to determine the i-th first quantization coefficient according to the parity of the i-th second quantization coefficient, as shown in Case 1 and Case 2.
[0490] Case 1: If the i-th second quantization coefficient is an odd number, the third operation method is used to operate on the second quantization coefficient to obtain the i-th first quantization coefficient.
[0491] The specific form of the third operation method mentioned above in the embodiment of the present application is not limited.
[0492] Mode 1, the third operation mode includes the i-th first quantization coefficient being equal to the value of the second quantization coefficient plus one divided by two.
[0493] Exemplarily, the third operation method is shown in formula (12):
[0494] val=(A+1) / 2 (12)
[0495] Wherein, A is the i-th second quantization coefficient, and val is the i-th first quantization coefficient.
[0496] In mode 1, if the i-th second quantization coefficient is an odd number, the i-th second quantization coefficient is parity-hidden according to the third operation mode shown in formula (12) above, thereby obtaining the i-th first quantization coefficient. For example, if the value of the i-th second quantization coefficient is 9, then according to formula (12) above, the value of the i-th first quantization coefficient is determined to be 5. Compared with the encoding value of 9, the encoding value of 5 can reduce the number of bits and thus reduce the encoding cost.
[0497] It should be noted that the above formula (12) 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 (12).
[0498] Case 2: If the i-th second quantization coefficient is an even number, the i-th second quantization coefficient is operated using the fourth operation method to obtain the i-th first quantization coefficient.
[0499] The specific form of the fourth operation method mentioned above in the embodiment of the present application is not limited.
[0500] Exemplarily, the fourth operation manner includes the i-th first quantization coefficient being equal to the value of the i-th second quantization coefficient divided by two.
[0501] For example, the fourth operation method is shown in formula (13):
[0502] val=A / 2 (13)
[0503] In case 2, if the i-th second quantization coefficient is an even number, the i-th second quantization coefficient is parity-hidden according to the fourth operation method shown in formula (13) above to obtain the i-th first quantization coefficient. For example, if the value of the i-th second quantization coefficient is 10, then according to formula (13) above, the value of the i-th 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.
[0504] It should be noted that the above formula (13) 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 (13).
[0505] In some embodiments, the encoding end may operate on the i-th second quantization coefficient using a preset operation method according to the parity of the i-th second quantization coefficient to obtain the i-th first quantization coefficient.
[0506] 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 i-th second quantization coefficient divided by a positive integer greater than 1.
[0507] Exemplarily, the preset operation method includes dividing the value of the i-th 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 i-th second quantization coefficient is 7, and 7 divided by 2 is 3.
[0508] For example, the encoder determines the i-th first quantization coefficient using the following formula (14):
[0509] Q b =Q / / 2 (14)
[0510] Among them, Q represents the i-th second quantization coefficient, Q b Represents the i-th first quantized coefficient, and “ / / ” represents a rounding operation.
[0511] As can be seen from the above formula (14), for the i-th second quantization coefficient, after the above operation and parity hiding, the i-th first quantization coefficient is obtained. The absolute value of the i-th first quantization coefficient is less than the absolute value of the i-th second quantization coefficient, and the number of bits required for encoding is small, thereby reducing the encoding cost. For example, when the i-th second quantization coefficient is 10, only 5 needs to be encoded. For another example, when the i-th second quantization coefficient is 21, only 10 needs to be encoded, which greatly reduces the number of bits required for encoding.
[0512] S703 : Encode the i-th first quantization coefficient to obtain a code stream.
[0513] According to the above method, after the i-th first quantization coefficient is determined, the i-th first quantization coefficient is encoded to obtain a code stream.
[0514] In this embodiment of the present application, the first characteristic of the i-th second quantization coefficient is identified by the second characteristic of the region corresponding to the i-th second quantization coefficient in the current block.
[0515] For example, a binary characteristic (0 or 1) of the region corresponding to the i-th second quantization coefficient in the current block is used to indicate the parity of the i-th second quantization coefficient.
[0516] In some embodiments, the parity of the i-th second quantized coefficient is indicated by the parity of the region, where the parity of the region can be understood as the parity of the number or the sum of the absolute values of the quantized coefficients in the region.
[0517] Exemplarily, the parity of the region may be the parity of the minimum quantization coefficient in the region, the maximum quantization coefficient in the region, the sum of absolute values in the region, the number of target quantization coefficients in the region, and the like.
[0518] In an embodiment of the present application, the parity of the region is used to indicate the parity of the i-th second quantization coefficient. For example, the parity of the region is odd to indicate that the i-th second quantization coefficient is odd, and the parity of the region is even to indicate that the i-th second quantization coefficient is even.
[0519] In some embodiments, if the parity of the region is inconsistent with the parity of the i-th second quantization coefficient, the method of the embodiment of the present application further includes the following steps 1 and 2:
[0520] Step 1: Determine the area corresponding to the i-th second quantization coefficient in the current block;
[0521] Step 2: Adjust the number or value of the quantization coefficients in the region so that the parity of the region is consistent with the parity of the second quantization coefficient.
[0522] In the embodiment of the present application, methods for determining the region corresponding to the i-th second quantization coefficient in the current block include but are not limited to the following:
[0523] Method 1: The area in the current block except the N second quantization coefficients is divided into N areas, and the N areas obtained by division are allocated one by one to the N second quantization coefficients, thereby obtaining the area corresponding to each second quantization coefficient in the current block.
[0524] Mode 2: determining the area corresponding to the i-th second quantization coefficient in the current block according to the number of second quantization coefficients in the current block.
[0525] In one example, a scanning index of the i-th first quantization coefficient is determined; and a region corresponding to the i-th first quantization coefficient in the current block is determined based on the scanning index and the number of first quantization coefficients in the current block.
[0526] In some embodiments, the scanning index of the i-th second quantization coefficient is determined according to a scanning order of the i-th second quantization coefficient among the N second quantization coefficients.
[0527] In some embodiments, if the i-th second quantized coefficient is the j-th scanned quantized coefficient among the N second quantized coefficients, the scanning index of the i-th second quantized coefficient is determined to be Nj.
[0528] After determining the scanning index of the i-th first quantization coefficient, the encoder determines the area corresponding to the i-th first quantization coefficient in the current block according to the scanning index and the number of first quantization coefficients in the current block.
[0529] In some embodiments, the first scanning index and the second scanning index are determined based on the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block and the first threshold; and based on the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th second quantization coefficient in the current block.
[0530] In some embodiments, a method for determining a first scan index includes determining a first value based on the scan index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and a first threshold. For example, the scan index of the i-th second quantization coefficient is added to a first preset value to obtain a first sum; the first threshold is subtracted from the second preset value to obtain a first difference; the first sum is multiplied by the first difference to obtain a first product; the first product is added to the number of second quantization coefficients in the current block, and then a third preset value is subtracted to obtain the first value. Next, the first scan index is determined based on the first value. In one example, a second value is determined based on the number of quantization coefficients in the current block, for example, the difference between the number of quantization coefficients in the current block and a fourth preset value is determined as the second value, and the minimum of the first and second values is determined as the first scan index.
[0531] In some embodiments, the method for determining the second scanning index includes: subtracting the first threshold from the fifth preset value to obtain a second difference; multiplying the scanning index of the i-th second quantization coefficient by the second difference to obtain a second product; adding the second product to the number of second quantization coefficients in the current block to obtain a second scanning index.
[0532] In the embodiment of the present application, after the encoding end determines the region corresponding to the i-th second quantization coefficient in the current block according to the above steps, if the parity of the region is inconsistent with the parity of the i-th second quantization coefficient, the number or value of the quantization coefficients in the region is adjusted to make the parity of the region consistent with the parity of the i-th second quantization coefficient.
[0533] In the embodiment of the present application, the manner of adjusting the region corresponding to the i-th second quantization coefficient in the current block includes at least the following situations:
[0534] Case 1: If the parity of the i-th second quantization coefficient is identified by the parity of the sum of the first absolute values of the region, then the above step 2 includes: adjusting the value of the region so that the parity of the sum of the first absolute values of the region is consistent with the parity of the i-th second quantization coefficient.
[0535] 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.
[0536] The above situation 1 includes the following two examples:
[0537] Example 1: If the i-th second quantization coefficient is an odd number and the sum of the first absolute values of the region is an even number, the value of the region is adjusted so that the sum of the first absolute values of the region after adjustment is an odd number.
[0538] For example, if the i-th second quantization coefficient is an odd number and the sum of the first absolute values of the region is an even number, then the minimum quantization coefficient in the region is increased or decreased by 1 to modify the sum of the first absolute values of the region to an odd number.
[0539] Example 2: If the i-th second quantization coefficient is an even number and the sum of the first absolute values of the region is an odd number, the value of the region is adjusted so that the sum of the first absolute values of the region after adjustment is an even number.
[0540] For example, the i-th second quantization coefficient is an even number, and the sum of the first absolute values of the region is an odd number. At this time, the minimum quantization coefficient in the region is increased by 1 or decreased by 1 to modify the sum of the first absolute values of the region to an even number.
[0541] In case 2, if the parity of the i-th second quantized coefficient is identified by the parity of the number of target quantized coefficients in the region, then step 2 includes adjusting the value of the region so that the parity of the number of target quantized coefficients in the region is consistent with the parity of the i-th second quantized coefficient.
[0542] Example 2 above includes at least the following two examples:
[0543] Example 1: If the i-th second quantization coefficient is an odd number and the number of target quantization coefficients in the region is an even number, the value of the region is adjusted so that the number of target quantization coefficients in the region after adjustment is an odd number.
[0544] Example 2: If the i-th second quantization coefficient is an even number and the number of target quantization coefficients in the region is an odd number, the value of the region is adjusted so that the number of target quantization coefficients in the region after adjustment is an even number.
[0545] The target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value.
[0546] In one example, if the target quantization coefficient is a non-zero quantization coefficient in the region, the encoder modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number and the number of non-zero quantization coefficients in the region is an even number, then a zero quantization coefficient in the region may be adjusted to 1, or the value of the smallest quantization coefficient in the region may be adjusted to 0, so that the number of non-zero quantization coefficients in the region is an odd number.
[0547] For another example, if the i-th second quantization coefficient is an even number, and the number of non-zero quantization coefficients in the region is an odd number, then one of the zero quantization coefficients in the region can be adjusted to 1, or the value of the smallest non-zero quantization coefficient in the region can be adjusted to 0, so that the number of non-zero quantization coefficients in the region is an even number.
[0548] In another example, if the target quantization coefficient is a non-zero quantization coefficient with an even value in the region, the encoder modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number and the number of non-zero quantization coefficients with even values in the region is even, then one of the zero quantization coefficients in the region may be adjusted to 2, or the value of the smallest non-zero quantization coefficient in the region may be increased or decreased by 1 so that the number of non-zero quantization coefficients with even values in the region is odd.
[0549] For another example, if the i-th second quantization coefficient is an even number, and the number of even-valued non-zero quantization coefficients in the region is odd, then one of the zero quantization coefficients in the region may be adjusted to 2, or the value of the smallest non-zero quantization coefficient in the region may be increased or decreased by 1 to make the number of non-zero quantization coefficients in the region even. The encoder adjusts at least one coefficient in the region using an adjustment method that minimizes rate-distortion cost.
[0550] In another example, if the target quantization coefficient is an even-valued quantization coefficient in the region, the encoder modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number and the number of even-valued quantization coefficients in the region is even, then a zero quantization coefficient in the region may be adjusted to 1, or the smallest non-zero quantization coefficient in the region may be adjusted to 0, so that the number of even-valued quantization coefficients in the region is odd.
[0551] For another example, if the i-th second quantization coefficient is an even number, and the number of quantization coefficients with even values in the region is odd, then one of the zero quantization coefficients in the region can be adjusted to 1, or the smallest non-zero quantization coefficient in the region can be adjusted to 0 to make the number of quantization coefficients in the region an even number.
[0552] In another example, if the target quantization coefficient is a quantization coefficient with an odd value in the region, the encoder modifies at least one coefficient in the region. For example, if the i-th second quantization coefficient is an odd number and the number of quantization coefficients with odd values in the region is even, then a zero quantization coefficient in the region may be adjusted to 1, or the smallest non-zero quantization coefficient in the region may be adjusted to 0, plus 1, or minus 1, so that the number of odd quantization coefficients in the region is an odd number.
[0553] For another example, if the i-th second quantization coefficient is an even number, and the number of quantization coefficients with odd values in the region is odd, then one of the zero quantization coefficients in the region can be adjusted to 1, or the smallest non-zero quantization coefficient in the region can be adjusted to 0 or added 1 or subtracted 1, so that the number of quantization coefficients in the region is an even number.
[0554] Furthermore, the parity hiding technology proposed in this application is implemented on the AVM reference software, the region size used is set to 16, and the threshold for the number of non-zero coefficients for parity hiding is 4. When the parity hiding technology of this application is turned on for the current region, if the sum of the absolute values of the non-zero coefficients in the current region is less than or equal to 15, it means that the last coefficient in the scanning order of the region (i.e., the second quantization coefficient) is an odd number, and if it is an even number, it means that the last coefficient in the scanning order of the region (i.e., the second quantization coefficient) is an even number. The coding performance of the YUV3 component under the full-frame AI configuration is improved by 0.21% / 1.02% / 1.05%. The coding performance of the YUV3 component under the random access RA configuration is improved by 0.29% / 0.63% / 0.72%.
[0555] In a video encoding method provided by an embodiment of the present application, an encoder determines N second quantization coefficients of a current block, where N is a positive integer; for the i-th second quantization coefficient among the N second quantization coefficients, the encoder hides the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient, where i is a positive integer less than or equal to N; and the i-th first quantization coefficient is encoded to obtain a bitstream. That is, in an embodiment of the present application, the encoder hides the first characteristic of the second quantization coefficient to obtain the first quantization coefficient. Because 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 first characteristic of the second quantization coefficient is identified by the second characteristic of the region corresponding to the second quantization coefficient, so that the decoder can determine the first characteristic of the second quantization coefficient based on the second characteristic of the region corresponding to the second quantization coefficient, and then accurately reconstruct the second quantization coefficient based on the first characteristic of the second quantization coefficient and the first quantization coefficient.
[0556] Based on the embodiment shown in FIG. 10 above, the video encoding method provided in the embodiment of the present application is further described below in conjunction with FIG. 11 .
[0557] FIG11 is a flow chart of a video encoding method according to an embodiment of the present application. Taking the first characteristic and the second characteristic both being parity as an example, as shown in FIG11 , the method according to the embodiment of the present application includes:
[0558] S801. Obtain at least one flag.
[0559] The at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.
[0560] 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.
[0561] 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.
[0562] 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 steps S802 and S807 are executed.
[0563] S802: Determine N second quantization coefficients of the current block.
[0564] S803 . For an i-th second quantization coefficient among the N second quantization coefficients, determine a region corresponding to the i-th second quantization coefficient in the current block.
[0565] The specific implementation process of the above S803 can refer to the relevant description of the above step 1, which will not be repeated here.
[0566] S804: Determine whether the area corresponding to the i-th second quantization coefficient in the current block meets a preset condition.
[0567] In the embodiments of the present application, the parity hiding technique proposed in the present application is limited. Specifically, if the current region satisfies a preset condition, it indicates that the region corresponding to the i-th second quantized coefficient in the current block can achieve significant beneficial effects using the parity hiding technique provided in the embodiments of the present application. In this case, step S805 is executed.
[0568] If the area corresponding to the i-th second quantization coefficient in the current block does not meet the preset conditions, it means that the parity hiding technology provided in the embodiment of the present application cannot achieve significant beneficial effects in this area. At this time, the following step S807 is executed.
[0569] 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.
[0570] In a possible implementation, the above-mentioned preset conditions include at least one of the following conditions:
[0571] Condition 1: the number of non-zero quantized coefficients in the region corresponding to the i-th second quantized coefficient in the current block is greater than a first value;
[0572] Condition 2: in the region, the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the scanning order is greater than the second value;
[0573] Condition 3: in the region, the distance between the first non-zero quantized coefficient and the last quantized coefficient in the scanning order is greater than a third value;
[0574] Condition 4: In this region, the sum of the absolute values of the non-zero quantized coefficients is greater than a fourth value.
[0575] In some embodiments, the above four conditions can also be combined with each other to form new constraints.
[0576] 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.
[0577] In one example, at least one of the first value, the second value, the third value, and the fourth value is a fixed value.
[0578] 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.
[0579] 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.
[0580] S805 . Perform parity hiding on the i th second quantization coefficient to obtain the i th first quantization coefficient.
[0581] S806: Encode the i-th first quantization coefficient to obtain a code stream.
[0582] The above steps S805 and S805 can refer to the description of the above steps S702 and S703, and will not be repeated here.
[0583] S807 : Encode the i-th second quantization coefficient to obtain a code stream.
[0584] In an embodiment of the present application, when encoding the second quantization coefficient, the encoding end first determines whether the area corresponding to the second quantization coefficient meets the preset conditions to determine whether the parity hiding technology provided by the present application can bring significant beneficial technical effects when encoding. When it is determined that the parity hiding technology has significant beneficial effects, the technical solution of the present application is used to encode the second quantization coefficient to improve encoding reliability.
[0585] It should be understood that Figures 5 to 8 are merely examples of the present application and should not be construed as limiting the present application.
[0586] 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.
[0587] 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.
[0588] 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.
[0589] FIG12 is a schematic block diagram of a video decoding device according to an embodiment of the present application.
[0590] As shown in FIG12 , the video decoding apparatus 10 includes:
[0591] a decoding unit 11, configured to decode a bitstream and determine N first quantization coefficients of a current block, where an i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained by hiding a first characteristic of an i-th second quantization coefficient in the current block, where N is a positive integer and i is a positive integer less than or equal to N;
[0592] an area determination unit 12, configured to determine an area corresponding to the i-th first quantization coefficient in the current block;
[0593] a characteristic determining unit 13, configured to determine the first characteristic of the i-th second quantization coefficient according to the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block;
[0594] The coefficient determination unit 14 is configured to determine the i-th second quantization coefficient according to the first characteristic of the i-th first quantization coefficient and the i-th second quantization coefficient.
[0595] In some embodiments, the N first quantized coefficients are located in an upper left corner area of the current block.
[0596] In some embodiments, the decoding unit 11 is specifically configured to decode the code stream to obtain the number of quantization coefficients of the current block; and determine the N first quantization coefficients according to the number of quantization coefficients of the current block.
[0597] In some embodiments, the decoding unit 11 is specifically used to determine a first threshold; determine the number of first quantization coefficients in the current block based on the number of quantization coefficients of the current block and the first threshold; and determine the N quantization coefficients in the upper left corner area of the current block as the N first quantization coefficients based on the number of first quantization coefficients in the current block.
[0598] In some embodiments, the decoding unit 11 is specifically configured to decode the code stream to obtain the first threshold.
[0599] Optionally, the first threshold is a preset value.
[0600] In some embodiments, the decoding unit 11 is specifically configured to determine a value obtained by rounding up the ratio of the number of quantization coefficients of the current block to the first threshold as the number of first quantization coefficients in the current block.
[0601] In some embodiments, the decoding unit 11 is specifically configured to determine, according to a scanning order, the N quantization coefficients in the upper left corner area of the current block as the N first quantization coefficients.
[0602] In some embodiments, the decoding unit 11 is specifically configured to determine the last N quantization coefficients in the current block in the scanning order as the N first quantization coefficients.
[0603] In some embodiments, the region determining unit 12 is specifically configured to determine the region corresponding to the i-th first quantization coefficient in the current block according to the number of first quantization coefficients in the current block.
[0604] In some embodiments, the area determination unit 12 is specifically used to determine the scanning index of the i-th first quantization coefficient; and determine the area corresponding to the i-th first quantization coefficient in the current block based on the scanning index and the number of first quantization coefficients in the current block.
[0605] In some embodiments, the region determination unit 12 is specifically configured to determine a scanning index of the i-th first quantization coefficient according to a scanning order of the i-th first quantization coefficient among the N first quantization coefficients.
[0606] In some embodiments, the region determination unit 12 is specifically configured to determine the scanning index of the i-th first quantization coefficient as Nj if the i-th first quantization coefficient is the j-th scanned quantization coefficient among the N first quantization coefficients.
[0607] In some embodiments, the area determination unit 12 is specifically used to determine the first scanning index and the second scanning index based on the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold; according to the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th first quantization coefficient in the current block.
[0608] In some embodiments, the area determination unit 12 is specifically used to determine a first value based on the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block and the first threshold; and determine the first scanning index based on the first value.
[0609] In some embodiments, the region determination unit 12 is specifically configured to determine a second value according to the number of quantization coefficients of the current block; and determine the minimum value between the first value and the second value as the first scanning index.
[0610] In some embodiments, the area determination unit 12 is specifically used to add the scanning index of the i-th first quantization coefficient to a first preset value to obtain a first sum; subtract the first threshold from the second preset value to obtain a first difference; multiply the first sum by the first difference to obtain a first product; add the first product to the number of first quantization coefficients in the current block, and then subtract a third preset value to obtain the first value.
[0611] In some embodiments, the region determination unit 12 is specifically configured to determine the difference between the number of quantization coefficients of the current block and a fourth preset value as the second value.
[0612] In some embodiments, the area determination unit 12 is specifically used to subtract the first threshold from the fifth preset value to obtain a second difference; multiply the scanning index of the i-th first quantization coefficient by the second difference to obtain a second product; and add the second product to the number of first quantization coefficients in the current block to obtain the second scanning index.
[0613] In some embodiments, the first characteristic and the second characteristic are both parity, and the characteristic determination unit 13 is specifically used to determine the parity of the i-th second quantization coefficient based on the parity of the region, where the parity of the region is the parity of the number or the sum of the absolute values of the quantization coefficients in the region; correspondingly, the coefficient determination unit 14 is specifically used to determine the i-th second quantization coefficient based on the parity of the i-th first quantization coefficient and the i-th second quantization coefficient.
[0614] In some embodiments, if the parity of the region is the parity of the sum of the first absolute values of the quantization coefficients in the region, the characteristic determination unit 13 is specifically used to determine the parity of the i-th second quantization coefficient based on the parity of the sum of the first absolute values of the quantization coefficients in the region, and the first absolute value is part or all of the absolute value of the quantization coefficient.
[0615] In some embodiments, if the parity of the region is the parity of the number of target quantization coefficients in the region, the characteristic determination unit 13 is specifically used to determine the target quantization coefficient in the region; and determine the parity of the i-th second quantization coefficient based on the parity of the number of target quantization coefficients.
[0616] In some embodiments, the target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value.
[0617] In some embodiments, the characteristic determination unit 13 is specifically configured to operate on the i-th first quantization coefficient using a preset operation method to obtain an operation result; and obtain the i-th second quantization coefficient based on the parity of the i-th second quantization coefficient and the operation result.
[0618] In some embodiments, the preset operation method includes multiplying the value of the i-th first quantization coefficient by two.
[0619] In some embodiments, the characteristic determination unit 13 is specifically configured to determine the first characteristic of the i-th second quantization coefficient according to the region if the region meets a preset condition.
[0620] In some implementations, the preset condition includes at least one of the following:
[0621] The number of non-zero quantized coefficients in the region is greater than a first value;
[0622] In the 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;
[0623] In the 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;
[0624] In the region, the sum of the absolute values of the non-zero quantized coefficients is greater than a fourth value.
[0625] 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.
[0626] FIG13 is a schematic block diagram of a video encoding device according to an embodiment of the present application.
[0627] As shown in FIG13 , the video encoding apparatus 20 includes:
[0628] A determining unit 21, configured to determine N second quantization coefficients of a current block, where N is a positive integer;
[0629] a hiding unit 22 configured to hide the first characteristic of an i-th second quantization coefficient among the N second quantization coefficients to obtain an i-th first quantization coefficient, where i is a positive integer less than or equal to N;
[0630] The encoding unit 23 is configured to encode the i-th first quantization coefficient to obtain a code stream, wherein the first characteristic of the i-th second quantization coefficient is identified by the second characteristic of the area corresponding to the i-th second quantization coefficient in the current block.
[0631] In some embodiments, the N second quantization coefficients are located in an upper left corner area of the current block.
[0632] In some embodiments, the determination unit 21 is specifically configured to determine the number of quantization coefficients of the current block; and determine the N second quantization coefficients according to the number of quantization coefficients of the current block.
[0633] In some embodiments, the determination unit 21 is specifically used to determine a first threshold; determine the number of second quantization coefficients in the current block based on the number of quantization coefficients of the current block and the first threshold; and determine the N quantization coefficients in the upper left corner area of the current block as the N second quantization coefficients based on the number of second quantization coefficients in the current block.
[0634] In some embodiments, the determination unit 21 is specifically configured to determine a value obtained by rounding up the ratio of the number of quantization coefficients of the current block to the first threshold as the number of second quantization coefficients in the current block.
[0635] In some embodiments, the determining unit 21 is specifically configured to determine, according to a scanning order, the N quantization coefficients in the upper left corner area of the current block as the N second quantization coefficients.
[0636] In some embodiments, the determining unit 21 is specifically configured to determine the last N quantization coefficients in the current block in the scanning order as the N second quantization coefficients.
[0637] Optionally, the first threshold is a preset value.
[0638] In some embodiments, the encoding unit 23 is further configured to write the first threshold into the bitstream.
[0639] In some embodiments, the encoding unit 23 is further configured to write the number of quantization coefficients of the current block into the bitstream.
[0640] In some embodiments, the first characteristic and the second characteristic are both parity, and the hiding unit 22 is specifically used to hide the parity of the i-th second quantization coefficient to obtain the i-th first quantization coefficient, and the parity of the i-th second quantization coefficient is identified by the parity of the region.
[0641] In some embodiments, the hidden unit 22 is further used to determine the area corresponding to the i-th second quantization coefficient in the current block; if the parity of the area is inconsistent with the parity of the second quantization coefficient, the number or value of the quantization coefficients in the area is adjusted to make the parity of the area consistent with the parity of the second quantization coefficient, and the parity of the area is the parity of the number or the sum of the absolute values of the quantization coefficients in the area.
[0642] In some embodiments, the hiding unit 22 is specifically configured to determine the region corresponding to the i-th second quantization coefficient in the current block according to the number of second quantization coefficients in the current block.
[0643] In some embodiments, the hidden unit 22 is specifically used to determine the scanning index of the i-th second quantization coefficient; and determine the area corresponding to the i-th second quantization coefficient in the current block based on the scanning index and the number of second quantization coefficients in the current block.
[0644] In some embodiments, the hiding unit 22 is specifically configured to determine a scanning index of the i-th second quantization coefficient according to a scanning order of the i-th second quantization coefficient among the N second quantization coefficients.
[0645] In some embodiments, the hiding unit 22 is specifically configured to determine the scanning index of the i-th second quantization coefficient as Nj if the i-th second quantization coefficient is the j-th scanned quantization coefficient among the N second quantization coefficients.
[0646] In some embodiments, the hidden unit 22 is specifically used to determine the first scanning index and the second scanning index based on the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block and the first threshold; according to the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th second quantization coefficient in the current block.
[0647] In some embodiments, the hidden unit 22 is specifically used to determine a first value based on the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block and the first threshold; and determine the first scanning index based on the first value.
[0648] In some embodiments, the hiding unit 22 is specifically configured to determine a second value according to the number of quantization coefficients of the current block; and determine the minimum value between the first value and the second value as the first scanning index.
[0649] In some embodiments, the hidden unit 22 is specifically used to add the scanning index of the i-th second quantization coefficient to a first preset value to obtain a first sum; subtract the first threshold from the second preset value to obtain a first difference; multiply the first sum by the first difference to obtain a first product; add the first product to the number of second quantization coefficients in the current block, and then subtract a third preset value to obtain the first value.
[0650] In some embodiments, the hiding unit 22 is specifically configured to determine the difference between the number of quantization coefficients of the current block and a fourth preset value as the second value.
[0651] In some embodiments, the hidden unit 22 is specifically used to subtract the first threshold from the fifth preset value to obtain a second difference; multiply the scanning index of the i-th second quantization coefficient by the second difference to obtain a second product; and add the second product to the number of second quantization coefficients in the current block to obtain the second scanning index.
[0652] In some embodiments, if the parity of the second quantization coefficient is identified by the parity of the sum of the first absolute values of the quantization coefficients in the region, the hidden unit 22 is specifically used to adjust the value of the quantization coefficient in the region so that the parity of the sum of the first absolute values of the quantization coefficients in the region is consistent with the parity of the second quantization coefficient.
[0653] In some embodiments, if the parity of the second quantization coefficient is identified by the parity of the number of target quantization coefficients in the region, the hiding unit 22 is further configured to adjust the values of the quantization coefficients in the region so that the parity of the number of target quantization coefficients in the region is consistent with the parity of the second quantization coefficient.
[0654] In some embodiments, the hiding unit 22 is specifically configured to operate on the i-th second quantization coefficient using a preset operation method to obtain the i-th first quantization coefficient.
[0655] In some embodiments, the preset operation method includes dividing the value of the i-th second quantization coefficient by two and rounding it up.
[0656] In some embodiments, the hiding unit 22 is specifically configured to hide the first characteristic of the i-th second quantization coefficient if the region meets a preset condition, so as to obtain the i-th first quantization coefficient.
[0657] In some embodiments, the preset condition includes at least one of the following:
[0658] The number of non-zero quantized coefficients in the region is greater than a first value;
[0659] In the 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;
[0660] In the 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;
[0661] In the region, the sum of the absolute values of the non-zero quantized coefficients is greater than a fourth value.
[0662] 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.
[0663] 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.
[0664] FIG11 is a schematic block diagram of an electronic device provided in an embodiment of the present application.
[0665] As shown in FIG11 , the electronic device 30 may be a video encoder or a video decoder according to an embodiment of the present application. The electronic device 30 may include:
[0666] 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.
[0667] 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 .
[0668] In some embodiments of the present application, the processor 32 may include but is not limited to:
[0669] 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.
[0670] In some embodiments of the present application, the memory 33 includes but is not limited to:
[0671] 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).
[0672] 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.
[0673] As shown in FIG11 , the electronic device 30 may further include:
[0674] The transceiver 33 may be connected to the processor 32 or the memory 33 .
[0675] 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.
[0676] 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.
[0677] FIG15 is a schematic block diagram of a video encoding and decoding system provided in an embodiment of the present application.
[0678] 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.
[0679] 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.
[0680] The present application also provides a code stream, which is obtained by the above-mentioned video encoding method.
[0681] 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)).
[0682] 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.
[0683] 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.
[0684] 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.
[0685] 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, determining N first quantization coefficients of a current block, where an i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained by hiding a first characteristic of an i-th second quantization coefficient in the current block, where N is a positive integer and i is a positive integer less than or equal to N; Determining a region corresponding to the i-th first quantization coefficient in the current block; determining, according to a second characteristic of a region corresponding to the i-th first quantization coefficient in the current block, a first characteristic of the i-th second quantization coefficient; The i-th second quantization coefficient is determined according to first characteristics of the i-th first quantization coefficient and the i-th second quantization coefficient.
2. The method according to claim 1, characterized in that The N first quantization coefficients are located in an upper left corner area of the current block.
3. The method according to claim 1, characterized in that The decoding code stream determines N first quantization coefficients of the current block, including: Decoding the code stream to obtain the number of quantization coefficients of the current block; The N first quantization coefficients are determined according to the number of quantization coefficients of the current block.
4. The method according to claim 3, characterized in that The determining the N first quantization coefficients according to the number of quantization coefficients of the current block includes: determining a first threshold; Determining the number of first quantization coefficients in the current block according to the number of quantization coefficients of the current block and the first threshold; According to the number of first quantization coefficients in the current block, the N quantization coefficients in the upper left corner area of the current block are determined as the N first quantization coefficients.
5. The method according to claim 4, characterized in that The determining of the first threshold comprises: The code stream is decoded to obtain the first threshold.
6. The method according to claim 4, characterized in that The first threshold is a preset value.
7. The method according to claim 4, characterized in that The determining, according to the number of quantization coefficients of the current block and the first threshold, the number of first quantization coefficients in the current block includes: A value obtained by rounding up the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of first quantization coefficients in the current block.
8. The method according to claim 4, characterized in that The determining, according to the number of first quantization coefficients in the current block, the N quantization coefficients in the upper left corner area of the current block as the N first quantization coefficients includes: According to a scanning order, the N quantization coefficients in the upper left corner area of the current block are determined as the N first quantization coefficients.
9. The method according to claim 8, characterized in that The step of determining, according to a scanning order, the N quantization coefficients in the upper left corner area of the current block as the N first quantization coefficients includes: The last N quantization coefficients in the current block in the scanning order are determined as the N first quantization coefficients.
10. The method according to any one of claims 4 to 9, characterized in that: The determining the area corresponding to the i-th first quantization coefficient in the current block includes: According to the number of first quantization coefficients in the current block, a region corresponding to the i-th first quantization coefficient in the current block is determined.
11. The method according to claim 10, characterized in that The determining, according to the number of first quantization coefficients in the current block, a region corresponding to the i-th first quantization coefficient in the current block includes: Determining a scan index of the i-th first quantization coefficient; According to the scanning index and the number of first quantization coefficients in the current block, a region corresponding to the i-th first quantization coefficient in the current block is determined.
12. The method according to claim 11, characterized in that The determining of the scanning index of the i-th first quantization coefficient includes: A scanning index of the i-th first quantization coefficient is determined according to a scanning order of the i-th first quantization coefficient among the N first quantization coefficients.
13. The method according to claim 12, characterized in that The determining, according to a scanning order of the i-th first quantization coefficient among the N first quantization coefficients, a scanning index of the i-th first quantization coefficient includes: If the i-th first quantization coefficient is the j-th scanned quantization coefficient among the N first quantization coefficients, the scanning index of the i-th first quantization coefficient is determined to be Nj.
14. The method according to claim 11, characterized in that The determining, according to the scan index and the number of first quantization coefficients in the current block, a region corresponding to the i-th first quantization coefficient in the current block includes: Determining a first scanning index and a second scanning index according to the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold; According to the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th first quantization coefficient in the current block.
15. The method according to claim 14, characterized in that The determining the first scanning index according to the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold value includes: determining a first value according to a scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold; The first scanning index is determined according to the first value.
16. The method according to claim 15, characterized in that The determining the first scanning index according to the first value includes: Determining a second value according to the number of quantization coefficients of the current block; The minimum value between the first value and the second value is determined as the first scanning index.
17. The method according to claim 15, characterized in that The determining the first value according to the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold includes: Adding the scanning index of the i-th first quantization coefficient to a first preset value to obtain a first sum value; Subtracting the first threshold from a second preset value to obtain a first difference; multiplying the first sum value and the first difference value to obtain a first product; The first product is added to the number of first quantization coefficients in the current block, and then a third preset value is subtracted to obtain the first value.
18. The method according to claim 16, characterized in that The determining the second value according to the number of quantization coefficients of the current block includes: The difference between the number of quantization coefficients of the current block and a fourth preset value is determined as the second value.
19. The method according to claim 14, wherein Determining a second scanning index according to the scanning index of the i-th first quantization coefficient, the number of first quantization coefficients in the current block, and the first threshold, includes: subtracting the first threshold from a fifth preset value to obtain a second difference; multiplying the scanning index of the i-th first quantization coefficient by the second difference to obtain a second product; The second product is added to the number of first quantization coefficients in the current block to obtain the second scanning index.
20. The method according to any one of claims 1-9 and 11-19, characterized in that The first characteristic and the second characteristic are both parity, and determining the first characteristic of the i-th second quantization coefficient according to the region corresponding to the i-th first quantization coefficient in the current block includes: determining the parity of the i-th second quantization coefficient according to the parity of the region, where the parity of the region is the parity of the number or the sum of the absolute values of the quantization coefficients in the region; The determining, according to the first characteristic of the i-th first quantization coefficient and the i-th second quantization coefficient, the i-th second quantization coefficient includes: The i-th second quantization coefficient is determined according to the parity of the i-th first quantization coefficient and the i-th second quantization coefficient.
21. The method according to claim 20, characterized in that If the parity of the region is the parity of the sum of first absolute values of the quantization coefficients in the region, determining the parity of the i-th second quantization coefficient according to the parity of the region includes: The parity of the i-th second quantized coefficient is determined according to the parity of the sum of first absolute values of the quantized coefficients in the region, where the first absolute value is part or all of the absolute values of the quantized coefficients.
22. The method according to claim 20, characterized in that If the parity of the region is the parity of the number of target quantization coefficients in the region, determining the parity of the i-th second quantization coefficient according to the parity of the region includes: determining a target quantization coefficient in the region; The parity of the i-th second quantization coefficient is determined according to the parity of the number of the target quantization coefficients.
23. The method according to claim 22, characterized in that The target quantization coefficient is any one of a non-zero quantization coefficient in the region, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, and a quantization coefficient with an odd value.
24. The method according to claim 20, characterized in that The determining, according to the parity of the i-th first quantization coefficient and the i-th second quantization coefficient, the i-th second quantization coefficient includes: Performing an operation on the i-th first quantization coefficient using a preset operation method to obtain an operation result; The i-th second quantization coefficient is obtained according to the parity of the i-th second quantization coefficient and the operation result.
25. The method according to claim 24, characterized in that The preset operation method includes multiplying the value of the i-th first quantization coefficient by two.
26. The method according to any one of claims 1-9 and 11-19, characterized in that The determining, according to the region corresponding to the i-th first quantization coefficient in the current block, the first characteristic of the i-th second quantization coefficient includes: If the region satisfies a preset condition, the first characteristic of the i-th second quantization coefficient is determined according to the region.
27. The method according to claim 26, characterized in that The preset conditions include at least one of the following: The number of non-zero quantized coefficients in the region is greater than a first value; In the 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 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 region, the sum of the absolute values of the non-zero quantized coefficients is greater than a fourth value.
28. A video encoding method, characterized in that: include: Determine N second quantization coefficients of the current block, where N is a positive integer; For an i-th second quantization coefficient among the N second quantization coefficients, hiding the first characteristic of the i-th second quantization coefficient to obtain an i-th first quantization coefficient, where i is a positive integer less than or equal to N; The i-th first quantization coefficient is encoded to obtain a code stream, and the first characteristic of the i-th second quantization coefficient is identified by the second characteristic of the area corresponding to the i-th second quantization coefficient in the current block.
29. The method according to claim 28, characterized in that The N second quantization coefficients are located in an upper left corner area of the current block.
30. The method according to claim 28, wherein The determining of N second quantization coefficients of the current block includes: Determining the number of quantization coefficients of the current block; The N second quantization coefficients are determined according to the number of quantization coefficients of the current block.
31. The method according to claim 30, wherein The determining the N second quantization coefficients according to the number of quantization coefficients of the current block includes: determining a first threshold; Determining the number of second quantization coefficients in the current block according to the number of quantization coefficients of the current block and the first threshold; According to the number of second quantization coefficients in the current block, the N quantization coefficients in the upper left corner area of the current block are determined as the N second quantization coefficients.
32. The method according to claim 31, characterized in that The determining, according to the number of quantization coefficients of the current block and the first threshold, the number of second quantization coefficients in the current block includes: A value obtained by rounding up the ratio of the number of quantization coefficients of the current block to the first threshold is determined as the number of second quantization coefficients in the current block.
33. The method according to claim 31, characterized in that The step of determining, according to the number of second quantization coefficients in the current block, the N quantization coefficients in the upper left corner area of the current block as the N second quantization coefficients includes: According to a scanning order, the N quantization coefficients in the upper left corner area of the current block are determined as the N second quantization coefficients.
34. The method according to claim 33, wherein The step of determining, according to a scanning order, the N quantization coefficients in the upper left corner area of the current block as the N second quantization coefficients includes: The last N quantization coefficients in the current block in the scanning order are determined as the N second quantization coefficients.
35. The method according to claim 31, wherein The first threshold is a preset value.
36. The method according to claim 31, wherein The method further comprises: The first threshold is written into the bitstream.
37. The method according to claim 31, wherein The method further comprises: The number of quantization coefficients of the current block is written into the bitstream.
38. The method according to any one of claims 31 to 37, characterized in that The first characteristic and the second characteristic are both parity, and the step of hiding the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient includes: The parity of the i-th second quantization coefficient is hidden to obtain the i-th first quantization coefficient, and the parity of the i-th second quantization coefficient is identified by the parity of the region.
39. The method according to claim 38, characterized in that The method further comprises: Determining a region corresponding to the i-th second quantization coefficient in the current block; If the parity of the region is inconsistent with the parity of the second quantization coefficient, the number or value of the quantization coefficients in the region is adjusted so that the parity of the region is consistent with the parity of the second quantization coefficient. The parity of the region is the parity of the number or the sum of the absolute values of the quantization coefficients in the region.
40. The method according to claim 39, wherein The determining the area corresponding to the i-th second quantization coefficient in the current block includes: According to the number of second quantization coefficients in the current block, a region corresponding to the i-th second quantization coefficient in the current block is determined.
41. The method according to claim 40, wherein The determining, according to the number of second quantization coefficients in the current block, a region corresponding to the i-th second quantization coefficient in the current block includes: Determining a scan index of the i-th second quantization coefficient; According to the scanning index and the number of second quantization coefficients in the current block, a region corresponding to the i-th second quantization coefficient in the current block is determined.
42. The method according to claim 41, wherein The determining of the scanning index of the i-th second quantization coefficient includes: A scanning index of the i-th second quantization coefficient is determined according to a scanning order of the i-th second quantization coefficient among the N second quantization coefficients.
43. The method according to claim 42, characterized in that The determining, according to a scanning order of the i-th second quantization coefficient among the N second quantization coefficients, a scanning index of the i-th second quantization coefficient includes: If the i-th second quantization coefficient is the j-th scanned quantization coefficient among the N second quantization coefficients, the scanning index of the i-th second quantization coefficient is determined to be Nj.
44. The method according to claim 41, wherein The determining, according to the scan index and the number of second quantization coefficients in the current block, a region corresponding to the i-th second quantization coefficient in the current block includes: Determining a first scanning index and a second scanning index according to the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold; According to the scanning order of the current block, the area within the first scanning index and the second scanning index in the current block is determined as the area corresponding to the i-th second quantization coefficient in the current block.
45. The method according to claim 44, wherein The determining the first scanning index according to the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold value includes: determining a first value according to a scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold; The first scanning index is determined according to the first value.
46. The method according to claim 45, characterized in that The determining the first scanning index according to the first value includes: Determining a second value according to the number of quantization coefficients of the current block; The minimum value between the first value and the second value is determined as the first scanning index.
47. The method according to claim 45, wherein The determining the first value according to the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold value includes: Adding the scanning index of the i-th second quantization coefficient to a first preset value to obtain a first sum value; Subtracting the first threshold from a second preset value to obtain a first difference; multiplying the first sum value and the first difference value to obtain a first product; The first value is obtained by adding the first product and the number of second quantization coefficients in the current block and then subtracting a third preset value.
48. The method according to claim 46, wherein The determining the second value according to the number of quantization coefficients of the current block includes: The difference between the number of quantization coefficients of the current block and a fourth preset value is determined as the second value.
49. The method according to claim 44, wherein Determining a second scanning index according to the scanning index of the i-th second quantization coefficient, the number of second quantization coefficients in the current block, and the first threshold, includes: subtracting the first threshold from a fifth preset value to obtain a second difference; multiplying the scanning index of the i-th second quantization coefficient by the second difference to obtain a second product; The second product is added to the number of second quantization coefficients in the current block to obtain the second scanning index.
50. The method according to claim 39, wherein If the parity of the second quantization coefficient is identified by the parity of the sum of first absolute values of the quantization coefficients in the region, and the first absolute value is a partial or complete absolute value of the quantization coefficients, then adjusting the quantization coefficients in the region includes: The values of the quantization coefficients in the region are adjusted so that the parity of the sum of the first absolute values of the quantization coefficients in the region is consistent with the parity of the second quantization coefficients.
51. The method according to claim 50, characterized in that If the parity of the second quantization coefficient is identified by the parity of the number of target quantization coefficients in the region, adjusting the quantization coefficients in the region includes: The values of the quantized coefficients in the region are adjusted so that the parity of the target number of quantized coefficients in the region is consistent with the parity of the second quantized coefficients.
52. The method according to claim 38, wherein The step of hiding the parity of the i-th second quantization coefficient to obtain the i-th first quantization coefficient includes: The i-th second quantization coefficient is operated by using a preset operation method to obtain the i-th first quantization coefficient.
53. The method according to claim 52, characterized in that The preset operation method includes dividing the value of the i-th second quantization coefficient by two and rounding it up.
54. The method according to any one of claims 28 to 37, wherein: The step of hiding the first characteristic of the i-th second quantization coefficient to obtain the i-th first quantization coefficient includes: If the region meets a preset condition, the first characteristic of the i-th second quantization coefficient is hidden to obtain the i-th first quantization coefficient.
55. The method according to claim 54, characterized in that The preset conditions include at least one of the following: The number of non-zero quantized coefficients in the region is greater than a first value; In the 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 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 region, the sum of the absolute values of the non-zero quantized coefficients is greater than a fourth value.
56. A video decoding device, characterized in that include: a decoding unit, configured to decode a bitstream and determine N first quantization coefficients of a current block, wherein an i-th first quantization coefficient among the N first quantization coefficients is a quantization coefficient obtained by hiding a first characteristic of an i-th second quantization coefficient in the current block, where N is a positive integer and i is a positive integer less than or equal to N; an area determination unit, configured to determine an area corresponding to the i-th first quantization coefficient in the current block; a characteristic determining unit, configured to determine the first characteristic of the i-th second quantization coefficient according to the second characteristic of the region corresponding to the i-th first quantization coefficient in the current block; The coefficient determination unit is configured to determine the i-th second quantization coefficient according to a first characteristic of the i-th first quantization coefficient and the i-th second quantization coefficient.
57. A video encoding device, characterized in that include: a determining unit, configured to determine N second quantization coefficients of the current block, where N is a positive integer; a hiding unit, configured to hide the first characteristic of an i-th second quantization coefficient among the N second quantization coefficients to obtain an i-th first quantization coefficient, where i is a positive integer less than or equal to N; The encoding unit is configured to encode the i-th first quantization coefficient to obtain a code stream, wherein the first characteristic of the i-th second quantization coefficient is identified by the second characteristic of the area corresponding to the i-th second quantization coefficient in the current block.
58. A video encoding and decoding system, characterized in that Includes video encoder and video decoder; The video decoder is configured to perform the video decoding method according to any one of claims 1 to 27; The video encoder is used to execute the video encoding method according to any one of claims 28 to 55.
59. 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 27 or 28 to 55.
60. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 27 or 28 to 55 when executed by a processor.
61. A code stream, characterized in that The code stream is obtained by the method according to any one of claims 28 to 55.