WO2023184250A1 - 视频编解码方法、装置、设备、系统及存储介质 - Google Patents

视频编解码方法、装置、设备、系统及存储介质 Download PDF

Info

Publication number
WO2023184250A1
WO2023184250A1 PCT/CN2022/084135 CN2022084135W WO2023184250A1 WO 2023184250 A1 WO2023184250 A1 WO 2023184250A1 CN 2022084135 W CN2022084135 W CN 2022084135W WO 2023184250 A1 WO2023184250 A1 WO 2023184250A1
Authority
WO
WIPO (PCT)
Prior art keywords
quantization
coefficient
parity
coefficients
quantization coefficient
Prior art date
Application number
PCT/CN2022/084135
Other languages
English (en)
French (fr)
Inventor
黄航
徐陆航
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2022/084135 priority Critical patent/WO2023184250A1/zh
Priority to PCT/CN2022/101259 priority patent/WO2023184747A1/zh
Publication of WO2023184250A1 publication Critical patent/WO2023184250A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process
    • H04N19/467Embedding additional information in the video signal during the compression process characterised by the embedded information being invisible, e.g. watermarking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding

Definitions

  • the present application relates to the technical field of video coding and decoding, and in particular to a video coding and decoding method, device, equipment, system and storage medium.
  • Digital video technology can be incorporated into a variety of video devices, such as digital televisions, smartphones, computers, e-readers, or video players.
  • video data includes a larger amount of data.
  • video devices implement video compression technology to make the video data more efficiently transmitted or stored.
  • the transform coefficients are quantized.
  • the purpose of quantization is to scale the transform coefficients, thereby reducing the number of bits consumed when encoding the coefficients.
  • the current quantization method has a high encoding cost.
  • Embodiments of the present application provide a video encoding and decoding method, device, equipment, system and storage medium to reduce the cost of quantization encoding.
  • this application provides a video decoding method, including:
  • the current region is a region in the current block that includes at least one non-zero quantization coefficient.
  • the first quantization coefficient is a pair of P quantization coefficients in the current region.
  • the quantized coefficient obtained after performing parity concealment on the second quantized coefficient, and the P is a positive integer;
  • a second quantization coefficient with parity is determined.
  • embodiments of the present application provide a video encoding method, including:
  • the quantized value of the first quantized coefficient is encoded to obtain a code stream, and the parity of the second quantized coefficient is indicated by P quantized coefficients in the current area, where P is a positive integer.
  • the present application provides a video encoder for performing the method in the above first aspect or its respective implementations.
  • the encoder includes a functional unit for performing the method in the above-mentioned first aspect or its respective implementations.
  • the present application provides a video decoder for performing the method in the above second aspect or various implementations thereof.
  • the decoder includes a functional unit for performing the method in the above-mentioned second aspect or its respective implementations.
  • a video encoder including a processor and a memory.
  • the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the above first aspect or its respective implementations.
  • a sixth aspect provides a video decoder, including a processor and a memory.
  • the memory is used to store a computer program
  • the processor is used to call and run the computer program stored in the memory to execute the method in the above second aspect or its respective implementations.
  • a seventh aspect provides a video encoding and decoding system, including a video encoder and a video decoder.
  • the video encoder is used to perform the method in the above-mentioned first aspect or its various implementations
  • the video decoder is used to perform the method in the above-mentioned second aspect or its various implementations.
  • An eighth aspect provides a chip for implementing any one of the above-mentioned first to second aspects or the method in each implementation manner thereof.
  • the chip includes: a processor, configured to call and run a computer program from a memory, so that the device installed with the chip executes any one of the above-mentioned first to second aspects or implementations thereof. method.
  • a ninth aspect provides a computer-readable storage medium for storing a computer program that causes a computer to execute any one of the above-mentioned first to second aspects or the method in each implementation thereof.
  • a computer program product including computer program instructions, which enable a computer to execute any one of the above-mentioned first to second aspects or the methods in each implementation thereof.
  • An eleventh aspect provides a computer program that, when run on a computer, causes the computer to execute any one of the above-mentioned first to second aspects or the method in each implementation thereof.
  • a twelfth aspect provides a code stream, including a code stream generated by any aspect of the second aspect.
  • the decoder decodes the code stream to obtain P quantization coefficients and the first quantization coefficient in the current area. Then, based on the P quantization coefficients, the parity of the second quantization coefficient is determined, and the parity of the second quantization coefficient is determined based on the first quantization coefficient and The parity of the second quantization coefficient determines the second quantization coefficient with parity.
  • the parity of the second quantization coefficient in the current area is hidden through P quantization coefficients in the current area, so as to reduce the video compression cost.
  • Figure 1 is a schematic block diagram of a video encoding and decoding system related to an embodiment of the present application
  • Figure 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application.
  • Figure 3 is a schematic block diagram of a decoding framework provided by an embodiment of the present application.
  • Figure 4 is a schematic flow chart of a video decoding method provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of area division involved in the embodiment of the present application.
  • Figure 6 is a schematic flow chart of a video decoding method provided by an embodiment of the present application.
  • Figure 7 is a schematic flow chart of a video encoding method provided by an embodiment of the present application.
  • Figure 8 is a schematic flow chart of a video encoding method provided by an embodiment of the present application.
  • Figure 9 is a schematic block diagram of a video decoding device provided by an embodiment of the present application.
  • Figure 10 is a schematic block diagram of a video encoding device provided by an embodiment of the present application.
  • Figure 11 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • Figure 12 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • This application can be applied to the fields of image encoding and decoding, video encoding and decoding, hardware video encoding and decoding, dedicated circuit video encoding and decoding, real-time video encoding and decoding, etc.
  • the solution of this application can be operated in conjunction with other proprietary or industry standards, including ITU-TH.261, ISO/IECMPEG-1Visual, ITU-TH.262 or ISO/IECMPEG-2Visual, ITU-TH.263 , ISO/IECMPEG-4Visual, ITU-TH.264 (also known as ISO/IECMPEG-4AVC), including scalable video codec (SVC) and multi-view video codec (MVC) extensions.
  • SVC scalable video codec
  • MVC multi-view video codec
  • FIG. 1 For ease of understanding, the video encoding and decoding system involved in the embodiment of the present application is first introduced with reference to FIG. 1 .
  • Figure 1 is a schematic block diagram of a video encoding and decoding system related to an embodiment of the present application. It should be noted that Figure 1 is only an example, and the video encoding and decoding system in the embodiment of the present application includes but is not limited to what is shown in Figure 1 .
  • the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120 .
  • the encoding device is used to encode the video data (which can be understood as compression) 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.
  • the encoding device 110 in the embodiment of the present application can be understood as a device with a video encoding function
  • 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. Examples include smartphones, desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, vehicle-mounted computers, and the like.
  • the encoding device 110 may transmit the encoded video data (eg, code stream) to the decoding device 120 via the channel 130 .
  • Channel 130 may include one or more media and/or devices capable of transmitting encoded video data from encoding device 110 to decoding device 120 .
  • channel 130 includes one or more communication media that enables encoding device 110 to transmit encoded video data directly to decoding device 120 in real time.
  • encoding device 110 may modulate the encoded video data according to the communication standard and transmit the modulated video data to decoding device 120.
  • the communication media includes wireless communication media, such as radio frequency spectrum.
  • the communication media may also include wired communication media, such as one or more physical transmission lines.
  • channel 130 includes a storage medium that can store video data encoded by encoding device 110 .
  • Storage media include a variety of local access data storage media, such as optical disks, DVDs, flash memories, etc.
  • the decoding device 120 may obtain the encoded video data from the storage medium.
  • channel 130 may include a storage server that may store video data encoded by encoding device 110 .
  • the decoding device 120 may download the stored encoded video data from the storage server.
  • the storage server may store the encoded video data and may transmit the encoded video data to the decoding device 120, such as a web server (eg, for a website), a File Transfer Protocol (FTP) server, etc.
  • FTP File Transfer Protocol
  • 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.
  • the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113 .
  • Video source 111 may include at least one of a video capture device (eg, a video camera), a video archive, a video input interface for receiving video data from a video content provider, a computer graphics system Used to generate video data.
  • a video capture device eg, a video camera
  • a video archive e.g., a video archive
  • video input interface for receiving video data from a video content provider
  • computer graphics system Used to generate video data.
  • the video encoder 112 encodes the video data from the video source 111 to generate a code stream.
  • Video data may include one or more images (pictures) or sequence of pictures (sequence of pictures).
  • the code stream contains the encoding information of an image or image sequence in the form of a bit stream.
  • Encoded information may include encoded image data and associated data.
  • the associated data may include sequence parameter set (SPS), picture parameter set (PPS) and other syntax structures.
  • SPS sequence parameter set
  • PPS picture parameter set
  • An SPS can contain parameters that apply to one or more sequences.
  • a PPS can contain parameters that apply to one or more images.
  • a syntax structure refers to a collection of zero or more syntax elements arranged in a specified order in a code stream.
  • the video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113 .
  • the encoded video data can also be stored on a storage medium or storage server for subsequent reading by the decoding device 120 .
  • decoding device 120 includes input interface 121 and video decoder 122.
  • the decoding device 120 may also include a display device 123.
  • the input interface 121 includes a receiver and/or a modem. Input interface 121 may receive encoded video data over channel 130.
  • the video decoder 122 is used to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123 .
  • the display device 123 displays the decoded video data.
  • Display device 123 may be integrated with decoding device 120 or external to decoding device 120 .
  • Display device 123 may include a variety of 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.
  • LCD liquid crystal display
  • plasma display a plasma display
  • OLED organic light emitting diode
  • Figure 1 is only an example, and the technical solution of the embodiment of the present application is not limited to Figure 1.
  • the technology of the present application can also be applied to unilateral video encoding or unilateral video decoding.
  • FIG. 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression of images (lossy compression), or can also be used to perform lossless compression (lossless compression) of images.
  • the lossless compression can be visually lossless compression (visually lossless compression) or mathematically lossless compression (mathematically lossless compression).
  • the video encoder 200 can be applied to image data in a luminance-chrominance (YCbCr, YUV) format.
  • YUV ratio can be 4:2:0, 4:2:2 or 4:4:4, Y represents brightness (Luma), Cb(U) represents blue chroma, Cr(V) represents red chroma, U and V represent Chroma, which is used to describe color and saturation.
  • 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 Chroma component (YYYYCbCrCbCr)
  • 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr).
  • the video encoder 200 reads video data, and for each frame of image in the video data, divides one frame of image into several coding tree units (coding tree units, CTU).
  • CTB may be called “Tree block", “Largest Coding unit” (LCU for short) or “coding tree block” (CTB for short).
  • LCU Large Coding unit
  • CTB coding tree block
  • Each CTU can be associated with an equal-sized block of pixels within the image.
  • Each pixel can correspond to one luminance (luminance or luma) sample and two chrominance (chrominance or chroma) samples. Therefore, each CTU can be associated with one block of luma samples and two blocks of chroma samples.
  • a CTU size is, for example, 128 ⁇ 128, 64 ⁇ 64, 32 ⁇ 32, etc.
  • a CTU can be further divided into several coding units (Coding Units, CUs) for encoding.
  • CUs can be rectangular blocks or square blocks.
  • CU can be further divided into prediction unit (PU for short) and transform unit (TU for short), thus enabling coding, prediction, and transformation to be separated and processing more flexible.
  • the CTU is divided into CUs in a quad-tree manner, and the CU is divided into TUs and PUs in a quad-tree manner.
  • Video encoders and video decoders can support various PU sizes. Assuming that the size of a specific CU is 2N ⁇ 2N, the video encoder and video decoder can support a PU size of 2N ⁇ 2N or N ⁇ N for intra prediction, and support 2N ⁇ 2N, 2N ⁇ N, N ⁇ 2N, N ⁇ N or similar sized symmetric PU for inter prediction. The video encoder and video decoder can also support 2N ⁇ nU, 2N ⁇ nD, nL ⁇ 2N and nR ⁇ 2N asymmetric PUs for inter prediction.
  • 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, and a loop filter unit. 260. Decode the image cache 270 and the entropy encoding unit 280. It should be noted that the video encoder 200 may include more, less, or different functional components.
  • the current block may be called the current coding unit (CU) or the current prediction unit (PU), etc.
  • the prediction block may also be called a predicted image block or an image prediction block
  • the reconstructed image block may also be called a reconstruction block or an image reconstructed image block.
  • prediction unit 210 includes inter prediction unit 211 and intra prediction unit 212. Since there is a strong correlation between adjacent pixels in a video frame, the intra-frame prediction method is used in video encoding and decoding technology to eliminate the spatial redundancy between adjacent pixels. Since there is a strong similarity between adjacent frames in the video, the interframe prediction method is used in video coding and decoding technology to eliminate the temporal redundancy between adjacent frames, thereby improving coding efficiency.
  • the inter-frame prediction unit 211 can be used for inter-frame prediction.
  • Inter-frame prediction can refer to image information of different frames.
  • Inter-frame prediction uses motion information to find reference blocks from reference frames and generate prediction blocks based on the reference blocks to eliminate temporal redundancy;
  • the frames used in inter-frame prediction may be P frames and/or B frames.
  • P frames refer to forward prediction frames
  • B frames refer to bidirectional prediction frames.
  • the motion information includes the reference frame list where the reference frame is located, the reference frame index, and the motion vector.
  • the motion vector can be in whole pixels or sub-pixels. If the motion vector is in sub-pixels, then interpolation filtering needs to be used in the reference frame to make the required sub-pixel blocks.
  • the reference frame found based on the motion vector is A block of whole pixels or sub-pixels is called a reference block.
  • Some technologies will directly use the reference block as a prediction block, and some technologies will process the reference block to generate a prediction block. Reprocessing to generate a prediction block based on a reference block can also be understood as using the reference block as a prediction block and then processing to generate a new prediction block based on the prediction block.
  • the intra prediction unit 212 only refers to the information of the same frame image and predicts the pixel information in the current coded image block to eliminate spatial redundancy.
  • the frames used in intra prediction may be I frames.
  • the white 4 ⁇ 4 block is the current block
  • 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 of them may have been encoded and decoded. There may also be some parts that are unavailable. For example, if the current block is the leftmost part of the entire frame, then the reference pixel on the left side of the current block is unavailable.
  • the lower left part of the current block has not been encoded or decoded, so the reference pixels in the lower left are also unavailable.
  • the available reference pixels or certain values or certain methods can be used for filling, or no filling can be performed.
  • the intra prediction method also includes a multiple reference line intra prediction method (multiple reference line, MRL).
  • MRL can use more reference pixels to improve coding efficiency.
  • mode 0 is to copy the pixels above the current block in the vertical direction to the current block as the prediction value
  • mode 1 is to copy the reference pixel on the left to the current block in the horizontal direction as the prediction value
  • mode 2 is to copy A ⁇
  • the average value of the eight points D and I ⁇ L is used as the predicted value of all points.
  • Mode 3 to mode 8 copy the reference pixel to the corresponding position of the current block at a certain angle. Because some positions of the current block cannot exactly correspond to the reference pixels, it may be necessary to use the weighted average of the reference pixels, or the sub-pixels of the interpolated reference pixels.
  • the intra-frame prediction modes used by HEVC include planar mode (Planar), DC and 33 angle modes, for a total of 35 prediction modes.
  • the intra-frame modes used by VVC include Planar, DC and 65 angle modes, for a total of 67 prediction modes.
  • the intra-frame modes used by AVS3 include DC, Plane, Bilinear and 63 angle modes, for a total of 66 prediction modes.
  • Residual unit 220 may generate a residual block of the CU based on the pixel block of the CU and the prediction block of the PU of the CU. For example, residual unit 220 may generate a residual block of a CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the PU of the CU. Predict the corresponding sample in the block.
  • Transform/quantization unit 230 may quantize the transform coefficients. Transform/quantization unit 230 may quantize transform coefficients associated with the TU of the CU based on quantization parameter (QP) values associated with the CU. Video encoder 200 may adjust the degree of quantization applied to transform coefficients associated with the CU by adjusting the QP value associated with the CU.
  • QP quantization parameter
  • Inverse transform/quantization unit 240 may apply inverse quantization and inverse transform to the quantized transform coefficients, respectively, to reconstruct the residual block from the quantized transform coefficients.
  • 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 produce a reconstructed image block associated with the TU. By reconstructing blocks of samples for each TU of a CU in this manner, video encoder 200 can reconstruct blocks of pixels of the CU.
  • Loop filtering unit 260 may perform deblocking filtering operations to reduce blocking artifacts for blocks of pixels associated with the CU.
  • the loop filtering unit 260 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, and an adaptive loop filtering ALF unit.
  • Decoded image cache 270 may store reconstructed pixel blocks.
  • Inter prediction unit 211 may perform inter prediction on PUs of other images using reference images containing reconstructed pixel blocks.
  • intra prediction unit 212 may use the reconstructed pixel blocks in decoded image cache 270 to perform intra prediction on other PUs in the same image as the CU.
  • Entropy encoding unit 280 may receive the quantized transform coefficients from transform/quantization unit 230 . Entropy encoding unit 280 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy encoded data.
  • the basic process of video encoding involved in this application is as follows: at the encoding end, the current image is divided into blocks, and for the current block, the prediction unit 210 uses intra prediction or inter prediction to generate a prediction block of the current block.
  • the residual unit 220 may calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block.
  • the residual block may also be called residual information.
  • the residual block undergoes transformation and quantization processes such as transformation/quantization unit 230 to remove information that is insensitive to human eyes to eliminate visual redundancy.
  • the residual block before transformation and quantization by the transformation/quantization unit 230 may be called a time domain residual block, and the time domain residual block after transformation and quantization by the transformation/quantization unit 230 may be called a frequency residual block. or frequency domain residual block.
  • the entropy encoding unit 280 receives the quantized transform coefficients output by the transform and quantization unit 230, and may perform entropy encoding on the quantized transform coefficients to output a code stream. For example, the entropy encoding unit 280 may eliminate character redundancy according to the target context model and probability information of the binary code stream.
  • the video encoder performs inverse quantization and inverse transformation on the quantized transform coefficients output by the transform and quantization unit 230 to obtain the residual block of the current block, and then adds the residual block of the current block and the prediction block of the current block, Get the reconstructed block of the current block.
  • reconstruction blocks corresponding to other image blocks in the current image can be obtained, and these reconstruction blocks are spliced to obtain a reconstructed image of the current image. Since errors are introduced during the encoding process, in order to reduce the error, the reconstructed image is filtered.
  • ALF is used to filter the reconstructed image to reduce the difference between the pixel value of the pixel in the reconstructed image and the original pixel value of the pixel in the current image. difference.
  • the filtered reconstructed image is stored in the decoded image cache 270 and can be used as a reference frame for inter-frame prediction for subsequent frames.
  • the block division information determined by the encoding end as well as mode information or parameter information such as prediction, transformation, quantization, entropy coding, loop filtering, etc., are carried in the code stream when necessary.
  • the decoding end determines the same block division information as the encoding end by parsing the code stream and analyzing the existing information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information, thereby ensuring the decoded image obtained by the encoding end It is the same as the decoded image obtained by the decoding end.
  • Figure 3 is a schematic block diagram of a video decoder provided by an embodiment of the present application.
  • 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 filtering unit 350 and a decoded image cache 360 . It should be noted that the video decoder 300 may include more, less, or different functional components.
  • Video decoder 300 can receive the code stream.
  • Entropy decoding unit 310 may parse the codestream to extract syntax elements from the codestream. As part of parsing the code stream, the entropy decoding unit 310 may parse entropy-encoded syntax elements in the code stream.
  • the prediction unit 320, the inverse quantization/transformation unit 330, the reconstruction unit 340 and the loop filtering unit 350 may decode the video data according to the syntax elements extracted from the code stream, that is, generate decoded video data.
  • prediction unit 320 includes inter prediction unit 321 and intra prediction unit 322.
  • Inter prediction unit 321 may perform intra prediction to generate predicted blocks for the PU. Inter prediction unit 321 may use an intra prediction mode to generate predicted blocks for a PU based on pixel blocks of spatially neighboring PUs. Inter prediction unit 321 may also determine the intra prediction mode of the PU based on one or more syntax elements parsed from the codestream.
  • Intra prediction unit 322 may construct a first reference image list (List 0) and a second reference image list (List 1) based on syntax elements parsed from the codestream. Additionally, if the PU uses inter-prediction encoding, entropy decoding unit 310 may parse the motion information of the PU. Intra-prediction unit 322 may determine one or more reference blocks for the PU based on the motion information of the PU. Intra-prediction unit 322 may generate a predicted block for the PU based on one or more reference blocks of the PU.
  • Inverse quantization/transform unit 330 may inversely quantize (ie, dequantize) transform coefficients associated with a TU. Inverse quantization/transform unit 330 may use the QP value associated with the CU of the TU to determine the degree of quantization.
  • inverse quantization/transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients to produce a residual block associated with the TU.
  • Reconstruction unit 340 uses the residual blocks associated with the TU of the CU and the prediction blocks of the PU of the CU to reconstruct the pixel blocks of the CU. For example, reconstruction unit 340 may 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.
  • Loop filtering unit 350 may perform deblocking filtering operations to reduce blocking artifacts for blocks of pixels associated with the CU.
  • the loop filtering unit 350 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, and an adaptive loop filtering ALF unit.
  • Video decoder 300 may store the reconstructed image of the CU in decoded image cache 360 .
  • the video decoder 300 may use the reconstructed image in the decoded image cache 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
  • the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block.
  • the prediction unit 320 uses intra prediction or inter prediction for the current block based on the prediction information to generate the current block.
  • the inverse quantization/transform unit 330 uses the quantization coefficient matrix obtained from the code stream to perform inverse quantization and inverse transformation on the quantization coefficient matrix to obtain a residual block.
  • the reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstruction block.
  • the reconstructed blocks constitute a reconstructed image
  • the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image.
  • the decoded image can also be called a reconstructed image.
  • the reconstructed image can be displayed by the display device, and on the other hand, it can be stored in the decoded image buffer 360 and used as a reference frame for inter-frame prediction for subsequent frames.
  • Quantization and inverse quantization are closely related to the coefficient coding part.
  • the purpose of quantization is to scale the transform coefficients, thereby reducing the number of bits consumed when encoding coefficients.
  • the quantized object is the residual, that is, the residual is directly scaled and then encoded.
  • t i is the transformation coefficient
  • qstep is the quantization step size, which is related to the quantization parameters set in the configuration file
  • q i is the quantization coefficient
  • round is the rounding process, which is not limited to upper rounding or lower rounding, etc., the quantization process Controlled by the encoder.
  • t′ i is the reconstructed transformation coefficient. Due to the accuracy loss caused by the rounding process, t′ i and t i are different.
  • Quantization will reduce the accuracy of the transform coefficients, and the loss of accuracy is irreversible.
  • Encoders usually measure the cost of quantization through a rate-distortion cost function.
  • B() is the bits consumed by the encoder to estimate the encoding quantization coefficient qi .
  • multi-symbol arithmetic coding may be used to encode or decode the quantized coefficients, and each quantized coefficient may be indicated by one or more multi-symbol identifiers. Specifically, Depending on the size of the quantization coefficient, it can be segmented and represented by the following multi-symbol identification bits.
  • 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.
  • 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, further encoding/decoding of identifier 3 is required.
  • 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, further encoding/decoding of identifier 4 is required.
  • Identification 4 represents the part from 9 to 12, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identification 4 is 3, identification 5 needs to be further encoded/decoded.
  • Identification 5 indicates the part from 12 to 15, with a total of 4 symbols (0, 1, 2, 3). When the symbol of identification 5 is 3, it is necessary to further encode/decode the part greater than or equal to 15.
  • encoding/decoding identifies 1-5 in scanning order from the last non-zero coefficient to the upper left corner of the transform block.
  • S() is the multi-symbol context model coding
  • L(1) is the bypass coding
  • the current encoding method of quantized coefficients is usually to fully encode the sign and absolute value of the quantized coefficient, which occupies a lot of bits and is expensive to encode.
  • At least one quantized coefficient in the current area is hidden according to the parity related to the quantized coefficient in the current area, so as to reduce the encoding cost.
  • FIG. 4 is a schematic flowchart of a video decoding method provided by an embodiment of the present application.
  • the embodiment of the present application is applied to the video decoders shown in FIGS. 1 and 3 .
  • the method in the embodiment of this application includes:
  • S401 Decode the code stream to obtain P quantization coefficients and the first quantization coefficient in the current area.
  • the current area is an area in the current block that includes at least one non-zero quantization coefficient
  • the first quantization coefficient is a quantization coefficient obtained by parity concealing the second quantization coefficient in the current area.
  • the quantization coefficient whose parity is hidden is called the first quantization coefficient.
  • the first quantized coefficient whose parity is hidden is also called a hidden coefficient.
  • the current block is divided into one or more areas, for example, into N areas, where N is a positive integer.
  • the parity of one or more quantized coefficients in the area can be hidden based on the parity related to the quantized coefficients in the same area, for example, based on the parity of the sum of the absolute values of the quantized coefficients in the area.
  • the second quantization coefficient whose parity is to be hidden is a1, and a1 is an odd number
  • the P quantized coefficients are all quantized coefficients in the current region except the first quantized coefficient.
  • the above P quantization coefficients are partial quantization coefficients in the current region.
  • the above-mentioned P quantization coefficients do not include the first quantization coefficient in the current region.
  • the above-mentioned quantized coefficients are obtained by quantizing the transform coefficients.
  • 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 quantized coefficient, and then encodes the quantized coefficient to obtain the code stream.
  • the decoder receives the code stream, decodes the code stream, obtains the quantized coefficients, inversely quantizes the quantized coefficients to obtain the transform coefficients of the current block, and then inversely transforms the transform coefficients to obtain the residual value of the current block.
  • the above-mentioned current block may also be called a current transform block.
  • the above-mentioned quantization coefficient is obtained by quantizing the residual value.
  • 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 quantizes the residual value to obtain the quantized coefficients, and then encodes the quantized coefficients to obtain the code stream.
  • the decoder receives the code stream, decodes the code stream, obtains the quantized coefficients, and performs inverse quantization on the quantized coefficients to obtain the residual value of the current block.
  • the quantization coefficient can be understood as a numerical value composed of an absolute value and a sign decoded from the code stream.
  • the absolute value includes the value of the flag bit corresponding to the quantization coefficient. If the value of the quantization coefficient exceeds 15, It also includes absolute values exceeding 15 parts.
  • the current block can be divided into N areas, and the sizes of these N areas can be the same or different.
  • the decoding end and the encoding end use the same region division method to divide the current block into N regions.
  • both the decoding end and the encoding end use the default region division method to divide the current block into N regions.
  • the encoding end may indicate the region division mode of the current block to the decoding end. For example, a flag A is encoded in the code stream, and the flag A is used to indicate the region division mode of the current block. In this way, the decoding end obtains the flag A by decoding the code stream, and determines the area division method of the current block based on the flag A.
  • the flag A may be a sequence-level flag, used to indicate that all decoding blocks in the sequence may use this region division method to divide the decoding blocks into N regions.
  • the flag A may be a frame-level flag, used to indicate that all decoded blocks in the image frame may use this region division method to divide the decoded blocks into N regions.
  • the flag A may be a slice-level flag, used to indicate that all decoded blocks in the image slice may use this region division method to divide the decoded blocks into N regions.
  • the flag A can be a block-level flag, used to indicate that the current block can be divided into N areas using this area division method.
  • the process by which the decoder determines the P quantization coefficients and the first quantization coefficient in the current area includes but is not limited to the following examples:
  • Example 1 The decoder decodes region by region to obtain the quantized coefficients of each region. For example, after decoding the quantized coefficients of a region, the decoder determines the P quantized coefficients and the first quantized coefficient of the region, and then decodes The quantization coefficient of the next area is determined, and based on the quantization coefficient of the next area, the P quantization coefficients and the first quantization coefficient of the next area are determined. That is to say, in this embodiment, the decoder can determine the P quantization coefficients and the first quantization coefficient in the current region when all the quantization coefficients of the current block are not completely decoded. For example, the region is divided into K pixels in the scanning direction as one region. In this way, when the decoder decodes the K quantized coefficients, it determines P of the K quantized coefficients based on the K quantized coefficients. quantization coefficient and the first quantization coefficient.
  • Example 2 After determining all the quantization coefficients of the current block, the decoder determines the P quantization coefficients and the first quantization coefficient in the current region. Specifically, it includes the following steps:
  • the decoder first decodes the code stream to obtain decoded information of the current block.
  • the decoded information includes quantized coefficients of different areas in the current block.
  • the current block is divided into N regions according to the region division method. Assuming that the current area is the k-th area among the N areas, the decoded information corresponding to the k-th area among the decoded information of the current block is determined as the decoded information of the current area.
  • the decoded information of the current area includes P quantization coefficients in the current area and the first quantization coefficient.
  • Method 1 Divide the current block into N areas according to the scanning order.
  • At least two areas among the N areas include the same number of quantization coefficients.
  • At least two of the N regions include different numbers of quantization coefficients.
  • every M non-zero quantized coefficients in the current block are divided into a region, resulting in N regions.
  • Each of these N regions includes M non-zero quantization coefficients.
  • At least one of the N regions includes one or more hidden coefficients.
  • the non-zero quantization coefficient included in the last region is not M, then the last region is divided into a separate region, or the last region and the previous region are merged into one region.
  • every K pixels in the current block are divided into a region, resulting in N regions.
  • N regions For example, for an 8x8 size transform block using the reverse ZigZag scan order, when each region is of equal size, that is, each region contains 16 coefficients, as shown in Figure 5, the current block is divided into 4 regions.
  • the divided N regions are of the same size, and each region includes K pixels. There may be regions in these N regions where the quantization coefficients are all 0, or there may be regions that do not include hidden coefficients. That is, at least one region among the N regions includes one or more hidden coefficients.
  • the quantization coefficient included in the last region is not K, the last region is divided into a separate region, or the last region and the previous region are merged into one region.
  • Method 2 Divide the current block into N areas according to the spatial position
  • the above-mentioned N areas are sub-blocks of the current block.
  • the current block is evenly divided into N sub-blocks.
  • the size of each sub-block is 4*4.
  • each sub-block includes at least one non-zero quantization coefficient.
  • the method of dividing the current block into N areas may also include other methods, and the embodiment of the present application does not limit this.
  • the current region in this embodiment of the present application includes at least one first quantization coefficient, that is, a hidden coefficient.
  • the first quantization coefficient may be any non-zero quantization coefficient in the current area defaulted by the codec end.
  • the first quantization coefficient may be a non-zero quantization coefficient with the largest absolute value in the current region.
  • the first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current area, and the K is less than or equal to the number of non-zero quantization coefficients in the current area.
  • the current area contains 16 coefficients, and the 16th non-zero quantization coefficient and/or the 15th non-zero quantization coefficient in the scanning order can be used as the first quantization coefficient of the current area.
  • a flag may be used to indicate whether the current block is allowed to use the technology of hiding the parity of quantization coefficients provided by the embodiments of this application.
  • the technology for hiding the parity of the quantization coefficient provided by the embodiments of the present application is also called the parity hiding technology.
  • the at least one flag set may be a flag of different levels, used to indicate whether the corresponding level allows the parity of the quantization coefficient to be hidden.
  • the at least one flag includes at least one of a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag.
  • the above-mentioned at least one flag includes a sequence-level flag, which is used to indicate whether the current sequence allows the parity of the quantization coefficient to be hidden. For example, if the value of the sequence-level flag is 1, it indicates that the current sequence allows the parity of the quantized coefficient to be hidden. If the value of the sequence-level flag is 0, it indicates that the current sequence does not allow the parity of the quantized coefficient to be hidden. .
  • the sequence-level flag may be located in the sequence header.
  • the above-mentioned at least one flag includes a picture-level flag, which is used to indicate whether the current picture allows the parity of the quantization coefficient to be hidden. For example, if the value of the image-level flag is 1, it indicates that the current image allows the parity of the quantized coefficient to be hidden. If the value of the image-level flag is 0, it indicates that the current image does not allow the parity of the quantized coefficient to be hidden. .
  • the image-level flag may be located in the picture header.
  • the above-mentioned at least one flag includes a slice-level flag, which is used to indicate whether the current slice (slice) allows the parity of the quantization coefficient to be hidden. For example, if the value of the slice-level flag is 1, it indicates that the current slice allows the parity of the quantized coefficient to be hidden. If the value of the slice-level flag is 0, it indicates that the current slice does not allow the parity of the quantized coefficient to be hidden. .
  • the slice-level flag may be located in the slice header.
  • the above-mentioned at least one flag includes a unit-level flag, which is used to indicate whether the current CTU allows the parity of the quantization coefficient to be hidden. For example, if the value of the unit-level flag is 1, it indicates that the current CTU allows the parity of the quantized coefficient to be hidden. If the value of the unit-level flag is 0, it indicates that the current CTU does not allow the parity of the quantized coefficient to be hidden. .
  • the above-mentioned at least one flag includes a block-level flag, which is used to indicate whether the current block allows the parity of the quantization coefficient to be hidden. For example, if the value of the block-level flag is 1, it indicates that the current block allows the parity of the quantized coefficient to be hidden. If the value of the block-level flag is 0, it indicates that the current block does not allow the parity of the quantized coefficient to be hidden. .
  • the decoder first decodes the code stream to obtain at least one of the above flags, and determines whether the current block allows the parity of the quantized coefficient to be hidden based on the at least one flag. If it is determined based on at least one of the above flags that the parity of the quantized coefficient is not allowed to be hidden in the current block, the method in the embodiment of the present application is skipped, and the decoded quantized coefficient is directly inversely quantized to obtain the transform coefficient. If it is determined based on at least one of the above flags that the current block is allowed to use the parity concealment technology provided by the embodiment of the present application, the method of the embodiment of the present application is executed.
  • the decoder first decodes the code stream to obtain the sequence-level flag. If the sequence-level flag indicates that the current sequence does not allow the use of the quantization coefficient parity concealment technology provided by the embodiment of the present application, the method of the embodiment of the present application is skipped and the method is used. The traditional method is to dequantize the current block. If the sequence-level flag indicates that the current sequence is allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application, continue to decode the code stream to obtain the image-level flag.
  • the image-level flag indicates that the current image is not allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application.
  • the method in the embodiment of the present application is skipped, and the traditional method is used to inverse quantize the current block. If the picture-level flag indicates that the current picture is allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application, continue to decode the code stream to obtain the slice-level flag. If the slice-level flag indicates that the current picture is not allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application.
  • the method in the embodiment of the present application is skipped, and the traditional method is used to inverse quantize the current block. If the slice-level flag indicates that the current slice is allowed to use the quantization coefficient parity concealment technology provided by the embodiment of this application, continue to decode the code stream to obtain the unit-level flag. If the unit-level flag indicates that the current CTU is not allowed to use the quantization coefficient parity concealment technology provided by the embodiment of this application.
  • the method in the embodiment of the present application is skipped, and the traditional method is used to inverse quantize the current block.
  • the unit-level flag indicates that the current CTU is allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application, continue to decode the code stream to obtain the block-level flag. If the block-level flag indicates that the current block is not allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application. When using the quantization coefficient parity concealment technology, the method in the embodiment of the present application is skipped, and the traditional method is used to inverse quantize the current block. If the block-level flag indicates that the current block is allowed to use the quantization coefficient parity concealment technology provided by the embodiment of the present application, then the embodiment of the present application is executed.
  • the quantization coefficient parity hiding technology provided by the embodiments of the present application is mutually exclusive with the target transformation method, where the target transformation method includes secondary transformation or multiple transformations.
  • the decoder determines that the current block is transformed using the target transformation method, it skips the technical solution provided by the embodiment of the present application, for example, skips the following step S402.
  • step S402 after decoding to obtain P quantization coefficients in the current area and the first quantization coefficient, the following step S402 is performed.
  • the encoding end performs parity hiding on the second quantization coefficient according to the parity of the second quantization coefficient in the current area, obtains the first quantization coefficient, and encodes the first quantization coefficient. , while using P quantization coefficients in the current area to indicate the parity of the second quantization coefficient. In this way, after the decoder obtains the P quantized coefficients in the current region according to the above steps, it can determine the parity of the second quantized coefficient based on the P quantized coefficients in the current region.
  • the embodiment of the present application does not limit the method of determining the parity of the second quantization coefficient in the current area based on the P quantization coefficients in the current area in S402 mentioned above.
  • a binary characteristic (0 or 1) of the P quantization coefficients in the current area is used to determine the parity of the second quantization coefficient in the current area.
  • the above S402 includes the following S402-A:
  • Example 1 if the parity corresponding to the P quantization coefficients is indicated by the parity of the sum of the first absolute values of the P quantization coefficients, at this time, the above S402-A includes: according to the sum of the first absolute values of the P quantization coefficients. The parity of the sum determines the parity of the second quantization coefficient.
  • the first absolute value of the quantized coefficient is part or all of the absolute value of the quantized coefficient.
  • the first absolute value is a part of the absolute value of the quantized coefficient that is less than 15.
  • 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.
  • the entire absolute value of the quantized coefficient refers to the entire decoded absolute value of the quantized coefficient, including the value of each identification bit. If the absolute value of the quantized coefficient is greater than 15, it will also Includes values with more than 15 parts.
  • some of the absolute values of the absolute values of the quantization coefficients refer to the values of all or part of the identification bits.
  • the decoding end determines the parity of the sum of the absolute values of the identification 1 values of the P quantization coefficients. The parity of the second quantization coefficient.
  • the second quantization coefficient is determined to be an even number.
  • Example 1 if the parity of the second quantized coefficient is inconsistent with the parity of the sum of the first absolute values of the P quantized coefficients, the coding end will Parity is modified. For example, if the second quantization coefficient is an odd number, and the sum of the first absolute values of the P quantization coefficients is an even number, at this time, the smallest quantization coefficient among the P quantization coefficients is added or subtracted by 1 to reduce the sum of the P quantization coefficients. The sum of the first absolute values is modified to be an odd number.
  • the second quantization coefficient is an even number
  • the sum of the first absolute values of the P quantization coefficients is an odd number
  • the smallest quantization coefficient among the P quantization coefficients is added or subtracted by 1 to change the P quantization coefficients.
  • the sum of the first absolute values of is modified to an even number.
  • Example 2 if the parity corresponding to the P quantization coefficients is the parity of the number of target quantization coefficients among the P quantization coefficients, at this time, the above S402-A includes: determining the target quantization coefficient among the P quantization coefficients, and The parity of the second quantization coefficient is determined according to the parity of the number of target quantization coefficients among the P quantization coefficients.
  • the above-mentioned target quantization coefficient is any one of the non-zero quantization coefficients among the P quantization coefficients, the non-zero quantization coefficients with even values, the quantization coefficients with even values, and the quantization coefficients with odd values.
  • the parity of the second quantization coefficient can be determined according to the parity of the number of non-zero quantization coefficients among the P quantization coefficients.
  • the second quantization coefficient is determined to be an odd number.
  • the second quantization coefficient is determined to be an even number.
  • the encoding end performs on at least one coefficient among the P quantized coefficients. Revise. For example, if the second quantization coefficient is an odd number and the number of non-zero quantization coefficients among the P quantization coefficients is an even number, then one of the P quantization coefficients that is zero can be adjusted to 1, or P quantization coefficients can be adjusted to 1. The value of the smallest quantization coefficient among the quantization coefficients is adjusted to 0, so that the number of non-zero quantization coefficients among the P quantization coefficients is an odd number.
  • the quantization coefficient in which one of the P quantization coefficients is zero can be adjusted to 1, or P The value of the smallest quantization coefficient among the P quantization coefficients is adjusted to 0, so that the number of non-zero quantization coefficients among the P quantization coefficients is an even number.
  • the target quantization coefficient is a non-zero quantization coefficient with an even number among the P quantization coefficients
  • the number of non-zero quantization coefficients with an even number among the P quantization coefficients can be determined. The parity of the second quantization coefficient.
  • the second quantization coefficient is determined to be an odd number.
  • the second quantization coefficient is determined to be an even number.
  • the encoding end will At least one coefficient is modified. For example, if the second quantization coefficient is an odd number, and the number of non-zero quantization coefficients among the P quantization coefficients is an even number, then the quantization coefficient in which one of the P quantization coefficients is zero can be adjusted to 2, or , add 1 or subtract 1 to the value of the smallest non-zero quantization coefficient among the P quantization coefficients, so that the number of non-zero quantization coefficients with even values among the P quantization coefficients is an odd number.
  • the quantization coefficient in which one of the P quantization coefficients is zero can be adjusted to 2
  • the second quantization coefficient can be determined based on the parity of the number of quantization coefficients with an even number among the P quantization coefficients. parity.
  • the quantization coefficients with an even number include quantization coefficients with a value of 0.
  • the second quantization coefficient is determined to be an odd number.
  • the second quantization coefficient is determined to be an even number.
  • the encoding end will coefficients are modified. For example, if the second quantization coefficient is an odd number, and the number of quantization coefficients with an even value among the P quantization coefficients is an even number, then one of the P quantization coefficients with a zero quantization coefficient can be adjusted to 1, or, The smallest non-zero quantization coefficient among the P quantization coefficients is adjusted to 0, so that the number of quantization coefficients with even values among the P quantization coefficients is an odd number.
  • the second quantization coefficient is an even number
  • the number of quantization coefficients with even values among the P quantization coefficients is an odd number
  • one of the P quantization coefficients with a value of zero can be adjusted to 1, or, Adjust the smallest non-zero quantization coefficient among the P quantization coefficients to 0 so that the number of quantization coefficients among the P quantization coefficients is an even number.
  • the second quantization coefficient can be determined based on the parity of the number of quantization coefficients with an odd value among the P quantization coefficients. parity.
  • the second quantization coefficient is determined to be an odd number.
  • the second quantization coefficient is determined to be an even number.
  • the encoding end will coefficients are modified. For example, if the second quantization coefficient is an odd number, and the number of quantization coefficients with odd values among the P quantization coefficients is an even number, then one of the P quantization coefficients with a zero value can be adjusted to 1, or, The smallest non-zero quantization coefficient among the P quantization coefficients is adjusted to 0 or plus 1 or minus 1, so that the number of quantization coefficients with odd values among the P quantization coefficients is an odd number.
  • the quantization coefficient in which one of the P quantization coefficients is zero can be adjusted to 1, or, Adjust the smallest non-zero quantization coefficient among the P quantization coefficients to 0 or add 1 or subtract 1 so that the number of quantization coefficients among the P quantization coefficients is an even number.
  • the encoding end uses an adjustment method with the smallest rate distortion cost to adjust at least one coefficient among the P quantization coefficients.
  • the parity of the second quantization coefficient is determined based on the parity of the preset features corresponding to other quantization coefficients in the current region.
  • step S403 is performed.
  • the coding end in order to reduce the coding cost, performs parity hiding on the second quantized coefficient in the current area to obtain the first quantized coefficient. Since the parity of the second quantized coefficient is hidden, therefore, Indicated by P quantization coefficients in the current area. In this way, when decoding the current area, the decoding end first decodes the code stream to obtain P quantization coefficients in the current area and the first quantization coefficient.
  • the second quantization coefficient with parity can be reconstructed, that is, the reconstruction of the coefficient with hidden parity can be achieved.
  • the decoder uses different ways to reconstruct the second quantized coefficient according to the parity of the second quantized coefficient.
  • the first operation method is used to operate the first quantization coefficient to obtain the second quantization coefficient.
  • the first operation mode used by the decoding end corresponds to the third operation mode used by the encoding end to determine the first quantization coefficient.
  • the embodiments of the present application do not limit the specific forms of the above-mentioned first operation method and the third operation method, where the first operation method can be understood as the inverse operation of the third operation method.
  • Method 1 For non-zero quantized coefficients, if the third operation method adopted by the encoding end is to add one to the value of the second quantized coefficient and divide it by two, it will be used as the first quantized coefficient.
  • the first operation method adopted by the decoder is that the value of the second quantization coefficient is equal to the first quantization coefficient multiplied by two minus one.
  • the first operation method is as shown in formula (4):
  • C is the second quantization coefficient
  • val is the first quantization coefficient
  • the second quantization coefficient is determined according to the first operation method shown in the above formula (4).
  • the quantization coefficients corresponding to these 6 pixels are obtained: 5, 6, 3, 2, 2, 0, and the current area is located at the scanning position.
  • the last five quantization coefficients are determined as P quantization coefficients.
  • the P quantization coefficients in the current area are 6, 3, 2, 2, and 0 respectively, among which the first quantization coefficient is 5.
  • the second quantization coefficient with an original value of 9 is hidden to 5 through the parity hiding technology in the embodiment of the present application, which can reduce the number of bits required for encoding and greatly reduce the encoding cost.
  • the above formula (4) is only an example of the first operation method involved in the embodiment of the present application.
  • the first operation method in the embodiment of the present application includes but is not limited to the above formula (4).
  • the second operation method is used to operate the first quantization coefficient to obtain the second quantization coefficient.
  • the second operation mode used by the decoding end corresponds to the fourth operation mode used by the encoding end to determine the first quantization coefficient.
  • the fourth operation method adopted by the encoding end is to divide the value of the second quantization coefficient by two as the first quantization coefficient.
  • the second operation mode adopted by the decoding end is that the value of the second quantization coefficient is equal to the first quantization coefficient multiplied by two.
  • the second operation method is as shown in formula (5):
  • C is the second quantization coefficient
  • val is the first quantization coefficient
  • the current second quantization coefficient is determined according to the second operation method shown in the above formula (5).
  • the quantization coefficients corresponding to these 6 pixels are obtained: 4, 3, 3, 2, 2, 0, and the current area is located at the scanning position.
  • the last five quantization coefficients are determined as P quantization coefficients.
  • the P quantization coefficients in the current area are 3, 3, 2, 2, and 0 respectively, among which the first quantization coefficient is 4.
  • the second quantization coefficient with the original value of 8 is processed into the first quantization coefficient with the value of 4 through the method of the embodiment of the present application, which can reduce the number of bits required for encoding and reduce the encoding cost.
  • the decoder can determine the second quantization coefficient in the following manner, that is, the above S403 includes the following steps:
  • the above-mentioned preset operation method includes multiplying the first quantization coefficient by two, that is, multiplying the value of the first quantization coefficient by two to obtain the operation result.
  • the second quantization coefficient is obtained. For example, the sum of the operation result and the preset value is determined as the value of the second quantization coefficient, where, if the second quantization coefficient is If the second quantization coefficient is an even number, the default value is 1. If the second quantization coefficient is an even number, the default value is 0.
  • the decoder can determine the second quantization coefficient according to the following formula (6):
  • Quant[pos] on the right side of the equal sign is the first quantization coefficient at the current position
  • Quant[pos] on the left side of the equal sign is the second quantization coefficient obtained by reconstruction
  • the code stream is decoded to obtain the quantization coefficient Quant[pos] of the current position. If the quantization coefficient of the current position is the first quantization coefficient, the second quantization coefficient of the current position is equal to Quant[pos] times After 2, add the value corresponding to the parity.
  • the decoding end it is possible to determine the second quantization coefficient corresponding to the first quantization coefficient of other areas in the current block, the second quantization coefficient of each area in the current block, and other quantization coefficients whose parity is not hidden to form the current block.
  • the quantization coefficient of the block Next, the reconstruction value of the current block is determined based on the quantization coefficient of the current block.
  • the encoding end if the encoding end skips the transformation step, the residual value of the current block is directly quantized.
  • the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the residual value of the current block.
  • the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • the encoding end if the encoding end does not skip the transformation step, that is, the encoding end transforms the residual value of the current block to obtain the transform coefficient, and quantizes the transform coefficient.
  • the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the transform coefficient of the current block, and performs inverse transformation on the transform coefficient to obtain the residual value of the current block.
  • the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • the decoder decodes the code stream to obtain P quantization coefficients and the first quantization coefficient in the current area, and then determines the parity of the second quantization coefficient based on the P quantization coefficients, and According to the parity of the first quantization coefficient and the second quantization coefficient, a second quantization coefficient with parity is determined.
  • the parity of the second quantization coefficient in the current area is hidden through P quantization coefficients in the current area, and the first quantization coefficient is obtained.
  • the first quantization coefficient is encoded during encoding, which can reduce the encoding time. The number of bits required reduces the cost of video compression.
  • Figure 6 is a schematic flowchart of a video decoding method provided by an embodiment of the present application. As shown in Figure 6, the method in the embodiment of this application includes:
  • the above-mentioned at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.
  • the at least one flag includes at least one of a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag.
  • the decoder first decodes the code stream to obtain at least one of the above flags, and based on the at least one flag, determines whether the current block allows the parity of the quantization coefficient to be hidden.
  • the following steps S602 and S609 are performed, that is, the code stream is decoded to obtain the decoded information of the current block, and the decoded information includes the current block.
  • the quantization coefficient of the block At this time, since the quantization coefficient in the current block has not been parity hidden, a subsequent inverse quantization process is performed.
  • the decoded information of the current block includes the quantization coefficient in the current block.
  • the decoding end first decodes the identifiers 1 to 5, and then decodes the part where the absolute value of each quantization coefficient exceeds 15 in the scanning order from the last non-zero coefficient to the upper left corner of the transform block, and finally obtains the parts of each quantization coefficient in the current block. Quantization coefficient.
  • the embodiment of the present application does not limit the method of dividing the area of the current block.
  • the current block is divided into N areas according to the decoding scanning order, or the current block is divided into N areas according to the spatial position of the pixels in the current block. .
  • the sizes of the above-mentioned N areas may be the same or different, and this is not limited in the embodiment of the present application.
  • the current area is an area to be decoded among the N areas of the current block.
  • the decoded information of the current block includes the quantization coefficient in the current block.
  • the P quantization coefficients and the first quantization coefficient included in the current area can be obtained from the decoded information of the current block.
  • the above-mentioned P quantization coefficients are all quantization coefficients of the current region.
  • the above-mentioned P quantization coefficients are partial quantization coefficients of the current region.
  • the P quantization coefficients may include quantization coefficients whose parity is hidden in the current region, or may not include quantization coefficients whose parity is hidden in the current region, for example , the above-mentioned P quantization coefficients are other quantization coefficients in the current area except the first quantization coefficient whose parity is hidden.
  • the parity concealment technology proposed in this application is limited. Specifically, if the current area meets the set preset conditions, it means that the current area can obtain significant beneficial effects by using the parity hiding technology provided by the embodiment of the present application. At this time, the following steps S606 to S608 are performed. If the current area does not meet the set preset conditions, it means that the parity hiding technology provided by the embodiment of the present application cannot achieve significant beneficial effects in the current area. In this case, perform the following step S609.
  • the above preset conditions include at least one of the following conditions:
  • Condition 1 The number of non-zero quantization coefficients in the current area is greater than the first value
  • Condition 2 In the current area, the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the decoding scanning order is greater than the second value
  • Condition 3 In the current area, the distance between the first non-zero quantized coefficient and the last quantized coefficient in the decoding scanning order is greater than the third value
  • Condition 4 In the current area, the sum of the absolute values of the non-zero quantization coefficients is greater than the fourth value.
  • the above four conditions can also be combined with each other to form new constraints.
  • the embodiments of the present application do not limit the specific values of the above-mentioned first numerical value to the fourth numerical value, as long as the first numerical value to the fourth numerical value are all positive integers.
  • At least one of the first value, the second value, the third value and the fourth value is a fixed value.
  • 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 based on the current encoding information.
  • the encoding end writes the non-fixed value into the code stream.
  • step S606 when it is determined that the current area satisfies the above preset conditions, it means that there is a quantization coefficient with hidden parity in the current area, that is, there is a first quantization coefficient in the current area. In this case, the following step S606 is performed.
  • the parity of the second quantization coefficient is determined based on the parity corresponding to the P quantization coefficients.
  • the parity of the second quantization coefficient is determined according to the parity of the sum of the first absolute values of the P quantization coefficients.
  • the parity of the second quantization coefficient is determined according to the parity of the number of target quantization coefficients among the P quantization coefficients.
  • the above-mentioned target quantization coefficient is any one of the non-zero quantization coefficients among the P quantization coefficients, the non-zero quantization coefficients with even values, the quantization coefficients with even values, and the quantization coefficients with odd values.
  • S607. Determine the second quantization coefficient according to the parity of the first quantization coefficient and the second quantization coefficient.
  • the first quantization coefficient is multiplied by the value of two plus one to determine the value of the second quantization coefficient.
  • the second quantization coefficient is an odd number
  • the value of the first quantization coefficient multiplied by two is determined as the value of the first quantization coefficient.
  • the quantized coefficients whose parity is hidden in each area of the current block are determined, and combined with the decoded other quantized coefficients whose parity is not hidden in the current block, the quantized coefficient of the current block is obtained.
  • S609 Determine the quantization coefficient of the current block according to the decoded information of the current block.
  • the quantization coefficient decoded in the code stream is used as the final quantization coefficient of the current block.
  • the quantization coefficient of the current block is determined, and the reconstruction value of the current block is determined in the following two ways.
  • Method 1 If the encoding end skips the transformation step, the residual value of the current block is directly quantized. Correspondingly, the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the residual value of the current block. In addition, the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • Method 2 if the encoding end does not skip the transformation step, that is, the encoding end transforms the residual value of the current block to obtain the transform coefficient, and quantizes the transform coefficient.
  • the decoding end performs inverse quantization on the quantization coefficient of the current block to obtain the transform coefficient of the current block, and performs inverse transformation on the transform coefficient to obtain the residual value of the current block.
  • the intra prediction and/or inter prediction method is used to determine the prediction value of the current block, and the prediction value of the current block and the reconstruction value are added to obtain the reconstruction value of the current block.
  • preset conditions are set for the parity hiding technology.
  • the parity hiding technology proposed by this application is used to hide the parity of the current area.
  • the first quantization coefficient in the region is decoded to improve decoding accuracy.
  • SUBSIZE and HPCTHRESH have been added to the above Table 3. Among them, SUBSIZE is used to identify the size of each area of the current block, and HPCTHRESH is used to identify the number of non-zero coefficients in each area required to turn on the parity hiding technology. threshold.
  • the decoder when decoding the current area, the decoder first determines whether the current area meets the preset conditions to determine whether the current area can bring significant beneficial technical effects when decoding using the parity concealment technology provided by the present application. , when it is determined that using this parity concealment technology has significant beneficial effects, the technical solution of this application is used to decode the current area and improve decoding reliability.
  • the video decoding method involved in the embodiment of the present application is described above. On this basis, the video decoding method involved in the present application is described below with respect to the encoding end.
  • FIG 7 is a schematic flowchart 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 the above-mentioned Figure 1 and Figure 2.
  • the method in the embodiment of this application includes:
  • the current block is divided into one or more areas, for example, into N areas, where N is a positive integer.
  • the parity of one or more quantized coefficients in the area can be hidden based on the parity related to the quantized coefficients in the same area, for example, based on the parity of the sum of the absolute values of the quantized coefficients in the area.
  • the value of the second quantization coefficient whose parity is to be hidden is a1, and a1 is an odd number
  • This embodiment of the present application does not limit the area division method of the current block.
  • At least two areas among the N areas include the same number of quantization coefficients.
  • At least two of the N regions include different numbers of quantization coefficients.
  • the specific ways of dividing the current block into N areas in S701 include but are not limited to the following:
  • Method 1 Divide the current block into N areas according to the scanning order.
  • every M non-zero quantized coefficients in the current block are divided into a region, resulting in N regions.
  • Each of these N regions includes M non-zero quantization coefficients.
  • At least one of the N regions includes one or more second quantization coefficients whose parity can be concealed.
  • the non-zero quantization coefficient included in the last region is not M, then the last region is divided into a separate region, or the last region and the previous region are merged into one region.
  • every K pixels in the current block are divided into a region, resulting in N regions.
  • N regions For example, for an 8x8 size transform block using the reverse ZigZag scan order, when each region is of equal size, that is, each region contains 16 coefficients, as shown in Figure 5, the current block is divided into 4 regions.
  • the quantization coefficient included in the last region is not K, the last region is divided into a separate region, or the last region and the previous region are merged into one region.
  • Method 2 Divide the current block into N areas according to the spatial position
  • the above-mentioned N areas are sub-blocks of the current block.
  • the current block is evenly divided into N sub-blocks.
  • the size of each sub-block is 4*4.
  • each sub-block includes at least one non-zero quantization coefficient.
  • the method of dividing the current block into N areas may also include other methods, and the embodiment of the present application does not limit this.
  • a flag may be used to indicate whether the current block is allowed to use the technology of hiding the parity of quantization coefficients provided by the embodiments of this application.
  • the technology of hiding the parity of the coefficients provided by the embodiments of the present application is also called the parity hiding technology.
  • the at least one flag set may be a flag of different levels, used to indicate whether the corresponding level allows the parity of the quantization coefficient to be hidden.
  • the at least one flag includes at least one of a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag.
  • the above-mentioned at least one flag includes a sequence-level flag, which is used to indicate whether the current sequence allows the parity of the quantization coefficient to be hidden.
  • the sequence-level flag may be located in the sequence header.
  • the above-mentioned at least one flag includes a picture-level flag, which is used to indicate whether the current picture allows the parity of the quantization coefficient to be hidden.
  • the image-level flag may be located in the picture header.
  • the above-mentioned at least one flag includes a slice-level flag, which is used to indicate whether the current slice (slice) allows the parity of the quantization coefficient to be hidden.
  • the slice-level flag may be located in the slice header.
  • the above-mentioned at least one flag includes a unit-level flag, which is used to indicate whether the current CTU allows the parity of the quantization coefficient to be hidden.
  • the above-mentioned at least one flag includes a block-level flag, which is used to indicate whether the current block allows the parity of the quantization coefficient to be hidden.
  • the encoding end first obtains the above-mentioned at least one flag, and determines whether the current block allows the parity of the quantized coefficient to be hidden based on the at least one flag. If it is determined based on at least one of the above flags that the current block does not allow the parity of the quantized coefficient to be hidden, the method in the embodiment of the present application is skipped. If it is determined based on at least one of the above flags that the current block is allowed to use the parity concealment technology provided by the embodiment of the present application, the method of the embodiment of the present application is executed.
  • the quantization coefficient parity hiding technology provided by the embodiments of the present application is mutually exclusive with the target transformation method, where the target transformation method includes secondary transformation or multiple transformations. At this time, when the encoding end determines that the current block is transformed using the target transformation method, it skips the technical solution provided by the embodiment of the present application.
  • S702. Determine the second quantization coefficient in the current area, and perform parity hiding on the second quantization coefficient to obtain the first quantization coefficient.
  • the current area is an area including at least one non-zero quantization coefficient among the N areas.
  • parity hiding is performed on the second quantized coefficient to obtain the first quantized coefficient, and the first quantized coefficient is encoded into the code stream, instead of encoding the second quantized coefficient into the code stream.
  • the first quantization coefficient is usually smaller than the second quantization coefficient, encoding the first quantization coefficient requires fewer bits than encoding the second quantization coefficient, thereby reducing the encoding cost.
  • the embodiment of the present application performs parity hiding on the second quantized coefficient, and the method of obtaining the first quantized coefficient is not limited.
  • different methods can be selected to determine the first quantization coefficient according to the parity of the second quantization coefficient, as shown in case 1 and case 2.
  • the third operation method is used to operate the second quantization coefficient to obtain the first quantization coefficient.
  • the third operation mode includes the first quantization coefficient being equal to the value of the second quantization coefficient plus one divided by two.
  • the third operation method is shown in formula (7):
  • A is the second quantization coefficient
  • val is the first quantization coefficient
  • the second quantization coefficient is an odd number
  • parity concealment is performed on the second quantization coefficient according to the third operation method shown in the above formula (7) to obtain the first quantization coefficient.
  • the value of the second quantization coefficient is 9, then the value of the first quantization coefficient is determined to be 5 according to the above formula (7).
  • the encoding value 5 can reduce the number of bits and reduce the encoding cost.
  • the fourth operation method is used to operate the second quantization coefficient to obtain the first quantization coefficient.
  • the fourth operation mode includes the first quantization coefficient being equal to the value of the second quantization coefficient divided by two.
  • the second quantization coefficient is an even number
  • parity hiding is performed on the second quantization coefficient according to the fourth operation method shown in the above formula (8) to obtain the first quantization coefficient.
  • the value of the second quantization coefficient is 10
  • the value of the first quantization coefficient is determined to be 5 according to the above formula (9).
  • the encoding value 5 can reduce the number of bits and reduce the encoding cost.
  • the encoding end may use a preset operation method to operate on the second quantization coefficient according to the parity of the second quantization coefficient to obtain the first quantization coefficient.
  • the preset operation method is to divide the value of the second quantization coefficient by a positive integer greater than 1.
  • the preset operation method includes dividing the value of the second quantization coefficient by two and rounding, where rounding can be understood as a quotient operation.
  • rounding can be understood as a quotient operation.
  • the value of the second quantization coefficient is 7, and 7 divided by 2 takes the value 3. .
  • the encoding end determines the first quantization coefficient through the following formula (9):
  • Q represents the second quantization coefficient
  • Q b represents the first quantization coefficient
  • "//" represents the rounding operation
  • the first quantization coefficient in the current region is determined, the first quantization coefficient is encoded to obtain a code stream.
  • the parity of the second quantization coefficient is indicated through P quantization coefficients in the current region.
  • a binary characteristic (0 or 1) of the P quantized coefficients in the current region is used to indicate the parity of the second quantized coefficient in the current region.
  • the parity of the second quantization coefficient is indicated by the parity corresponding to the P quantization coefficients in the current region.
  • the above-mentioned P quantization coefficients are all quantization coefficients in the current area.
  • the above P quantization coefficients are partial quantization coefficients in the current region.
  • the above-mentioned P quantization coefficients do not include the first quantization coefficient in the current region.
  • the parity corresponding to the P quantization coefficients may be the smallest quantization coefficient among the P quantization coefficients, the largest quantization coefficient among the P quantization coefficients, the sum of the absolute values of the P quantization coefficients, and the target quantization coefficient among the P quantization coefficients.
  • the embodiment of the present application uses the parity corresponding to the P quantization coefficients in the current area to indicate the parity of the second quantization coefficient. For example, using the parity corresponding to the P quantization coefficients to be an odd number to indicate that the current second quantization coefficient is an odd number, use The parity corresponding to the P quantization coefficients is an even number, indicating that the current second quantization coefficient is an even number.
  • the method in the embodiment of the present application further includes the following step 1:
  • Step 1 Adjust the P quantization coefficients so that the parity corresponding to the P quantization coefficients is consistent with the parity of the second quantization coefficient.
  • step 1 above includes: adjusting the values of the P quantization coefficients so that the P quantization coefficients The parity of the sum of the first absolute values of the coefficients is consistent with the parity of the second quantized coefficient.
  • the first absolute value of the quantized coefficient is part or all of the absolute value of the quantized coefficient.
  • the first absolute value of the quantized coefficient is an absolute value smaller than 15 parts.
  • the above situation 1 includes the following two examples:
  • Example 1 if the second quantization coefficient is an odd number and the sum of the first absolute values of the P quantization coefficients is an even number, adjust the values of the P quantization coefficients so that the adjusted first absolute values of the P quantization coefficients The sum is an odd number.
  • the second quantization coefficient is an odd number
  • the sum of the first absolute values of the P quantization coefficients is an even number
  • the smallest quantization coefficient among the P quantization coefficients is added or subtracted by 1 to reduce the sum of the P quantization coefficients.
  • the sum of the first absolute values is modified to be an odd number.
  • Example 2 if the second quantization coefficient is an even number and the sum of the first absolute values of the P quantization coefficients is an odd number, adjust the values of the P quantization coefficients so that the first absolute value of the adjusted P quantization coefficients is The sum of the values is an even number.
  • the second quantization coefficient is an even number
  • the sum of the first absolute values of the P quantization coefficients is an odd number.
  • the smallest quantization coefficient among the P quantization coefficients is added or subtracted by 1 to reduce the first quantization coefficient of the P quantization coefficients.
  • the sum of absolute values is modified to an even number.
  • the above step 1 includes: adjusting the values of the P quantization coefficients so that the P quantization coefficients The parity of the target number of quantized coefficients in the coefficients is consistent with the parity of the second quantized coefficient.
  • Example 2 above includes at least the following two examples:
  • Example 1 if the second quantization coefficient is an odd number, and the number of target quantization coefficients among the P quantization coefficients is an even number, adjust the values of the P quantization coefficients so that the number of target quantization coefficients among the adjusted P quantization coefficients is odd number.
  • Example 2 if the second quantization coefficient is an even number, and the number of target quantization coefficients among the P quantization coefficients is an odd number, adjust the values of the P quantization coefficients so that the number of target quantization coefficients among the adjusted P quantization coefficients is an even number.
  • the above-mentioned target quantization coefficient is any one of the non-zero quantization coefficients among the P quantization coefficients, the non-zero quantization coefficients with even values, the quantization coefficients with even values, and the quantization coefficients with odd values.
  • the encoding end modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient is an odd number, and the number of non-zero quantization coefficients among the P quantization coefficients is an even number, then one of the P quantization coefficients that is zero can be adjusted to 1, or the P quantization coefficients can be adjusted to 1. The value of the smallest quantization coefficient among the coefficients is adjusted to 0, so that the number of non-zero quantization coefficients among the P quantization coefficients is an odd number.
  • the second quantization coefficient is an even number
  • the number of non-zero quantization coefficients among the P quantization coefficients is an odd number
  • one of the P quantization coefficients that is zero can be adjusted to 1, or P quantization coefficients can be adjusted to 1.
  • the value of the smallest non-zero quantization coefficient among the quantization coefficients is adjusted to 0, so that the number of non-zero quantization coefficients among the P quantization coefficients is an even number.
  • the encoding end modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient is an odd number, and the number of non-zero quantization coefficients among the P quantization coefficients is an even number, then the quantization coefficient in which one of the P quantization coefficients is zero can be adjusted to 2, or, Add 1 or subtract 1 to the value of the smallest non-zero quantization coefficient among the P quantization coefficients, so that the number of non-zero quantization coefficients with even values among the P quantization coefficients is an odd number.
  • the quantization coefficient with a zero value among the P quantization coefficients can be adjusted to 2, or , add 1 or subtract 1 to the value of the smallest non-zero quantization coefficient among the P quantization coefficients, so that the number of non-zero quantization coefficients among the P quantization coefficients is an even number.
  • the encoding end uses an adjustment method with the smallest rate distortion cost to adjust at least one coefficient among the P quantization coefficients.
  • the encoding end modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient is an odd number, and the number of quantization coefficients with an even value among the P quantization coefficients is an even number, then one of the P quantization coefficients with a zero value can be adjusted to 1, or P The smallest non-zero quantization coefficient among the P quantization coefficients is adjusted to 0, so that the number of quantization coefficients with even values among the P quantization coefficients is an odd number.
  • the second quantization coefficient is an even number
  • the number of quantization coefficients with an even value among the P quantization coefficients is an odd number
  • one of the P quantization coefficients with a zero value can be adjusted to 1, or, The smallest non-zero quantization coefficient among the P quantization coefficients is adjusted to 0, so that the number of quantization coefficients among the P quantization coefficients is an even number.
  • the encoding end modifies at least one coefficient among the P quantization coefficients. For example, if the second quantization coefficient is an odd number, and the number of quantization coefficients with odd values among the P quantization coefficients is an even number, then one of the P quantization coefficients with a zero value can be adjusted to 1, or P The smallest non-zero quantization coefficient among the P quantization coefficients is adjusted to 0 or plus 1 or minus 1, so that the number of quantization coefficients with an odd value among the P quantization coefficients is an odd number.
  • the second quantization coefficient is an even number
  • the number of quantization coefficients with odd values among the P quantization coefficients is an odd number
  • one of the P quantization coefficients with zero quantization coefficient can be adjusted to 1, or, The smallest non-zero quantization coefficient among the P quantization coefficients is adjusted to 0 or plus 1 or minus 1, so that the number of quantization coefficients among the P quantization coefficients is an even number.
  • the parity hiding technology proposed in this application is implemented on the AVM reference software, the area size used is set to 16, and the threshold for the number of non-zero coefficients that enable parity hiding is 4.
  • the parity hiding technology of this application is enabled for the current area, the sum of the absolute values of the non-zero coefficients less than or equal to 15 in the current area is an odd number, which means that the last coefficient (i.e., the second quantization coefficient) in the scanning order of the area is an odd number.
  • being an even number means that the last coefficient (i.e., the second quantization coefficient) in the scanning order of this area is an even number.
  • PSNR in Table 4 above is the peak signal-to-noise ratio, which represents the ratio of the maximum possible power of the signal to the destructive noise power that affects its representation accuracy. Since many signals have very wide dynamic ranges, peak signal-to-noise ratio is often expressed in logarithmic decibel units.
  • PSNR is used to evaluate the quality of an image after compression compared with the original image. The higher the PSNR, the smaller the distortion after compression.
  • the full-frame intra frame encoding performance YUV3 component is improved to 0.10%, 0.75% and 0.79%.
  • the encoding end divides the current block into N areas, determines the second quantization coefficient in the current area, and performs parity hiding on the second quantization coefficient to obtain the first quantization coefficient; then, The first quantization coefficient is encoded to obtain a code stream, and the parity of the second quantization coefficient is indicated by P quantization coefficients in the current region. That is to say, in the embodiment of the present application, the encoding end performs parity hiding on the second quantized coefficient in the current area to obtain the first quantized coefficient.
  • the parity of the second quantized coefficient is indicated through the P quantized coefficients in the current area, so that the decoder determines the parity of the second quantized coefficient based on the P quantized coefficients in the current area, and then uses the P quantized coefficients in the current area to determine the parity of the second quantized coefficient.
  • the parity of the two quantized coefficients and the first quantized coefficient enable accurate reconstruction of the second quantized coefficient.
  • FIG 8 is a schematic flowchart of a video encoding method provided by an embodiment of the present application. As shown in Figure 8, the method in the embodiment of this application includes:
  • the above-mentioned at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden.
  • At least one flag includes at least one of a sequence-level flag, an image-level flag, a slice-level flag, a unit-level flag, and a block-level flag.
  • step S802 If it is determined according to at least one flag that the parity of the quantization coefficient of the current block is allowed to be hidden, the following step S802 is performed.
  • step S806 is performed.
  • the embodiment of the present application does not limit the method of dividing the area of the current block.
  • the current block is divided into N areas according to the scanning order, or the current block is divided into N areas according to the spatial position of the pixels in the current block.
  • the sizes of the above-mentioned N areas may be the same or different, and the embodiments of the present application do not limit this.
  • the parity concealment technology proposed in this application is limited. Specifically, if the current area meets the set preset conditions, it means that the current area can obtain significant beneficial effects by using the parity concealment technology provided by the embodiment of the present application. At this time, the following step S804 is performed.
  • the above preset conditions include at least one of the following conditions:
  • Condition 1 The number of non-zero quantization coefficients in the current area is greater than the first value
  • Condition 2 In the current area, the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the decoding scanning order is greater than the second value
  • Condition 3 In the current area, the distance between the first non-zero quantized coefficient and the last quantized coefficient in the decoding scanning order is greater than the third value
  • Condition 4 In the current area, the sum of the absolute values of the non-zero quantization coefficients is greater than the fourth value.
  • the above four conditions can also be combined with each other to form new constraints.
  • the embodiments of the present application do not limit the specific values of the above-mentioned first numerical value to the fourth numerical value, as long as the first numerical value to the fourth numerical value are all positive integers.
  • At least one of the first value, the second value, the third value and the fourth value is a fixed value.
  • 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 based on the current encoding information.
  • the encoding end writes the non-fixed value into the code stream, and the decoding end reads the value from the code stream.
  • the non-fixed value is parsed out.
  • the encoding end when encoding the current area, the encoding end first determines whether the current area meets the preset conditions to determine whether the current area can bring significant beneficial technical effects when encoded using the parity concealment technology provided by this application.
  • the technical solution of this application is used to encode the current area to improve coding reliability.
  • the size of the sequence numbers of the above-mentioned processes does not mean the order of execution.
  • the execution order of each process should be determined by its functions and internal logic, and should not be used in this application.
  • the implementation of the examples does not constitute any limitations.
  • the term "and/or" is only an association relationship describing associated objects, indicating that three relationships can exist. Specifically, A and/or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
  • the character "/" in this article generally indicates that the related objects are an "or" relationship.
  • Figure 9 is a schematic block diagram of a video decoding device provided by an embodiment of the present application.
  • the video decoding device 10 includes:
  • the decoding unit 11 is used to decode the code stream to obtain P quantization coefficients and a first quantization coefficient in the current region.
  • the current region is a region in the current block that includes at least one non-zero quantization coefficient.
  • the first quantization coefficient is The quantized coefficient obtained after performing parity concealment on the second quantized coefficient in the current area, where the P is a positive integer;
  • the parity determination unit 12 is configured to determine the parity of the second quantization coefficient according to the P quantization coefficients
  • the coefficient determination unit 13 is configured to determine a second quantization coefficient with parity according to the parity of the first quantization coefficient and the second quantization coefficient.
  • the parity determination unit 12 is specifically configured to determine the parity of the second quantization coefficient according to the parity corresponding to the P quantization coefficients.
  • the parity determination unit 12 is specifically configured to determine the parity of the second quantization coefficient according to the parity of the sum of the first absolute values of the P quantization coefficients, and the first absolute value is part or all of the absolute value of the quantization coefficient.
  • the parity determination unit 12 is specifically configured to determine that the second quantization coefficient is an odd number if the sum of the first absolute values of the P quantization coefficients is an odd number; if the P quantization coefficients The sum of the first absolute values of is an even number, then it is determined that the second quantization coefficient is an even number.
  • the parity determination unit 12 is specifically configured to determine the target quantization coefficient among the P quantization coefficients; determine the second second quantization coefficient according to the number parity of the target quantization coefficient among the P quantization coefficients. Parity of quantized coefficients.
  • the parity determination unit 12 is specifically configured to determine that the second quantization coefficient is an odd number if the number of the target quantization coefficients among the P quantization coefficients is an odd number; if the P quantization coefficients are If the number of the target quantization coefficients among the quantization coefficients is an even number, it is determined that the second quantization coefficient is an even number.
  • the target quantization coefficient is any of the non-zero quantization coefficients among the P quantization coefficients, non-zero quantization coefficients with an even number, quantization coefficients with an even number, and quantization coefficients with an odd number. one.
  • the coefficient determination unit 13 is specifically configured to perform operations on the first quantization coefficient using a preset operation method to obtain an operation result; according to the parity of the second quantization coefficient and the operation result, obtain the second quantization coefficient.
  • the preset operation method includes multiplying the value of the first quantization coefficient by two.
  • the coefficient determination unit 13 is specifically configured to determine the sum of the operation result and the preset value as the second quantization coefficient, wherein if the second quantization coefficient is an odd number, then the The default value is 1. If the second quantization coefficient is an even number, the default value is 0.
  • the parity determination unit 12 is specifically configured to determine the parity of the second quantization coefficient according to the P quantization coefficients if the current area meets a preset condition.
  • the preset conditions include at least one of the following:
  • the number of non-zero quantization coefficients in the current region is greater than the first value
  • the distance between the first non-zero quantized coefficient and the last non-zero quantized coefficient in the decoding scanning order is greater than the second value
  • the distance between the first non-zero quantized coefficient and the last quantized coefficient in the decoding scanning order is greater than the third value
  • the sum of absolute values of non-zero quantization coefficients is greater than the fourth value.
  • At least one of the first value, the second value, the third value and the fourth value is a fixed value.
  • At least one of the first value, the second value, the third value and the fourth value is a non-fixed value.
  • the decoding unit 11 is also used to decode the code stream to obtain the non-fixed value.
  • the decoding unit 11 is also configured to skip the quantization values according to the P quantization coefficients and determine the first block in the current area if the current block is transformed using a target transformation method. Steps to quantify the parity of coefficients.
  • the target transformation method includes two transformations or multiple transformations.
  • the first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current area, and the K is less than or equal to the number of non-zero quantization coefficients in the current area.
  • the decoding unit 11 is also used to decode the code stream to obtain the decoded information of the current block; divide the current block into N regions, where N is a positive integer; from From the decoded information of the current block, the P quantization coefficients and the first quantization coefficient are obtained.
  • the decoding unit 11 is also configured to divide the current block into N regions according to the scanning order.
  • the decoding unit 11 is specifically configured to divide the current block into N regions according to spatial positions.
  • At least two areas among the N areas include the same number of quantization coefficients.
  • At least two of the N regions include different numbers of quantization coefficients.
  • the decoding unit 11 is also used to decode the code stream to obtain at least one flag.
  • the at least one flag is used to indicate whether the parity of the quantized coefficient is allowed to be hidden; if according to the at least one flag, when it is determined that the parity of at least one quantization coefficient in the current block is allowed to be hidden, the current block is divided into N regions.
  • 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.
  • the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here.
  • the video decoding device 10 shown in FIG. 9 may correspond to the corresponding subject in performing the method of the embodiment of the present application, and the aforementioned and other operations and/or functions of each unit in the video decoding device 10 are respectively to implement the method, etc. The corresponding processes in each method will not be repeated here for the sake of brevity.
  • Figure 10 is a schematic block diagram of a video encoding device provided by an embodiment of the present application.
  • the video encoding device 20 includes:
  • the dividing unit 21 is used to divide the current block into N areas, where N is a positive integer;
  • the processing unit 22 is configured to determine the second quantization coefficient in the current area, and perform parity hiding on the second quantization coefficient to obtain the first quantization coefficient.
  • the current area is the N area including at least one non- Area of zero quantization coefficient;
  • the encoding unit 23 is configured to encode the first quantization coefficient to obtain a code stream.
  • the parity of the second quantization coefficient is indicated by P quantization coefficients in the current region, where P is a positive integer.
  • the parity of the second quantization coefficient is indicated by the parity corresponding to the P quantization coefficients in the current region.
  • the processing unit 22 is also configured to adjust the P quantization coefficients so that The parity corresponding to the P quantization coefficients is consistent with the parity of the second quantization coefficient.
  • the processing unit 22 is also configured to perform quantization on the P quantization coefficients. The value of the coefficient is adjusted so that the parity of the sum of the first absolute values of the P quantized coefficients is consistent with the parity of the second quantized coefficient.
  • the processing unit 22 is specifically configured to adjust the sum of the first absolute values of the P quantization coefficients if the second quantization coefficient is an odd number and the sum of the first absolute values of the P quantization coefficients is an even number. value, so that the adjusted sum of the first absolute values of the P quantization coefficients is an odd number; if the second quantization coefficient is an even number, and the sum of the first absolute values of the P quantization coefficients is an odd number , then the values of the P quantization coefficients are adjusted so that the sum of the adjusted first absolute values of the P quantization coefficients is an even number.
  • the processing unit 22 is specifically configured to perform quantization on the P quantization coefficients. The value of the coefficient is adjusted so that the parity of the target number of quantized coefficients among the P quantized coefficients is consistent with the parity of the second quantized coefficient.
  • the processing unit 22 is specifically configured to adjust the selection of the P quantization coefficients if the second quantization coefficient is an odd number and the number of target quantization coefficients among the P quantization coefficients is an even number. value, so that the number of target quantization coefficients among the adjusted P quantization coefficients is an odd number; if the second quantization coefficient is an even number, and the number of target quantization coefficients among the P quantization coefficients is an odd number, then The values of the P quantization coefficients are adjusted so that the target number of quantization coefficients among the adjusted P quantization coefficients is an even number.
  • the target quantization coefficient is any one of a non-zero quantization coefficient among the P quantization coefficients, a non-zero quantization coefficient with an even value, a quantization coefficient with an even value, or a quantization coefficient with an odd value.
  • the processing unit 22 is configured to operate on the second quantization coefficient using a preset operation method according to the parity of the second quantization coefficient to obtain the first quantization coefficient.
  • the preset operation method includes dividing the value of the second quantization coefficient by two and rounding.
  • the processing unit 22 is specifically configured to perform parity hiding on the second quantization coefficient to obtain the first quantization coefficient if the current area satisfies the preset condition.
  • the preset conditions include at least one of the following:
  • the number of non-zero quantization coefficients in the current region is greater than the first value
  • the distance between the first non-zero quantization coefficient and the last non-zero quantization coefficient in the scanning order is greater than the second value
  • the distance between the first non-zero quantization coefficient and the last quantization coefficient in the scanning order is greater than the third value
  • the sum of absolute values of non-zero quantization coefficients is greater than the fourth value.
  • At least one of the first value, the second value, the third value and the fourth value is a fixed value.
  • At least one of the first value, the second value, the third value and the fourth value is a non-fixed value.
  • the encoding unit 23 is also used to convert the Non-fixed values are written into the code stream.
  • the first quantization coefficient is a non-zero quantization coefficient located at the Kth position in the scanning order in the current area, and the K is less than or equal to the number of non-zero quantization coefficients in the current area.
  • the processing unit 22 is specifically configured to divide the current block into N regions according to the scanning order.
  • the processing unit 22 is specifically configured to divide the current block into N regions according to the spatial location.
  • At least two areas among the N areas include the same number of quantization coefficients.
  • At least two of the N regions include different numbers of quantization coefficients.
  • the processing unit 22 is also configured to obtain at least one flag, which is used to indicate whether the parity of the quantized coefficient is allowed to be hidden; if it is determined that the parity of the quantized coefficient is allowed to be hidden according to the at least one flag, When the parity of the quantization coefficient of the current block is hidden, the current block is divided into N regions.
  • 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.
  • the processing unit 22 is also configured to skip dividing the current block into N regions if the current block is transformed using a target transformation method.
  • the target transformation method includes two transformations or multiple transformations.
  • the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here.
  • the video encoding device 20 shown in FIG. 10 may correspond to the corresponding subject in performing 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 to implement the method, etc. The corresponding processes in each method will not be repeated here for the sake of brevity.
  • the functional unit can be implemented in the form of hardware, can also be implemented in the form of instructions in the software, or can be implemented in a combination of hardware and software units.
  • each step of the method embodiments in the embodiments of the present application can be completed by integrated logic circuits of hardware in the processor and/or instructions in the form of software.
  • the steps of the methods disclosed in conjunction with the embodiments of the present application can be directly embodied in hardware.
  • the execution of the decoding processor is completed, or the execution is completed using a combination of hardware and software units in the decoding processor.
  • the software unit may be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, 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 combination with its hardware.
  • Figure 11 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 30 may be the video encoder or video decoder described in the embodiment of the present application.
  • the electronic device 30 may include:
  • Memory 33 and processor 32 the memory 33 is used to store the computer program 34 and transmit the program code 34 to the processor 32.
  • 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.
  • the processor 32 may be configured to perform steps in the above method according to instructions in the computer program 34 .
  • the processor 32 may include but is not limited to:
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • the memory 33 includes but is not limited to:
  • Non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM Random Access Memory
  • RAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM DDR SDRAM
  • ESDRAM enhanced synchronous dynamic random access memory
  • SLDRAM synchronous link dynamic random access memory
  • Direct Rambus RAM Direct Rambus RAM
  • the computer program 34 can be divided into one or more units, and the one or more units are stored in the memory 33 and executed by the processor 32 to complete the tasks provided by this application.
  • the one or more units may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program 34 in the electronic device 30 .
  • the electronic device 30 may also include:
  • Transceiver 33 the transceiver 33 can be connected to the processor 32 or the memory 33 .
  • 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.
  • 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.
  • bus system where in addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus.
  • Figure 12 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • the video encoding and decoding system 40 may include: a video encoder 41 and a video decoder 42, where the video encoder 41 is used to perform the video encoding method involved in the embodiment of the present application, and the video decoder 42 is used to perform The embodiment of the present application relates to a video decoding method.
  • This application also provides a computer storage medium on which a computer program is stored.
  • the computer program When the computer program is executed by a computer, the computer can perform the method of the above method embodiment.
  • embodiments of the present application also provide a computer program product containing instructions, which when executed by a computer causes the computer to perform the method of the above method embodiments.
  • This application also provides a code stream, which is obtained by the above video coding method.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted over a wired connection from a website, computer, server, or data center (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website, computer, server or data center.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the available media may be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as digital video discs (DVD)), or semiconductor media (such as solid state disks (SSD)), etc.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or may be Integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • a unit described as a separate component may or may not be physically separate.
  • a component shown as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本申请实施例提供一种视频编解码方法、装置、设备、系统及存储介质,通过解码码流,得到当前区域中P个量化系数和第一量化系数,其中当前区域为当前块中包括至少一个非零量化系数的区域,第一量化系数为对当前区域中的第二量化系数进行奇偶性隐藏得到的量化系数;接着,根据P个量化系数,确定第二量化系数的奇偶性,并根据第一量化系数和第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。本申请实施例,通过当前区域中P个量化系数对当前区域中的第二量化系数的奇偶性进行隐藏,以降低视频压缩代价。

Description

视频编解码方法、装置、设备、系统及存储介质 技术领域
本申请涉及视频编解码技术领域,尤其涉及一种视频编解码方法、装置、设备、系统及存储介质。
背景技术
数字视频技术可以并入多种视频装置中,例如数字电视、智能手机、计算机、电子阅读器或视频播放器等。随着视频技术的发展,视频数据所包括的数据量较大,为了便于视频数据的传输,视频装置执行视频压缩技术,以使视频数据更加有效的传输或存储。
在视频压缩过程中为了便于编码,对变换系数进行量化,量化的目的是将变换系数进行缩放,从而使得编码系数时消耗的比特数减少。但是,目前的量化方法,编码代价较大。
发明内容
本申请实施例提供了一种视频编解码方法、装置、设备、系统及存储介质,以降低量化编码代价。
第一方面,本申请提供了一种视频解码方法,包括:
解码码流,得到当前区域中的P个量化系数和第一量化系数,所述当前区域为当前块中包括至少一个非零量化系数的区域,所述第一量化系数为对所述当前区域中的第二量化系数进行奇偶性隐藏后得到的量化系数,所述P为正整数;
根据所述P个量化系数,确定所述第二量化系数的奇偶性;
根据所述第一量化系数和所述第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。
第二方面,本申请实施例提供一种视频编码方法,包括:
将当前块划分为N个区域,所述N为正整数;
确定当前区域中的第二量化系数,所述当前区域为所述N个区域中包括至少一个非零量化系数的区域;
对所述第二量化系数进行奇偶性隐藏,得到第一量化系数;
对所述第一量化系数的量化值进行编码,得到码流,所述第二量化系数的奇偶性通过所述当前区域中P个量化系数进行指示,所述P为正整数。
第三方面,本申请提供了一种视频编码器,用于执行上述第一方面或其各实现方式中的方法。具体地,该编码器包括用于执行上述第一方面或其各实现方式中的方法的功能单元。
第四方面,本申请提供了一种视频解码器,用于执行上述第二方面或其各实现方式中的方法。具体地,该解码器包括用于执行上述第二方面或其各实现方式中的方法的功能单元。
第五方面,提供了一种视频编码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第一方面或其各实现方式中的方法。
第六方面,提供了一种视频解码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第二方面或其各实现方式中的方法。
第七方面,提供了一种视频编解码系统,包括视频编码器和视频解码器。视频编码器用于执行上述第一方面或其各实现方式中的方法,视频解码器用于执行上述第二方面或其各实现方式中的方法。
第八方面,提供了一种芯片,用于实现上述第一方面至第二方面中的任一方面或其各实现方式中的方法。具体地,该芯片包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有该芯片的设备执行如上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第九方面,提供了一种计算机可读存储介质,用于存储计算机程序,该计算机程序使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十方面,提供了一种计算机程序产品,包括计算机程序指令,该计算机程序指令使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十一方面,提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十二方面,提供了一种码流,包括第二方面任一方面生成的码流。
基于以上技术方案,解码器解码码流,得到当前区域中的P个量化系数和第一量化系数,接着,根据P个量化系数,确定第二量化系数的奇偶性,并根据第一量化系数和第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。本申请实施例,通过当前区域中P个量化系数对当前区域中的第二量化系数的奇偶性进行隐藏,以降低视频压缩代价。
附图说明
图1为本申请实施例涉及的一种视频编解码系统的示意性框图;
图2是本申请实施例提供的视频编码器的示意性框图;
图3是本申请实施例提供的解码框架的示意性框图;
图4为本申请实施例提供的一种视频解码码方法的流程示意图;
图5为本申请实施例涉及的区域划分示意图;
图6为本申请一实施例提供的视频解码方法流程示意图;
图7为本申请实施例提供的视频编码方法的一种流程示意图;
图8为本申请一实施例提供的视频编码方法流程示意图;
图9是本申请实施例提供的视频解码装置的示意性框图;
图10是本申请实施例提供的视频编码装置的示意性框图;
图11是本申请实施例提供的电子设备的示意性框图;
图12是本申请实施例提供的视频编解码系统的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
本申请可应用于图像编解码领域、视频编解码领域、硬件视频编解码领域、专用电路视频编解码领域、实时视频编解码领域等。或者,本申请的方案可结合至其它专属或行业标准而操作,所述标准包含ITU-TH.261、ISO/IECMPEG-1Visual、ITU-TH.262或ISO/IECMPEG-2Visual、ITU-TH.263、ISO/IECMPEG-4Visual,ITU-TH.264(还称为ISO/IECMPEG-4AVC),包含可分级视频编解码(SVC)及多视图视频编解码(MVC)扩展。应理解,本申请的技术不限于任何特定编解码标准或技术。
为了便于理解,首先结合图1对本申请实施例涉及的视频编解码系统进行介绍。
图1为本申请实施例涉及的一种视频编解码系统的示意性框图。需要说明的是,图1只是一种示例,本申请实施例的视频编解码系统包括但不限于图1所示。如图1所示,该视频编解码系统100包含编码设备110和解码设备120。其中编码设备用于对视频数据进行编码(可以理解成压缩)产生码流,并将码流传输给解码设备。解码设备对编码设备编码产生的码流进行解码,得到解码后的视频数据。
本申请实施例的编码设备110可以理解为具有视频编码功能的设备,解码设备120可以理解为具有视频解码功能的设备,即本申请实施例对编码设备110和解码设备120包括更广泛的装置,例如包含智能手机、台式计算机、移动计算装置、笔记本(例如,膝上型)计算机、平板计算机、机顶盒、电视、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机等。
在一些实施例中,编码设备110可以经由信道130将编码后的视频数据(如码流)传输给解码设备120。信道130可以包括能够将编码后的视频数据从编码设备110传输到解码设备120的一个或多个媒体和/或装置。
在一个实例中,信道130包括使编码设备110能够实时地将编码后的视频数据直接发射到解码设备120的一个或多个通信媒体。在此实例中,编码设备110可根据通信标准来调制编码后的视频数据,且将调制后的视频数据发射到解码设备120。其中通信媒体包含无线通信媒体,例如射频频谱,可选的,通信媒体还可以包含有线通信媒体,例如一根或多根物理传输线。
在另一实例中,信道130包括存储介质,该存储介质可以存储编码设备110编码后的视频数据。存储介质包含多种本地存取式数据存储介质,例如光盘、DVD、快闪存储器等。在该实例中,解码设备120可从该存储介质中获取编码后的视频数据。
在另一实例中,信道130可包含存储服务器,该存储服务器可以存储编码设备110编码后的视频数据。在此实例中,解码设备120可以从该存储服务器中下载存储的编码后的视频数据。可选的,该存储服务器可以存储编码后的视频数据且可以将该编码后的视频数据发射到解码设备120,例如web服务器(例如,用于网站)、文件传送协议(FTP)服务器等。
一些实施例中,编码设备110包含视频编码器112及输出接口113。其中,输出接口113可以包含调制器/解调器(调制解调器)和/或发射器。
在一些实施例中,编码设备110除了包括视频编码器112和输入接口113外,还可以包括视频源111。
视频源111可包含视频采集装置(例如,视频相机)、视频存档、视频输入接口、计算机图形系统中的至少一个,其中,视频输入接口用于从视频内容提供者处接收视频数据,计算机图形系统用于产生视频数据。
视频编码器112对来自视频源111的视频数据进行编码,产生码流。视频数据可包括一个或多个图像(picture)或图像序列(sequence of pictures)。码流以比特流的形式包含了图像或图像序列的编码信息。编码信息可以包含编码图像数据及相关联数据。相关联数据可包含序列参数集(sequence parameter set,简称SPS)、图像参数集(picture parameter set,简称PPS)及其它语法结构。SPS可含有应用于一个或多个序列的参数。PPS可含有应用于一个或多个图像的参数。语法结构是指码流中以指定次序排列的零个或多个语法元素的集合。
视频编码器112经由输出接口113将编码后的视频数据直接传输到解码设备120。编码后的视频数据还可存储于存储介质或存储服务器上,以供解码设备120后续读取。
在一些实施例中,解码设备120包含输入接口121和视频解码器122。
在一些实施例中,解码设备120除包括输入接口121和视频解码器122外,还可以包括显示装置123。
其中,输入接口121包含接收器及/或调制解调器。输入接口121可通过信道130接收编码后的视频数据。
视频解码器122用于对编码后的视频数据进行解码,得到解码后的视频数据,并将解码后的视频数据传输至显示装置123。
显示装置123显示解码后的视频数据。显示装置123可与解码设备120整合或在解码设备120外部。显示装置123可包括多种显示装置,例如液晶显示器(LCD)、等离子体显示器、有机发光二极管(OLED)显示器或其它类型的显示装置。
此外,图1仅为实例,本申请实施例的技术方案不限于图1,例如本申请的技术还可以应用于单侧的视频编码或单侧的视频解码。
下面对本申请实施例涉及的视频编码器进行介绍。
图2是本申请实施例提供的视频编码器的示意性框图。应理解,该视频编码器200可用于对图像进行有损压缩(lossy compression),也可用于对图像进行无损压缩(lossless compression)。该无损压缩可以是视觉无损压缩(visually lossless compression),也可以是数学无损压缩(mathematically lossless compression)。
该视频编码器200可应用于亮度色度(YCbCr,YUV)格式的图像数据上。例如,YUV比例可以为4:2:0、4:2:2或者4:4:4,Y表示明亮度(Luma),Cb(U)表示蓝色色度,Cr(V)表示红色色度,U和V表示为色度(Chroma)用于描述色彩及饱和度。例如,在颜色格式上,4:2:0表示每4个像素有4个亮度分量,2个色度分量(YYYYCbCr),4:2:2表示每4个像素有4个亮度分量,4个色度分量(YYYYCbCrCbCr),4:4:4表示全像素显示(YYYYCbCrCbCrCbCrCbCr)。
例如,该视频编码器200读取视频数据,针对视频数据中的每帧图像,将一帧图像划分成若干个编码树单元(coding tree unit,CTU),在一些例子中,CTB可被称作“树型块”、“最大编码单元”(Largest Coding unit,简称LCU)或“编码树型块”(coding tree block,简称CTB)。每一个CTU可以与图像内的具有相等大小的像素块相关联。每一像素可对应一个亮度(luminance或luma)采样及两个色度(chrominance或chroma)采样。因此,每一个CTU可与一个亮度采样块及两个色度采样块相关联。一个CTU大小例如为128×128、64×64、32×32等。一个CTU又可以继续被划分成若干个编码单元(Coding Unit,CU)进行编码,CU可以为矩形块也可以为方形块。CU可以进一步划分为预测单元(prediction Unit,简称PU)和变换单元(transform unit,简称TU),进而使得编码、预测、变换分离,处理的时候更灵活。在一种示例中,CTU以四叉树方式划分为CU,CU以四叉树方式划分为TU、PU。
视频编码器及视频解码器可支持各种PU大小。假定特定CU的大小为2N×2N,视频编码器及视频解码器可支持2N×2N或N×N的PU大小以用于帧内预测,且支持2N×2N、2N×N、N×2N、N×N或类似大小的对称PU以用于帧间预测。视频编码器及视频解码器还可支持2N×nU、2N×nD、nL×2N及nR×2N的不对称PU以用于帧间预测。
在一些实施例中,如图2所示,该视频编码器200可包括:预测单元210、残差单元220、变换/量化单元230、反变换/量化单元240、重建单元250、环路滤波单元260、解码图像缓存270和熵编码单元280。需要说明的是,视频编码器200可包含更多、更少或不同的功能组件。
可选的,在本申请中,当前块可以称为当前编码单元(CU)或当前预测单元(PU)等。预测块也可称为预测图像块或图像预测块,重建图像块也可称为重建块或图像重建图像块。
在一些实施例中,预测单元210包括帧间预测单元211和帧内预测单元212。由于视频的一个帧中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。由于视频中的相邻帧之间存在着很强的相似性,在视频编解码技术中使用帧间预测方法消除相邻帧之间的时间冗余,从而提高编码效率。
帧间预测单元211可用于帧间预测,帧间预测可以参考不同帧的图像信息,帧间预测使用运动信息从参考帧中找到参考块,根据参考块生成预测块,用于消除时间冗余;帧间预测所使用的帧可以为P帧和/或B帧,P帧指的是向前预测帧,B帧指的是双向预测帧。运动信息包括参考帧所在的参考帧列表,参考帧索引,以及运动矢量。运动矢量可以是整像素的或者是分像素的,如果运动矢量是分像素的,那么需要再参考帧中使用插值滤波做出所需的分像素的块,这里把根据运动矢量找到的参考帧中的整像素或者分像素的块叫参考块。有的技术会直接把参考块作为预测块,有的技术会在参考块的基础上再处理生成预测块。在参考块的基础上再处理生成预测块也可以理解为把参考块作为预测块然后再在预测块的基础上处理生成新的预测块。
帧内预测单元212只参考同一帧图像的信息,预测当前码图像块内的像素信息,用于消除空间冗余。帧内预测所使用的帧可以为I帧。例如图5所示,白色的4×4块是当前块,当前块左边一行和上面一列的灰色的像素为当前块的参考像素,帧内预测使用这些参考像素对当前块进行预测。这些参考像素可能已经全部可得,即全部已经编解码。也可能有部分不可得,比如当前块是整帧的最左侧,那么当前块的左边的参考像素不可得。或者编解码当前块时,当前块左下方的部分还没有编解码,那么左下方的参考像素也不可得。对于参考像素不可得的情况,可以使用可得的参考像素或某些值或某些方法进行填充,或者不进行填充。
在一些实施例中,帧内预测方法还包括多参考行帧内预测方法(multiple reference line,MRL),MRL可以使用更多的参考像素从而提高编码效率。
帧内预测有多种预测模式,H.264中对4×4的块进行帧内预测的9种模式。其中模式0是将当前块上面的像素按竖直方向复制到当前块作为预测值;模式1是将左边的参考像素按水平方向复制到当前块作为预测值;模式2(DC)是将A~D和I~L这8个点的平均值作为所有点的预测值,模式3至模式8是分别按某一个角度将参考像素复制到当前块的对应位置。因为当前块某些位置不能正好对应到参考像素,可能需要使用参考像素的加权平均值,或者说是插值的参考像素的分像素。
HEVC使用的帧内预测模式有平面模式(Planar)、DC和33种角度模式,共35种预测模式。VVC使用的帧内模式有Planar、DC和65种角度模式,共67种预测模式。AVS3使用的帧内模式有DC、Plane、Bilinear和63种角度模式,共66种预测模式。
需要说明的是,随着角度模式的增加,帧内预测将会更加精确,也更加符合对高清以及超高清数字视频发展的需求。
残差单元220可基于CU的像素块及CU的PU的预测块来产生CU的残差块。举例来说,残差单元220可产生CU的残差块,使得残差块中的每一采样具有等于以下两者之间的差的值:CU的像素块中的采样,及CU的PU的预测块中的对应采样。
变换/量化单元230可量化变换系数。变换/量化单元230可基于与CU相关联的量化参数(QP)值来量化与CU的TU相关联的变换系数。视频编码器200可通过调整与CU相关联的QP值来调整应用于与CU相关联的变换系数的量化程度。
反变换/量化单元240可分别将逆量化及逆变换应用于量化后的变换系数,以从量化后的变换系数重建残差块。
重建单元250可将重建后的残差块的采样加到预测单元210产生的一个或多个预测块的对应采样,以产生与TU相关联的重建图像块。通过此方式重建CU的每一个TU的采样块,视频编码器200可重建CU的像素块。
环路滤波单元260可执行消块滤波操作以减少与CU相关联的像素块的块效应。
在一些实施例中,环路滤波单元260包括去块滤波单元、样点自适应补偿SAO单元、自适应环路滤波ALF单元。
解码图像缓存270可存储重建后的像素块。帧间预测单元211可使用含有重建后的像素块的参考图像来对其它图像的PU执行帧间预测。另外,帧内预测单元212可使用解码图像缓存270中的重建后的像素块来对在与CU相同的图像中的其它PU执行帧内预测。
熵编码单元280可接收来自变换/量化单元230的量化后的变换系数。熵编码单元280可对量化后的变换系数执行一个或多个熵编码操作以产生熵编码后的数据。
本申请涉及的视频编码的基本流程如下:在编码端,将当前图像划分成块,针对当前块,预测单元210使用帧内预测或帧间预测产生当前块的预测块。残差单元220可基于预测块与当前块的原始块计算残差块,即预测块和当前块的原始块的差值,该残差块也可称为残差信息。该残差块经由变换/量化单元230变换与量化等过程,可以去除人眼不敏感的信息,以消除视觉冗余。可选的,经过变换/量化单元230变换与量化之前的残差块可称为时域残差块,经过变换/量化单元230变换与量化之后的时域残差块可称为频率残差块或频域残差块。熵编码单元280接收到变换量化单元230输出的量化后的变换系数,可对该量化后的变换系数进行熵编码,输出码流。例如,熵编码单元280可根据目标上下文模型以及二进制码流的概率信息消除字符冗余。
另外,视频编码器对变换量化单元230输出的量化后的变换系数进行反量化和反变换,得到当前块的残差块,再将当前块的残差块与当前块的预测块进行相加,得到当前块的重建块。随着编码的进行,可以得到当前图像中其他图像块对应的重建块,这些重建块进行拼接,得到当前图像的重建图像。由于编码过程中引入误差,为了降低误差,对重建图像进行滤波,例如,使用ALF对重建图像进行滤波,以减小重建图像中像素点的像素值与当前图像中像素点的原始像素值之间差异。将滤波后的重建图像存放在解码图像缓存270中,可以为后续的帧作为帧间预测的参考帧。
需要说明的是,编码端确定的块划分信息,以及预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息等在必要时携带在码流中。解码端通过解析码流及根据已有信息进行分析确定与编码端相同的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息,从而保证编码端获得的解码图像和解码端获得的解码图像相同。
图3是本申请实施例提供的视频解码器的示意性框图。
如图3所示,视频解码器300包含:熵解码单元310、预测单元320、反量化/变换单元330、重建单元340、环路滤波单元350及解码图像缓存360。需要说明的是,视频解码器300可包含更多、更少或不同的功能组件。
视频解码器300可接收码流。熵解码单元310可解析码流以从码流提取语法元素。作为解析码流的一部分,熵解码单元310可解析码流中的经熵编码后的语法元素。预测单元320、反量化/变换单元330、重建单元340及环路滤波单元350可根据从码流中提取的语法元素来解码视频数据,即产生解码后的视频数据。
在一些实施例中,预测单元320包括帧间预测单元321和帧内预测单元322。
帧间预测单元321可执行帧内预测以产生PU的预测块。帧间预测单元321可使用帧内预测模式以基于空间相邻PU的像素块来产生PU的预测块。帧间预测单元321还可根据从码流解析的一个或多个语法元素来确定PU的帧内预测模式。
帧内预测单元322可根据从码流解析的语法元素来构造第一参考图像列表(列表0)及第二参考图像列表(列表1)。此外,如果PU使用帧间预测编码,则熵解码单元310可解析PU的运动信息。帧内预测单元322可根据PU的运动信息来确定PU的一个或多个参考块。帧内预测单元322可根据PU的一个或多个参考块来产生PU的预测块。
反量化/变换单元330可逆量化(即,解量化)与TU相关联的变换系数。反量化/变换单元330可使用与TU的CU相关联的QP值来确定量化程度。
在逆量化变换系数之后,反量化/变换单元330可将一个或多个逆变换应用于逆量化变换系数,以便产生与TU相关联的残差块。
重建单元340使用与CU的TU相关联的残差块及CU的PU的预测块以重建CU的像素块。例如,重建单元340可将残差块的采样加到预测块的对应采样以重建CU的像素块,得到重建图像块。
环路滤波单元350可执行消块滤波操作以减少与CU相关联的像素块的块效应。
在一些实施例中,环路滤波单元350包括去块滤波单元、样点自适应补偿SAO单元、自适应环路滤波ALF单元。
视频解码器300可将CU的重建图像存储于解码图像缓存360中。视频解码器300可将解码图像缓存360中的重建图像作为参考图像用于后续预测,或者,将重建图像传输给显示装置呈现。
本申请涉及的视频解码的基本流程如下:熵解码单元310可解析码流得到当前块的预测信息、量化系数矩阵等,预测单元320基于预测信息对当前块使用帧内预测或帧间预测产生当前块的预测块。反量化/变换单元330使用从码流得到的量化系数矩阵,对量化系数矩阵进行反量化、反变换得到残差块。重建单元340将预测块和残差块相加得到重建块。重建块组成重建图像,环路滤波单元350基于图像或基于块对重建图像进行环路滤波,得到解码图像。该解码图像也可以称为重建图像,该重建图像一方面可以被显示设备进行显示,另一方面可以存放在解码图像缓存360中,为后续的帧作为帧间预测的参考帧。
上述是基于块的混合编码框架下的视频编解码器的基本流程,随着技术的发展,该框架或流程的一些模块或步骤可能会被优化,本申请适用于该基于块的混合编码框架下的视频编解码器的基本流程,但不限于该框架及流程。
下面对本申请涉及的量化相关技术进行介绍。
量化、反量化与系数编码部分关系紧密,量化的目的是将变换系数缩放,从而使得编码系数时消耗的比特数减少。
在一些实施例中,存在跳过变换的情况,此时量化的对象为残差,即直接对残差进行缩放后,进行编码。
示例性的,可以采用如下公式(1)实现量化:
Figure PCTCN2022084135-appb-000001
其中,t i为变换系数,qstep为量化步长,与配置文件中设置的量化参数相关,q i为量化系数,round为取整过程,不限于上取整或下取整等,量化的过程受编码器控制。
示例性的,可以采用如下公式(2)实现反量化:
t′ i=q i·qstep        (2)
其中,t′ i为重建的变换系数,由于取整过程中造成的精度损失,t′ i与t i是不同的。
量化会使得变换系数的精度降低,并且精度的损失是不可逆的。编码器通常通过率失真代价函数来衡量量化的代价。
示例性的,采用如下公式(3)确定量化代价:
J=D+λ·R=(t i-t′ i) 2+λ·B(q i)     (3)
其中,B()为编码器估计编码量化系数q i所消耗的比特。
理论上,无论编码器如何决定q i的取值,解码端的反量化过程都是不变的,所以编码器可以更自由的决定q i。通常的,编码器会根据当前块总的代价最小为原则,对每一个q i进行调整以达到整体代价最优化,这样的过程叫做率失真优化量化,也被广泛使用在视频编码中。
在一些实施例中,可以使用多符号的算数编码(Multi-symbol arithmetic coding)方式对量化系数进行编码或解码,每个量化系数都可以由一个或多个多符号的标识来指示,具体的,根据量化系数的大小,可分段由以下几种多符号的标识位表示。
标识1:表示0~3的部分,共4个符号(0,1,2,3),当标识1的符号为3时,则需要进一步编码/解码标识2。
标识2:表示3~6的部分,共4个符号(0,1,2,3),当标识2的符号为3时,则需要进一步编码/解码标识3。
标识3:表示6~9的部分,共4个符号(0,1,2,3),当标识3的符号为3时,则需要进一步编码/解码标识4。
标识4:表示9~12的部分,共4个符号(0,1,2,3),当标识4的符号为3时,则需要进一步编码/解码标识5。
标识5:表示12~15的部分,共4个符号(0,1,2,3),当标识5的符号为3时,则需要进一步编码/解码大于等于15的部分。
大于等于15的部分使用指数哥伦布编码/解码且不依赖上下文模型,而标识1~5则使用上下文模型,其中标识1有一套单独的上下文模型,而标识2-5公用一套上下文模型。另外若当前系数为非零系数时,还需要编码/解码正负号。各个标识在变换块中的编码/解码过程如下:
首先,按照从最后一个非零系数至变换块左上角的扫描顺序,编码/解码标识1-5。
接着,分别按照从变换块左上角到最后一个非零系数的顺序,编码/解码非零系数的正负号和超过系数超过15的部分,其中,左上角系数若为非零,其正负号的编码/解码采用上下文模型编码,其余位置上的非零系数编码/解码采用等概率模型编码。
示例性的,编码语法如下表1所示:
表1
Figure PCTCN2022084135-appb-000002
Figure PCTCN2022084135-appb-000003
上述表1中S()为多符号的上下文模型编码,L(1)为旁路编码。
目前量化系数的编码方式通常是,对量化系数的正负号和绝对值进行完全编码,其占用比特位较多,编码代价大。
本申请实施例,在量化系数的编码过程中,根据当前区域中量化系数相关的奇偶性,对当前区域中的至少一个量化系数进行隐藏,以降低编码代价。
下面结合具体的实施例对本申请实施例提供的技术方案进行详细描述。
首先结合图4,以解码端为例进行介绍。
图4为本申请实施例提供的一种视频解码码方法的流程示意图,本申请实施例应用于图1和图3所示视频解码器。如图4所示,本申请实施例的方法包括:
S401、解码码流,得到当前区域中的P个量化系数和第一量化系数。
其中,当前区域为当前块中包括至少一个非零量化系数的区域,第一量化系数为对当前区域中的第二量化系数进行奇偶性隐藏后得到的量化系数。
为了便于描述,本申请实施例将奇偶性被隐藏的量化系数,称为第一量化系数。
在一些实施例中,奇偶性被隐藏的第一量化系数也称为隐藏系数。
本申请实施例,将当前块划分为一个或多个区域,例如划分为N个区域,N为正整数。为了降低编码代价,可以根据同一个区域中量化系数相关的奇偶性,例如根据该区域中量化系数的绝对值之和的奇偶性,对该区域中一个或多个量化系数的奇偶性进行隐藏,以降低奇偶性被隐藏的量化系数,例如,奇偶性待隐藏的第二量化系数为a1,a1为奇数,则采用奇数对应的处理方法对a1进行处理,得到a1对应的第一量化系数a2,a2小于a1,这样对a2进行编码相比于对a1进行编码,使用更少的比特数,降低了编码代价。
在一种示例中,上述P个量化系数为当前区域中除第一量化系数外的所有量化系数。
在另一种示例中,上述P个量化系数为当前区域中的部分量化系数。
可选的,上述P个量化系数中不包括当前区域中的第一量化系数。
在一些实施例中,上述量化系数是对变换系数进行量化得到的。例如,编码端对当前块进行预测,得到当前块的预测值,当前块的原始值与预测值进行相减,得到当前块的残差值。编码端对残差值进行变换,得到当前块的变换系数,接着,对变换系数进行量化,得到量化系数,再对量化系数进行编码,得到码流。这样,解码端接收到码流中,解码码流,得到量化系数,对量化系数进行反量化,得到当前块的变换系数,再对变换系数进行反变换,得到当前块的残差值。可选的,在该实例中,上述当前块也可以称为当前变换块。
在一些实施例中,上述量化系数是对残差值进行量化得到的。例如,编码端对当前块进行预测,得到当前块的预测值,当前块的原始值与预测值进行相减,得到当前块的残差值。编码端对残差值进行量化,得到量化系数,再对量化系数进行编码,得到码流。这样,解码端接收到码流中,解码码流,得到量化系数,对量化系数进行反量化,得到当前块的残差值。
在一些实施例中,量化系数可以理解为从码流中解码出的绝对值以及正负号组成的数值,该绝对值包括量化系数对应的标识位的值,若该量化系数的值超过15,则还包括超过15部分的绝对值。
本申请实施例中,可以将当前块划分为N个区域,这N个区域大小可以相同,也可以不同。
本申请实施例中,解码端和编码端采用相同的区域划分方式,将当前块划分为N个区域。
在一些实施例中,解码端和编码端均采用默认的区域划分方式,将当前块划分为N个区域。
在一些实施例中,编码端可以将当前块的区域划分方式指示给解码端。例如,在码流中编入一标志A,该标志A用于指示当前块的区域划分方式。这样,解码端通过解码码流,得到该标志A,并根据该标志A,确定当前块的区域划分方式。
可选的,该标志A可以为序列级标志,用于指示该序列中的所有解码块均可以采用该区域划分方式,将解码块划分为N个区域。
可选的,该标志A可以为帧级标志,用于指示该图像帧中的所有解码块均可以采用该区域划分方式,将解码块划分为N个区域。
可选的,该标志A可以为片级标志,用于指示该图像片中的所有解码块均可以采用该区域划分方式,将解码块划分为N个区域。
可选的,该标志A可以为块级标志,用于指示当前块可以采用该区域划分方式,将当前块划分为N个区域。
本申请实施例中,解码端在确定当前区域中的P个量化系数和第一量化系数的过程包括但不限于如下几种示例:
示例1,解码端逐区域进行解码,以得到每个区域的量化系数,例如,解码端在解码出一个区域的量化系数之后,确定该区域的P个量化系数和第一量化系数,接着,解码下一个区域的量化系数,并根据下一个区域的量化系数,确定该下一个区域的P个量化系数和第一量化系数。也就是说,在该实施例中,解码端可以在未完全解码出当前块的所有量化系数时,确定出当前区域中的P个量化系数和第一量化系数。例如,区域的划分方式为将扫描方向上的K个像素点作为一个区域,这样,解码端在解码出K个量化系数时,根据这K个量化系数,确定这K个量化系数中的P个量化系数以及第一量化系数。
示例2,解码端在确定出当前块的所有量化系数之后,确定当前区域中的P个量化系数和第一量化系数。具体包括如下步骤:
S401-A1、解码码流,得到当前块的已解码信息;
S401-A2、将当前块划分为N个区域,N为正整数;
S401-A3、从当前块的已解码信息中,得到当前区域中的P个量化系数和第一量化系数。
在该示例2中,解码端首先解码码流,得到当前块的已解码信息,该已解码信息中包括当前块中不同区域的量化系数。接着,根据区域划分方式,将当前块划分为N个区域。假设当前区域为这N个区域中的第k个区域,则将当前块的已解码信息中,第k个区域对应的已解码信息,确定为当前区域的已解码信息。当前区域的已解码信息中包括当前区域中的P个量化系数,以及第一量化系数。
上述S401-A2中将当前块划分为N个区域的具体方式包括但不限于如下几种:
方式1,根据扫描顺序,将当前块划分为N个区域。
可选的,这N个区域中至少两个区域所包括的量化系数个数相同。
可选的,这N个区域中至少两个区域所包括的量化系数个数不相同。
在一种示例中,按照扫描方向,将当前块中每隔M个非零量化系数划分为一个区域,得到N个区域。这N个区域中每个区域均包括M个非零量化系数。这N个区域中至少一个区域包括一个或多个隐藏系数。在该示例中,若最 后一个区域所包括的非零量化系数不为M时,则将该最后一个区域划分为单独的一个区域,或者,将该最后一个区域与上一个区域合并为一个区域。
在另一种示例中,按照扫描方向,将当前块中每隔K个像素点划分为一个区域,得到N个区域。例如,对于一个使用反向ZigZag扫描顺序的8x8大小的变换块,当每个区域大小相等,即每个区域包含16个系数时,图5所示,将当前块划分为4个区域。在该示例中,划分得到的N个区域大小相同,每个区域均包括K个像素点,这N个区域中可能存在量化系数全为0的区域,也可能存在不包括隐藏系数的区域。也就是说,N个区域中至少一个区域包括一个或多个隐藏系数。在该示例中,若最后一个区域所包括的量化系数不为K时,则将该最后一个区域划分为单独的一个区域,或者,将该最后一个区域与上一个区域合并为一个区域。
方式2,根据空间位置,将当前块划分为N个区域
在一种示例中,上述N个区域为当前块的子块,例如将当前块平均划分为N个子块,示例性的,每个子块的大小为4*4。在该示例中,N个区域中可能存在量化系数全为0的区域,也可能存在不包括隐藏系数的区域。也就是说,N个区域中至少一个区域包括一个或多个隐藏系数。
在另一种示例中,根据当前块中像素点的空间位置关系,将空间位置上相邻的多个像素点划分为一个子块,每个子块中至少包括一个非零量化系数。
本申请实施例中,将当前块划分为N个区域的方法除上述各示例外,还可以包括其他的方法,本申请实施例对此不做限制。
本申请实施例的当前区域包括至少一个第一量化系数,即隐藏系数。
在一种示例中,第一量化系数可以为编解码端默认的当前区域中任意一个非零的量化系数。
在另一种示例中,第一量化系数可以为当前区域中绝对值最大的非零量化系数。
在另一种示例中,第一量化系数为当前区域中位于扫描顺序的第K个位置处的非零量化系数,该K小于或等于当前区域中非零量化系数个数。例如,如图5所示,当前区域中包含16个系数,可以将扫描顺序上的第16个非零量化系数和/或第15个非零量化系数作为当前区域的第一量化系数。
在一些实施例中,可以通过标志来指示当前块是否允许采用本申请实施例提供的量化系数奇偶性被隐藏的技术。在一些实施例中,本申请实施例提供的量化系数奇偶性被隐藏的技术也称为奇偶性隐藏技术。
示例性的,设置的至少一个标志可以是不同级别的标志,用于指示对应级别是否允许量化系数的奇偶性被隐藏。
可选的,上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
例如,上述至少一个标志包括序列级标志,该序列级标志用于指示当前序列是否允许量化系数的奇偶性被隐藏。例如,若该序列级标志的取值为1时,指示当前序列允许量化系数的奇偶性被隐藏,若该序列级标志的取值为0时,指示当前序列不允许量化系数的奇偶性被隐藏。
可选的,若至少一个标志包括序列级标志时,该序列级标志可以位于序列头(sequence header)中。
再例如,上述至少一个标志包括图像级标志,该图像级标志用于指示当前图像是否允许量化系数的奇偶性被隐藏。例如,若该图像级标志的取值为1时,指示当前图像允许量化系数的奇偶性被隐藏,若该图像级标志的取值为0时,指示当前图像不允许量化系数的奇偶性被隐藏。
可选的,若至少一个标志包括图像级标志时,该图像级标志可以位于图像头(picture header)中。
再例如,上述至少一个标志包括片级标志,该片级标志用于指示当前片(slice)是否允许量化系数的奇偶性被隐藏。例如,若该片级标志的取值为1时,指示当前片允许量化系数的奇偶性被隐藏,若该片级标志的取值为0时,指示当前片不允许量化系数的奇偶性被隐藏。
可选的,若至少一个标志包括片级标志时,该片级标志可以位于片头(slice header)中。
再例如,上述至少一个标志包括单元级标志,该单元级标志用于指示当前CTU是否允许量化系数的奇偶性被隐藏。例如,若该单元级标志的取值为1时,指示当前CTU允许量化系数的奇偶性被隐藏,若该单元级标志的取值为0时,指示当前CTU不允许量化系数的奇偶性被隐藏。
再例如,上述至少一个标志包括块级标志,该块级标志用于指示当前块是否允许量化系数的奇偶性被隐藏。例如,若该块级标志的取值为1时,指示当前块允许量化系数的奇偶性被隐藏,若该块级标志的取值为0时,指示当前块不允许量化系数的奇偶性被隐藏。
这样,解码端首先解码码流,得到上述至少一个标志,根据这至少一个标志,判断当前块是否允许量化系数的奇偶性被隐藏。若根据上述至少一个标志,确定当前块不允许量化系数的奇偶性被隐藏时,则跳过本申请实施例的方法,直接将上述解码出的量化系数进行反量化,得到变换系数。若根据上述至少一个标志,确定当前块允许使用本申请实施例提供的奇偶性隐藏技术时,则执行本申请实施例的方法。
例如,若上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志。此时,解码端首先解码码流,得到序列级标志,若该序列级标志指示当前序列不允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该序列级标志指示当前序列允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则继续解码码流,得到图像级标志,若该图像级标志指示当前图像不允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该图像级标志指示当前图像允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则继续解码码流,得到片级标志,若该片级标志指示当前片不允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该片级标志指示当前片允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则继续解码码流,得到单元级标志,若该单元级标志指示当前CTU不允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该单元级标志指示当前CTU允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则继续解码码流,得到块级标志,若该块级标志 指示当前块不允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则跳过本申请实施例的方法,采用传统的方法,对当前块进行反量化。若该块级标志指示当前块允许使用本申请实施例提供的量化系数奇偶隐藏技术时,则执行本申请实施例。
在一些实施例中,本申请实施例提供的量化系数奇偶隐藏技术,与目标变换方式互斥,其中目标变换方式包括二次变换或多次变换等。此时,解码端在确定当前块采用目标变换方式进行变换时,则跳过本申请实施例提供的技术方案,例如,跳过下面S402的步骤。
本申请实施例中,根据上述步骤,解码得到当前区域中P个量化系数,以及第一量化系数后,执行如下S402步骤。
S402、根据P个量化系数,确定第二量化系数的奇偶性。
本申请实施例中,为了降低编码代价,编码端根据当前区域中第二量化系数的奇偶性,对第二量化系数进行奇偶性隐藏,得到第一量化系数,并对该第一量化系数进行编码,同时使用当前区域中P个量化系数,来指示第二量化系数的奇偶性。这样,解码端根据上述步骤,得到当前区域中P个量化系数后,可以根据当前区域中P个量化系数,确定第二量化系数的奇偶性。
本申请实施例对上述S402中,根据当前区域中P个量化系数,确定当前区域中第二量化系数的奇偶性的方式不做限制。
例如,使用当前区域中P个量化系数的一种二值特性(0或1),确定当前区域中第二量化系数的奇偶性。
在一些实施例中,上述S402包括如下S402-A:
S402-A、根据P个量化系数对应的奇偶性,确定第二量化系数的奇偶性。
示例1,若P个量化系数对应的奇偶性为P个量化系数的第一绝对值之和的奇偶性进行指示,此时,上述S402-A包括:根据P个量化系数的第一绝对值之和的奇偶性,确定第二量化系数的奇偶性。
其中,量化系数的第一绝对值为该量化系数的部分或全部绝对值,例如第一绝对值为量化系数的绝对值中小于15的部分。
本申请实施例中,量化系数的绝对值用一个或多个标识指示,若该量化系数的绝对值大于15,则该量化系数的绝对值还包括超出15的部分。
基于此,本申请实施例中,量化系数的全部绝对值,指的是解码出的关于该量化系数的整个绝对值,包括各标识位的值,若该量化系数的绝对值大于15时,还包括超过15部分的值。
可选的,量化系数的绝对值中的部分绝对值指标识位中的全部或部分标识位的值,例如解码端根据P个量化系数的标识1的值的绝对值之和的奇偶性,确定第二量化系数的奇偶性。
例如,若P个量化系数的第一绝对值之和为偶数,则确定第二量化系数为偶数。
需要说明的是,该示例1中,若第二量化系数的奇偶性与P个量化系数的第一绝对值之和的奇偶性不一致时,则编码端对P个量化系数中的至少一个系数的奇偶性进行修改。例如,若第二量化系数为奇数,而P个量化系数的第一绝对值之和为偶数,此时,将P个量化系数中最小量化系数加1或减1,以将P个量化系数的第一绝对值之和修改为奇数。再例如,若第二量化系数为偶数,而P个量化系数的第一绝对值之和为奇数,此时,将P个量化系数中最小量化系数加1或减1,以将P个量化系数的第一绝对值之和修改为偶数。
示例性2,若P个量化系数对应的奇偶性为P个量化系数中目标量化系数的个数的奇偶性,此时,上述S402-A包括:确定P个量化系数中的目标量化系数,并根据P个量化系数中目标量化系数的个数奇偶性,确定所述第二量化系数的奇偶性。
上述目标量化系数为P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一种示例中,若目标量化系数为P个量化系数中的非零量化系数,则可以根据P个量化系数中非零量化系数的个数奇偶性,确定该第二量化系数的奇偶性。
例如,若P个量化系数中非零量化系数的个数为奇数,则确定第二量化系数为奇数。
例如,若P个量化系数中非零量化系数的个数为偶数,则确定第二量化系数为偶数。
需要说明的是,该示例中,若第二量化系数的奇偶性与P个量化系数中非零量化系数的个数的奇偶性不一致时,则编码端对P个量化系数中的至少一个系数进行修改。例如,若第二量化系数为奇数,而P个量化系数中非零量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个量化系数的值调整为0,以使P个量化系数中非零量化系数的个数为奇数。再例如,若第二量化系数为偶数,而P个量化系数中非零量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个量化系数的值调整为0,以使P个量化系数中非零量化系数的个数为偶数。
在另一种示例中,若目标量化系数为P个量化系数中值为偶数的非零量化系数,则可以根据P个量化系数中值为偶数的非零量化系数的个数奇偶性,确定该第二量化系数的奇偶性。
例如,若P个量化系数中值为偶数的非零量化系数的个数为奇数,则确定第二量化系数为奇数。
例如,若P个量化系数中值为偶数的非零量化系数的个数为偶数,则确定第二量化系数为偶数。
需要说明的是,该示例中,若第二量化系数的奇偶性与P个量化系数中值为偶数的非零量化系数的个数的奇偶性不一致时,则编码端对P个量化系数中的至少一个系数进行修改。例如,若第二量化系数为奇数,而P个量化系数中值为偶数的非零量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为2,或者,将P个量化系数中最小的一个非零量化系数的值加1或减1,以使P个量化系数中值为偶数的非零量化系数的个数为奇数。再例如,若第二量化系数为偶数,而P个量化系数中值为偶数的非零量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为2,或者,将P个量化系数中最小的一个非零量化系数的值加1或减1,以使P个量化 系数中非零量化系数的个数为偶数。
在另一种示例中,若目标量化系数为P个量化系数中值为偶数的量化系数,则可以根据P个量化系数中值为偶数的量化系数的个数奇偶性,确定该第二量化系数的奇偶性。该值为偶数的量化系数中包括值为0的量化系数。
例如,若P个量化系数中值为偶数的量化系数的个数为奇数,则确定第二量化系数为奇数。
例如,若P个量化系数中值为偶数的量化系数的个数为偶数,则确定第二量化系数为偶数。
需要说明的是,该示例中,若第二量化系数的奇偶性与P个量化系数中值为偶数的量化系数的个数的奇偶性不一致时,则编码端对P个量化系数中的至少一个系数进行修改。例如,若第二量化系数为奇数,而P个量化系数中值为偶数的量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0,以使P个量化系数中值为偶数的量化系数的个数为奇数。再例如,若第二量化系数为偶数,而P个量化系数中值为偶数的量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0,以使P个量化系数中量化系数的个数为偶数。
在另一种示例中,若目标量化系数为P个量化系数中值为奇数的量化系数,则可以根据P个量化系数中值为奇数的量化系数的个数奇偶性,确定该第二量化系数的奇偶性。
例如,若P个量化系数中值为奇数的量化系数的个数为奇数,则确定第二量化系数为奇数。
例如,若P个量化系数中值为奇数的量化系数的个数为偶数,则确定第二量化系数为偶数。
需要说明的是,该示例中,若第二量化系数的奇偶性与P个量化系数中值为奇数的量化系数的个数的奇偶性不一致时,则编码端对P个量化系数中的至少一个系数进行修改。例如,若第二量化系数为奇数,而P个量化系数中值为奇数的量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0或加1或减1,以使P个量化系数中值为奇数的量化系数的个数为奇数。再例如,若第二量化系数为偶数,而P个量化系数中值为奇数的量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0或加1或减1,以使P个量化系数中量化系数的个数为偶数。
可选的,编码端使用率失真代价最小的调整方式,对P个量化系数中的至少一个系数进行调整。
由上述可知,本申请实施例,根据当前区域中其他量化系数对应的预设特征的奇偶性,确定第二量化系数的奇偶性。
根据上述各方式,确定出当前区域中第二量化系数的奇偶性后,执行如下步骤S403。
S403、根据第一量化系数和第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。
由上述可知,本申请实施例中,为了降低编码代价,编码端对当前区域中的第二量化系数进行奇偶性隐藏,得到第一量化系数,由于第二量化系数的奇偶性被隐藏,因此,通过当前区域中P个量化系数来指示。这样解码端在解码当前区域时,首先解码码流,得到当前区域中的P个量化系数,以及第一量化系数,接着,根据P个量化系数,确定出该第二量化系数的奇偶性,这样,可以根据第一量化系数及第二量化系数的奇偶性,可以重建出具有奇偶性的第二量化系数,即可以实现奇偶性被隐藏系数的重建。
在一些实施例中,解码端根据第二量化系数的奇偶性不同,采用不同的方式重建第二量化系数。
情况1,若第二量化系数为奇数,则采用第一运算方式对第一量化系数进行运算,得到第二量化系数。
解码端采用的第一运算方式,与编码端确定第一量化系数的第三运算方式对应。
本申请实施例对上述第一运算方式和第三运算方式的具体形式不做限制,其中第一运算方式可以理解为第三运算方式的逆运算。
方式1,对于非零量化系数,若编码端采用的第三运算方式为将第二量化系数的值加一除以二,作为该第一量化系数。对应的,解码端采用的第一运算方式为第二量化系数的值等于第一量化系数乘以二减一。
示例性的,第一运算方式如公式(4)所示:
C=2*val-1          (4)
其中,C为第二量化系数,val为第一量化系数。
在该方式1中,若第二量化系数为奇数时,根据上述公式(4)所示的第一运算方式,确定出第二量化系数。
举例说明,假设当前区域包括6个像素点,通过解码码流,得到这6个像素点对应的量化系数分别为:5、6、3、2、2、0,将当前区域中位于扫描位置上的后5个量化系数确定为P个量化系数。此时,当前区域中P个量化系数分别为6、3、2、2、0,其中第一量化系数为5。示例性的,根据P个量化系数的第一绝对值之和的奇偶性确定第二量化系数的奇偶性,这P个量化系数的第一绝对值之和为13,是奇数,则确定第二量化系数为奇数。这样,解码端可以根据上述公式(4),重建出第二量化系数的值为5*2-1=9。
由上述示例可知,将原本值为9的第二量化系数,通过本申请实施例的奇偶隐藏技术,将隐藏为5,可以减少编码所需的比特数,大大降低了编码代价。
需要说明的是,上述公式(4)只是本申请实施例涉及的第一运算方式的一种示例,本申请实施例的第一运算方式包括但不限于上述公式(4)。
情况2,若第二量化系数为偶数,则采用第二运算方式对第一量化系数进行运算,得到第二量化系数。
解码端采用的第二运算方式,与编码端确定第一量化系数的第四运算方式对应。
本申请实施例对上述第二运算方式和第四运算方式的具体形式不做限制,其中第二运算方式可以理解为第四运算方式的逆运算。
在一种可能的实现方式中,若编码端采用的第四运算方式为将第二量化系数的值除以二,作为第一量化系数。对应的,解码端采用的第二运算方式为第二量化系数的值等于第一量化系数乘以二。
示例性的,第二运算方式如公式(5)所示:
C=2*val        (5)
其中,C为第二量化系数,val为第一量化系数。
在示例中,若第二量化系数为偶数时,根据上述公式(5)所示的第二运算方式,确定出当前第二量化系数。
举例说明,假设当前区域包括6个像素点,通过解码码流,得到这6个像素点对应的量化系数分别为:4、3、3、2、2、0,将当前区域中位于扫描位置上的后5个量化系数确定为P个量化系数。此时,当前区域中P个量化系数分别为3、3、2、2、0,其中第一量化系数为4。示例性的,可以根据P个量化系数的第一绝对值之和的奇偶性确定当前第二量化系数的奇偶性,这P个量化系数的第一绝对值之和为10,是偶数,则确定当前第二量化系数为偶数。这样,解码端可以根据上述公式(5),重建出第二量化系数的值为4*2=8。
由上述示例可知,将原本值为8的第二量化系数,通过本申请实施例的方法,处理为值为4的第一量化系数,可以减少编码所需的比特数,降低了编码代价。
在一些实施例中,解码端可以通过如下方式,确定出第二量化系数,即上述S403包括如下步骤:
S404-A1、采用预设运算方式对第一量化系数进行运算,得到运算结果;
S404-A2、根据第二量化系数的奇偶性和运算结果,得到第二量化系数。
本申请实施例对上述预设运算方式的具体形式不做限制。
在一些实施例中,上述预设运算方式包括所述第一量化系数乘以二,也就是说,将第一量化系数的值乘以2,得到运算结果。
接着,根据第二量化系数的奇偶性和上述运算结果,得到第二量化系数,例如,将运算结果与预设值之和,确定为第二量化系数的值,其中,若第二量化系数为奇数,则预设值为1,若第二量化系数为偶数,则预设值为0。
示例性的,解码端可以根据如下公式(6),确定出第二量化系数:
Quant[pos]=Quant[pos]*2+parity       (6)
其中,等号右侧的Quant[pos]为当前位置处的第一量化系数,等号左侧的Quant[pos]为重建得到的第二量化系数,parity为预设值,若第二量化系数为奇数时,则该parity=1,若第二量化系数为奇数时,则该parity=0。
由上述公式(6)可知,解码码流,得到当前位置的量化系数Quant[pos],若当前位置的量化系数为第一量化系数,则当前位置的第二量化系数等于Quant[pos]乘以2后加上奇偶性对应的值。
解码端,根据上述方法,可以确定出当前块中其他区域的第一量化系数对应的第二量化系数,当前块中各区域的第二量化系数,以及其他奇偶性未被隐藏的量化系数组成当前块的量化系数。接着,根据当前块的量化系数,确定当前块的重建值。
在一些实施例中,若编码端跳过变换步骤,直接对当前块的残差值进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
在一些实施例中,若编码端未跳过变换步骤,即编码端对当前块的残差值进行变换,得到变换系数,对变换系数进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的变换系数,对变换系数进行反变换,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
本申请实施例提供的种视频解码方法,解码器解码码流,得到当前区域中的P个量化系数和第一量化系数,接着,根据P个量化系数,确定第二量化系数的奇偶性,并根据第一量化系数及第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。本申请实施例,通过当前区域中P个量化系数,对当前区域中的第二量化系数的奇偶性进行隐藏,得到第一量化系数,在编码时对第一量化系数进行编码,可以减少编码所需的比特数,降低视频压缩代价。
在上述图4所示实施例的基础上,下面结合图6,对本申请实施例提供的视频解码方法做进一步说明。
图6为本申请一实施例提供的视频解码方法流程示意图。如图6所示,本申请实施例的方法包括:
S601、解码码流,得到至少一个标志。
上述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏。
可选的,上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
具体的,解码端首先解码码流,得到上述至少一个标志,根据这至少一个标志,判断当前块是否允许量化系数的奇偶性被隐藏。
若根据上述至少一个标志,确定当前块不允许量化系数的奇偶性被隐藏时,则执行如下S602和S609的步骤,即解码码流,得到当前块的已解码信息,该已解码信息中包括当前块的量化系数,此时,由于当前块中的量化系数未进行奇偶性隐藏,则执行进行后续的反量化过程。
若根据上述至少一个标志,确定当前块允许量化系数的奇偶性被隐藏时,则执行如下S602至S608的步骤。
S602、解码码流,得到当前块的已解码信息。
上述当前块的已解码信息中包括当前块中的量化系数。
示例性的,解码端首先解码标识1到5,接着按照从最后一个非零系数至变换块左上角的扫描顺序,解码每个量化系数的绝对值超出15的部分,最终得的当前块中各量化系数。
S603、将当前块划分为N个区域。
本申请实施例对当前块的区域划分方式不做限制,例如,根据解码扫描顺序,将当前块划分为N个区域,或者根据当前块中像素点的空间位置,将当前块划分为N个区域。
上述N个区域的大小可以相同,也可以不同,本申请实施例对此不做限制。
上述S603的具体实现过程可以参照上述S401-A2的相关描述,在此不再赘述。
S604、从当前块的已解码信息中,得到当前区域中的P个量化系数和第一量化系数。
其中,当前区域为当前块的N个区域中待解码的一个区域。
上述当前块的已解码信息中包括当前块中的量化系数,这样可以从当前块的已解码信息中,得到当前区域所包括的P个量化系数和第一量化系数。
在一些实施例中,上述P个量化系数为当前区域的所有量化系数。
在一些实施例中,上述P个量化系数为当前区域的部分量化系数。
若上述P个量化系数为当前区域的部分量化系数时,这P个量化系数中可以包括当前区域的奇偶性被隐藏的量化系数,也可以不包括当前区域中奇偶性被隐藏的量化系数,例如,上述P个量化系数为当前区域中除奇偶性被隐藏的第一量化系数之外的其他量化系数。
上述S604的具体实现过程可以参照上述S401-A3的相关描述,在此不再赘述。
S605、判断当前区域是否满足预设条件。
本申请实施例中,对本申请提出的奇偶性隐藏技术进行限定。具体是,若当前区域满足设定的预设条件时,则说明当前区域使用本申请实施例提供的奇偶性隐藏技术可以得到显著的有益效果,此时,执行如下S606至S608的步骤。若当前区域不满足设定的预设条件时,说明当前区域使用本申请实施例提供的奇偶性隐藏技术无法达到显著的有益效果,此时,执行如下S609的步骤。
本申请实施例对上述预设条件的具体内容不做限制,可以根据实际需要设定。
在一种可能的实现方式中,上述预设条件包括如下至少一个条件:
条件1,当前区域中非零量化系数的个数大于第一数值;
条件2,当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
条件3,当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
条件4,当前区域中,非零量化系数的绝对值之和大于第四数值。
在该实现方式中,若当前区域满足上述4个条件中的至少一个条件时,则执行如下S606至S608的步骤。
在一些实施例中,上述4个条件还可以相互组合,形成新的约束条件。
本申请实施例对上述第一数值至第四数值的具体取值不做限制,只有第一数值至第四数值均为正整数即可。
在一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为固定值。
在另一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值,即为编码端根据当前编码信息确定的数值。
在一些实施例中,若第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值时,则编码端将该非固定值写入码流。
根据上述预设条件,确定出当前区域满足上预设条件时,则说明当前区域中存在奇偶性被隐藏的量化系数,即当前区域存在第一量化系数,此时执行如下步骤S606。
S606、根据P个量化系数,确定第二量化系数的奇偶性。
例如,根据P个量化系数对应的奇偶性,确定第二量化系数的奇偶性。
示例的,根据P个量化系数的第一绝对值之和的奇偶性,确定第二量化系数的奇偶性。
示例的,根据P个量化系数中目标量化系数的个数奇偶性,确定所述第二量化系数的奇偶性。
上述目标量化系数为P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
上述S606的具体实现过程可以参照上述S402的相关描述,在此不再赘述。
S607、根据第一量化系数和第二量化系数的奇偶性,确定第二量化系数。
例如,若第二量化系数为奇数,则将第一量化系数乘以二加一的值,确定为第二量化系数的值。
再例如,若第二量化系数为奇数,则将第一量化系数乘以二减一的值,确定为第一量化系数的值。
再例如,若第二量化系数为偶数,则将第一量化系数乘以二的值,确定为第一量化系数的值。
S608、根据第二量化系数,确定当前块的量化系数。
根据上述方法,确定出当前块各区域中奇偶性被隐藏的量化系数,结合解码出的当前块中奇偶性未被隐藏的其他量化系数,得到当前块的量化系数。
S609、根据当前块的已解码信息,确定当前块的量化系数。
若当前区域不包括奇偶性被隐藏的量化系数,则将码流中解码出的量化系数,作为当前块最终的量化系数。
S610、根据当前块的量化系数,得到当前块的重建值。
根据上述方法,确定出当前块的量化系数,通过如下两种方式,确定当前块的重建值。
方式1,若编码端跳过变换步骤,直接对当前块的残差值进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
方式2,若编码端未跳过变换步骤,即编码端对当前块的残差值进行变换,得到变换系数,对变换系数进行量化。对应的,解码端对当前块的量化系数进行反量化,得到当前块的变换系数,对变换系数进行反变换,得到当前块的残差值。另外,采用帧内预测和/或帧间预测方法,确定出当前块的预测值,将当前块的预测值与重建值相加,得到当前块的重建值。
本申请实施例,为奇偶性隐藏技术设置预设条件,在当前区域满足预设条件时,确定当前区域中至少一个量化系数的奇偶性被隐藏,进而采用本申请提出的奇偶性隐藏技术对当前区域中的第一量化系数进行解码,提高解码准确性。
示例性的,本申请实施例对应的编解码语法如表3所示:
表3
Figure PCTCN2022084135-appb-000004
Figure PCTCN2022084135-appb-000005
上述表3中增加了变量SUBSIZE和HPCTHRESH,其中,SUBSIZE用于标识当前块的每个区域的大小,HPCTHRESH用于标识每个区域中打开奇偶隐藏技术需要的区域中非零系数个数大于某个阈值。
本申请实施例,解码端在解码码当前区域时,首先判断当前区域是否满足预设条件,以确定当前区域采用本申请提供的奇偶性隐藏技术进行解码时,是否可以带来显著的有益技术效果,在确定采用该奇偶性隐藏技术具有显著的有益效果时,采用本申请的技术方案对当前区域进行解码,提高解码可靠性。
上文对本申请实施例涉及的视频解码方法进行了描述,在此基础上,下面针对编码端,对本申请涉及的视频解码方法进行描述。
图7为本申请实施例提供的视频编码方法的一种流程示意图。本申请实施例的执行主体可以为上述图1和图2所示的编码器。
如图7所示,本申请实施例的方法包括:
S701、将当前块划分为N个区域,N为正整数。
本申请实施例,将当前块划分为一个或多个区域,例如划分为N个区域,N为正整数。为了降低编码代价,可以根据同一个区域中量化系数相关的奇偶性,例如根据该区域中量化系数的绝对值之和的奇偶性,对该区域中一个或多个量化系数的奇偶性进行隐藏,以降低奇偶性被隐藏的量化系数,例如,奇偶性待隐藏的第二量化系数的值为a1,a1 为奇数,则采用奇数对应的处理方法对a1进行处理,得到a1对应的第一量化系数a2,a2小于a1,这样对a2进行编码相比于对a1进行编码,使用更少的比特数,降低了编码代价。
本申请实施例对当前块的区域划分方式不做限制。
可选的,这N个区域中至少两个区域所包括的量化系数个数相同。
可选的,这N个区域中至少两个区域所包括的量化系数个数不相同。
在一些实施例中,上述S701中将当前块划分为N个区域的具体方式包括但不限于如下几种:
方式1,根据扫描顺序,将当前块划分为N个区域。
在一种示例中,按照扫描方向,将当前块中每隔M个非零量化系数划分为一个区域,得到N个区域。这N个区域中每个区域均包括M个非零量化系数。这N个区域中至少一个区域包括一个或多个奇偶性可隐藏的第二量化系数。在该示例中,若最后一个区域所包括的非零量化系数不为M时,则将该最后一个区域划分为单独的一个区域,或者,将该最后一个区域与上一个区域合并为一个区域。
在另一种示例中,按照扫描方向,将当前块中每隔K个像素点划分为一个区域,得到N个区域。例如,对于一个使用反向ZigZag扫描顺序的8x8大小的变换块,当每个区域大小相等,即每个区域包含16个系数时,图5所示,将当前块划分为4个区域。在该示例中,若最后一个区域所包括的量化系数不为K时,则将该最后一个区域划分为单独的一个区域,或者,将该最后一个区域与上一个区域合并为一个区域。
方式2,根据空间位置,将当前块划分为N个区域
在一种示例中,上述N个区域为当前块的子块,例如将当前块平均划分为N个子块,示例性的,每个子块的大小为4*4。
在另一种示例中,根据当前块中像素点的空间位置关系,将空间位置上相邻的多个像素点划分为一个子块,每个子块中至少包括一个非零量化系数。
本申请实施例中,将当前块划分为N个区域的方法除上述各示例外,还可以包括其他的方法,本申请实施例对此不做限制。
在一些实施例中,可以通过标志来指示当前块是否允许采用本申请实施例提供的量化系数奇偶性被隐藏的技术。在一些实施例中,本申请实施例提供的化系数奇偶性被隐藏的技术也称为奇偶性隐藏技术。
示例性的,设置的至少一个标志可以是不同级别的标志,用于指示对应级别是否允许量化系数的奇偶性被隐藏。
可选的,上述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
例如,上述至少一个标志包括序列级标志,该序列级标志用于指示当前序列是否允许量化系数的奇偶性被隐藏。
可选的,若至少一个标志包括序列级标志时,该序列级标志可以位于序列头(sequence header)中。
再例如,上述至少一个标志包括图像级标志,该图像级标志用于指示当前图像是否允许量化系数的奇偶性被隐藏。
可选的,若至少一个标志包括图像级标志时,该图像级标志可以位于图像头(picture header)中。
再例如,上述至少一个标志包括片级标志,该片级标志用于指示当前片(slice)是否允许量化系数的奇偶性被隐藏。
可选的,若至少一个标志包括片级标志时,该片级标志可以位于片头(slice header)中。
再例如,上述至少一个标志包括单元级标志,该单元级标志用于指示当前CTU是否允许量化系数的奇偶性被隐藏。
再例如,上述至少一个标志包括块级标志,该块级标志用于指示当前块是否允许量化系数的奇偶性被隐藏。
这样,编码端首先得到上述至少一个标志,根据这至少一个标志,判断当前块是否允许量化系数的奇偶性被隐藏。若根据上述至少一个标志,确定当前块不允许量化系数的奇偶性被隐藏时,则跳过本申请实施例的方法。若根据上述至少一个标志,确定当前块允许使用本申请实施例提供的奇偶性隐藏技术时,则执行本申请实施例的方法。
在一些实施例中,本申请实施例提供的量化系数奇偶隐藏技术,与目标变换方式互斥,其中目标变换方式包括二次变换或多次变换等。此时,编码端在确定当前块采用目标变换方式进行变换时,则跳过本申请实施例提供的技术方案。
S702、确定当前区域中的第二量化系数,并对第二量化系数进行奇偶性隐藏,得到第一量化系数。
其中,当前区域为N个区域中包括至少一个非零量化系数的区域。
本申请实施例,为了降低编码代价,对该第二量化系数进行奇偶性隐藏,得到第一量化系数,并将该第一量化系数编入码流,而不是将该第二量化系数编码码流。由于第一量化系数通常小于第二量化系数,因此,对第一量化系数进行编码,相比于编码第二量化系数,所需要的比特数减少,进而降低了编码代价。
本申请实施例对第二量化系数进行奇偶性隐藏,得到第一量化系数的方式不做限制。
在一些实施例中,可根据第二量化系数的奇偶性,选择不同的方式,确定第一量化系数,具体如情况1和情况2所示。
情况1,若第二量化系数为奇数,则采用第三运算方式对第二量化系数进行运算,得到所第一量化系数。
本申请实施例上述第三运算方式的具体形式不做限制。
方式1,第三运算方式包括第一量化系数等于第二量化系数的值加一除以二。
示例性的,第三运算方式如公式(7)所示:
val=(A+1)/2             (7)
其中,A为第二量化系数,val为第一量化系数。
在方式1中,若第二量化系数为奇数时,根据上述公式(7)所示的第三运算方式,对第二量化系数进行奇偶性隐藏,得到第一量化系数。例如,第二量化系数的值为9,则根据上述公式(7)确定出该第一量化系数的值为5,编码数值5相比于编码数值9可以减少比特数,降低编码代价。
需要说明的是,上述公式(7)只是本申请实施例涉及的第三运算方式的一种示例,本申请实施例的第三运算方式包括但不限于上述公式(7)。
情况2,若第二量化系数为偶数,则采用第四运算方式对第二量化系数进行运算,得到第一量化系数。
本申请实施例上述第四运算方式的具体形式不做限制。
示例性的,第四运算方式包括第一量化系数等于第二量化系数的值除以二。
例如,第四运算方式如公式(8)所示:
val=A/2         (8)
在情况2中,若第二量化系数为偶数时,根据上述公式(8)所示的第四运算方式,对第二量化系数进行奇偶性隐藏,得到第一量化系数。例如,第二量化系数的值为10,则根据上述公式(9)确定出该第一量化系数的值为5,编码数值5相比于编码数值10可以减少比特数,降低编码代价。
需要说明的是,上述公式(8)只是本申请实施例涉及的第四运算方式的一种示例,本申请实施例的第四运算方式包括但不限于上述公式(8)。
在一些实施例中,则编码端可以根据第二量化系数的奇偶性,采用预设运算方式对第二量化系数进行运算,得到第一量化系数。
本申请对预设运算方式的具体取值不做限制,例如预设运算方式为第二量化系数的值除以大于1的正整数。
示例性的,预设运算方式包括第二量化系数的值除以二取整,其中取整可以理解为取商值操作,例如第二量化系数的值为7,7除以2取值为3。
例如,编码端通过如下公式(9)确定出第一量化系数:
Q b=Q//2       (9)
其中,Q表示第二量化系数,Q b表示第一量化系数,“//”表示取整运算。
由上述公式(9)可知,对于第二量化系数,经过上述运算进行奇偶性隐藏,得到第一量化系数,第一量化系数的绝对值小于第二量化系数的绝对值,在编码时所需的比特数少,进而降低编码代价。例如,第二量化系数为10时,则只需要编码5即可,再例如,第二量化系数为21时,则只需要编码10即可,大幅度减少编码所需的比特数。
S703、对第一量化系数进行编码,得到码流。
根据上述方法,确定出当前区域中第一量化系数后,对该第一量化系数进行编码,得到码流。
本申请实施例,通过当前区域中P个量化系数对该第二量化系数的奇偶性进行指示。
例如,使用当前区域中P个量化系数的一种二值特性(0或1),指示当前区域中第二量化系数的奇偶性。
在一些实施例中,通过当前区域中P个量化系数对应的奇偶性指示第二量化系数的奇偶性。
在一种示例中,上述P个量化系数为当前区域中的所有量化系数。
在另一种示例中,上述P个量化系数为当前区域中的部分量化系数。
可选的,上述P个量化系数中不包括当前区域中的第一量化系数。
示例性的,P个量化系数对应的奇偶性可以是P个量化系数中最小量化系数、P个量化系数中最大量化系数、P个量化系数的绝对值之和、P个量化系数中目标量化系数的个数等等的奇偶性。
本申请实施例使用当前区域中P个量化系数对应的奇偶性指示第二量化系数的奇偶性,例如,使用P个量化系数对应的奇偶性为奇数,来指示当前第二量化系数为奇数,使用P个量化系数对应的奇偶性为偶数,来指示当前第二量化系数为偶数。
在一些实施例中,若P个量化系数对应的奇偶性,与第二量化系数的奇偶性不一致时,则本申请实施例的方法还包括如下步骤1:
步骤1、对P个量化系数进行调整,以使P个量化系数对应的奇偶性,与第二量化系数的奇偶性一致。
情况1,若第二量化系数的奇偶性通过P个量化系数的第一绝对值之和的奇偶性进行指示,则上述步骤1包括:对P个量化系数的值进行调整,以使P个量化系数的第一绝对值之和的奇偶性,与第二量化系数的奇偶性一致。
其中,量化系数的第一绝对值为量化系数的部分或全部绝对值,例如,量化系数的第一绝对值为小于15部分的绝对值。
上述情况1包括如下两种示例:
示例1,若第二量化系数为奇数,且P个量化系数的第一绝对值之和为偶数时,则调整P个量化系数的值,以使调整后的P个量化系数的第一绝对值之和为奇数。
例如,若第二量化系数为奇数,而P个量化系数的第一绝对值之和为偶数,此时,将P个量化系数中最小量化系数加1或减1,以将P个量化系数的第一绝对值之和修改为奇数。
示例2,若第二量化系数为偶数,且P个量化系数的第一绝对值之和为奇数时,则调整P个量化系数的取值,以使调整后的P个量化系数的第一绝对值之和为偶数。
例如,第二量化系数为偶数,而P个量化系数的第一绝对值之和为奇数,此时,将P个量化系数中最小量化系数加1或减1,以将P个量化系数的第一绝对值之和修改为偶数。
情况2,若第二量化系数的奇偶性通过P个量化系数中目标量化系数的个数的奇偶性进行指示,则上述步骤1包括:对P个量化系数的值进行调整,以使P个量化系数中目标量化系数个数的奇偶性,与第二量化系数的奇偶性一致。
上述示例2至少包括如下两种示例:
示例1,若第二量化系数为奇数,且P个量化系数中目标量化系数的个数为偶数,则调整P个量化系数的取值,以使调整后的P个量化系数中目标量化系数个数的奇数。
示例2,若第二量化系数为偶数,且P个量化系数中目标量化系数的个数为奇数,则调整P个量化系数的取值,以使调整后的P个量化系数中目标量化系数个数的偶数。
上述目标量化系数为P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一种示例中,若目标量化系数为P个量化系数中的非零量化系数,则编码端对P个量化系数中的至少一个系数进行修改。例如,第二量化系数为奇数,而P个量化系数中非零量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个量化系数的值调整为0,以使P个量化系数中非零量化系数的个数为奇数。
再例如,第二量化系数为偶数,而P个量化系数中非零量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数的值调整为0,以使P个量化系数中非零量化系数的个数为偶数。
在另一种示例中,若目标量化系数为P个量化系数中值为偶数的非零量化系数,则编码端对P个量化系数中的至少一个系数进行修改。例如,第二量化系数为奇数,而P个量化系数中值为偶数的非零量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为2,或者,将P个量化系数中最小的一个非零量化系数的值加1或减1,以使P个量化系数中值为偶数的非零量化系数的个数为奇数。
再例如,第二量化系数为偶数,而P个量化系数中值为偶数的非零量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为2,或者,将P个量化系数中最小的一个非零量化系数的值加1或减1,以使P个量化系数中非零量化系数的个数为偶数。编码端使用率失真代价最小的调整方式,对P个量化系数中的至少一个系数进行调整。
在另一种示例中,若目标量化系数为P个量化系数中值为偶数的量化系数,则编码端对P个量化系数中的至少一个系数进行修改。例如,第二量化系数为奇数,而P个量化系数中值为偶数的量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0,以使P个量化系数中值为偶数的量化系数的个数为奇数。
再例如,第二量化系数为偶数,而P个量化系数中值为偶数的量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0,以使P个量化系数中量化系数的个数为偶数。
在另一种示例中,若目标量化系数为P个量化系数中值为奇数的量化系数,则编码端对P个量化系数中的至少一个系数进行修改。例如,第二量化系数为奇数,而P个量化系数中值为奇数的量化系数的个数为偶数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0或加1或减1,以使P个量化系数中值为奇数的量化系数的个数为奇数。
再例如,第二量化系数为偶数,而P个量化系数中值为奇数的量化系数的个数为奇数,则可以将P个量化系数中的一个为零的量化系数调整为1,或者,将P个量化系数中最小的一个非零量化系数调整为0或加1或减1,以使P个量化系数中量化系数的个数为偶数。
进一步的,将本申请提出的奇偶性隐藏技术实施在AVM参考软件上,使用的区域大小设置为16,奇偶性隐藏的开启非零系数个数阈值为4。当本申请的奇偶性隐藏技术对当前区域开启时,当前区域中非零系数小于等于15部分的绝对值和为奇数,则表示该区域扫描顺序上最后一个系数(即第二量化系数)为奇数,为偶数表示该区域扫描顺序上最后一个系数(即第二量化系数)为偶数。具体测试结果如表4所示:
表4
Figure PCTCN2022084135-appb-000006
上述表4中的PSNR为峰值信噪比(Peak signal-to-noise ratio),表示信号最大可能功率和影响它的表示精度的破坏性噪声功率的比值。由于许多信号都有非常宽的动态范围,峰值信噪比常用对数分贝单位来表示。在视频编解码中,PSNR用于来评价一幅图像压缩后和原图像相比质量的好坏,PSNR越高,压缩后失真越小。
由上述表4可知,在AVM通用测试条件下,采用本申请实施例的奇偶性隐藏技术,全帧内帧编码性能YUV3分量上提升为0.10%、0.75%和0.79%。
本申请实施例提供的视频编码方法,编码端将当前块划分为N个区域,确定当前区域中的第二量化系数,并对第二量化系数进行奇偶性隐藏,得到第一量化系数;接着,对第一量化系数进行编码,得到码流,该第二量化系数的奇偶性通过当前区域中P个量化系数进行指示。即本申请实施例,编码端对于当前区域中第二量化系数进行奇偶性隐藏,得到第一量化系数,由于第一量化系数的绝对值小于第二量化系数,这样对第一量化系数进行编码相比于第二量化系数,可以减少编码比特数,进而降低编码代价。同时,通过当前区域中P个量化系数对该第二量化系数的奇偶性进行指示,以使解码端根据当前区域中P个量化系数,确定出该第二量化系数的奇偶性,进而根据该第二量化系数的奇偶性和第一量化系数实现对该第二量化系数的准确重建。
在上述图7所示实施例的基础上,下面结合图8,对本申请实施例提供的视频编码方法做进一步说明。
图8为本申请一实施例提供的视频编码方法流程示意图。如图8所示,本申请实施例的方法包括:
S801、获得至少一个标志。
上述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏。
可选的,至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
若根据至少一个标志,确定允许当前块的量化系数的奇偶性被隐藏时,则执行如下步骤S802。
若根据至少一个标志,确定不允许当前块的量化系数的奇偶性被隐藏时,则执行如下步骤S806。
S802、将当前块划分为N个区域。
本申请实施例对当前块的区域划分方式不做限制,例如,根据扫描顺序,将当前块划分为N个区域,或者根据当前块中像素点的空间位置,将当前块划分为N个区域。
上述N个区域的大小可以相同,也可以不同,本申请实施例对此不做限制。
上述S802的具体实现过程可以参照上述S701的相关描述,在此不再赘述。
S803、判断当前区域是否满足预设条件。
本申请实施例中,对本申请提出的奇偶性隐藏技术进行限定。具体是,若当前区域满足设定的预设条件时,则说明当前区域使用本申请实施例提供的奇偶性隐藏技术可以得到显著的有益效果,此时,执行如下S804的步骤。
若当前区域不满足设定的预设条件时,说明当前区域使用本申请实施例提供的奇偶性隐藏技术无法达到显著的有益效果,此时,执行如下S806的步骤。
本申请实施例对上述预设条件的具体内容不做限制,可以根据实际需要设定。
在一种可能的实现方式中,上述预设条件包括如下至少一个条件:
条件1,当前区域中非零量化系数的个数大于第一数值;
条件2,当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
条件3,当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
条件4,当前区域中,非零量化系数的绝对值之和大于第四数值。
在一些实施例中,上述4个条件还可以相互组合,形成新的约束条件。
本申请实施例对上述第一数值至第四数值的具体取值不做限制,只有第一数值至第四数值均为正整数即可。
在一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为固定值。
在另一种示例中,上述第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值,即为编码端根据当前编码信息确定的数值。
在一些实施例中,若第一数值、第二数值、第三数值和第四数值中的至少一个为非固定值时,则编码端将该非固定值写入码流,解码端从码流中解析出该非固定值。
S804、确定当前区域中的第二量化系数,并对第二量化系数进行奇偶性隐藏,得到第一量化系数。
S805、对第一量化系数进行编码,得到码流。
上述S804和S805的步骤,可以参照上述S702和S703的描述,在此不再赘述。
S806、对第二量化系数进行编码,得到码流。
本申请实施例,编码端在编码当前区域时,首先判断当前区域是否满足预设条件,来确定当前区域采用本申请提供的奇偶性隐藏技术进行编码时,是否可以带来显著的有益技术效果,在确定采用该奇偶性隐藏技术具有显著的有益效果时,采用本申请的技术方案对当前区域进行编码,提高编码可靠性。
应理解,图4至图8仅为本申请的示例,不应理解为对本申请的限制。
以上结合附图详细描述了本申请的优选实施方式,但是,本申请并不限于上述实施方式中的具体细节,在本申请的技术构思范围内,可以对本申请的技术方案进行多种简单变型,这些简单变型均属于本申请的保护范围。例如,在上述具体实施方式中所描述的各个具体技术特征,在不矛盾的情况下,可以通过任何合适的方式进行组合,为了避免不必要的重复,本申请对各种可能的组合方式不再另行说明。又例如,本申请的各种不同的实施方式之间也可以进行任意组合,只要其不违背本申请的思想,其同样应当视为本申请所公开的内容。
还应理解,在本申请的各种方法实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。另外,本申请实施例中,术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系。具体地,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
上文结合图4至图8,详细描述了本申请的方法实施例,下文结合图9至图12,详细描述本申请的装置实施例。
图9是本申请实施例提供的视频解码装置的示意性框图。
如图9所示,视频解码装置10包括:
解码单元11,用于解码码流,得到当前区域中的P个量化系数和第一量化系数,所述当前区域为当前块中包括至少一个非零量化系数的区域,所述第一量化系数为对所述当前区域中的第二量化系数进行奇偶性隐藏后得到的量化系数,所述P为正整数;
奇偶性确定单元12,用于根据所述P个量化系数,确定所述第二量化系数的奇偶性;
系数确定单元13,用于根据所述第一量化系数和所述第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。
在一些实施例中,奇偶性确定单元12,具体用于根据所述P个量化系数对应的奇偶性,确定所述第二量化系数的奇偶性。
在一些实施例中,奇偶性确定单元12,具体用于根据所述P个量化系数的第一绝对值之和的奇偶性,确定所述第 二量化系数的奇偶性,所述第一绝对值为所述量化系数的部分或全部绝对值。
在一些实施例中,奇偶性确定单元12,具体用于若所述P个量化系数的第一绝对值之和为奇数,则确定所述第二量化系数为奇数;若所述P个量化系数的第一绝对值之和为偶数,则确定所述第二量化系数为偶数。
在一些实施例中,奇偶性确定单元12,具体用于确定所述P个量化系数中的目标量化系数;根据所述P个量化系数中目标量化系数的个数奇偶性,确定所述第二量化系数的奇偶性。
在一些实施例中,奇偶性确定单元12,具体用于若所述P个量化系数中所述目标量化系数的个数为奇数,则确定所述第二量化系数为奇数;若所述P个量化系数中所述目标量化系数的个数为偶数,则确定所述第二量化系数为偶数。
在一些实施例中,所述目标量化系数为所述P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一些实施例中,系数确定单元13,具体用于采用预设运算方式对所述第一量化系数进行运算,得到运算结果;根据所述第二量化系数的奇偶性和所述运算结果,得到所述第二量化系数。
在一些实施例中,所述预设运算方式包括所述第一量化系数的值乘以二。
在一些实施例中,系数确定单元13,具体用于将所述运算结果与预设值之和,确定为所述第二量化系数,其中,若所述第二量化系数为奇数,则所述预设值为1,若所述第二量化系数为偶数,则所述预设值为0。
在一些实施例中,奇偶性确定单元12,具体用于若所述当前区域满足预设条件时,则根据所述P个量化系数,确定所述第二量化系数的奇偶性。
在一些实施例中,所述预设条件包括如下至少一个:
所述当前区域中非零量化系数的个数大于第一数值;
所述当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
所述当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
所述当前区域中,非零量化系数的绝对值之和大于第四数值。
在一些实施例中,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为固定值。
在一些实施例中,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值。
在一些实施例中,若所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值,则所述解码单元11,还用于解码所述码流,得到所述非固定值。
在一些实施例中,所述解码单元11,还用于若所述当前块采用目标变换方式进行变换时,则跳过根据所述P个量化系数的量化值,确定所述当前区域中第一量化系数的奇偶性的步骤。
在一些实施例中,所述目标变换方式包括二次变换或多次变换。
在一些实施例中,所述第一量化系数为所述当前区域中位于扫描顺序中第K个位置处的非零量化系数,所述K小于或等于所述当前区域中非零量化系数个数。
在一些实施例中,所述解码单元11,还用于解码所述码流,得到所述当前块的已解码信息;将所述当前块划分为N个区域,所述N为正整数;从所述当前块的已解码信息中,得到所述P个量化系数和所述第一量化系数。
在一些实施例中,解码单元11,还用于根据扫描顺序,将所述当前块划分为N个区域。
在一些实施例中,解码单元11,具体用于根据空间位置,将所述当前块划分为N个区域。
在一些实施例中,所述N个区域中至少两个区域所包括的量化系数个数相同。
在一些实施例中,所述N个区域中至少两个区域所包括的量化系数个数不相同。
在一些实施例中,所述解码单元11,还用于解码所述码流,得到至少一个标志,所述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏;若根据所述至少一个标志,确定允许所述当前块中至少一个量化系数的奇偶性被隐藏时,将所述当前块划分为N个区域。
在一些实施例中,所述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图9所示的视频解码装置10可以对应于执行本申请实施例的方法中的相应主体,并且视频解码装置10中的各个单元的前述和其它操作和/或功能分别为了实现方法等各个方法中的相应流程,为了简洁,在此不再赘述。
图10是本申请实施例提供的视频编码装置的示意性框图。
如图10所示,视频编码装置20包括:
划分单元21,用于将当前块划分为N个区域,所述N为正整数;
处理单元22,用于确定当前区域中的第二量化系数,并对所述第二量化系数进行奇偶性隐藏,得到第一量化系数,所述当前区域为所述N个区域中包括至少一个非零量化系数的区域;
编码单元23,用于对所述第一量化系数进行编码,得到码流,所述第二量化系数的奇偶性通过所述当前区域中P个量化系数进行指示,所述P为正整数。
在一些实施例中,所述第二量化系数的奇偶性通过所述当前区域中P个量化系数对应的奇偶性进行指示。
在一些实施例中,若所述P个量化系数对应的奇偶性,与所述第二量化系数的奇偶性不一致时,处理单元22,还用于对所述P个量化系数进行调整,以使所述P个量化系数对应的奇偶性,与所述第二量化系数的奇偶性一致。
在一些实施例中,若所述第二量化系数的奇偶性通过所述P个量化系数的第一绝对值之和的奇偶性进行指示,则处理单元22,还用于对所述P个量化系数的值进行调整,以使所述P个量化系数的第一绝对值之和的奇偶性,与所述第二量化系数的奇偶性一致。
在一些实施例中,处理单元22,具体用于若所述第二量化系数为奇数,且所述P个量化系数的第一绝对值之和为 偶数时,则调整所述P个量化系数的值,以使调整后的所述P个量化系数的第一绝对值之和为奇数;若所述第二量化系数为偶数,且所述P个量化系数的第一绝对值之和为奇数时,则调整所述P个量化系数的值,以使调整后的所述P个量化系数的第一绝对值之和为偶数。
在一些实施例中,若所述第二量化系数的奇偶性通过所述P个量化系数中目标量化系数的个数的奇偶性进行指示,则处理单元22,具体用于对所述P个量化系数的值进行调整,以使所述P个量化系数中目标量化系数个数的奇偶性,与所述第二量化系数的奇偶性一致。
在一些实施例中,处理单元22,具体用于若所述第二量化系数为奇数,且所述P个量化系数中目标量化系数的个数为偶数,则调整所述P个量化系数的取值,以使调整后的所述P个量化系数中目标量化系数个数的奇数;若所述第二量化系数为偶数,且所述P个量化系数中目标量化系数的个数为奇数,则调整所述P个量化系数的取值,以使调整后的所述P个量化系数中目标量化系数个数的偶数。
在一些实施例中,所述目标量化系数为P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
在一些实施例中,所述处理单元22,用于根据所述第二量化系数的奇偶性,采用预设运算方式对所述第二量化系数进行运算,得到所述第一量化系数。
在一些实施例中,所述预设运算方式包括所述第二量化系数的值除以二取整。
在一些实施例中,所述处理单元22,具体用于若所述当前区域满足所述预设条件时,对所述第二量化系数进行奇偶性隐藏,得到第一量化系数。
在一些实施例中,所述预设条件包括如下至少一个:
所述当前区域中非零量化系数的个数大于第一数值;
所述当前区域中,扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
所述当前区域中,扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
所述当前区域中,非零量化系数的绝对值之和大于第四数值。
在一些实施例中,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为固定值。
在一些实施例中,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值。
在一些实施例中,若所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值,则所述编码单元23,还用于将所述非固定值写入所述码流。
在一些实施例中,所述第一量化系数为所述当前区域中位于扫描顺序中第K个位置处的非零量化系数,所述K小于或等于所述当前区域中非零量化系数个数。
在一些实施例中,所述处理单元22,具体用于根据扫描顺序,将所述当前块划分为N个区域。
在一些实施例中,所述处理单元22,具体用于根据空间位置,将所述当前块划分为N个区域。
在一些实施例中,所述N个区域中至少两个区域所包括的量化系数个数相同。
在一些实施例中,所述N个区域中至少两个区域所包括的量化系数个数不相同。
在一些实施例中,所述处理单元22,还用于获得至少一个标志,所述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏;若根据所述至少一个标志,确定允许所述当前块的量化系数的奇偶性被隐藏时,将当前块划分为N个区域。
在一些实施例中,所述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
在一些实施例中,所述处理单元22,还用于若所述当前块采用目标变换方式进行变换时,则跳过将所述当前块划分为N个区域。
在一些实施例中,所述目标变换方式包括二次变换或多次变换。
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图10所示的视频编码装置20可以对应于执行本申请实施例的方法中的相应主体,并且视频编码装置20中的各个单元的前述和其它操作和/或功能分别为了实现方法等各个方法中的相应流程,为了简洁,在此不再赘述。
上文中结合附图从功能单元的角度描述了本申请实施例的装置和系统。应理解,该功能单元可以通过硬件形式实现,也可以通过软件形式的指令实现,还可以通过硬件和软件单元组合实现。具体地,本申请实施例中的方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路和/或软件形式的指令完成,结合本申请实施例公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件单元组合执行完成。可选地,软件单元可以位于随机存储器,闪存、只读存储器、可编程只读存储器、电可擦写可编程存储器、寄存器等本领域的成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法实施例中的步骤。
图11是本申请实施例提供的电子设备的示意性框图。
如图11所示,该电子设备30可以为本申请实施例所述的视频编码器,或者视频解码器,该电子设备30可包括:
存储器33和处理器32,该存储器33用于存储计算机程序34,并将该程序代码34传输给该处理器32。换言之,该处理器32可以从存储器33中调用并运行计算机程序34,以实现本申请实施例中的方法。
例如,该处理器32可用于根据该计算机程序34中的指令执行上述方法中的步骤。
在本申请的一些实施例中,该处理器32可以包括但不限于:
通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等等。
在本申请的一些实施例中,该存储器33包括但不限于:
易失性存储器和/或非易失性存储器。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)。
在本申请的一些实施例中,该计算机程序34可以被分割成一个或多个单元,该一个或者多个单元被存储在该存储器33中,并由该处理器32执行,以完成本申请提供的方法。该一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述该计算机程序34在该电子设备30中的执行过程。
如图11所示,该电子设备30还可包括:
收发器33,该收发器33可连接至该处理器32或存储器33。
其中,处理器32可以控制该收发器33与其他设备进行通信,具体地,可以向其他设备发送信息或数据,或接收其他设备发送的信息或数据。收发器33可以包括发射机和接收机。收发器33还可以进一步包括天线,天线的数量可以为一个或多个。
应当理解,该电子设备30中的各个组件通过总线系统相连,其中,总线系统除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。
图12是本申请实施例提供的视频编解码系统的示意性框图。
如图12所示,该视频编解码系统40可包括:视频编码器41和视频解码器42,其中视频编码器41用于执行本申请实施例涉及的视频编码方法,视频解码器42用于执行本申请实施例涉及的视频解码方法。
本申请还提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得该计算机能够执行上述方法实施例的方法。或者说,本申请实施例还提供一种包含指令的计算机程序产品,该指令被计算机执行时使得计算机执行上述方法实施例的方法。
本申请还提供了一种码流,该码流通过上述视频编码方法得到。
当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。例如,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以该权利要求的保护范围为准。

Claims (55)

  1. 一种视频解码方法,其特征在于,包括:
    解码码流,得到当前区域中的P个量化系数和第一量化系数,所述当前区域为当前块中包括至少一个非零量化系数的区域,所述第一量化系数为对所述当前区域中的第二量化系数进行奇偶性隐藏后得到的量化系数,所述P为正整数;
    根据所述P个量化系数,确定所述第二量化系数的奇偶性;
    根据所述第一量化系数和所述第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述P个量化系数,确定所述第二量化系数的奇偶性,包括:
    根据所述P个量化系数对应的奇偶性,确定所述第二量化系数的奇偶性。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述P个量化系数对应的奇偶性,确定所述第二量化系数的奇偶性,包括:
    根据所述P个量化系数的第一绝对值之和的奇偶性,确定所述第二量化系数的奇偶性,所述第一绝对值为所述量化系数的部分或全部绝对值。
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述P个量化系数的第一绝对值之和的奇偶性,确定所述第二量化系数的奇偶性,包括:
    若所述P个量化系数的第一绝对值之和为奇数,则确定所述第二量化系数为奇数;
    若所述P个量化系数的第一绝对值之和为偶数,则确定所述第二量化系数为偶数。
  5. 根据权利要求3所述的方法,其特征在于,所述根据所述P个量化系数对应的奇偶性,确定所述第二量化系数的奇偶性,包括:
    确定所述P个量化系数中的目标量化系数;
    根据所述P个量化系数中目标量化系数的个数奇偶性,确定所述第二量化系数的奇偶性。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述P个量化系数中目标量化系数的个数奇偶性,确定所述第二量化系数的奇偶性,包括:
    若所述P个量化系数中所述目标量化系数的个数为奇数,则确定所述第二量化系数为奇数;
    若所述P个量化系数中所述目标量化系数的个数为偶数,则确定所述第二量化系数为偶数。
  7. 根据权利要求5所述的方法,其特征在于,所述目标量化系数为所述P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述根据所述第一量化系数和所述第二量化系数的奇偶性,确定具有奇偶性的第二量化系数,包括:
    采用预设运算方式对所述第一量化系数进行运算,得到运算结果;
    根据所述第二量化系数的奇偶性和所述运算结果,得到所述第二量化系数。
  9. 根据权利要求8所述的方法,其特征在于,所述预设运算方式包括所述第一量化系数的值乘以二。
  10. 根据权利要求9所述的方法,其特征在于,所述根据所述第二量化系数的奇偶性和所述运算结果,得到所述第二量化系数,包括:
    将所述运算结果与预设值之和,确定为所述第二量化系数,其中,若所述第二量化系数为奇数,则所述预设值为1,若所述第二量化系数为偶数,则所述预设值为0。
  11. 根据权利要求1-7任一项所述的方法,其特征在于,所述根据所述P个量化系数,确定所述第二量化系数的奇偶性,包括:
    若所述当前区域满足预设条件时,则根据所述P个量化系数,确定所述第二量化系数的奇偶性。
  12. 根据权利要求11所述的方法,其特征在于,所述预设条件包括如下至少一个:
    所述当前区域中非零量化系数的个数大于第一数值;
    所述当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
    所述当前区域中,解码扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
    所述当前区域中,非零量化系数的绝对值之和大于第四数值。
  13. 根据权利要求12所述的方法,其特征在于,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为固定值。
  14. 根据权利要求12所述的方法,其特征在于,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值。
  15. 根据权利要求14所述的方法,其特征在于,若所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值,则所述方法还包括:
    解码所述码流,得到所述非固定值。
  16. 根据权利要求1-7任一项所述的方法,其特征在于,所述方法还包括:
    若所述当前块采用目标变换方式进行变换时,则跳过根据所述P个量化系数,确定所述第二量化系数的奇偶性的步骤。
  17. 根据权利要求16所述的方法,其特征在于,所述目标变换方式包括二次变换或多次变换。
  18. 根据权利要求1-7任一项所述的方法,其特征在于,所述第一量化系数为所述当前区域中位于扫描顺序中第K个位置的非零量化系数,所述K小于或等于所述当前区域中非零量化系数个数。
  19. 根据权利要求1-7任一项所述的方法,其特征在于,所述解码码流,得到当前区域中的P个量化系数和第一 量化系数,包括:
    解码所述码流,得到所述当前块的已解码信息;
    将所述当前块划分为N个区域,所述N为正整数;
    从所述当前块的已解码信息中,得到所述P个量化系数和所述第一量化系数。
  20. 根据权利要求19所述的方法,其特征在于,所述将所述当前块划分为N个区域,包括:
    根据扫描顺序,将所述当前块划分为N个区域。
  21. 根据权利要求19所述的方法,其特征在于,所述将所述当前块划分为N个区域,包括:
    根据空间位置,将所述当前块划分为N个区域。
  22. 根据权利要求19所述的方法,其特征在于,所述N个区域中至少两个区域所包括的量化系数个数相同。
  23. 根据权利要求19所述的方法,其特征在于,所述N个区域中至少两个区域所包括的量化系数个数不相同。
  24. 根据权利要求19所述的方法,其特征在于,所述方法还包括:
    解码所述码流,得到至少一个标志,所述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏;
    所述将所述当前块划分为N个区域,包括:
    若根据所述至少一个标志,确定允许所述当前块中至少一个量化系数的奇偶性被隐藏时,将所述当前块划分为N个区域。
  25. 根据权利要求24所述的方法,其特征在于,所述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
  26. 一种视频编码方法,其特征在于,包括:
    将当前块划分为N个区域,所述N为正整数;
    确定当前区域中的第二量化系数,所述当前区域为所述N个区域中包括至少一个非零量化系数的区域;
    对所述第二量化系数进行奇偶性隐藏,得到第一量化系数;
    对所述第一量化系数进行编码,得到码流,所述第二量化系数的奇偶性通过所述当前区域中P个量化系数进行指示,所述P为正整数。
  27. 根据权利要求26所述的方法,其特征在于,所述第二量化系数的奇偶性通过所述当前区域中P个量化系数对应的奇偶性进行指示。
  28. 根据权利要求27所述的方法,其特征在于,若所述P个量化系数对应的奇偶性,与所述第二量化系数的奇偶性不一致时,所述方法还包括:
    对所述P个量化系数进行调整,以使所述P个量化系数对应的奇偶性,与所述第二量化系数的奇偶性一致。
  29. 根据权利要求28所述的方法,其特征在于,若所述第二量化系数的奇偶性通过所述P个量化系数的第一绝对值之和的奇偶性进行指示,所述第一绝对值为所述量化系数的部分或全部绝对值,则对所述P个量化系数进行调整,包括:
    对所述P个量化系数的值进行调整,以使所述P个量化系数的第一绝对值之和的奇偶性,与所述第二量化系数的奇偶性一致。
  30. 根据权利要求29所述的方法,其特征在于,所述对所述P个量化系数进行调整,以使所述P个量化系数的第一绝对值之和的奇偶性,与所述第二量化系数的奇偶性一致,包括:
    若所述第二量化系数为奇数,且所述P个量化系数的第一绝对值之和为偶数时,则调整所述P个量化系数的值,以使调整后的所述P个量化系数的第一绝对值之和为奇数;
    若所述第二量化系数为偶数,且所述P个量化系数的第一绝对值之和为奇数时,则调整所述P个量化系数的值,以使调整后的所述P个量化系数的第一绝对值之和为偶数。
  31. 根据权利要求28所述的方法,其特征在于,若所述第二量化系数的奇偶性通过所述P个量化系数中目标量化系数的个数的奇偶性进行指示,则对所述P个量化系数进行调整,包括:
    对所述P个量化系数的值进行调整,以使所述P个量化系数中目标量化系数个数的奇偶性,与所述第二量化系数的奇偶性一致。
  32. 根据权利要求31所述的方法,其特征在于,所述对所述P个量化系数的值进行调整,以使所述P个量化系数中目标量化系数个数的奇偶性,与所述第二量化系数的奇偶性一致,包括:
    若所述第二量化系数为奇数,且所述P个量化系数中目标量化系数的个数为偶数,则调整所述P个量化系数的取值,以使调整后的所述P个量化系数中目标量化系数个数的奇数;
    若所述第二量化系数为偶数,且所述P个量化系数中目标量化系数的个数为奇数,则调整所述P个量化系数的取值,以使调整后的所述P个量化系数中目标量化系数个数的偶数。
  33. 根据权利要求31所述的方法,其特征在于,所述目标量化系数为P个量化系数中的非零量化系数、值为偶数的非零量化系数、值为偶数的量化系数、值为奇数的量化系数中的任意一个。
  34. 根据权利要求26-33任一项所述的方法,其特征在于,所述对所述第二量化系数进行奇偶性隐藏,得到第一量化系数,包括:
    根据所述第二量化系数的奇偶性,采用预设运算方式对所述第二量化系数进行运算,得到所述第一量化系数。
  35. 根据权利要求34所述的方法,其特征在于,所述预设运算方式包括所述第二量化系数的值除以二取整。
  36. 根据权利要求26-33任一项所述的方法,其特征在于,所述对所述第二量化系数进行奇偶性隐藏,得到第一量化系数,包括:
    若所述当前区域满足预设条件时,对所述第二量化系数进行奇偶性隐藏,得到第一量化系数。
  37. 根据权利要求36所述的方法,其特征在于,所述预设条件包括如下至少一个:
    所述当前区域中非零量化系数的个数大于第一数值;
    所述当前区域中,扫描顺序上的第一个非零量化系数与最后一个非零量化系数之间距离大于第二数值;
    所述当前区域中,扫描顺序上的第一个非零量化系数与最后一个量化系数之间距离大于第三数值;
    所述当前区域中,非零量化系数的绝对值之和大于第四数值。
  38. 根据权利要求37所述的方法,其特征在于,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为固定值。
  39. 根据权利要求37所述的方法,其特征在于,所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值。
  40. 根据权利要求39所述的方法,其特征在于,若所述第一数值、所述第二数值、第三数值和所述第四数值中的至少一个为非固定值,则所述方法还包括:
    将所述非固定值写入所述码流。
  41. 根据权利要求26-33任一项所述的方法,其特征在于,所述第一量化系数为所述当前区域中位于扫描顺序中第K个位置的非零量化系数,所述K小于或等于所述当前区域中非零量化系数个数。
  42. 根据权利要求26-33任一项所述的方法,其特征在于,所述将当前块划分为N个区域,包括:
    根据扫描顺序,将所述当前块划分为N个区域。
  43. 根据权利要求26-33任一项所述的方法,其特征在于,所述将当前块划分为N个区域,包括:
    根据空间位置,将所述当前块划分为N个区域。
  44. 根据权利要求26-33任一项所述的方法,其特征在于,所述N个区域中至少两个区域所包括的量化系数个数相同。
  45. 根据权利要求26-33任一项所述的方法,其特征在于,所述N个区域中至少两个区域所包括的量化系数个数不相同。
  46. 根据权利要求26-33任一项所述的方法,其特征在于,所述方法还包括:
    获得至少一个标志,所述至少一个标志用于指示是否允许量化系数的奇偶性被隐藏;
    所述将当前块划分为N个区域,包括:
    若根据所述至少一个标志,确定允许所述当前块的量化系数的奇偶性被隐藏时,将所述当前块划分为N个区域。
  47. 根据权利要求46所述的方法,其特征在于,所述至少一个标志包括序列级标志、图像级标志、片级标志、单元级标志和块级标志中的至少一个。
  48. 根据权利要求26-33任一项所述的方法,其特征在于,所述方法还包括:
    若所述当前块采用目标变换方式进行变换时,则跳过将所述当前块划分为N个区域。
  49. 根据权利要求48所述的方法,其特征在于,所述目标变换方式包括二次变换或多次变换。
  50. 一种视频解码装置,其特征在于,包括:
    解码单元,用于解码码流,得到当前区域中的P个量化系数和第一量化系数,所述当前区域为当前块中包括至少一个非零量化系数的区域,所述第一量化系数为对所述当前区域中的第二量化系数进行奇偶性隐藏后得到的量化系数,所述P为正整数;
    奇偶性确定单元,用于根据所述P个量化系数,确定所述第二量化系数的奇偶性;
    系数确定单元,用于根据所述第一量化系数和所述第二量化系数的奇偶性,确定具有奇偶性的第二量化系数。
  51. 一种视频编码装置,其特征在于,包括:
    划分单元,用于将当前块划分为N个区域,所述N为正整数;
    处理单元,用于确定当前区域中的第二量化系数,并对所述第二量化系数进行奇偶性隐藏,得到第一量化系数,所述当前区域为所述N个区域中包括至少一个非零量化系数的区域;
    编码单元,用于对所述第一量化系数进行编码,得到码流,所述第二量化系数的奇偶性通过所述当前区域中P个量化系数进行指示,所述P为正整数。
  52. 一种视频编解码系统,其特征在于,包括视频编码器和视频解码器;
    所述视频解码器用于执行如权利要求1-25任一项所述的视频解码方法;
    所述视频编码器用于执行如权利要求26-49任一项所述的视频编码方法。
  53. 一种电子设备,其特征在于,包括:存储器,处理器;
    所述存储器,用于存储计算机程序;
    所述处理器,用于执行所述计算机程序以实现如上述权利要求1至25或26至49任一项所述方法。
  54. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如权利要求1至25或26至49任一项所述的方法。
  55. 一种码流,其特征在于,所述码流通过如权利要求26至49任一项所述的方法得到。
PCT/CN2022/084135 2022-03-30 2022-03-30 视频编解码方法、装置、设备、系统及存储介质 WO2023184250A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/084135 WO2023184250A1 (zh) 2022-03-30 2022-03-30 视频编解码方法、装置、设备、系统及存储介质
PCT/CN2022/101259 WO2023184747A1 (zh) 2022-03-30 2022-06-24 视频编解码方法、装置、设备、系统及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/084135 WO2023184250A1 (zh) 2022-03-30 2022-03-30 视频编解码方法、装置、设备、系统及存储介质

Publications (1)

Publication Number Publication Date
WO2023184250A1 true WO2023184250A1 (zh) 2023-10-05

Family

ID=88198506

Family Applications (2)

Application Number Title Priority Date Filing Date
PCT/CN2022/084135 WO2023184250A1 (zh) 2022-03-30 2022-03-30 视频编解码方法、装置、设备、系统及存储介质
PCT/CN2022/101259 WO2023184747A1 (zh) 2022-03-30 2022-06-24 视频编解码方法、装置、设备、系统及存储介质

Family Applications After (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/101259 WO2023184747A1 (zh) 2022-03-30 2022-06-24 视频编解码方法、装置、设备、系统及存储介质

Country Status (1)

Country Link
WO (2) WO2023184250A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2675159A1 (en) * 2012-06-15 2013-12-18 BlackBerry Limited Multi-bit information hiding using overlapping subsets
CN108055541A (zh) * 2011-11-07 2018-05-18 杜比国际公司 用于编码和解码图像的方法、编码和解码设备
CN111837389A (zh) * 2018-03-07 2020-10-27 华为技术有限公司 适用于多符号位隐藏的块检测方法及装置
CN112514386A (zh) * 2018-06-18 2021-03-16 高通股份有限公司 网格编解码量化系数编解码

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9313498B2 (en) * 2012-04-16 2016-04-12 Qualcomm Incorporated Sign hiding techniques for quantized transform coefficients in video coding
CN104380740A (zh) * 2012-06-29 2015-02-25 索尼公司 编码装置、编码方法、解码装置和解码方法
US20140133574A1 (en) * 2012-11-13 2014-05-15 Mediatek Inc. Method and Apparatus for Sign Data Hiding of Video and Image Data
WO2019135630A1 (ko) * 2018-01-05 2019-07-11 에스케이텔레콤 주식회사 변환 계수의 부호 데이터 은닉
CN112422991B (zh) * 2019-08-23 2022-04-15 杭州海康威视数字技术股份有限公司 编码方法、解码方法及装置
US11297320B2 (en) * 2020-01-10 2022-04-05 Mediatek Inc. Signaling quantization related parameters
CN112543324B (zh) * 2020-12-06 2023-02-28 浙江大华技术股份有限公司 视频解码方法、编码方法、编解码器及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108055541A (zh) * 2011-11-07 2018-05-18 杜比国际公司 用于编码和解码图像的方法、编码和解码设备
EP2675159A1 (en) * 2012-06-15 2013-12-18 BlackBerry Limited Multi-bit information hiding using overlapping subsets
CN111837389A (zh) * 2018-03-07 2020-10-27 华为技术有限公司 适用于多符号位隐藏的块检测方法及装置
CN112514386A (zh) * 2018-06-18 2021-03-16 高通股份有限公司 网格编解码量化系数编解码

Also Published As

Publication number Publication date
WO2023184747A1 (zh) 2023-10-05

Similar Documents

Publication Publication Date Title
US11190779B2 (en) Quantization parameter control for video coding with joined pixel/transform based quantization
CN113784126A (zh) 图像编码方法、装置、设备及存储介质
CN116405686A (zh) 图像重建方法和装置
US20230042484A1 (en) Decoding method and coding method for unmatched pixel, decoder, and encoder
WO2023044868A1 (zh) 视频编解码方法、设备、系统、及存储介质
CN114205582B (zh) 用于视频编解码的环路滤波方法、装置及设备
WO2023184250A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023236113A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023184248A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023220946A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2022155922A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
WO2023122969A1 (zh) 帧内预测方法、设备、系统、及存储介质
WO2024050723A1 (zh) 一种图像预测方法、装置及计算机可读存储介质
WO2023122968A1 (zh) 帧内预测方法、设备、系统、及存储介质
US20230421765A1 (en) Video coding and decoding method and system, and video coder and video decoder
WO2023220969A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2023220970A1 (zh) 视频编码方法、装置、设备、系统、及存储介质
WO2023173255A1 (zh) 图像编解码方法、装置、设备、系统、及存储介质
WO2023197229A1 (zh) 视频编解码方法、装置、设备、系统及存储介质
WO2022174475A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
CN116760976B (zh) 仿射预测决策方法、装置、设备及存储介质
WO2023092404A1 (zh) 视频编解码方法、设备、系统、及存储介质
US20230319267A1 (en) Video coding method and video decoder
WO2022193389A1 (zh) 视频编解码方法与系统、及视频编解码器
US20230300329A1 (en) Picture processing method and video decoder

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22934101

Country of ref document: EP

Kind code of ref document: A1