WO2022217447A1 - 视频编解码方法与系统、及视频编解码器 - Google Patents

视频编解码方法与系统、及视频编解码器 Download PDF

Info

Publication number
WO2022217447A1
WO2022217447A1 PCT/CN2021/086734 CN2021086734W WO2022217447A1 WO 2022217447 A1 WO2022217447 A1 WO 2022217447A1 CN 2021086734 W CN2021086734 W CN 2021086734W WO 2022217447 A1 WO2022217447 A1 WO 2022217447A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
quantization
quantization mode
flag bit
mode flag
Prior art date
Application number
PCT/CN2021/086734
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 CN202180096782.1A priority Critical patent/CN117121485A/zh
Priority to PCT/CN2021/086734 priority patent/WO2022217447A1/zh
Publication of WO2022217447A1 publication Critical patent/WO2022217447A1/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/46Embedding additional information in the video signal during the compression process

Definitions

  • the present application relates to the technical field of video encoding and decoding, and in particular, to a video encoding and decoding method and system, and a video encoding and decoding device.
  • Digital video technology can be incorporated into a variety of video devices, such as digital televisions, smartphones, computers, e-readers or video players, and the like. With the development of video technology, the amount of data included in video data is relatively large. In order to facilitate the transmission of video data, video devices implement video compression technology to enable more efficient transmission or storage of video data.
  • the transform coefficients are quantized, but the current quantization process is complicated, resulting in low encoding and decoding efficiency.
  • Embodiments of the present application provide a video encoding and decoding method and system, and a video encoding and decoding device, so as to improve encoding and decoding efficiency.
  • the present application provides a video encoding method, including:
  • the to-be-coded block is encoded to generate a code stream, wherein the code stream includes a quantization mode flag bit, and the quantization mode flag bit is used to indicate a target quantization mode adopted by the to-be-coded block.
  • an embodiment of the present application provides a video decoding method, including:
  • the block to be decoded is decoded according to the quantization mode flag bit.
  • the present application provides a video encoder for performing the method in the first aspect or each of its implementations.
  • the encoder includes a functional unit for executing the method in the above-mentioned first aspect or each of its implementations.
  • the present application provides a video decoder for executing the method in the second aspect or each of its implementations.
  • the decoder includes functional units for performing the methods in the second aspect or the respective implementations thereof.
  • a video encoder including a processor and a memory.
  • the memory is used for storing a computer program
  • the processor is used for calling and running the computer program stored in the memory, so as to execute the method in the above-mentioned first aspect or each implementation manner thereof.
  • a video decoder including a processor and a memory.
  • the memory is used for storing a computer program
  • the processor is used for calling and running the computer program stored in the memory, so as to execute the method in the above-mentioned second aspect or each implementation manner thereof.
  • 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 first aspect or each of its implementations
  • the video decoder is used to perform the method in the above-mentioned second aspect or each of its implementations.
  • a chip for implementing any one of the above-mentioned first aspect to the second aspect or the method in each implementation manner thereof.
  • the chip includes: a processor for invoking and running a computer program from a memory, so that a device on which the chip is installed executes any one of the above-mentioned first to second aspects or each of its implementations method.
  • a computer-readable storage medium for storing a computer program, the computer program causing a computer to execute the method in any one of the above-mentioned first aspect to the second aspect or each of its implementations.
  • a computer program product comprising computer program instructions, the computer program instructions causing a computer to perform the method in any one of the above-mentioned first to second aspects or the implementations thereof.
  • a computer program which, when run on a computer, causes the computer to perform the method in any one of the above-mentioned first to second aspects or the respective implementations thereof.
  • a twelfth aspect provides a code stream, the code stream is generated by the encoding method of the first aspect, wherein the code stream includes a quantization mode flag bit, and the quantization mode flag bit is used to indicate the to-be-coded The target quantization method used by the block.
  • a quantization flag bit is programmed into the code stream, and the quantization flag bit is used to indicate the target quantization mode of the block to be encoded.
  • the decoding end can directly parse out the quantization flag bit from the code stream, and determine the target inverse quantization method used by the block to be decoded according to the quantization flag bit, and use the determined target inverse quantization method to inverse quantize the block to be decoded, that is, decoding
  • the terminal can directly parse out the target inverse quantization method of the block to be decoded from the code stream, without using other methods to judge the target inverse quantization method of the block to be decoded, thereby reducing the decoding complexity and improving the decoding efficiency.
  • FIG. 1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of the application
  • FIG. 2 is a schematic block diagram of a video encoder provided by an embodiment of the present application.
  • FIG. 3 is a schematic block diagram of a decoding framework provided by an embodiment of the present application.
  • Fig. 4 is the schematic diagram that two kinds of quantizers Q0 and Q1 carry out quantization
  • 5A is a schematic diagram of state transition of a quantizer used for determining transform coefficients
  • 5B is a schematic diagram of a state transition table of a quantizer
  • FIG. 6 is a schematic diagram of the dependency of the grid structure representation state and transform coefficient level
  • FIG. 8 is a schematic flowchart of a video encoding method provided in Embodiment 1 of the present application.
  • FIG. 9 is a schematic flowchart of a video encoding method provided by another embodiment of the present application.
  • FIG. 10 is a schematic diagram of a quantizer of Q0 and Q1 involved in the application.
  • FIG. 11 is a schematic diagram of state transition of a state machine involved in an embodiment of the application.
  • FIG. 13 is a schematic flowchart of a video decoding method provided by an embodiment of the present application.
  • FIG. 14 is a schematic flowchart of a video decoding method provided by another embodiment of the present application.
  • FIG. 15 is a schematic diagram of coefficient coding of a scanning area involved in an embodiment of the present application.
  • 16 is a schematic block diagram of a video encoder provided by an embodiment of the present application.
  • 17 is a schematic block diagram of a video decoder provided by an embodiment of the present application.
  • FIG. 18 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 19 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • the present application can be applied to the field of image encoding and decoding, the field of video encoding and decoding, the field of hardware video encoding and decoding, the field of dedicated circuit video encoding and decoding, the field of real-time video encoding and decoding, and the like.
  • audio video coding standard audio video coding standard, AVS for short
  • H.264/audio video coding audio video coding, AVC for short
  • H.265/High Efficiency Video Coding High efficiency video coding, referred to as HEVC
  • H.266/versatile video coding versatile video coding, referred to as VVC
  • the schemes of the present application may operate in conjunction with other proprietary or industry standards including ITU-TH.261, ISO/IECMPEG-1 Visual, ITU-TH.262 or ISO/IECMPEG-2 Visual, 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 coding and decoding system involved in the embodiments of the present application is first introduced with reference to FIG. 1 .
  • FIG. 1 is a schematic block diagram of a video encoding and decoding system 100 according to an embodiment of the present application. It should be noted that FIG. 1 is only an example, and the video encoding and decoding systems in the embodiments of the present application include, but are not limited to, those shown in FIG. 1 .
  • the video codec 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 encoded by the encoding device to obtain decoded video data.
  • the encoding device 110 in this embodiment of the present application may be understood as a device with a video encoding function
  • the decoding device 120 may be understood as a device with a video decoding function, that is, the encoding device 110 and the decoding device 120 in the embodiments of the present application include a wider range of devices, 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, in-vehicle computers, and the like.
  • the encoding device 110 may transmit the encoded video data (eg, a 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 apparatus 110 may modulate the encoded video data according to a communication standard and transmit the modulated video data to decoding apparatus 120 .
  • the communication medium includes a wireless communication medium, such as a radio frequency spectrum, optionally, the communication medium may also include a wired communication medium, 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 locally accessible data storage media such as optical discs, DVDs, flash memory, and the like.
  • the decoding apparatus 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, and the like.
  • FTP file transfer protocol
  • encoding apparatus 110 includes video encoder 112 and output interface 113 .
  • the output interface 113 may include a modulator/demodulator (modem) and/or a transmitter.
  • encoding device 110 may include video source 111 in addition to video encoder 112 and input interface 113 .
  • the video source 111 may include at least one of a video capture device (eg, a video camera), a video archive, a video input interface, a computer graphics system 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
  • a video input interface e.g., a video input interface
  • a computer graphics system for receiving video data from a video content provider e.g., a 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 pictures or a sequence of pictures.
  • the code stream contains the encoding information of the image or image sequence in the form of bit stream.
  • the encoded information may include encoded image data and associated data.
  • the associated data may include a sequence parameter set (SPS for short), a picture parameter set (PPS for short), and other syntax structures.
  • SPS sequence parameter set
  • PPS picture parameter set
  • An SPS may contain parameters that apply to one or more sequences.
  • a PPS may contain parameters that apply to one or more images.
  • a syntax structure refers to a set of zero or more syntax elements in a codestream arranged in a specified order.
  • the video encoder 112 directly transmits the encoded video data to the decoding device 120 via the output interface 113 .
  • the encoded video data may also be stored on a storage medium or a 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 include a display device 123 in addition to the input interface 121 and the video decoder 122 .
  • the input interface 121 includes a receiver and/or a modem.
  • the input interface 121 may receive the encoded video data through the channel 130 .
  • the video decoder 122 is configured to decode the encoded video data, obtain the decoded video data, and transmit the decoded video data to the display device 123 .
  • the display device 123 displays the decoded video data.
  • the display device 123 may be integrated with the decoding apparatus 120 or external to the decoding apparatus 120 .
  • the display device 123 may include various display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.
  • LCD liquid crystal display
  • plasma display a plasma display
  • OLED organic light emitting diode
  • FIG. 1 is only an example, and the technical solutions of the embodiments of the present application are not limited to FIG. 1 .
  • the technology of the present application may also be applied to single-side video encoding or single-side 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 on images, and can also be used to perform lossless compression on images.
  • the lossless compression may 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 luminance chrominance (YCbCr, YUV) format.
  • the YUV ratio can be 4:2:0, 4:2:2 or 4:4:4, Y represents the luminance (Luma), Cb(U) represents the blue chromaticity, Cr(V) represents the red chromaticity, U and V are expressed as chroma (Chroma) to describe color and saturation.
  • 4:2:0 means that every 4 pixels has 4 luma components
  • 2 chrominance components YYYYCbCr
  • 4:2:2 means that every 4 pixels has 4 luma components
  • 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 a frame of image into several coding tree units (coding tree units, CTUs), "largest coding units” (Largest Coding units, LCU for short) or "coding tree block” (CTB for short).
  • CTU coding tree units
  • LCU Large Coding units
  • CTB coding tree block
  • Each CTU may be associated with a block of pixels of equal size within the image.
  • Each pixel may correspond to one luminance (luma) sample and two chrominance (chrominance or chroma) samples.
  • each CTU may be associated with one block of luma samples and two blocks of chroma samples.
  • the size of one CTU is, for example, 128 ⁇ 128, 64 ⁇ 64, 32 ⁇ 32, and so on.
  • a CTU can be further divided into several coding units (Coding Unit, CU) for coding, and the CU can be a rectangular block or a square block.
  • the CU can be further divided into a prediction unit (PU for short) and a transform unit (TU for short), so that coding, prediction, and transformation are separated and processing is more flexible.
  • the CTU is divided into CUs in a quadtree manner, and the CUs are divided into TUs and PUs in a quadtree manner.
  • Video encoders and video decoders may support various PU sizes. Assuming the size of a particular CU is 2Nx2N, video encoders and video decoders may support PU sizes of 2Nx2N or NxN for intra prediction, and support 2Nx2N, 2NxN, Nx2N, NxN or similar sized symmetric PUs for inter prediction. Video encoders and video decoders may also support 2NxnU, 2NxnD, nLx2N, and nRx2N 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, a loop filtering unit 260 , a decoded image buffer 270 and an entropy encoding unit 280 . It should be noted that the video encoder 200 may include more, less or different functional components.
  • a current block may be referred to as a current coding unit (CU) or a current prediction unit (PU), or the like.
  • a prediction block may also be referred to as a predicted block to be encoded or an image prediction block, and the reconstructed block to be encoded may also be referred to as a reconstructed block or an image reconstruction to be encoded block.
  • prediction unit 210 includes an inter prediction unit 211 and an intra prediction unit 212 . Since there is a strong correlation between adjacent pixels in a frame of a video, the method of intra-frame prediction is used in video coding and decoding technology to eliminate the spatial redundancy between adjacent pixels. Due to the strong similarity between adjacent frames in the video, the inter-frame prediction method is used in the video coding and decoding technology to eliminate the temporal redundancy between adjacent frames, thereby improving the coding efficiency.
  • the inter-frame prediction unit 211 can be used for inter-frame prediction, and the inter-frame prediction can refer to image information of different frames, and the inter-frame prediction uses motion information to find a reference block from the reference frame, and generates a prediction block according to the reference block for eliminating temporal redundancy;
  • Frames used for inter-frame prediction may be P frames and/or B frames, where P frames refer to forward predicted frames, and B frames refer to bidirectional predicted 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 of whole pixel or sub-pixel. If the motion vector is sub-pixel, then it is necessary to use interpolation filtering in the reference frame to make the required sub-pixel block.
  • the reference frame found according to the motion vector is used.
  • the whole pixel or sub-pixel block is called the reference block.
  • the reference block is directly used as the prediction block, and some technologies are processed on the basis of the reference block to generate the prediction block.
  • Reprocessing to generate a prediction block on the basis of the reference block can also be understood as taking the reference block as a prediction block and then processing it on the basis of the prediction block to generate a new prediction block.
  • inter-frame prediction methods include: geometric partitioning mode (GPM) in the VVC video codec standard, and angular weighted prediction (AWP) in the AVS3 video codec standard. These two intra prediction modes have something in common in principle.
  • GPM geometric partitioning mode
  • AVS3 angular weighted prediction
  • the intra-frame prediction unit 212 only refers to the information of the same frame image, and predicts the pixel information in the block to be encoded in the current code, so as to eliminate the spatial redundancy.
  • Frames used for intra prediction may be I-frames.
  • the intra prediction method further includes a multiple reference line intra prediction method (multiple reference line, MRL), which can use more reference pixels to improve coding efficiency.
  • MRL multiple reference line intra prediction method
  • mode 0 is to copy the pixels above the current block to the current block in the vertical direction as the predicted value
  • mode 1 is to copy the reference pixel on the left to the current block in the horizontal direction as the predicted value
  • mode 2 (DC) is to copy A ⁇
  • the average value of the 8 points D and I to L is used as the predicted value of all points.
  • Modes 3 to 8 copy the reference pixels to the corresponding position of the current block according to a certain angle respectively. Because some positions of the current block cannot exactly correspond to the reference pixels, it may be necessary to use a weighted average of the reference pixels, or sub-pixels of the interpolated reference pixels.
  • the intra-frame prediction modes used by HEVC include Planar mode, DC and 33 angle modes, for a total of 35 prediction modes.
  • the intra-frame modes used by VVC are Planar, DC, and 65 angular modes, for a total of 67 prediction modes.
  • the intra-frame modes used by AVS3 are DC, Plane, Bilinear and 63 angle modes, a total of 66 prediction modes.
  • the intra-frame prediction will be more accurate and more in line with the demand for the development of high-definition and ultra-high-definition digital video.
  • Residual unit 220 may generate a residual block of the CU based on the pixel blocks of the CU and the prediction blocks of the PUs of the CU. For example, residual unit 220 may generate a residual block of the CU such that each sample in the residual block has a value equal to the difference between the samples in the CU's pixel block, and the CU's PU's Corresponding samples in the prediction block.
  • Transform/quantization unit 230 may quantize transform coefficients. Transform/quantization unit 230 may quantize transform coefficients associated with TUs 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, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.
  • Reconstruction unit 250 may add the samples of the reconstructed residual block to corresponding samples of the one or more prediction blocks generated by prediction unit 210 to generate a reconstructed block to be encoded associated with the TU. By reconstructing the block of samples for each TU of the CU in this manner, video encoder 200 may reconstruct the block of pixels of the CU.
  • In-loop filtering unit 260 may perform deblocking filtering operations to reduce blocking artifacts for pixel blocks associated with the CU.
  • loop filtering unit 260 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, an adaptive loop filtering ALF unit.
  • the decoded image buffer 270 may store the reconstructed pixel blocks.
  • Inter-prediction unit 211 may use the reference picture containing the reconstructed pixel block to perform inter-prediction on PUs of other pictures.
  • intra-prediction unit 212 may use the reconstructed pixel blocks in decoded picture buffer 270 to perform intra-prediction on other PUs in the same picture 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 flow of video coding involved in the present application is as follows: at the coding end, the current image is divided into blocks, and for the current block, the prediction unit 210 uses intra-frame prediction or inter-frame prediction to generate a prediction block of the current block.
  • the residual unit 220 may calculate a residual block based on the predicted block and the original block of the current block, that is, the difference between the predicted block and the original block of the current block, and the residual block may also be referred to as residual information.
  • the residual block can be transformed and quantized by the transform/quantization unit 230 to remove information insensitive to human eyes, so as to eliminate visual redundancy.
  • the residual block before being transformed and quantized by the transform/quantization unit 230 may be referred to as a time-domain residual block, and the time-domain residual block after being transformed and quantized by the transform/quantization unit 230 may be referred to as a frequency residual block. or a frequency domain residual block.
  • the entropy encoding unit 280 receives the quantized transform coefficient output by the transform and quantization unit 230, and can perform entropy encoding on the quantized transform coefficient to output a code stream.
  • the entropy encoding unit 280 may eliminate character redundancy according to the target context model and the probability information of the binary code stream.
  • the video encoder performs inverse quantization and inverse transformation on the quantized transform coefficient output by the transform and quantization unit 230 to obtain a residual block of the current block, and then adds the residual block of the current block to the prediction block of the current block, Get the reconstructed block of the current block.
  • reconstructed blocks corresponding to other blocks to be encoded in the current image can be obtained, and these reconstructed blocks are spliced to obtain a reconstructed image of the current image.
  • the reconstructed image is filtered, for example, 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 buffer 270, and can be used as a reference frame for inter-frame prediction for subsequent frames.
  • the block division information determined by the coding end, and mode information or parameter information such as prediction, transformation, quantization, entropy coding, and loop filtering, etc. are carried in the code stream when necessary.
  • the decoding end determines the same block division information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information as the encoding end by analyzing the code stream and analyzing the existing information, so as to ensure the decoded image obtained by the encoding end. It is the same as the decoded image obtained by the decoder.
  • FIG. 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 buffer 360 . It should be noted that the video decoder 300 may include more, less or different functional components.
  • the video decoder 300 may receive the code stream.
  • Entropy decoding unit 310 may parse the codestream to extract syntax elements from the codestream. As part of parsing the codestream, entropy decoding unit 310 may parse the entropy-encoded syntax elements in the codestream.
  • the prediction unit 320, the inverse quantization/transform unit 330, the reconstruction unit 340, and the in-loop filtering unit 350 may decode the video data according to the syntax elements extracted from the code stream, ie, generate decoded video data.
  • prediction unit 320 includes intra prediction unit 321 and inter prediction unit 322 .
  • Intra-prediction unit 321 may perform intra-prediction to generate prediction blocks for the PU. Intra-prediction unit 321 may use an intra-prediction mode to generate prediction blocks for a PU based on pixel blocks of spatially neighboring PUs. Intra-prediction unit 321 may also determine an intra-prediction mode for the PU from one or more syntax elements parsed from the codestream.
  • Inter-prediction unit 322 may construct a first reference picture list (List 0) and a second reference picture list (List 1) from the syntax elements parsed from the codestream. Furthermore, if the PU is encoded using inter-prediction, entropy decoding unit 310 may parse the motion information for the PU. Inter-prediction unit 322 may determine one or more reference blocks for the PU according to the motion information of the PU. Inter-prediction unit 322 may generate a prediction block for the PU from one or more reference blocks of the PU.
  • the inverse quantization/transform unit 330 inversely quantizes (ie, dequantizes) the transform coefficients associated with the TUs.
  • 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 generate a residual block associated with the TU.
  • Reconstruction unit 340 uses the residual blocks associated with the TUs of the CU and the prediction blocks of the PUs 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, resulting in a reconstructed block to be encoded.
  • In-loop filtering unit 350 may perform deblocking filtering operations to reduce blocking artifacts for pixel blocks associated with the CU.
  • the loop filtering unit 350 includes a deblocking filtering unit, a sample adaptive compensation SAO unit, an adaptive loop filtering ALF unit.
  • Video decoder 300 may store the reconstructed images of the CU in decoded image buffer 360 .
  • the video decoder 300 may use the reconstructed image in the decoded image buffer 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
  • the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block, and the prediction unit 320 uses intra prediction or inter prediction for the current block to generate the current block based on the prediction information.
  • the predicted block for the block The inverse quantization/transform unit 330 performs inverse quantization and inverse transformation on the quantized coefficient matrix using the quantized coefficient matrix obtained from the code stream to obtain a residual block.
  • the reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstructed block.
  • the reconstructed blocks form a reconstructed image
  • the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the block to obtain a decoded image.
  • the decoded image may also be referred to as a reconstructed image.
  • the reconstructed image may be displayed by a display device, and on the other hand, the reconstructed image may be stored in the decoded image buffer 360 to serve as a reference frame for inter-frame prediction for subsequent frames.
  • the above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. This application is applicable to the block-based hybrid coding framework.
  • the basic process of the video codec but not limited to the framework and process.
  • DQ Dependent Quantization
  • dual quantization works on the transformed block. Different from traditional quantization, dual quantization includes two quantizers. Although these two quantizers have the same quantization step size, their matching with transform coefficients is interleaved.
  • FIG. 4 is a schematic diagram of the dual quantization quantizer Q0 and the quantizer Q1 matching the transform coefficients.
  • the quantizer Q0 matches an even multiple of the quantization step size ⁇ and the transform coefficient level (ie, the numbers corresponding to points A and B), and the quantizer Q1 matches an odd multiple of the quantization step size ⁇ and the transform coefficient level (ie, C, D). point the corresponding number).
  • dependent quantization enables the quantizer with large step size to complete finer quantization, reducing the difference between the reconstructed transform coefficients and the original transform coefficients. loss, thereby improving coding efficiency.
  • quantization can be performed using the two quantizers Q0 and Q1 described in FIG. 4 , and the quantization methods of these two quantizers are similar to those of conventional quantizers (eg, quantization in HEVC).
  • the reconstruction coefficients of the two quantizers can be represented by the quantization step size ⁇ , and the reconstruction coefficients of the two quantizers are defined as follows:
  • the reconstruction level of the quantizer is an even multiple of the quantization step size ⁇ .
  • the reconstructed transform coefficient t' can be calculated according to the following formula (1),
  • k represents the associated transform coefficient level described in FIG. 4 .
  • the reconstruction level of the quantizer is an odd or zero times the quantization step size ⁇ .
  • the reconstructed transform coefficient t′ can be calculated according to the following formula (2),
  • sgn( ) represents the symbolic function
  • Quantization using Q0 or Q1 is not controlled by encoding flags. Instead, the parity of the transform coefficient level of the previous coefficient in coefficient scan order (the transform coefficient level described in Figure 4) is used to decide whether the current transform coefficient uses Q0 or Q1.
  • FIG. 5A is a schematic diagram of a state transition of a quantizer used for determining transform coefficients
  • FIG. 5B is a schematic diagram of a state transition table of the quantizer.
  • the reconstructed value of the current quantized coefficient can determine the state of the next coefficient through the transition method shown in FIG. 5A .
  • the state of the first coefficient in scan order of each transform block is set to the initial state 0.
  • Status 0, 1, 2, and 3 also determine which quantizer is used for the current coefficient.
  • Status 0, 1 corresponds to using quantizer Q0
  • status 2, 3 corresponds to using quantizer Q1.
  • t k and q k represent the original transform coefficient and transform coefficient level, respectively
  • %) represents the reconstructed transform coefficient value at the current transform coefficient level q k
  • %) represents the estimated number of bits consumed by encoding q k .
  • FIG. 6 is a schematic diagram showing the dependency of states and transform coefficient levels in a trellis structure, with the coding order from left to right.
  • the dependencies between the quantizer and the transform coefficient levels can be represented as a trellis diagram as shown in Fig. 6, with the four states in each column representing the four possible four states of the current quantized coefficient states, each node is connected to a possible two state nodes of the next coefficient in coding order.
  • the current quantizer can be used to quantize the corresponding transform coefficient level.
  • the encoder can choose to use an odd-numbered transform coefficient level or an even-numbered transform coefficient level.
  • the odd-numbered transform coefficients The levels correspond to B (Q0 with parity 1) and D (Q1 with parity 1) in FIG. 6, and the even-numbered transform coefficient levels correspond to A (Q0 with parity 0) and C (Q1 with parity 0).
  • the transform coefficient level q k It can be determined by finding a route with the minimum cost sum, and determining the minimum cost sum can be achieved by the Viterbi algorithm.
  • Step 1 find 4 candidate transform coefficient levels from Q0 and Q1 corresponding to the original transform coefficients, as shown in Figure 7;
  • Step 2 use the Viterbi algorithm to determine the transform coefficient levels q k of a series of current nodes by using the estimated rate-distortion sum (the cost synthesis corresponding to the transform coefficient levels determined by the previous nodes).
  • the encoding end will be introduced below with reference to FIG. 8 .
  • FIG. 8 is a schematic flowchart of a video encoding method provided in Embodiment 1 of the present application, and the embodiment of the present application is applied to the video encoder shown in FIG. 1 and FIG. 2 .
  • the method of the embodiment of the present application includes:
  • the block to be encoded in the present application may also be referred to as a current block, or an image block currently to be processed, or an image block, or an image block to be encoded, or the like.
  • the video encoder receives a video stream, which consists of a series of image frames, and performs video encoding for each frame of image in the video stream.
  • a video stream which consists of a series of image frames
  • this application uses a frame of image currently to be encoded Record as the current image.
  • the video encoder divides the current image into one or more blocks to be coded, and for each block to be coded, the prediction unit 210 in the video encoder generates the block to be coded through inter-frame prediction and intra-frame prediction.
  • the prediction block is sent to the residual unit 220, which can be understood as a summer, including one or more components that perform a subtraction operation.
  • the residual unit 220 subtracts the prediction block from the block to be encoded to form a residual block, and sends the residual block to the transform and quantization unit 230 .
  • the transform and quantization unit 230 transforms the residual block using, for example, discrete cosine transform (DCT) or the like, to obtain transform coefficients.
  • DCT discrete cosine transform
  • the transform and quantization unit 230 further quantizes the transform coefficients to obtain quantized transform coefficients, that is, quantized coefficients.
  • the transform and quantization unit 230 forwards the quantized transform coefficients to the entropy encoding unit 280 .
  • the entropy encoding unit 280 entropy encodes the quantized transform coefficients.
  • entropy encoding unit 280 may perform context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), syntax-based context adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) ) coding and other coding methods, entropy coding is performed on the quantized transform coefficients to obtain a code stream.
  • CAVLC context adaptive variable length coding
  • CABAC context adaptive binary arithmetic coding
  • SBAC syntax-based context adaptive binary arithmetic coding
  • PIPE probability interval partitioning entropy
  • This application is mainly aimed at the above-mentioned quantification process.
  • the encoding end uses a quantization mode flag bit in the code stream to indicate the target quantization mode used in the quantization of the block to be encoded.
  • the decoding end can directly parse the quantization mode flag bit from the code stream, and determine the target inverse quantization mode adopted by the block to be decoded according to the quantization mode flag bit, and use the determined target inverse quantization mode to inverse quantize the block to be decoded. That is, the decoding end can directly parse out the target inverse quantization method of the block to be decoded from the code stream, and does not need to use other methods to determine the quantization method of the block to be decoded, thereby reducing decoding complexity and improving decoding efficiency.
  • the above-mentioned target quantization manner may be any quantization manner among multiple quantization manners, for example, the quantization manner with the smallest coding loss among the multiple quantization manners.
  • the above-mentioned target quantization method is a first quantization method or a second quantization method, wherein the first quantization method is different from the second quantization method.
  • This embodiment does not limit the specific types of the first quantization manner and the second quantization manner.
  • the first quantization manner includes a DQ quantization manner
  • the second quantization manner includes a non-DQ quantization manner.
  • the non-DQ quantization mode includes a default quantization mode.
  • the default quantization mode may be an RDOQ quantization mode or a constant quantization parameter quantization mode, or the like.
  • the quantization mode flag bits in the embodiments of the present application may be block-level (CU/TU) quantization mode flag bits.
  • the block-level quantization mode flag is used to indicate the target quantization mode of the block.
  • the quantization mode flag bits in the embodiments of the present application may be sequence-level quantization mode flag bits.
  • the quantization mode flag bit at the sequence level is used to indicate the target quantization mode of all blocks in the sequence.
  • the value of the quantization mode flag bit at the sequence level is 1, it indicates that all blocks in the sequence can use the DQ quantization mode.
  • the value of the quantization mode flag bit at the sequence level is 0, it indicates that all blocks in the sequence cannot use the DQ quantization mode.
  • the quantization mode flag bit in this embodiment of the present application may be a CTU-level quantization mode flag bit.
  • the quantization mode flag bit at the CTU level is used to indicate the target quantization mode of all blocks in the CTU. For example, when the value of the quantization mode flag at the CTU level is 1, it means that all blocks in the CTU can use the DQ quantization mode. When the value of the quantization mode flag bit at the CTU level is 0, it indicates that all blocks in the CTU cannot use the DQ quantization mode.
  • the quantization mode flag bit in this embodiment of the present application may be a block-level (CU/TU) quantization mode flag bit, a sequence-level quantization mode flag bit, or a CTU-level quantization mode flag bit, so that the quantization mode flag bit is
  • CU/TU block-level quantization mode flag bit
  • sequence-level quantization mode flag bit a sequence-level quantization mode flag bit
  • CTU-level quantization mode flag bit a CTU-level quantization mode flag bit
  • the coding end only needs to program a quantization mode flag bit into the code stream for all blocks in the CTU to indicate the target of all blocks in the CTU quantization mode, thereby greatly reducing the number of quantization mode flag bits encoded into the code stream, thereby saving code words and improving encoding efficiency.
  • FIG. 9 is a schematic flowchart of a video encoding method provided by another embodiment of the present application.
  • the method in the embodiment of the present application includes:
  • the prediction block of the block to be encoded is generated via inter prediction, intra prediction.
  • the prediction block is subtracted from the block to be coded to form a residual block. Transform the residual block to obtain transform coefficients.
  • the above-mentioned target quantization method is the default quantization method.
  • the above-mentioned target quantization method is any quantization method among M kinds of quantization methods, for example, the target quantization method is a random quantization method, and the M is a positive integer greater than or equal to 2.
  • the above-mentioned target quantization method is the quantization method with the smallest coding cost among the M quantization methods, that is, S905 includes: for each of the preset M quantization methods, determining to use this quantization method to treat The coding cost when the coded block is quantized.
  • the embodiment of the present application may calculate the coding cost based on the Lagrangian rate distortion cost.
  • the quantization method For each of the M quantization methods, use the quantization method to quantize the variable coefficient to obtain the quantized coefficient, and then perform inverse quantization and inverse change on the quantized coefficient to obtain the residual value of the block to be encoded.
  • the residual value of the block and the predicted value of the block to be encoded are reconstructed, for example, the reconstructed value Coef rec of the block to be encoded is obtained by adding them together.
  • the distortion D1 between the reconstructed value Coef rec of the block to be coded and the original pixel value Coef org of the block to be coded is determined. According to the distortion D1 between the reconstructed value Coef rec of the block to be coded and the original pixel value Coef org of the block to be coded, the coding cost corresponding to the quantization mode is determined.
  • R1 represents the number of bits consumed by encoding various flags and coefficients of the block to be coded
  • is a variable related to the quantization parameter
  • D1 represents the reconstructed value Coef rec of the block to be coded and the original pixel value Coef of the block to be coded Distortion between orgs.
  • the distortion D1 between the reconstructed value Coef rec of the block to be encoded and the original pixel value Coef org of the block to be encoded can be calculated according to the following formula (5):
  • the quantization method is used to quantize the variation coefficient to obtain a quantization coefficient, and then the quantization coefficient is inversely quantized to obtain an inverse quantization coefficient.
  • the coding cost corresponding to the quantization mode is determined.
  • R represents the number of bits consumed to encode the coefficients in the block to be encoded
  • is a variable related to the quantization parameter
  • D2 represents the distortion between the inverse quantization Coef invQ and the actual transform coefficient Coef Trans .
  • the distortion D2 between the inverse quantization Coef invQ and the actual transform coefficient Coef Trans can be calculated according to the following formula (7):
  • the above-mentioned method 1 or method 2 is used to calculate the encoding cost corresponding to each quantization method, and the quantization method with the smallest encoding cost is determined as the target quantization method .
  • S906 Determine the value of the quantization mode flag bit according to the target quantization mode.
  • the above-mentioned M quantization manners include the first quantization manner. Therefore, the target quantization manner in this embodiment of the present application may be the first quantization manner or the second quantization manner.
  • the value of the quantization mode flag bit is determined to be the first value
  • the value of the quantization mode flag bit is determined to be the second value.
  • the first quantization manner includes a DQ quantization manner
  • the second quantization manner includes a non-DQ quantization manner.
  • the non-DQ quantization mode includes a default quantization mode, such as an RDOQ quantization mode.
  • first numerical value and second numerical value may be arbitrary values, which are not limited in this embodiment of the present application.
  • the first value may be 1.
  • the second value may be 0.
  • the target quantization mode of the block to be encoded may be determined by the value of the quantization mode flag bit. For example, when the value of the dependent quantization flag bit is a first numerical value (for example, 1), it is determined that the target quantization mode is the DQ quantization mode, If the value of the dependent quantization flag is a second value (for example, 0), the target quantization mode is determined to be a non-DQ quantization mode.
  • the quantized coefficients of the present application may also be quantized coefficients, or current coefficients, or coefficients to be encoded, or varying coefficient levels, reconstruction levels, or reconstruction levels, and the like.
  • S907 and S906 are executed in no order, that is, S907 can be executed after the above S906, can also be executed before S906, and can also be executed simultaneously with S906.
  • the coding end uses the DQ quantization method to quantize the variation coefficient of the block to be coded to obtain the quantized coefficient. For example, one quantizer is selected from N quantizers corresponding to the DQ quantization mode to quantize the variable coefficient.
  • the encoding end uses the non-DQ quantization method to quantize the variation coefficient of the to-be-coded block to obtain the quantized coefficient. For example, the encoding end uses the RDOQ quantization method to quantize the variable coefficients of the block to be encoded.
  • S908 Encode the quantization coefficient, and encode the value of the quantization mode flag bit into the code stream.
  • At least one of the above N quantizers is a non-zero quantizer that can quantize the transform coefficients into non-zero quantized coefficients.
  • the non-zero quantizer can also be referred to as a non-zero point quantizer.
  • At least one of the N quantizers is a zero-point quantizer that can quantize transform coefficients to zero.
  • the state of the current quantization coefficient is obtained according to the state of the previous quantization coefficient in the scanning order, and then it is determined whether the target quantizer is a non-zero quantizer (for example, when the state is 0 or 1, it is determined that the target quantizer is a zero-point quantizer For example, when the state of the current quantization coefficient is 2 or 3, the target quantizer is determined to be a non-zero quantizer).
  • the target quantizer is determined to be a non-zero quantizer, the encoding of sig_flag is skipped and its value is 1 by default.
  • the encoder knows that the absolute value of the minimum value of the data quantized by the non-zero quantizer is 1, that is to say, all coefficients quantized by the non-zero quantizer are non-zero quantizers. zero value, so the coefficients quantized by the non-zero quantizer do not need to encode the coefficient non-zero flag sig_flag, thus saving code words.
  • the N quantizers include a Q0 quantizer and a Q1 quantizer.
  • the Q0 quantizer has not changed, and the Q1 quantizer has removed the point quantized to 0, that is, the Q1 quantizer can only quantize the coefficients into non-zero coefficients, where Q0 is a zero-point quantizer, and Q1 is a non-zero quantizer.
  • the non-zero quantizer may also be Q0, that is, the Q0 quantizer has no zeros, but the Q1 quantizer has zeros.
  • both quantizers have no zeros, ie both Q0 and Q1 are non-zero quantizers.
  • the number of quantizers may be further expanded, and may be two or more than two quantizers.
  • the zero-point quantizer among the N quantizers may be any one of them, or may be any of them.
  • the inverse quantization value of even times ⁇ can be obtained, and when quantizer Q1 is used for quantization or inverse quantization, odd times ⁇ can be obtained.
  • the inverse quantization value of ( ⁇ represents the quantization step size, which is a parameter obtained by looking up the table with the quantization parameter Quantization parameter, and the quantization parameter is the value defined by the coding end).
  • the quantized values are divided into 4 subsets, S0, S1, S2 and S3, wherein the subsets S0 and S2 belong to the quantizer Q0, and the subsets S1 and S3 belong to the Q1.
  • the DQ quantization method of the present application selects the target quantizer according to whether the previous quantization coefficient is equal to 1 as a jump condition.
  • the target quantizer can be understood as a quantizer for quantizing the variation coefficient among the N quantizers corresponding to the DQ quantization manner.
  • the previous quantized coefficient may be understood as the quantized transform coefficient that precedes the variable coefficient in the quantization order (or scan order).
  • the present application determines a target quantizer from N quantizers to quantize the coefficient of variation, including the following steps:
  • A2 according to the flag bit information of the previous quantized coefficient and the state of the previous quantized coefficient, determine the current quantized coefficient state
  • A3 according to the current quantization coefficient state, determine the target quantizer from N quantizers;
  • the encoding device will determine the target quantizer used in the current quantization process according to the current state of the state machine. For a non-zero quantizer, it will no longer be able to quantize the coefficients to zero when trying to quantize.
  • the state of the quantized coefficients is represented by a state machine, that is, the state of the state machine can be understood as the state of the quantized coefficients.
  • the initial state of the state machine is 0.
  • the initial state of the state machine is included in the codestream.
  • the initial state of the state machine is 0, so that the initial state of the state machine at the decoding end is consistent with that at the encoding end, thereby ensuring accurate decoding of the coefficients by the decoding end.
  • the encoding device can obtain the state of the previous quantized coefficient.
  • the flag bit information of the previous quantized coefficient includes a coefficient non-zero flag of the previous quantized coefficient, a flag whose absolute value of the coefficient is greater than 1 (Greater than 1 flag, gt1 flag for short), a flag whose absolute value of the coefficient is greater than 2 ( Greater than 2 flag, referred to as gt2 flag).
  • the flag bit information of the previous quantized coefficient includes Sig flag, gt1 flag, gt2 flag, gt3 flag, ..., gtK flag of the previous quantized coefficient, where K is greater than 3.
  • the method of determining the state of the current quantized coefficient includes but is not limited to the following methods:
  • the state of the current quantized coefficient is determined according to the state of the previous quantized coefficient. For example, when the state of the previous quantization coefficient is 0, the state of the current quantization coefficient is determined to be 0; if the state of the previous quantization coefficient is 1, the state of the current quantization coefficient is determined to be 2, and if the state of the previous quantization coefficient is 2 When the value is 2, the state of the current quantization coefficient is determined to be 1; if the state of the previous quantization coefficient is 3, the state of the current quantization coefficient is determined to be 3.
  • the above A2 includes the following steps A21 and A22:
  • A22 Determine the state of the current quantized coefficient according to the state of the previous quantized coefficient and the state jump value.
  • the flag bit information of the previous quantized coefficient includes a coefficient non-zero flag, and if the value of the coefficient non-zero flag is 0, the state jump value is determined to be 0.
  • the flag bit information of the previous quantized coefficient includes a coefficient non-zero flag and a coefficient absolute value greater than 1 flag.
  • the state jump value is determined to be 1; if the value of the coefficient non-zero flag and the value of the coefficient absolute value greater than 1 flag do not satisfy the following formula (8), then the state jump value is determined to be 0;
  • t is the state jump value
  • sigflag is the value of the coefficient non-zero flag
  • gt1 is the value of the coefficient absolute value greater than 1 flag (ie gt1 flag).
  • the state of the current quantized coefficient is determined according to t and the state of the previous quantized coefficient.
  • the present application can complete the state transition by the state machine shown in FIG. 11 .
  • the true or false of t can be determined according to the above formula (8), and the state of the current quantized coefficient can be determined according to the true or false of t and the state of the previous quantized coefficient. For example, when t is true, the state of the previous quantized coefficient If it is 2, the state of the current quantization coefficient is 3.
  • the state of the state machine is updated according to the current state of the quantized coefficients.
  • state jumping methods involved in the embodiments of the present application include, but are not limited to, the method shown in FIG. 11 , for example, an existing state jumping method or other future state jumping methods may also be used.
  • conditions are set for the use of the DQ quantization mode, that is, when the set conditions are met, the DQ quantization mode can be used, that is, the DQ quantization mode is turned on.
  • the DQ quantization mode cannot be used, that is, the DQ quantization mode is turned off.
  • the present application may determine whether to program a quantization mode flag bit in the code stream based on the first quantization mode, for example, whether the DQ quantization mode can be used.
  • the quantization method flag bit can be encoded in the code stream.
  • the code stream of any block can be quantized.
  • the quantization mode flag bit is programmed to indicate whether the block is quantized using the DQ quantization mode.
  • the quantization mode flag bit is encoded into the code stream, where the target condition includes at least one of the following conditions: the color component of the block to be encoded is a luminance component, the block to be encoded The scan area of the block to be encoded that is not divided into transform units TU is larger than the preset value.
  • the above-mentioned scanning area of the block to be coded is greater than a preset value includes: the SRx times SRy of the scanning area of the block to be coded is greater than the first preset value, or the SRx or SRy of the scanning area of the block to be coded is greater than the first preset value. Two default values.
  • This embodiment does not limit the specific sizes of the first preset value and the second preset value.
  • the first preset value is 10, for example, SRx*SRy>10.
  • the block to be coded if the block to be coded meets the above target conditions, for example, the color component of the block to be coded is a luminance component, the block to be coded is not divided into transform units TU, and the scanning area of the block to be coded is larger than the preset value, the block to be coded
  • the block can be quantized using the first quantization method, such as DQ quantization method, and at this time, a quantization method flag bit can be programmed into the code stream. If the block to be coded meets the above target conditions, it is determined that the block to be coded cannot be quantized using the first quantization method, such as DQ quantization.
  • whether to program the quantization mode flag bit into the code stream is determined according to the color component, this is because the quantization effect is not obvious when the DQ quantization mode is used for quantization under the chrominance component, and When the DQ quantization method is used for quantization under the luminance component, a better quantization effect can be achieved. Therefore, in this embodiment, when it is determined that the color component of the block to be encoded is a luminance component, the quantization mode flag bit is encoded in the code stream, and when it is determined that the color component of the block to be encoded is a chrominance component, it is not encoded in the code stream.
  • the quantization mode flag bit is added, thereby improving the coding accuracy of the quantization mode flag bit, preventing the occurrence of wasting codewords caused by coding the quantization mode flag when it is determined that the DQ quantization mode cannot be used, thereby improving the coding efficiency.
  • the block to be coded when the block to be coded is not divided into transform units TU or the scanning area of the block to be coded is larger than the preset value, it can be determined that the block to be coded is larger, and the number of coefficients of variation in the block to be coded is large, and the DQ quantization method can be used. achieve better quantification effect. Therefore, when the block to be coded is not divided into transform units TU or the scanning area of the block to be coded is larger than the preset value, the quantization mode flag bit is programmed into the code stream, thereby improving the coding accuracy of the quantization mode flag bit, and then Encoding efficiency is improved.
  • a quantization mode flag bit is encoded into the code stream. This is because the compression effect of the I frame is poor, the residual error is large, and there are many change coefficients in the formed changed block.
  • the first quantization method such as the DQ quantization method, can achieve a better quantization effect. Therefore, after determining the block to be coded When it belongs to an I frame, the quantization mode flag bit is encoded into the code stream.
  • the encoding of the quantization mode flag bit is skipped. This is because the compression effect of the P frame or B frame is good, the residual error is small, and the change coefficients in the formed change block are less, and the first quantization method (such as DQ quantization method) cannot achieve a better quantization effect.
  • the quantization mode flag bit is not programmed into the code stream, that is, the encoding of the quantization mode flag bit is skipped during encoding.
  • the quantization mode flag bit is encoded into the code stream. That is to say, when the size of the to-be-coded block is smaller than the third preset value, for example, when the to-be-coded block is smaller than 4 ⁇ 4 or smaller than 8 ⁇ 8, the number of coefficients in the to-be-coded block is too small, and the first quantization method is adopted (For example, DQ quantization method) cannot achieve better quantization effect, therefore, skip encoding the quantization method flag bit into the code stream.
  • the first quantization method (such as the DQ quantization method) cannot achieve a better quantization effect. Therefore, a quantization method flag can be programmed into the code stream. bit.
  • the block to be coded when it is determined that the color component of the block to be coded is a luminance component, the block to be coded is not divided into transform units TU, the scanning area of the block to be coded is larger than the preset value, or the block to be coded belongs to the I frame, in the code stream
  • the quantization mode flag bits are incorporated, thereby improving the programming accuracy of the quantization mode flag bits, thereby improving the coding efficiency.
  • the video encoding method involved in the embodiments of the present application is described above. Based on this, the following describes the video decoding method involved in the present application for the decoding end.
  • FIG. 13 is a schematic flowchart of a video decoding method provided by an embodiment of the present application. As shown in FIG. 13 , the method of the embodiment of the present application includes:
  • the block to be decoded in the present application may also be referred to as a current block, or an image block currently to be processed, or an image block, or an image block to be decoded, or the like.
  • the entropy decoding unit 310 in the decoder can parse the code stream to obtain prediction information, quantization coefficient matrix, etc. to be decoded in the current image, and the prediction unit 320 uses intra-frame prediction or Inter prediction produces a predicted block of blocks to be decoded.
  • the inverse quantization/transform unit 330 performs inverse quantization and inverse transformation on the quantized coefficient matrix using the quantized coefficient matrix obtained from the code stream to obtain a residual block.
  • the reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstructed block.
  • the reconstructed blocks of other blocks to be encoded in the current image can be obtained, and each reconstructed block constitutes a reconstructed image.
  • This application is mainly aimed at the above-mentioned inverse quantization process.
  • the decoding end can directly parse the quantization mode flag bit from the code stream, determine the target inverse quantization mode of the block to be decoded according to the quantization mode flag bit, and use the target inverse quantization mode to inverse quantize the to-be-decoded block. That is, the decoding end can directly parse the inverse quantization method of the block to be decoded from the code stream, and does not need to use other methods to determine the inverse quantization method of the block to be decoded, thereby reducing decoding complexity and improving decoding efficiency.
  • the quantization mode flag bit in this embodiment of the present application may be a block-level (CU/TU) quantization mode flag bit, where the block-level quantization mode flag bit is used to indicate the target inverse quantization mode of the block.
  • CU/TU block-level quantization mode flag bit
  • the quantization mode flag bits in the embodiments of the present application may be sequence-level quantization mode flag bits.
  • the quantization mode flag bit at the sequence level is used to indicate the target quantization mode of all blocks in the sequence. For example, when the value of the quantization mode flag bit at the sequence level is 1, it indicates that all blocks in the sequence can be inversely quantized using the DQ inverse quantization mode. When the value of the quantization mode flag bit at the sequence level is 0, it indicates that all blocks in the sequence cannot be inversely quantized using the DQ inverse quantization mode.
  • the quantization mode flag bit in this embodiment of the present application may be a CTU-level quantization mode flag bit.
  • the quantization mode flag at the CTU level is used to indicate the target inverse quantization mode of all blocks in the CTU. For example, when the value of the quantization mode flag bit at the CTU level is 1, it indicates that all blocks in the CTU can be inversely quantized using the DQ inverse quantization mode. When the value of the quantization mode flag bit of the CTU level is 0, it indicates that all blocks in the CTU cannot be inversely quantized using the DQ inverse quantization mode.
  • the quantization mode flag bit in this embodiment of the present application may be a block-level (CU/TU) quantization mode flag bit, a sequence-level quantization mode flag bit, or a CTU-level quantization mode flag bit, so that the quantization mode flag bit is
  • CU/TU block-level quantization mode flag bit
  • sequence-level quantization mode flag bit a sequence-level quantization mode flag bit
  • CTU-level quantization mode flag bit a CTU-level quantization mode flag bit
  • Quantization mode or when the quantization mode flag bit is the CTU-level quantization mode flag bit, the decoding end only needs to decode a quantization mode flag bit from the code stream for all blocks in the CTU to indicate the quantization mode flag bit in the CTU.
  • Target quantization mode thereby greatly reducing the number of decoding quantization mode flag bits and improving decoding efficiency.
  • FIG. 14 is a schematic flowchart of a video decoding method provided by another embodiment of the present application. As shown in FIG. 14 , the method of the embodiment of the present application includes:
  • the quantization mode flag bit is used to indicate the target inverse quantization mode of the block to be decoded.
  • the target inverse quantization mode flag bit is the first value, it is determined that the target inverse quantization mode is the first inverse quantization mode.
  • the target inverse quantization mode is determined to be the second single quantization mode.
  • the first inverse quantization method is different from the second inverse quantization method.
  • the first inverse quantization manner includes a DQ inverse quantization manner
  • the second inverse quantization manner includes a non-DQ inverse quantization manner
  • the first value is 1.
  • the second value is 0.
  • S203 Perform inverse quantization on the block to be decoded according to the target inverse quantization method to obtain reconstructed transform coefficients.
  • the target inverse quantization method is not the DQ single quantization method, for example, the target single quantization method is the RDOQ single quantization method
  • the non-DQ inverse quantization method is used to perform inverse quantization on the block to be decoded.
  • the target inverse quantization method is the DQ inverse quantization method
  • the DQ inverse quantization mode corresponds to N quantizers, where N is a positive integer greater than or equal to 2.
  • At least one of the above N quantizers is a non-zero quantizer that can quantize the transform coefficients into non-zero quantized coefficients.
  • At least one of the N quantizers is a zero-point quantizer capable of quantizing transform coefficients to zero.
  • the N quantizers include one zero-point quantizer and one non-zero quantizer.
  • the above S203 includes: determining a target quantizer from the N quantizers, and using the target quantizer to perform inverse quantization on the quantization coefficients of the block to be decoded to obtain Reconstructed transform coefficients.
  • the above-mentioned determining a target quantizer from the N quantizers includes the following steps:
  • the above S903 includes the following steps S903-A1 to S903-A4:
  • the previous quantized coefficient is an adjacent previous inverse quantized quantized coefficient of the current quantized coefficient in the scanning order.
  • the decoding device can obtain the flag bit information of the previous quantized coefficient.
  • the flag bit information of the previous quantized coefficient includes a coefficient non-zero flag of the previous quantized coefficient, a flag whose absolute value of the coefficient is greater than 1 (Greater than 1 flag, gt1 flag for short), a flag whose absolute value of the coefficient is greater than 2 ( Greater than 2 flag, referred to as gt2 flag).
  • the flag bit information of the previous quantized coefficient includes Sig flag, gt1 flag, gt2 flag, gt3 flag, ..., gtK flag of the previous quantized coefficient, where K is greater than 3.
  • the state of the quantization coefficient can be understood as the state of the state machine.
  • the initial state of the state machine is 0.
  • the initial state of the state machine is included in the codestream.
  • the initial state of a state machine is 0.
  • the decoding device can obtain the state of the previous quantized coefficient.
  • the implementation manner of the above-mentioned B2 includes but is not limited to the following manners:
  • the state of the quantized coefficient is determined according to the state of the previous quantized coefficient. For example, when the state of the previous quantization coefficient is 0, the state of the quantization coefficient is determined to be 0; if the state of the previous quantization coefficient is 1, the state of the quantization coefficient is determined to be 2; if the state of the previous quantization coefficient is 2 When it is 2, the state of the quantized coefficient is determined to be 1, and if the state of the previous quantized coefficient is 3, the state of the quantized coefficient is determined to be 3.
  • the above-mentioned B2 includes the following steps B21 and B22:
  • the state jump value is determined to be 0.
  • the flag bit information of the previous quantization coefficient includes a coefficient non-zero flag and a coefficient absolute value greater than 1 flag, if the coefficient non-zero flag value and the coefficient absolute value greater than 1 flag value satisfy the following formula (9) , the state jump value is determined to be 1; if the value of the coefficient non-zero flag and the absolute value of the coefficient greater than 1 flag do not satisfy the following formula (9), the state jump value is determined to be 0;
  • t is the state jump value
  • sigflag is the value of the coefficient non-zero flag
  • gt1 is the value of the coefficient absolute value greater than 1 flag.
  • the truth of the variable t depends on whether the last coefficient value is 1 during the decoding process. But whether it is 1 can be obtained by the values of the two flag bits sig_flag and Greater than 1 flag (gt1 flag), which can be obtained without reconstructing all the current quantization coefficients, thereby reducing the complexity of quantization and improving decoding efficiency.
  • the present application can complete the state transition by the state machine shown in FIG. 11 .
  • the true or false of t can be determined according to the above formula (9), and the state of the quantized coefficient can be determined according to the true or false of t and the state of the previous quantized coefficient.
  • the state of the previous quantized coefficient is 2
  • the state of the quantized coefficient is 3.
  • the state of the state machine is updated based on the state of the quantized coefficients.
  • Predict the block to be decoded to obtain a predicted block for example, use an inter-frame prediction method or an intra-frame prediction method to predict the to-be-decoded block to obtain a predicted block.
  • S206 Obtain a reconstructed block according to the residual block and the predicted block, for example, add the residual block and the predicted block to a sum, as the reconstructed block of the block to be decoded.
  • the quantization mode flag bit is parsed from the code stream
  • the target condition includes at least one of the following conditions: the color component of the block to be decoded is a luminance component, the block to be decoded is not divided into transform units TU, and the scanning area of the block to be decoded is greater than a preset value.
  • the fact that the scanning area of the block to be decoded is greater than a preset value includes that SRx times SRy of the scanning area of the block to be decoded is greater than a first preset value; or, SRx or SRy of the scanning area of the block to be decoded is greater than a first preset value. greater than the second preset value.
  • This embodiment does not limit the specific sizes of the first preset value and the second preset value.
  • the first preset value is 10, for example, SRx*SRy>10.
  • the block to be decoded is not divided into transform units TU or the scanning area of the block to be decoded is larger than the preset value, it can be determined that the block to be decoded is larger, and the number of change coefficients in the block to be decoded is large, and the DQ inverse quantization method is adopted. A better inverse quantization effect can be achieved. Therefore, when the block to be decoded is not divided into transform units TU or the scanning area of the block to be decoded is larger than the preset value, the quantization mode flag bit is parsed from the code stream, thereby improving the parsing accuracy of the quantization mode flag bit, thereby improving the decoding efficiency.
  • the quantization mode flag bit is parsed from the code stream.
  • the block to be decoded belongs to a P frame or a B frame
  • parsing the quantization mode flag bit from the code stream is skipped.
  • the quantization mode flag bit is parsed from the code stream.
  • the block to be decoded is not divided into transform units TU, the scanning area of the block to be decoded is larger than the preset value, or the block to be decoded belongs to an I frame, the code stream
  • the quantization mode flag bit is parsed in the middle, thereby improving the parsing accuracy of the quantization mode flag bit, thereby improving the decoding efficiency.
  • the decoding end obtains the code stream information, and judges whether the quantization mode flag bit needs to be parsed from the code stream. For example, if it is judged that the block to be decoded meets the above target conditions, or the block to be decoded belongs to an I frame, or the size of the block to be decoded is greater than or equal to When the third preset value is used, the quantization mode flag bit is parsed from the code stream.
  • the quantization mode flag bit is parsed from the code stream, and the target inverse quantization mode is determined according to the quantization mode flag bit.
  • the default inverse quantization mode is determined as the target inverse quantization mode.
  • the block to be decoded is inverse quantized using the target inverse quantization method.
  • the decoding process in this embodiment further includes determining the target quantizer from N quantizers corresponding to the DQ inverse quantization method.
  • the method for determining the target quantizer includes the following steps:
  • the coefficient scanning range information in the transform block of the block to be decoded including the abscissa SRx at the right end of the scanning area and the ordinate SRy at the lower end of the scanning area.
  • the coefficient scanning area is determined, and the coefficient scanning area is a rectangular area with the position (0, 0) as the upper left corner and the position (SRx, SRy) as the lower right corner.
  • a schematic diagram of coefficient coding based on this scanning area is shown in Figure 15, where 0 represents a zero coefficient and 1 represents a non-zero coefficient.
  • the coefficient decoding order is a reverse zigzag scan from the lower right corner to the upper left corner (can also be used for any other form of scanning, such as horizontal scanning, vertical scanning, diagonal scanning, etc.).
  • the decoding device determines the position of the quantized coefficient in the coefficient scanning area, it first determines whether the quantized coefficient satisfies any one of the following conditions: that is, whether the position of the quantized coefficient is in the lower left corner of the coefficient scanning area and is the only non-zero coefficient in the current row, Or whether the position of the currently coded coefficient is in the upper right corner of the coefficient scanning area and is the only non-zero coefficient in the current column, or whether a non-zero quantizer is used is determined according to the state of the state machine where the currently coded coefficient is located.
  • the sig_flag of the quantized coefficient is directly set to 1. Then, the next bin parsed from the code stream is the Greater than 1 flag (gt1 flag) of the quantized coefficient.
  • the relevant flag bits to determine the absolute value of the quantized coefficient, including Greater than 2 Flag, Remaining abs level and other flag bits, note that the decoded coefficient value will not be zero.
  • the next bin parsed from the code stream is the sig_flag of the quantized coefficient.
  • sig_flag it is judged whether the quantized coefficient is a non-zero coefficient. If it is a non-zero coefficient, continue to parse the relevant flag according to the default scheme.
  • Bit to determine the absolute value of the quantization coefficient including flag bits such as Greater than 1 flag, Greater than 2 flag, Remaining abs level, etc.
  • the quantization coefficient is not a non-zero coefficient, the value of the quantization coefficient is 0.
  • the absolute value of the transform coefficient level (that is, the absolute value of the quantization coefficient) is sig_flag+Greater than 1 flag+Greater than 2 flag+Remaining abs level.
  • the sign flag bit is parsed to determine the positive and negative of the quantized coefficient.
  • the reconstructed transform coefficient t′ is obtained according to the above formula (1) or formula (2) according to the target quantizer and the transform coefficient level corresponding to the current quantization coefficient.
  • FIG. 8 to FIG. 15 are only examples of the present application, and should not be construed as a limitation of the present application.
  • the size of the sequence numbers of the above-mentioned processes does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be dealt with in the present application.
  • the implementation of the embodiments constitutes no limitation.
  • the term "and/or" is only an association relationship for describing associated objects, indicating that there may be three kinds of relationships. Specifically, A and/or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone.
  • the character "/" in this document generally indicates that the related objects are an "or" relationship.
  • FIG. 16 is a schematic block diagram of a video encoder provided by an embodiment of the present application.
  • the video encoder 10 includes:
  • an obtaining unit 11 for obtaining the block to be encoded
  • the encoding unit 12 is configured to encode the block to be encoded and generate a code stream, where the code stream includes a quantization mode flag bit, and the quantization mode flag bit is used to indicate the target quantization mode adopted by the to-be-coded block .
  • the encoding unit 12 is further configured to determine a target quantization mode of the block to be encoded; and determine the value of the quantization mode flag bit according to the target quantization mode.
  • the encoding unit 12 is specifically configured to, if the target quantization mode is the first quantization mode, determine the value of the quantization mode flag bit as a first value; if the target quantization mode is the second quantization mode If a quantization mode is used, the value of the quantization mode flag bit is determined to be a second value, wherein the first quantization mode is different from the second quantization mode.
  • the first quantization manner includes a dependent quantization DQ quantization manner
  • the second quantization manner includes a non-DQ quantization manner
  • the encoding unit 12 is specifically configured to, for each of the preset M quantization methods, determine an encoding cost when using this quantization method to quantize the block to be encoded, the M is a positive integer greater than or equal to 2;
  • the quantization mode with the smallest coding cost among the M quantization modes is determined as the target quantization mode.
  • the encoding unit 12 is further configured to encode the quantization mode flag bit into the code stream when it is determined that the block to be encoded satisfies the target condition;
  • the target condition includes at least one of the following conditions: the color component of the to-be-coded block is a luminance component, the to-be-coded block is not divided into transform units TU, and the scanning area of the to-be-coded block is greater than a preset value.
  • the scanning area of the block to be coded is greater than a preset value includes that SRx times SRy of the scanning area of the block to be coded is greater than a first preset value; or;
  • the fact that the scanning area of the block to be coded that is larger than a preset value includes that the SRx or SRy of the scanning area of the block to be coded is greater than a second preset value.
  • the encoding unit 12 is further configured to encode the quantization mode flag bit into the code stream when it is determined that the block to be encoded belongs to an I frame.
  • the encoding unit 12 is further configured to skip encoding of the quantization mode flag bit when it is determined that the block to be encoded belongs to a P frame or a B frame.
  • the encoding unit 12 is further configured to encode the quantization mode flag bit into the code stream when it is determined that the size of the block to be encoded is greater than or equal to a third preset value.
  • the quantization mode flags include at least one of the following: sequence-level quantization mode flags, frame-level quantization mode flags, coding tree unit CTU-level quantization mode flags, and block-level quantization mode flags flag bit.
  • the first value is 1, and/or the second value is 0.
  • the DQ quantization method corresponds to N quantizers, the N is a positive integer greater than or equal to 2, and at least one of the N quantizers quantizes the transform coefficients into non-zero quantization coefficients.
  • At least one of the N quantizers is a zero-point quantizer that quantizes the transform coefficient to zero.
  • the N quantizers include a zero-point quantizer and a non-zero quantizer.
  • the apparatus embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, details are not repeated here.
  • the video encoder 10 shown in FIG. 16 can execute the encoding method of the embodiment of the present application, and the aforementioned and other operations and/or functions of the respective units in the video encoder 10 are for the purpose of implementing the corresponding methods in the respective methods. The process, for the sake of brevity, will not be repeated here.
  • FIG. 17 is a schematic block diagram of a video decoder provided by an embodiment of the present application.
  • the video decoder 20 may include:
  • the first decoding unit 21 is used for decoding the code stream to obtain the quantization mode flag bit of the block to be decoded, and the quantization mode flag bit is used to indicate the target inverse quantization mode of the block to be decoded;
  • the second decoding unit 22 is configured to decode the block to be decoded according to the quantization mode flag bit.
  • the second decoding unit 22 is specifically configured to determine, according to the value of the quantization method flag bit, the target inverse quantization method used in the quantization of the block to be decoded; according to the target inverse quantization method, Inverse quantization is performed on the block to be decoded.
  • the second decoding unit 22 is specifically configured to determine that the target inverse quantization method is the first inverse quantization method if the value of the quantization method flag bit is a first value;
  • the target inverse quantization mode flag bit is the second value, it is determined that the target inverse quantization mode is the second inverse quantization mode.
  • the first inverse quantization manner includes a dependent quantization DQ inverse quantization manner
  • the second inverse quantization manner includes a non-DQ inverse quantization manner
  • the first decoding unit 21 is specifically configured to parse the quantization mode flag bit from the code stream when it is determined that the block to be decoded satisfies the target condition;
  • the target condition includes at least one of the following conditions: the color component of the block to be decoded is a luminance component, the block to be decoded is not divided into transform units TU, and the scanning area of the block to be decoded is larger than a preset value.
  • the scanning area of the block to be decoded is greater than a preset value comprises that the SRx times SRy of the scanning area of the block to be decoded is greater than a first preset value; or;
  • the fact that the scanning area of the block to be decoded that is larger than a preset value includes that the SRx or SRy of the scanning area of the block to be decoded is greater than a second preset value.
  • the first decoding unit 21 is specifically configured to parse the quantization mode flag bit from the code stream when it is determined that the block to be decoded belongs to an I frame.
  • the first decoding unit 21 is specifically configured to skip parsing the quantization mode flag bit from the code stream when it is determined that the block to be decoded belongs to a P frame or a B frame.
  • the first decoding unit 21 is specifically configured to parse the quantization mode flag bit from the code stream when it is determined that the size of the block to be decoded is greater than or equal to a third preset value.
  • the quantization mode flags include at least one of the following: sequence-level quantization mode flags, frame-level quantization mode flags, coding tree unit CTU-level quantization mode flags, and block-level quantization mode flags flag bit.
  • the first value is 1, and/or the second value is 0.
  • the DQ inverse quantization method corresponds to N quantizers, the N is a positive integer greater than or equal to 2, and at least one of the N quantizers is to quantize the transform coefficients into non-zero quantizers. Non-zero quantizer for coefficients.
  • At least one of the N quantizers is a zero-point quantizer that quantizes the transform coefficient to zero.
  • the N quantizers include a zero-point quantizer and a non-zero quantizer.
  • the apparatus embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, details are not repeated here.
  • the video decoder 20 shown in FIG. 17 may correspond to the corresponding subject in executing the decoding method of the embodiment of the present application, and the aforementioned and other operations and/or functions of each unit in the video decoder 20 are for the purpose of implementing the method, respectively. For the sake of brevity, the corresponding processes in each method will not be repeated here.
  • the functional unit may be implemented in the form of hardware, may also be implemented by an instruction in the form of software, or may be implemented by a combination of hardware and software units.
  • the steps of the method embodiments in the embodiments of the present application may be completed by hardware integrated logic circuits in the processor and/or instructions in the form of software, and the steps of the methods disclosed in conjunction with the embodiments of the present application may be directly embodied as hardware
  • the execution of the decoding processor is completed, or the execution is completed by a combination of hardware and software units in the decoding processor.
  • the software unit may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, and other storage media mature in the art.
  • 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 embodiments in combination with its hardware.
  • FIG. 18 is a schematic block diagram of an electronic device 30 provided by an embodiment of the present application.
  • the electronic device 30 may be the video encoder or the video decoder described in this embodiment of the application, and the electronic device 30 may include:
  • the processor 32 can call and run the computer program 34 from the memory 33 to implement the methods in the embodiments of the present application.
  • the processor 32 may be adapted to perform the steps of the above-described methods 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 may be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically programmable read-only memory (Erasable PROM, EPROM). Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile memory may be Random Access Memory (RAM), which acts as an external cache.
  • RAM Random Access Memory
  • RAM Static RAM
  • DRAM Dynamic RAM
  • SDRAM Synchronous DRAM
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM DDR SDRAM
  • enhanced SDRAM ESDRAM
  • synchronous link dynamic random access memory SLDRAM
  • Direct Rambus RAM Direct Rambus RAM
  • the computer program 34 may 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 procedures provided by the present application.
  • the one or more units may be a series of computer program instruction segments capable of performing specific functions, and 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 further include:
  • a transceiver 33 which 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, can send information or data to other devices, or receive information or data sent by other devices.
  • the transceiver 33 may include a transmitter and a receiver.
  • the transceiver 33 may further include antennas, and the number of the antennas may be one or more.
  • each component in the electronic device 30 is connected through a bus system, wherein the bus system includes a power bus, a control bus and a status signal bus in addition to a data bus.
  • FIG. 19 is a schematic block diagram of a video coding and decoding system 40 provided by an embodiment of the present application.
  • the video coding and decoding system 40 may include: a video encoder 41 and a video decoder 42 , wherein the video encoder 41 is used for executing the video coding method involved in the embodiments of the present application, and the video decoder 42 is used for executing The video decoding method involved in the embodiments of the present application.
  • the present application also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, enables the computer to execute the methods of the above method embodiments.
  • the embodiments of the present application further provide a computer program product including instructions, and when the instructions are executed by a computer, the instructions cause the computer to execute the method of the above method embodiments.
  • An embodiment of the present application further provides a code stream, which is generated by the encoding method shown in FIG. 8 or FIG. 9 , wherein the code stream includes a quantization mode flag bit, and the quantization mode flag bit is used to indicate the Describe the target quantization mode adopted by the block to be coded.
  • 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 on or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted over a wire from a website site, computer, server or data center (eg coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) means to another website site, 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, data center, etc. that includes one or more available media integrated.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, digital video disc (DVD)), or semiconductor media (eg, solid state disk (SSD)), and the like.
  • the disclosed system, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the unit is only a logical function division.
  • there may be other division methods for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • Units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

Landscapes

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

Abstract

本申请实施例提供一种视频编解码方法与系统、及视频编解码器,通过在码流中编入量化方式标志位,该量化方式标志位用于指示该待编码块的目标量化方式。这样解码端可以直接从码流中解析出量化方式标志位,并根据该量化方式标志位确定待解码块的目标反量化方式,并采用确定的目标反量化方式对待解码块进行反量化,即解码端直接可以从码流中解析出待解码块的反量化方式,无需采用其他的方式判断待解码块的反量化方式,进而降低解码复杂度,提高解码效率。

Description

视频编解码方法与系统、及视频编解码器 技术领域
本申请涉及视频编解码技术领域,尤其涉及一种视频编解码方法与系统、及视频编解码器。
背景技术
数字视频技术可以并入多种视频装置中,例如数字电视、智能手机、计算机、电子阅读器或视频播放器等。随着视频技术的发展,视频数据所包括的数据量较大,为了便于视频数据的传输,视频装置执行视频压缩技术,以使视频数据更加有效的传输或存储。
在视频压缩过程中为了便于编码,对变换系数进行量化,但是目前的量化过程复杂,造成编解码效率低。
发明内容
本申请实施例提供了一种视频编解码方法与系统、及视频编解码器,以提高编解码效率。
第一方面,本申请提供了一种视频编码方法,包括:
获取待编码块;
对所述待编码块进行编码,生成码流,所述码流中包括量化方式标志位,所述量化方式标志位用于指示所述待编码块所采用的目标量化方式。
第二方面,本申请实施例提供一种视频解码方法,包括:
解码码流,得到待解码块的量化方式标志位,所述量化方式标志位用于指示所述待解码块的目标反量化方式;
根据所述量化方式标志位,对所述待解码块进行解码。
第三方面,本申请提供了一种视频编码器,用于执行上述第一方面或其各实现方式中的方法。具体地,该编码器包括用于执行上述第一方面或其各实现方式中的方法的功能单元。
第四方面,本申请提供了一种视频解码器,用于执行上述第二方面或其各实现方式中的方法。具体地,该解码器包括用于执行上述第二方面或其各实现方式中的方法的功能单元。
第五方面,提供了一种视频编码器,包括处理器和存储器。该存储器用于存储计算机 程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第一方面或其各实现方式中的方法。
第六方面,提供了一种视频解码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第二方面或其各实现方式中的方法。
第七方面,提供了一种视频编解码系统,包括视频编码器和视频解码器。视频编码器用于执行上述第一方面或其各实现方式中的方法,视频解码器用于执行上述第二方面或其各实现方式中的方法。
第八方面,提供了一种芯片,用于实现上述第一方面至第二方面中的任一方面或其各实现方式中的方法。具体地,该芯片包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有该芯片的设备执行如上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第九方面,提供了一种计算机可读存储介质,用于存储计算机程序,该计算机程序使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十方面,提供了一种计算机程序产品,包括计算机程序指令,该计算机程序指令使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十一方面,提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。
第十二方面,提供了一种码流,该码流经过上述第一方面的编码方法生成的,其中码流中包括指量化方式标志位,所述量化方式标志位用于指示所述待编码块所采用的目标量化方式。
基于以上技术方案,通过在码流中编入量化标志位,该量化标志位用于指示待编码块的目标量化方式。这样解码端可以直接从码流中解析出量化标志位,并根据该量化标志位确定待解码块所采用的目标反量化方式,并采用确定的目标反量化方式对待解码块进行反量化,即解码端直接可以从码流中解析出待解码块的目标反量化方式,无需采用其他的方式判断待解码块的目标反量化方式,进而降低解码复杂度,提高解码效率。
附图说明
图1为本申请实施例涉及的一种视频编解码系统的示意性框图;
图2是本申请实施例提供的视频编码器的示意性框图;
图3是本申请实施例提供的解码框架的示意性框图;
图4为两种量化器Q0和Q1进行量化的示意图;
图5A为决定变换系数所使用量化器的状态转移示意图;
图5B为量化器的状态转移表的示意图;
图6为网格结构表示状态与变换系数级别的依赖性示意图;
图7为Q0和Q1的候选变换系数级别示意图;
图8为本申请实施例一提供的视频编码方法的流程示意图;
图9为本申请另一实施例提供的视频编码方法的流程示意图;
图10为本申请涉及的Q0,Q1的量化器示意图;
图11为本申请一实施例涉及的状态机状态跳转示意图;
图12为本申请一实施例涉及的状态跳转及量化器选择示意图;
图13为本申请一实施例提供的视频解码方法的流程示意图;
图14为本申请另一实施例提供的视频解码方法的流程示意图;
图15为本申请实施例涉及的扫描区域的系数编码示意图;
图16是本申请实施例提供的视频编码器的示意性框图;
图17是本申请实施例提供的视频解码器的示意性框图;
图18是本申请实施例提供的电子设备的示意性框图;
图19是本申请实施例提供的视频编解码系统的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
本申请可应用于图像编解码领域、视频编解码领域、硬件视频编解码领域、专用电路视频编解码领域、实时视频编解码领域等。例如,本申请的方案可结合至音视频编码标准(audio video coding standard,简称AVS),例如,H.264/音视频编码(audio video coding,简称AVC)标准,H.265/高效视频编码(high efficiency video coding,简称HEVC)标准以及H.266/多功能视频编码(versatile video coding,简称VVC)标准。或者,本申请的方案可结合至其它专属或行业标准而操作,所述标准包含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为本申请实施例涉及的一种视频编解码系统100的示意性框图。需要说明的是,图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)、“最大编码单元”(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可包含更多、更少或不同的功能组件。
可选的,在本申请中,当前块(current block)可以称为当前编码单元(CU)或当前预测单元(PU)等。预测块也可称为预测待编码块或图像预测块,重建待编码块也可称为重建块或图像重建待编码块。
在一些实施例中,预测单元210包括帧间预测单元211和帧内预测单元212。由于视频的一个帧中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。由于视频中的相邻帧之间存在着很强的相似性,在 视频编解码技术中使用帧间预测方法消除相邻帧之间的时间冗余,从而提高编码效率。
帧间预测单元211可用于帧间预测,帧间预测可以参考不同帧的图像信息,帧间预测使用运动信息从参考帧中找到参考块,根据参考块生成预测块,用于消除时间冗余;帧间预测所使用的帧可以为P帧和/或B帧,P帧指的是向前预测帧,B帧指的是双向预测帧。运动信息包括参考帧所在的参考帧列表,参考帧索引,以及运动矢量。运动矢量可以是整像素的或者是分像素的,如果运动矢量是分像素的,那么需要再参考帧中使用插值滤波做出所需的分像素的块,这里把根据运动矢量找到的参考帧中的整像素或者分像素的块叫参考块。有的技术会直接把参考块作为预测块,有的技术会在参考块的基础上再处理生成预测块。在参考块的基础上再处理生成预测块也可以理解为把参考块作为预测块然后再在预测块的基础上处理生成新的预测块。
目前最常用的帧间预测方法包括:VVC视频编解码标准中的几何划分模式(geometric partitioning mode,GPM),以及AVS3视频编解码标准中的角度加权预测(angular weighted prediction,AWP)。这两种帧内预测模式在原理上有共通之处。
帧内预测单元212只参考同一帧图像的信息,预测当前码待编码块内的像素信息,用于消除空间冗余。帧内预测所使用的帧可以为I帧。
在一些实施例中,帧内预测方法还包括多参考行帧内预测方法(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中,为后续的帧作为帧间预测的参考帧。
上述是基于块的混合编码框架下的视频编解码器的基本流程,随着技术的发展,该框架或流程的一些模块或步骤可能会被优化,本申请适用于该基于块的混合编码框架下的视频编解码器的基本流程,但不限于该框架及流程。
下面对本申请涉及的量化技术进行介绍。
依赖性量化(Dependent Quantization,DQ),也称为对偶量化。对偶量化作用在变换后的块上。与传统的量化不同的是,对偶量化共包含了两个量化器,这两个量化器虽然有着相同的量化步长,但与变换系数的匹配却是交错的。图4是对偶量化的量化器Q0和量化器Q1与变换系数匹配的示意图。
其中,量化器Q0匹配了偶数倍的量化步长Δ与变换系数级别(即A,B点对应的数字),量化器Q1匹配了奇数倍的量化步长Δ与变换系数级别(即C,D点对应的数字)。
依赖量化通过引入两个交错的量化器,以及量化器之间跳转的原则,使得大步长的量化器能够完成更精细的量化,达到减小了重建的变换系数与原始变换系数之间的损失,从而提高编码效率。
对于每个变换系数,都可以使用图4中描述的两种量化器Q0,Q1进行量化,这两个量化器的量化的方式与传统的量化器(例如HEVC中的量化)相似。两个量化器的重建系数都可以用量化步长Δ表示,两个量化器的重建系数定义如下:
Q0:该量化器的重建级别为偶数倍的量化步长Δ,当使用这个量化器时,重建的变换系数t′可根据如下公式(1)计算,
t'=2·k·Δ      (1)
其中,k表示图4中所述相关的变换系数级别。
Q1:该量化器的重建级别为奇数或零倍的量化步长Δ,当使用这个量化器时,重建的变换系数t′可根据如下公式(2)计算,
t'=(2·k-sgn(k))·Δ     (2)
其中,sgn(·)代表符号函数,
Figure PCTCN2021086734-appb-000001
使用Q0或Q1进行量化并不会通过编码标志位来进行控制。取而代之的是,使用在系数扫描顺序上的上一个系数的变换系数级别(图4中所述的变换系数级别)的奇偶性来决定当前变换系数使用Q0或Q1。
图5A为决定变换系数所使用量化器的状态转移示意图,图5B为量化器的状态转移表的示意图。在系数扫描顺序上,当前量化系数的重建值可以通过图5A中所示的转移方法决定下一个系数的状态,状态共有四种,分别由0,1,2,3这四个值来表示。例如当前量化系数的状态为2且当前变换系数级别为5时,由于5是奇数,所以决定下一个系数的状态跳转为状态3。每一个变换块在扫描顺序上的第一个系数的状态被设定为初始状态0。状态的0,1,2,3也决定这当前的系数使用哪一个量化器,状态0,1对应着使用量化器Q0,状态2,3对应着使用量化器Q1。
对对偶量化的决策与率失真优化量化(rate-distortion optimized quantization,RDOQ)的实现方式相似,变换系数级别{q k}的取值为最小化如下公式(3)拉格朗日率失真代价的一个过程,
J=D+λ·R=∑ k(t k-t' k(q k|q k-1,q k-2,...)) 2+λ·R k(q k|q k-1,q k-2,...)   (3)
其中,t k和q k分别代表原始的表换系数和变换系数级别,t' k(q k|...)代表在当前变换系数级别q k下重建出的变换系数值,R K(q k|...)代表估计出的编码q k需要消耗的比特数。
图6为网格结构表示状态与变换系数级别的依赖性示意图,其编码顺序从左到右。 如之前所介绍的状态机的转移,可以将量化器与变换系数级别之间的依赖性表示成如图6所示的网格图,每一列的四个状态表示当前量化系数的可能的四种状态,每个节点与编码顺序上下一个系数的可能的两个状态节点相连。对于一个给定的当前状态和当前变换系数t k,可以使用当前量化器量化出对应的变换系数级别,编码器可以选择使用奇数的变换系数级别也可以选择使用偶数的变换系数级别,奇数变换系数级别对应图6中B(Q0 with parity 1)和D(Q1 with parity 1),偶数变换系数级别对应A(Q0 with parity 0)和C(Q1 with parity 0)。当算出所有节点的代价J K(q k)=(t k-t' k(q k|...)) 2+λ·R k(q k|...)后,变换系数级别q k就可以通过找到一条代价总和最小的路线来决定,而确定最小代价和可以通过维特比算法(Viterbi algorithm)来实现。
具体的实现由两步组成:
步骤1,找到4个与原始变换系数对应的4个分别来自Q0和Q1的候选变换系数级别如图7所示;
步骤2,使用维特比算法以估计出的rate-distortion总和(之前节点已确定的变换系数级别对应的代价综合)来确定一系列当前节点的变换系数级别q k
上文对DQ技术以及变换系数的变化系数级别的确定过程进行介绍,在此基础上,下面结合具体的实施例对本申请实施例提供的技术方案进行详细描述。
下面结合图8对编码端进行介绍。
图8为本申请实施例一提供的视频编码方法的流程示意图,本申请实施例应用于图1和图2所示视频编码器。如图8所示,本申请实施例的方法包括:
S801、获取待编码块;
S802、对待编码块进行编码,生成码流,其中,码流中包括量化方式标志位,该量化方式标志位用于指示待编码块所采用的目标量化方式。
在一些实施例中,本申请的待编码块也可以称为当前块,或当前待处理的图像块,或图像块,或待编码的图像块等。
在视频编码过程中,视频编码器接收视频流,该视频流由一系列图像帧组成,针对视频流中的每一帧图像进行视频编码,为了便于描述,本申请将当前待编码的一帧图像记为当前图像。
具体的,参照图2所示,视频编码器将当前图像划分成一个或多个待编码块,针对每个待编码块,视频编码器中的预测单元210经由帧间预测、帧内预测产生待编码块的 预测块之后,将预测块发送给残差单元220,该残差单元220可以理解为求和器,包括执行减法运算的一个或多个组建。残差单元220从待编码块中减去预测块形成残差块,并将残差块发送给变换量化单元230。变换量化单元230使用例如离散余弦变换(DCT)或者类似的变换将残差块进行变换处理,得到变换系数。变换量化单元230进一步对变换系数进行量化,得到量化后的变换系数,即量化系数。
由图2可知,变换量化单元230将量化后的变换系数转发给熵编码单元280。熵编码单元280对量化后的变换系数进行熵编码。举例来说,熵编码单元280可执行上下文自适应可变长度编码(CAVLC)、上下文自适应二进制算术编码(CABAC)、基于语法的上下文自适应二进制算术编码(SBAC)、概率区间分割熵(PIPE)编码等编码方法,对量化后的变换系数进行熵编码,得到码流。
本申请主要针对的是上述量化过程。
本申请实施例编码端通过在码流中编入量化方式标志位用于指示该待编码块在量化时所采用的目标量化方式。这样解码端可以直接从码流中解析出量化方式标志位,并根据该量化方式标志位确定待解码块所采用的目标反量化方式,并采用确定的目标反量化方式对待解码块进行反量化,即解码端直接可以从码流中解析出待解码块的目标反量化方式,无需采用其他的方式判断待解码块的量化方式,进而降低解码复杂度,提高解码效率。
在一些实施例中,上述目标量化方式可以是多种量化方式中的任意一种量化方式,例如为多种量化方式中编码损失最小的量化方式。
在一些实施例中,上述目标量化方式为第一种量化方式或者为第二种量化方式,其中第一种量化方式与第二种量化方式不同。本实施例对第一种量化方式和第二种量化方式的具体类型不做限制。
示例性的,第一种量化方式包括DQ量化方式,第二种量化方式包括非DQ量化方式。
可选的,非DQ量化方式包括默认的量化方式。
在一些实施例中,默认的量化方式可以为RDOQ量化方式或恒定量化参数量化方式等。
在一些实施例中,本申请实施例的量化方式标志位可以为块级(CU/TU)的量化方式标志位。
在一种示例中,块级的量化方式标志位用于指示该块的目标量化方式。
在一些实施例中,本申请实施例的量化方式标志位可以为序列级的量化方式标志位。
在一种示例中,序列级的量化方式标志位用于指示该序列中的所有块的目标量化方式。当序列级的量化方式标志位的值为1时,表示该序列中的所有块均可以使用DQ量化方式。当序列级的量化方式标志位的值为0时,表示该序列中的所有块均不可以使用DQ量化方式。
在一些实施例中,本申请实施例的量化方式标志位可以为CTU级的量化方式标志位。
在一种示例中,CTU级的量化方式标志位用于指示该CTU中的所有块的目标量化方式。例如,当CTU级的量化方式标志位的值为1时,表示该CTU中的所有块均可以使用DQ量化方式。当CTU级的量化方式标志位的值为0时,表示该CTU中的所有块均不可以使用DQ量化方式。
由上述可知,本申请实施例的量化方式标志位可以为块级(CU/TU)的量化方式标志位、序列级的量化方式标志位或CTU级的量化方式标志位,使得量化方式标志位的样式丰富,进而提高了编码的多样性。另外,当量化方式标志位为序列级的量化方式标志位时,编码端针对序列中的所有块只需在码流中编入一个量化方式标志位即可指示该序列中的所有块的目标量化方式,或者当量化方式标志位为CTU级的量化方式标志位时,编码端针对CTU中的所有块只需在码流中编入一个量化方式标志位即可指示该CTU中的所有块的目标量化方式,进而大大减少编入码流的量化方式标志位的个数,进而节约码字,提高编码效率。
图9为本申请另一实施例提供的视频编码方法的流程示意图,本申请实施例的方法包括:
S901、获取待编码块。
S902、对待编码块进行预测,得到待编码块的预测块。
S903、根据待编码块和预测块,得到待编码块的残差块。
S904、对残差块进行变换,得到变换系数。
例如,经由帧间预测、帧内预测产生待编码块的预测块。从待编码块中减去预测块形成残差块。对残差块进行变换处理,得到变换系数。
S905、确定待编码块的目标量化方式。
在一些实施例中,上述目标量化方式为默认的量化方式。
在一些实施例中,上述目标量化方式为M种量化方式中的任意一种量化方式,例如 目标量化方式为随机的一种量化方式,所述M为大于或等于2的正整数。
在一些实施例中,上述目标量化方式为M种量化方式中编码代价最小的量化方式,即S905包括:针对预设的M种量化方式中的每一种量化方式,确定使用该种量化方式对待编码块进行量化时的编码代价。
示例性的,本申请实施例可以基于拉格朗日率失真代价来计算编码代价。
本申请实施例涉及的计算编码代价的方式包括但不限于如下几种:
方式一,基于空域的编码代价
针对M种量化方式中每一种量化方式,使用该量化方式对变化系数进行量化,得到量化系数,再对该量化系数进行反量化和反变化,得到待编码块的残差值,将待编码块的残差值与待编码块的预测值进行重构,例如相加得到待编码块的重建值Coef rec。确定待编码块的重建值Coef rec与待编码块的原始像素值Coef org之间的失真D1。根据待编码块的重建值Coef rec与待编码块的原始像素值Coef org之间的失真D1,确定该量化方式对应的编码代价。
例如,采用如下公式(4)计算各量化方式对应的编码代价J:
J=D1+λ×R1     (4)
其中,R1代表编码该待编码块的各种flag及系数所消耗的比特数,λ为与量化参数相关的一个变量,D1表示待编码块的重建值Coef rec与待编码块的原始像素值Coef org之间的失真。
示例性的,可以根据如下公式(5),计算待编码块的重建值Coef rec与待编码块的原始像素值Coef org之间的失真D1:
D1=(Coef org-Coef rec) 2      (5)
方式二,基于变换域的编码代价
针对M种量化方式中每一种量化方式,使用该量化方式对变化系数进行量化,得到量化系数,再对该量化系数进行反量化得到反量化系数。确定反量化Coef invQ与实际变换系数Coef Trans之间的失真D2。根据反量化Coef invQ与实际变换系数Coef Trans之间的失真D2,确定该量化方式对应的编码代价。
例如,采用如下公式(6)计算各量化方式对应的编码代价J:
J=D2+λ×R2    (6)
其中,R代表编码该待编码块中系数所消耗的比特数,λ为与量化参数相关的一个变量,D2表示反量化Coef invQ与实际变换系数Coef Trans之间的失真。
示例性的,可以根据如下公式(7),计算反量化Coef invQ与实际变换系数Coef Trans 之间的失真D2:
D2=(Coef invQ-Coef Trans) 2     (7)
需要说明的是,本申请实施例确定各量化方式对应的编码代价的方式包括但不限于如上两种方式。
该实施例中,针对M种量化方式中的每一种量化方式,采用上述方式一或方式二,计算出每一种量化方式对应的编码代价,将编码代价最小的量化方式确定为目标量化方式。
S906、根据目标量化方式,确定量化方式标志位的值。
示例性的,上述M种量化方式中包括第一种量化方式,因此,本申请实施例的目标量化方式可以为第一种量化方式,也可以第二种量化方式。
在一些实施例中,若目标量化方式为第一种量化方式,则确定量化方式标志位的值为第一数值;
若目标量化方式为第二种量化方式,则确定量化方式标志位的值为第二数值。
可选的,第一种量化方式包括DQ量化方式,第二种量化方式包括非DQ量化方式。
可选的,非DQ量化方式包括默认量化方式,例如RDOQ量化方式。
其中,上述第一数值和第二数值可以为任意值,本申请实施例对此不做限制。
可选的,第一数值可以为1。
可选的,第二数值可以为0。
即本申请实施例可以通过量化方式标志位的值来确定待编码块的目标量化方式,例如依赖性量化标注位的值为第一数值(例如1)时,确定目标量化方式为DQ量化方式,若依赖性量化标注位为的值为第二数值(例如0)时,确定目标量化方式为非DQ量化方式。
S907、使用目标量化方式对变换系数进行量化,得到量化系数。
在一些实施例中,本申请的量化系数也可以量化后的系数,或者当前系数,或者待编码的系数,或者变化系数级别、重建级别或重建电平等。
需要说明的是,上述S907和S906在执行时没有先后顺序,即S907可以在上述S906之后执行,也可以在S906之前执行,还可以与S906同时执行。
若目标量化方式为DQ量化方式,则编码端采用DQ量化方式对待编码块的变化系数进行量化,得到量化系数。例如,从DQ量化方式对应的N个量化器中选择一个量化器对该变化系数进行量化。
若目标量化方式不是DQ量化方式时,编码端采用非DQ量化方式对待编码块的变化系数进行量化,得到量化系数。例如,编码端采用RDOQ量化方式对待编码块的变化系数进行量化。
S908、对量化系数进行编码,并将所述量化方式标志位的值编入码流。
在一些实施例中上述N个量化器中至少有一个量化器为可以将变换系数均量化为非零量化系数的非零量化器。其中非零量化器也可以称为非零点量化器。
在一些实施例中,N个量化器中至少有一个量化器为可以将变换系数量化为零的零点量化器。
在一些实施例中,N个量化器包括一个零点量化器和一个非零量化器。即N=2,即本申请提出在两个量化器中,只有一个量化器有零点,即一个量化器可以把系数量化为零,这样的量化器称为零点量化器;另一个量化器不可以把系数量化为零,这样的量化器称为非零量化器。
在一些实施例中,在编码sig_flag时,有以下两种情况可跳过对其编码:
情况1,根据扫描顺序上的上一个量化系数的状态来获取当前量化系数的状态,进而确定目标量化器是否为非零量化器(例如状态为0或1时,确定目标量化器为零点量化器,例如当前量化系数的状态为2或3时,确定目标量化器为非零量化器),在确定目标量化器为非零量化器时,跳过对sig_flag的编码并默认其值为1。
情况2,当前扫描区域的最右一列仅右上角系数为非零或最下一行仅左下角系数为非零时,也可跳过对sig_flag的编码并默认其值为1。
即本申请对使用非零量化器进行量化的系数编码时,因为编码器已知非零量化器量化的数据最小值的绝对值为1,也就是说所有非零量化器量化后的系数都是非零值,因此非零量化器量化后的系数不需要编码系数非零标志sig_flag,从而节省码字。
在一些实施例中,如图10所示,N个量化器包括Q0量化器和Q1量化器。其中Q0量化器并未作出改变,Q1量化器则是去掉了量化为0的点,即Q1量化器只能将系数量化成非零系数,这里Q0是零点量化器,Q1是非零量化器。
在一些实施例中,非零量化器也可以是Q0,也就是说Q0量化器没有零点,但Q1量化器有零点。
在一些实施例中,两个量化器都没有零点,即Q0和Q1都是非零量化器。
可选的,量化器的个数也可以进一步扩展,可以是两个也可以是两个以上的量化器。 对于两个以上量化器的情况,即N大于2时,N个量化器中零点量化器可以是其中任意一个,也可以是其中任意多个。
如图10所示的双量化器,使用量化器Q0进行量化或反量化时,可以获得偶数倍的Δ的反量化值,而使用量化器Q1进行量化或反量化时,可以得到奇数倍的Δ的反量化值(Δ代表量化步长,是由量化参数Quantization parameter查表得到的一个参数,量化参数为编码端定义的值)。
将一个量化值编入码流时,会根据它的大小将其使如表1所示的flag表示。
如图10所示,量化值分为4个子集,为S0、S1、S2和S3,其中子集S0和S2归属于量化器Q0,子集S1和S3归属于Q1。
在一些实施例中,本申请的DQ量化方式根据前一个量化系数是否等于1作为跳转条件来选择目标量化器。该目标量化器可以理解为DQ量化方式对应的N个量化器中用于量化变化系数的量化器。
在一些实施例中,前一个量化系数可以理解为在量化顺序(或扫描顺序)中,位于该变化系数之前的已量化的变换系数。
在一些实施例中,本申请从N个量化器中确定一个目标量化器对变化系数进行量化,包括如下步骤:
A1,获取前一个量化系数的状态;
A2,根据前一个量化系数的标志位信息,以及前一个量化系数的状态,确定当前量化系数状态;
A3,根据当前量化系数状态,从N个量化器中确定目标量化器;
A4,使用目标量化器,对变换系数进行量化。
在实际编码过程中,编码设备会根据状态机的当前状态判断当前量化过程中所使用的目标量化器,对非零量化器,在尝试量化的时候将不再能够把系数量化成零。
其中量化系数的状态通过状态机来表征,即状态机的状态可以理解为量化系数的状态。
可选的,状态机的初始状态为0。
在一些实施例中,码流中包括状态机的初始状态。例如,状态机的初始状态为0,使得解码端的状态机的初始状态与编码端的一致,进而保证了解码端对系数的准确解码。
本申请中由于当前量化系数的前一个量化系数已编码,其状态已知,因此,编码设备可以获得该前一个量化系数的状态。
在一些实施例中,量化系数的标志位信息包括如下至少一个:系数非零标志(Significant flag,简称Sig flag)、至少一个系数绝对值大于i标志(Greater than i flag,简称gti flag),所述i=1,2...。
在一种示例中,前一个量化系数的标志位信息包括该前一个量化系数的系数非零标志、系数绝对值大于1标志(Greater than 1 flag,简称gt1 flag)、系数绝对值大于2标志(Greater than 2 flag,简称gt2 flag)。
在一种示例中,前一个量化系数的标志位信息包括该前一个量化系数的Sig flag、gt1 flag、gt2 flag、gt3 flag、……、gtK flag,其中K大于3。
在一些实施例中,上述A2中根据所述前一个量化系数的标志位信息,以及所述前一个量化系数的状态,确定所述当前量化系数的状态的方式包括但不限于如下方式:
方式一,若前一个量化系数的标志位信息中的Sig flag的值为0时,则根据前一个量化系数的状态,确定所述当前量化系数的状态。例如,前一个量化系数的状态为0时,则确定当前量化系数的状态为0,若前一个量化系数的状态为1时,则确定当前量化系数的状态为2,若前一个量化系数的状态为2时,则确定当前量化系数的状态为1,若前一个量化系数的状态为3时,则确定当前量化系数的状态为3。
方式二,上述A2包括如下步骤A21和A22:
A21、根据前一个量化系数的标志位信息,确定状态跳转值;
A22、根据前一个量化系数的状态和状态跳转值,确定当前量化系数的状态。
在一种示例中,前一个量化系数的标志位信息包括系数非零标志,若系数非零标志的值为0时,则确定状态跳转值为0。
在另一种示例中,前一个量化系数的标志位信息包括系数非零标志和系数绝对值大于1标志,此时,若系数非零标志的值和系数绝对值大于1标志的值满足如下公式(8),则确定状态跳转值为1;若系数非零标志的值和系数绝对值大于1标志的值不满足如下公式(8),则确定状态跳转值为0;
t=sigflag==1&&gt1==0   (8)
其中,t为状态跳转值,sigflag为系数非零标志的值,gt1为系数绝对值大于1标志(即gt1 flag)的值。
根据上述方式,确定出t后,根据t和前一个量化系数的状态,确定出当前量化系数的状态。
本申请可由如图11所示的状态机完成状态的转移。例如,如图11所示,当t=1,表 示t为真,当t=0时,表示t为假。这样可以根据如上公式(8)确定出t的真假,并根据t的真假和前一个量化系数的状态,确定出当前量化系数的状态,例如,当t为真,前一个量化系数的状态为2,则当前量化系数的状态为3。
由上述公式(8)可知,当量化系数的值为1时,t为真,当量化系数的值不等于1时,t为假。也就是说,本申请实施例中量化器之间的跳转是基于前一个位置上的量化系数是否等于1,例如图12所示,当前状态为状态0时,若当前量化值为0,则下一个状态依然为状态0,若当前量化值为1,则下一个状态跳转至状态2。
在一些实施例中,根据当前量化系数的状态,更新状态机的状态。
需要说明的是,本申请实施例涉及的状态跳转方法包括但不限于图11所示的方法,例如还可以采用已有的状态跳转方法或未来其他的状态跳转方法。
下面对量化方式标志位的使用条件进行介绍。
在以下两种状况下,依赖性量化效果可能不佳:
1)如图4所示,当前块中多数变换值没有集中在Δ附近时;
2)当前块的变换系数个数过少。
基于上述状况,在一些实施例中,对DQ量化方式的使用设定条件,即在满足设定的条件时,可以使用DQ量化方式,即DQ量化方式打开。在不满足设定的条件时,不可以使用DQ量化方式,即DQ量化方式关闭。
在一些实施例中,本申请可以基于第一种量化方式,例如DQ量化方式可否使用来确定是否在码流中编入量化方式标志位。
在一些实施例中,无论待编码块是否可以采用第一种量化方式,例如DQ量化方式进行量化,码流中均可以编码量化方式标志位,例如在VVC中,可以对任意块的码流中编入量化方式标志位,以表示该块是否使用DQ量化方式进行量化。
在一些实施例中,在确定待编码块满足目标条件时,将量化方式标志位编入码流中,其中,目标条件包括如下至少一个条件:待编码块的颜色分量为亮度分量、待编码块不划分为变换单元TU、待编码块的扫描区域大于预设值。
在一种示例中,上述待编码块的扫描区域大于预设值包括:待编码块的扫描区域的SRx乘SRy大于第一预设值,或者,待编码块的扫描区域的SRx或SRy大于第二预设值。
本实施例对上述第一预设值和第二预设值的具体大小不进行限定。
可选的,第一预设值为10,例如SRx*SRy>10。
即该实施例中,若待编码块满足上述目标条件时,例如待编码块的颜色分量为亮度分量、待编码块不划分为变换单元TU、待编码块的扫描区域大于预设值,待编码块可以使用第一种量化方式,例如DQ量化方式进行量化,此时,可以在码流中编入量化方式标志位。若待编码块满足上述目标条件时,确定待编码块不可以使用第一种量化方式,例如DQ量化方式,进行量化,此时,在码流中不编入量化方式标志位。
由上述可知,在一些实施例中,根据颜色分量来确定是否在码流中编入量化方式标志位,这是由于在色度分量下使用DQ量化方式进行量化时,量化效果不明显,而在亮度分量下使用DQ量化方式进行量化时,可以达到较好的量化效果。因此,本实施例在确定待编码块的颜色分量为亮度分量时,在码流中编入量化方式标志位,而在确定待编码块的颜色分量为色度分量时,在码流中不编入量化方式标志位,进而提高了量化方式标志位的编入准确性,防止在确定无法使用DQ量化方式的情况下编入量化方式标志导致浪费码字的情况发生,进而提高了编码效率。
另外,在待编码块不划分为变换单元TU或待编码块的扫描区域大于预设值时,可以确定待编码块较大,则待编码块中的变化系数数量较多,采用DQ量化方式可以实现较好的量化效果。因此,在待编码块不划分为变换单元TU或待编码块的扫描区域大于预设值时,在码流中编入量化方式标志位,进而提高了量化方式标志位的编入准确性,进而提高了编码效率。
在一些实施例中,在确定待编码块属于I帧时,将量化方式标志位编入所述码流。这是由于I帧的压缩效果差,残差大,形成的变化块中变化系数较多,采用第一种量化方式,例如DQ量化方式可以达到较好的量化效果,因此,在确定待编码块属于I帧时,将量化方式标志位编入码流。
在一些实施例中,在确定待编码块属于P帧或B帧时,跳过对量化方式标志位的编码。这是由于P帧或B帧的压缩效果好,残差小,形成的变化块中变化系数较少,采用第一种量化方式(例如DQ量化方式)无法达到较好的量化效果,因此,在确定待编码块属于P帧或B帧时,在码流中不编入量化方式标志位,即在编码时跳过对量化方式标志位的编码。
在一些实施例中,在确定待编码块的大小大于或等于第三预设值时,将量化方式标志位编入码流。也就是说,当待编码块的大小小于第三预设值时,例如待编码块小于4×4或小于8×8时,该待编码块中系数个数过少,采用第一种量化方式(例如DQ量化方 式)无法达到较好的量化效果,因此,跳过将量化方式标志位编入码流。相反,若待编码块的大小大于或等于第三预设值时,采用第一种量化方式(例如DQ量化方式)无法达到较好的量化效果,因此,可以在码流中编入量化方式标志位。
即本申请实施例在确定待编码块的颜色分量为亮度分量、待编码块不划分为变换单元TU、待编码块的扫描区域大于预设值、或待编码块属于I帧时在码流中编入量化方式标志位,进而提高了量化方式标志位的编入准确性,进而提高了编码效率。
上文对本申请实施例涉及的视频编码方法进行了描述,在此基础上,下面针对解码端,对本申请涉及的视频解码方法进行描述。
图13为本申请一实施例提供的视频解码方法的流程示意图,如图13所示,本申请实施例的方法包括:
S101、解码码流,得到待解码块的量化方式标志位,其中量化方式标志位用于指示待解码块的目标反量化方式;
S102、根据量化方式标志位,对待解码块进行解码。
在一些实施例中,本申请的待解码块也可以称为当前块,或当前待处理的图像块,或图像块,或待解码的图像块等。
具体的,参照图3所示,解码器中的熵解码单元310可解析码流得到当前图像中待解码的预测信息、量化系数矩阵等,预测单元320基于预测信息对待解码块使用帧内预测或帧间预测产生待解码块的预测块。反量化/变换单元330使用从码流得到的量化系数矩阵,对量化系数矩阵进行反量化、反变换得到残差块。重建单元340将预测块和残差块相加得到重建块。依次类推,可以得到当前图像中其他待编码块的重建块,各重建块组成重建图像。
本申请主要针对的是上述反量化过程。
本申请实施例解码端可以直接从码流中解析出量化方式标志位,并根据该量化方式标志位确定待解码块的目标反量化方式,并采用目标反量化方式对待解码块进行反量化。即解码端直接可以从码流中解析出待解码块的反量化方式,无需采用其他的方式判断待解码块的反量化方式,进而降低解码复杂度,提高解码效率。
在一些实施例中,本申请实施例的量化方式标志位可以为块级(CU/TU)的量化方式标志位,其中块级的量化方式标志位用于指示该块的目标反量化方式。
在一些实施例中,本申请实施例的量化方式标志位可以为序列级的量化方式标志位。
在一种示例中,序列级的量化方式标志位用于指示该序列中的所有块的目标量化方式。例如,当序列级的量化方式标志位的值为1时,表示该序列中的所有块均可以使用DQ反量化方式进行反量化。当序列级的量化方式标志位的值为0时,表示该序列中的所有块均不可以使用DQ反量化方式进行反量化。
在一些实施例中,本申请实施例的量化方式标志位可以为CTU级的量化方式标志位。
在一种示例中,CTU级的量化方式标志位用于指示该CTU中的所有块的目标反量化方式。例如,当CTU级的量化方式标志位的值为1时,表示该CTU中的所有块均可以使用DQ反量化方式进行反量化。当CTU级的量化方式标志位的值为0时,表示该CTU中的所有块均不可以使用DQ反量化方式进行反量化。
由上述可知,本申请实施例的量化方式标志位可以为块级(CU/TU)的量化方式标志位、序列级的量化方式标志位或CTU级的量化方式标志位,使得量化方式标志位的样式丰富,进而提高了解码的多样性。另外,当量化方式标志位为序列级的量化方式标志位时,解码端针对序列中的所有块只需要从码流中解码出一个量化方式标志位即可指示该序列中的所有块的目标反量化方式,或者当量化方式标志位为CTU级的量化方式标志位时,解码端针对CTU中的所有块只需从码流中解码出一个量化方式标志位即可指示该CTU中的所有块的目标量化方式,进而大大减少解码量化方式标志位的个数,提高解码效率。
图14为本申请另一实施例提供的视频解码方法的流程示意图,如图14所示,本申请实施例的方法包括:
S201、解码码流,得到待解码块的量化方式标志位。
其中,量化方式标志位用于指示待解码块的目标反量化方式。
S202、根据量化方式标志位,确定待解码块在量化时所采用的目标反量化方式。
例如,若量化方式标志位的值为第一数值,则确定目标反量化方式为第一种反量化方式。
例如,若量化方式标志位的值为第二数值,则确定目标反量化方式为第二种单量化方式。
其中第一种反量化方式与所述第二反量化方式不同。
可选的,第一种反量化方式包括DQ反量化方式,第二种反量化方式包括非DQ反量化方式。
可选的,第一数值为1。
可选的,第二数值为0。
S203、根据目标反量化方式,对待解码块进行反量化,得到重建的变换系数。
在一种实施例中,若目标反量化方式不是DQ单量化方式时,例如目标单量化方式为RDOQ单量化方式,使用该非DQ反量化方式对待解码块进行反量化。
若目标反量化方式为DQ反量化方式,则使用DQ反量化方式对待解码块进行反量化。
在一些实施例中,DQ反量化方式对应N个量化器,N为大于或等于2的正整数。
在一些实施例中,上述N个量化器中至少有一个量化器为可以将变换系数均量化为非零量化系数的非零量化器。
在一些实施例中,所述N个量化器中至少有一个量化器为可以将变换系数量化为零的零点量化器。
在一些实施例中,所述N个量化器包括一个零点量化器和一个非零量化器。
在一些实施例中,若目标反量化方式为DQ反量化方式,则上述S203包括:从N个量化器中确定一个目标量化器,使用该目标量化器对待解码块的量化系数进行反量化,得到重建的变换系数。
在一些实施例中,上述从N个量化器中确定一个目标量化器包括如下步骤:
在一些实施例中,上述S903包括如下步骤S903-A1至S903-A4:
B1、获取在量化系数之前已反量化的前一个量化系数的状态;
B2、根据前一个量化系数的标志位信息,以及前一个量化系数的状态,确定该量化系数的状态;
B3、根据当前量化系数的状态,从N个量化器中确定目标量化器。
在一些实施例中,按照扫描区域中的扫描顺序,前一个量化系数为扫描顺序中当前量化系数的相邻的前一个已反量化的量化系数。
本申请中前一个量化系数已解码出,因此,解码设备可以获得该前一个量化系数的标志位信息。
在一些实施例中,前一个量化系数的标志位信息包括:系数非零标志(Significant flag,简称Sig flag)、至少一个系数绝对值大于i标志(Greater than i flag,简称gti flag),所述i=1,2...;其中,系数非零标志用于指示量化系数是否为零,或者用于指示变换系数级别是否存在;系数绝对值大于i标志用于指示量化系数的绝对值是否大于正整数i,或者 用于指示变换系数级别是否大于i。
在一种示例中,前一个量化系数的标志位信息包括该前一个量化系数的系数非零标志、系数绝对值大于1标志(Greater than 1 flag,简称gt1 flag)、系数绝对值大于2标志(Greater than 2 flag,简称gt2 flag)。
在一种示例中,前一个量化系数的标志位信息包括该前一个量化系数的Sig flag、gt1 flag、gt2 flag、gt3 flag、……、gtK flag,其中K大于3。
其中量化系数的状态可以理解为状态机的状态。
可选的,状态机的初始状态为0。
在一些实施例中,码流中包括状态机的初始状态。例如,状态机的初始状态为0。
本申请中由于前一个量化系数已解码,其状态已知,因此,解码设备可以获得该前一个量化系数的状态。
在一些实施例中,上述B2的实现方式包括但不限于如下方式:
方式一,若前一个量化系数的标志位信息中的Sig flag的值为0时,则根据前一个量化系数的状态,确定该量化系数的状态。例如,前一个量化系数的状态为0时,则确定该量化系数的状态为0,若前一个量化系数的状态为1时,则确定该量化系数的状态为2,若前一个量化系数的状态为2时,则确定该量化系数的状态为1,若前一个量化系数的状态为3时,则确定该量化系数的状态为3。
方式二,上述B2包括如下步骤B21和B22:
B21、根据前一个量化系数的标志位信息,确定状态跳转值;
B22、根据前一个量化系数的状态和状态跳转值,确定该量化系数的状态。
在一种示例中,若前一个量化系数的标志位信息包括系数非零标志,且系数非零标志的值为0时,则确定状态跳转值为0。
在另一种示例中,前一个量化系数的标志位信息包括系数非零标志和系数绝对值大于1标志,若系数非零标志的值和系数绝对值大于1标志的值满足如下公式(9),则确定状态跳转值为1;若系数非零标志的值和系数绝对值大于1标志的值不满足如下公式(9),则确定状态跳转值为0;
t=sigflag==1&&gt1==0   (9)
其中,t为状态跳转值,sigflag为系数非零标志的值,gt1为系数绝对值大于1标志的值。
该方式中,其中变量t的真假取决于在解码的过程中,上一个系数值是否为1。而是 否为1可由sig_flag与Greater than 1 flag(gt1 flag)两个标志位的取值得到,无需全部重建出当前量化系数即可得到,进而降低量化复杂性,提供解码效率。
本申请可由如图11所示的状态机完成状态的转移。例如,如图11所示,当t=1,表示t为真,当t=0时,表示t为假。这样可以根据如上公式(9)确定出t的真假,并根据t的真假和前一个量化系数的状态,确定出该量化系数的状态,例如,当t为真,前一个量化系数的状态为2,则该量化系数的状态为3。
在一些实施例中,根据该量化系数的状态,更新状态机的状态。
S204、对重建的变换系数进行反变化,得到残差块。
S205、对待解码块进行预测,得到预测块;例如使用帧间预测方法或帧内预测方法,对待解码块进行预测,得到预测块。
S206、根据残差块和预测块,得到重建块,例如将残差块与预测块相加之和,作为待解码块的重建块。
在一些实施例中,在确定待解码块满足目标条件时,从码流中解析量化方式标志位;
其中,目标条件包括如下至少一个条件:所述待解码块的颜色分量为亮度分量、所述待解码块不划分为变换单元TU、所述待解码块的扫描区域大于预设值。
在一些实施例中,所述待解码块的扫描区域大于预设值包括所述待解码块的扫描区域的SRx乘SRy大于第一预设值;或者,待解码块的扫描区域的SRx或SRy大于第二预设值。
本实施例对上述第一预设值和第二预设值的具体大小不进行限定。
可选的,第一预设值为10,例如SRx*SRy>10。
由上述可知,在一些实施例中,根据颜色分量来确定是否从码流中解析量化方式标志位,这是由于在色度分量下使用DQ反量化方式进行反量化时,反量化效果不明显,而在亮度分量下使用DQ反量化方式进行反量化时,可以达到较好的反量化效果。因此,本实施例在确定待解码块的颜色分量为亮度分量时,从码流中解析量化方式标志位,而在确定待解码块的颜色分量为色度分量时,不从码流中解析量化方式标志位,进而提高了量化方式标志位的解析准确性,进而提高了解析效率。
另外,在待解码块不划分为变换单元TU或待解码块的扫描区域大于预设值时,可以确定待解码块较大,则待解码块中的变化系数数量较多,采用DQ反量化方式可以实现较好的反量化效果。因此,在待解码块不划分为变换单元TU或待解码块的扫描区域 大于预设值时,从码流中解析量化方式标志位,进而提高了量化方式标志位的解析准确性,进而提高了解码效率。
在一些实施例中,在确定所述待解码块属于I帧时,从所述码流中解析所述量化方式标志位。
在一些实施例中,在确定所述待解码块属于P帧或B帧时,跳过从所述码流中解析所述量化方式标志位。
在一些实施例中,在确定所述待解码块的大小大于或等于第三预设值时,从所述码流中解析所述量化方式标志位。
即本申请实施例在确定待解码块的颜色分量为亮度分量、待解码块不划分为变换单元TU、待解码块的扫描区域大于预设值、或待解码块属于I帧时,从码流中解析量化方式标志位,进而提高了量化方式标志位的解析准确性,进而提高了解码效率。
本申请的另一种实施例的解码过程如下:
解码端获取码流信息,判断是否需要从码流中解析出量化方式标志位,例如,若判断待解码块满足上述目标条件、或待解码块属于I帧、或待解码块的大小大于或等于第三预设值时,从码流中解析所述量化方式标志位。
若确定需要从码流中解析出量化方式标志位时,从码流中解析出该量化方式标志位,并根据量化方式标志位确定目标反量化方式。
若确定不需要从码流中解析出量化方式标志位时,将默认的反量化方式确定为目标反量化方式。
使用目标反量化方式对待解码块进行反量化。
在一些实施例中,若目标反量化方式为DQ反量化方式时,本实施例的解码过程还包括从DQ反量化方式对应的N个量化器中确定出目标量化器。
其中,确定目标量化器的方法包括如下步骤:
解析待编码块的标识位信息。
获取待解码块的变换块中系数扫描范围信息,包括扫描区域右端横坐标SRx,扫描区域下端纵坐标SRy。确定系数扫描区域,系数扫描区域为以(0,0)位置为左上角,以(SRx,SRy)位置为右下角的矩形区域。基于该扫描区域的系数编码示意图如图15所示,其中0表示零系数,1表示非零系数。系数解码顺序是从右下角到左上角的反向Z字型扫描(也可用于其它任何形式的扫描方式,例如,水平扫描,垂直扫描,对角扫描等)。
将状态机状态初始化为0。
解码设备在系数扫描区域中确定该量化系数的位置后,首先判断该量化系数是否满足如下任意一个条件:即该量化系数的位置是否在系数扫描区域的左下角且为当前行唯一非零系数,或者该当前编码的系数的位置是否在系数扫描区域的右上角且为当前列唯一非零系数,或者根据当前编码的系数所处状态机的状态判断是否使用了非零量化器。
若满足上述任意一个条件,则该量化系数的sig_flag直接置1。接着,从码流中解析出的下一个bin是该量化系数的Greater than 1 flag(gt1 flag),依据系数编码的默认方案继续解析相关标志位以确定该量化系数绝对值大小,包含Greater than 2 flag、Remaining abs level等标志位,注意到这样解码出的系数值不会是零。
若不满足上述条件,从码流中解析出的下一个bin是该量化系数的sig_flag,依据sig_flag的值判断该量化系数是否为非零系数,若是非零系数,则依据默认方案继续解析相关标志位以确定该量化系数绝对值大小,包含Greater than 1 flag、Greater than 2 flag、Remaining abs level等标志位。
如果该量化系数不为非零系数,则该量化系数的值为0。
如果该量化系数为非零系数,则变换系数级别的绝对值(即该量化系数的绝对值)为sig_flag+Greater than 1 flag+Greater than 2 flag+Remaining abs level。
最后解析符号标志位确定该量化系数的正负。
根据上述步骤,确定出当前量化系数对应的目标量化器后,根据目标量化器和当前量化系数对应的变换系数级别,根据如上公式(1)或公式(2)得到重建的变换系数t′。
应理解,图8至图15仅为本申请的示例,不应理解为对本申请的限制。
以上结合附图详细描述了本申请的优选实施方式,但是,本申请并不限于上述实施方式中的具体细节,在本申请的技术构思范围内,可以对本申请的技术方案进行多种简单变型,这些简单变型均属于本申请的保护范围。例如,在上述具体实施方式中所描述的各个具体技术特征,在不矛盾的情况下,可以通过任何合适的方式进行组合,为了避免不必要的重复,本申请对各种可能的组合方式不再另行说明。又例如,本申请的各种不同的实施方式之间也可以进行任意组合,只要其不违背本申请的思想,其同样应当视为本申请所公开的内容。
还应理解,在本申请的各种方法实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。另外,本申请实施例中,术语“和/或”,仅仅是一种描述关联 对象的关联关系,表示可以存在三种关系。具体地,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
上文结合图8至图15,详细描述了本申请的方法实施例,下文结合图16至图18,详细描述本申请的装置实施例。
图16是本申请实施例提供的视频编码器的示意性框图。
如图16所示,视频编码器10包括:
获取单元11,用于获取待编码块;
编码单元12,用于对所述待编码块进行编码,生成码流,所述码流中包括量化方式标志位,所述量化方式标志位用于指示所述待编码块所采用的目标量化方式。
在一些实施例中,编码单元12还用于确定所述待编码块的目标量化方式;根据所述目标量化方式,确定所述量化方式标志位的值。
在一些实施例中,编码单元12,具体用于若所述目标量化方式为第一种量化方式,则确定所述量化方式标志位的值为第一数值;若所述目标量化方式为第二种量化方式,则确定所述量化方式标志位的值为第二数值,其中,所述第一种量化方式与第二种量化方式不同。
可选的,所述第一种量化方式包括依赖性量化DQ量化方式,所述第二种量化方式包括非DQ量化方式。
在一些实施例中,编码单元12,具体用于针对预设的M种量化方式中的每一种量化方式,确定使用该种量化方式对所述待编码块进行量化时的编码代价,所述M为大于或等于2的正整数;
将所述M种量化方式中编码代价最小的量化方式,确定为所述目标量化方式。
在一些实施例中,编码单元12,还用于在确定所述待编码块满足目标条件时,将所述量化方式标志位编入所述码流;
所述目标条件包括如下至少一个条件:所述待编码块的颜色分量为亮度分量、所述待编码块不划分为变换单元TU、所述待编码块的扫描区域大于预设值。
在一些实施例中,所述待编码块的扫描区域大于预设值包括所述待编码块的扫描区域的SRx乘SRy大于第一预设值;或者;
所述待编码块的扫描区域的大于满足预设值包括所述待编码块的扫描区域的SRx或 SRy大于第二预设值。
在一些实施例中,编码单元12,还用于在确定所述待编码块属于I帧时,将所述量化方式标志位编入所述码流。
在一些实施例中,编码单元12,还用于在确定所述待编码块属于P帧或B帧时,跳过对所述量化方式标志位的编码。
在一些实施例中,编码单元12,还用于在确定所述待编码块的大小大于或等于第三预设值时,将所述量化方式标志位编入所述码流。
在一些实施例中,所述量化方式标志位包括如下至少一种:序列级的量化方式标志位、帧级的量化方式标志位、编码树单元CTU级的量化方式标志位、块级的量化方式标志位。
可选的,所述第一数值为1,和/或所述第二数值为0。
可选的,所述DQ量化方式对应N个量化器,所述N为大于或等于2的正整数,所述N个量化器中至少有一个量化器为将变换系数均量化为非零量化系数的非零量化器。
可选的,所述N个量化器中至少有一个量化器为将变换系数量化为零的零点量化器。
可选的,所述N个量化器包括一个零点量化器和一个非零量化器。
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图16所示的视频编码器10可以执行本申请实施例的编码方法,并且视频编码器10中的各个单元的前述和其它操作和/或功能分别为了实现方法等各个方法中的相应流程,为了简洁,在此不再赘述。
图17是本申请实施例提供的视频解码器的示意性框图。
如图17所示,该视频解码器20可包括:
第一解码单元21,用于解码码流,得到待解码块的量化方式标志位,所述量化方式标志位用于指示所述待解码块的目标反量化方式;
第二解码单元22,用于根据所述量化方式标志位,对所述待解码块进行解码。
在一些实施例中,第二解码单元22,具体用于根据所述量化方式标志位的值,确定所述待解码块在量化时所采用的目标反量化方式;根据所述目标反量化方式,对所述待解码块进行反量化。
在一些实施例中,第二解码单元22,具体用于若所述量化方式标志位的值为第一数值,则确定所述目标反量化方式为第一种反量化方式;
若所述量化方式标志位的值为第二数值,则确定所述目标反量化方式为第二种反量化方式。
可选的,所述第一种反量化方式包括依赖性量化DQ反量化方式,所述第二种反量化方式包括非DQ反量化方式。
在一些实施例中,第一解码单元21,具体用于在确定所述待解码块满足目标条件时,从所述码流中解析所述量化方式标志位;
所述目标条件包括如下至少一个条件:所述待解码块的颜色分量为亮度分量、所述待解码块不划分为变换单元TU、所述待解码块的扫描区域大于预设值。
在一些实施例中,所述待解码块的扫描区域大于预设值包括所述待解码块的扫描区域的SRx乘SRy大于第一预设值;或者;
所述待解码块的扫描区域的大于满足预设值包括所述待解码块的扫描区域的SRx或SRy大于第二预设值。
在一些实施例中,第一解码单元21,具体用于在确定所述待解码块属于I帧时,从所述码流中解析所述量化方式标志位。
在一些实施例中,第一解码单元21,具体用于在确定所述待解码块属于P帧或B帧时,跳过从所述码流中解析所述量化方式标志位。
在一些实施例中,第一解码单元21,具体用于在确定所述待解码块的大小大于或等于第三预设值时,从所述码流中解析所述量化方式标志位。
在一些实施例中,所述量化方式标志位包括如下至少一种:序列级的量化方式标志位、帧级的量化方式标志位、编码树单元CTU级的量化方式标志位、块级的量化方式标志位。
可选的,所述第一数值为1,和/或所述第二数值为0。
可选的,所述DQ反量化方式对应N个量化器,所述N为大于或等于2的正整数,所述N个量化器中至少有一个量化器为将变换系数均量化为非零量化系数的非零量化器。
可选的,所述N个量化器中至少有一个量化器为将变换系数量化为零的零点量化器。
可选的,所述N个量化器包括一个零点量化器和一个非零量化器。
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图17所示的视频解码器20可以对应于执行本申请实施例的解码方法中的相应主体,并且视频解码器20中的各个单元的前述和其它操作和/或功能分别为了实现方法等各个方法中的相应流程,为了简洁,在此不再赘述。
上文中结合附图从功能单元的角度描述了本申请实施例的装置和系统。应理解,该功能单元可以通过硬件形式实现,也可以通过软件形式的指令实现,还可以通过硬件和软件单元组合实现。具体地,本申请实施例中的方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路和/或软件形式的指令完成,结合本申请实施例公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件单元组合执行完成。可选地,软件单元可以位于随机存储器,闪存、只读存储器、可编程只读存储器、电可擦写可编程存储器、寄存器等本领域的成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法实施例中的步骤。
图18是本申请实施例提供的电子设备30的示意性框图。
如图18所示,该电子设备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中的执行过程。
如图18所示,该电子设备30还可包括:
收发器33,该收发器33可连接至该处理器32或存储器33。
其中,处理器32可以控制该收发器33与其他设备进行通信,具体地,可以向其他设备发送信息或数据,或接收其他设备发送的信息或数据。收发器33可以包括发射机和接收机。收发器33还可以进一步包括天线,天线的数量可以为一个或多个。
应当理解,该电子设备30中的各个组件通过总线系统相连,其中,总线系统除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。
图19是本申请实施例提供的视频编解码系统40的示意性框图。
如图19所示,该视频编解码系统40可包括:视频编码器41和视频解码器42,其中视频编码器41用于执行本申请实施例涉及的视频编码方法,视频解码器42用于执行本申请实施例涉及的视频解码方法。
本申请还提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得该计算机能够执行上述方法实施例的方法。
本申请实施例还提供一种包含指令的计算机程序产品,该指令被计算机执行时使得计算机执行上述方法实施例的方法。
本申请实施例还提供一种码流,该码流经过上述图8或图9所示的编码方法生成的,其中码流中包括指量化方式标志位,所述量化方式标志位用于指示所述待编码块所采用的目标量化方式。
当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光 纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。例如,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上该,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变换或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以该权利要求的保护范围为准。

Claims (35)

  1. 一种视频编码方法,其特征在于,包括:
    获取待编码块;
    对所述待编码块进行编码,生成码流,所述码流中包括量化方式标志位,所述量化方式标志位用于指示所述待编码块所采用的目标量化方式。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    确定所述待编码块的目标量化方式;
    根据所述目标量化方式,确定所述量化方式标志位的值。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述目标量化方式,确定所述量化方式标志位的值,包括:
    若所述目标量化方式为第一种量化方式,则确定所述量化方式标志位的值为第一数值;
    若所述目标量化方式为第二种量化方式,则确定所述量化方式标志位的值为第二数值,其中,所述第一种量化方式与第二种量化方式不同。
  4. 根据权利要求3所述的方法,其特征在于,所述第一种量化方式包括依赖性量化DQ量化方式,所述第二种量化方式包括非DQ量化方式。
  5. 根据权利要求2-4任一项所述的方法,其特征在于,所述确定所述待编码块的目标量化方式,包括:
    针对预设的M种量化方式中的每一种量化方式,确定使用该种量化方式对所述待编码块进行量化时的编码代价,所述M为大于或等于2的正整数;
    将所述M种量化方式中编码代价最小的量化方式,确定为所述目标量化方式。
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在确定所述待编码块满足目标条件时,将所述量化方式标志位编入所述码流;
    所述目标条件包括如下至少一个条件:所述待编码块的颜色分量为亮度分量、所述待编码块不划分为变换单元TU、所述待编码块的扫描区域大于预设值。
  7. 根据权利要求6所述的方法,其特征在于,所述待编码块的扫描区域大于预设值包括所述待编码块的扫描区域的SRx乘SRy大于第一预设值;或者;
    所述待编码块的扫描区域的大于满足预设值包括所述待编码块的扫描区域的SRx或SRy大于第二预设值。
  8. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在确定所述待编码块属于I帧时,将所述量化方式标志位编入所述码流。
  9. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在确定所述待编码块属于P帧或B帧时,跳过对所述量化方式标志位的编码。
  10. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在确定所述待编码块的大小大于或等于第三预设值时,将所述量化方式标志位编入所述码流。
  11. 根据权利要求1所述的方法,其特征在于,所述量化方式标志位包括如下至少一种:序列级的量化方式标志位、帧级的量化方式标志位、编码树单元CTU级的量化方式标志位、块级的量化方式标志位。
  12. 根据权利要求3所述的方法,其特征在于,所述第一数值为1,和/或所述第二数值为0。
  13. 根据权利要求4所述的方法,其特征在于,所述DQ量化方式对应N个量化器,所述N为大于或等于2的正整数,所述N个量化器中至少有一个量化器为将变换系数均量化为非零量化系数的非零量化器。
  14. 根据权利要求13所述的方法,其特征在于,所述N个量化器中至少有一个量化器为将变换系数量化为零的零点量化器。
  15. 根据权利要求14所述的方法,其特征在于,所述N个量化器包括一个零点量化器和一个非零量化器。
  16. 一种视频解码方法,其特征在于,包括:
    解码码流,得到待解码块的量化方式标志位,所述量化方式标志位用于指示所述待解码块的目标反量化方式;
    根据所述量化方式标志位,对所述待解码块进行解码。
  17. 根据权利要求16所述的方法,其特征在于,所述根据所述量化方式标志位,对所述待解码块进行解码,包括:
    根据所述量化方式标志位的值,确定所述待解码块在量化时所采用的目标反量化方式;
    根据所述目标反量化方式,对所述待解码块进行反量化。
  18. 根据权利要求17所述的方法,其特征在于,所述根据所述量化方式标志位的值,确定所述待解码块在量化时所采用的目标反量化方式,包括:
    若所述量化方式标志位的值为第一数值,则确定所述目标反量化方式为第一种反量 化方式;
    若所述量化方式标志位的值为第二数值,则确定所述目标反量化方式为第二种反量化方式,其中所述第一种反量化方式与所述第二种反量化方式不同。
  19. 根据权利要求18所述的方法,其特征在于,所述第一种反量化方式包括依赖性量化DQ反量化方式,所述第二种反量化方式包括非DQ反量化方式。
  20. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    在确定所述待解码块满足目标条件时,从所述码流中解析所述量化方式标志位;
    所述目标条件包括如下至少一个条件:所述待解码块的颜色分量为亮度分量、所述待解码块不划分为变换单元TU、所述待解码块的扫描区域大于预设值。
  21. 根据权利要求20所述的方法,其特征在于,所述待解码块的扫描区域大于预设值包括所述待解码块的扫描区域的SRx乘SRy大于第一预设值;或者;
    所述待解码块的扫描区域的大于满足预设值包括所述待解码块的扫描区域的SRx或SRy大于第二预设值。
  22. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    在确定所述待解码块属于I帧时,从所述码流中解析所述量化方式标志位。
  23. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    在确定所述待解码块属于P帧或B帧时,跳过从所述码流中解析所述量化方式标志位。
  24. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    在确定所述待解码块的大小大于或等于第三预设值时,从所述码流中解析所述量化方式标志位。
  25. 根据权利要求16所述的方法,其特征在于,所述量化方式标志位包括如下至少一种:序列级的量化方式标志位、帧级的量化方式标志位、编码树单元CTU级的量化方式标志位、块级的量化方式标志位。
  26. 根据权利要求18所述的方法,其特征在于,所述第一数值为1,和/或所述第二数值为0。
  27. 根据权利要求19所述的方法,其特征在于,所述DQ量化方式对应N个量化器,所述N为大于或等于2的正整数,所述N个量化器中至少有一个量化器为将变换系数均量化为非零量化系数的非零量化器。
  28. 根据权利要求27所述的方法,其特征在于,所述N个量化器中至少有一个量化 器为将变换系数量化为零的零点量化器。
  29. 根据权利要求28所述的方法,其特征在于,所述N个量化器包括一个零点量化器和一个非零量化器。
  30. 一种视频编码器,其特征在于,包括:
    获取单元,用于获取待编码块;
    编码单元,用于对所述待编码块进行编码,生成码流,所述码流中包括量化方式标志位,所述量化方式标志位用于指示所述待编码块所采用的目标量化方式。
  31. 一种视频解码器,其特征在于,包括:
    第一解码单元,用于解码码流,得到待解码块的量化方式标志位,所述量化方式标志位用于指示所述待解码块的目标反量化方式;
    第二解码单元,用于根据所述量化方式标志位,对所述待解码块进行解码。
  32. 一种视频编码器,其特征在于,包括:存储器,处理器;
    所述存储器,用于存储计算机程序;
    所述处理器,用于执行所述计算机程序以实现如上述权利要求1至15任一项所述方法。
  33. 一种视频解码器,其特征在于,包括:存储器,处理器;
    所述存储器,用于存储计算机程序;
    所述处理器,用于执行所述计算机程序以实现如上述权利要求16至29任一项所述方法。
  34. 一种视频编解码系统,其特征在于,包括:
    根据权利要求30或32所述的视频编码器;
    以及根据权利要求31或33所述的视频解码器。
  35. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如权利要求1至15或16至29任一项所述的方法。
PCT/CN2021/086734 2021-04-12 2021-04-12 视频编解码方法与系统、及视频编解码器 WO2022217447A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202180096782.1A CN117121485A (zh) 2021-04-12 2021-04-12 视频编解码方法与系统、及视频编解码器
PCT/CN2021/086734 WO2022217447A1 (zh) 2021-04-12 2021-04-12 视频编解码方法与系统、及视频编解码器

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/086734 WO2022217447A1 (zh) 2021-04-12 2021-04-12 视频编解码方法与系统、及视频编解码器

Publications (1)

Publication Number Publication Date
WO2022217447A1 true WO2022217447A1 (zh) 2022-10-20

Family

ID=83639376

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/086734 WO2022217447A1 (zh) 2021-04-12 2021-04-12 视频编解码方法与系统、及视频编解码器

Country Status (2)

Country Link
CN (1) CN117121485A (zh)
WO (1) WO2022217447A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453642A (zh) * 2007-11-30 2009-06-10 华为技术有限公司 图像编/解码方法、装置和系统
US20110150072A1 (en) * 2009-12-21 2011-06-23 Han Ki-Hun Encoding method, decoding method and apparatus thereof
US20110243221A1 (en) * 2006-03-29 2011-10-06 Telefonaktiebolaget L M Ericsson (Publ) Method and Apparatus for Video Encoding
CN103686183A (zh) * 2013-12-27 2014-03-26 南京讯思雅信息科技有限公司 一种功耗可控的帧内视频编码方法
CN106101703A (zh) * 2016-06-20 2016-11-09 杭州比特瑞旺电脑有限公司 一种面向数字kvm切换器的屏幕视频压缩方法
CN109587485A (zh) * 2018-10-26 2019-04-05 西安科锐盛创新科技有限公司 视频压缩编码方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110243221A1 (en) * 2006-03-29 2011-10-06 Telefonaktiebolaget L M Ericsson (Publ) Method and Apparatus for Video Encoding
CN101453642A (zh) * 2007-11-30 2009-06-10 华为技术有限公司 图像编/解码方法、装置和系统
US20110150072A1 (en) * 2009-12-21 2011-06-23 Han Ki-Hun Encoding method, decoding method and apparatus thereof
CN103686183A (zh) * 2013-12-27 2014-03-26 南京讯思雅信息科技有限公司 一种功耗可控的帧内视频编码方法
CN106101703A (zh) * 2016-06-20 2016-11-09 杭州比特瑞旺电脑有限公司 一种面向数字kvm切换器的屏幕视频压缩方法
CN109587485A (zh) * 2018-10-26 2019-04-05 西安科锐盛创新科技有限公司 视频压缩编码方法

Also Published As

Publication number Publication date
CN117121485A (zh) 2023-11-24

Similar Documents

Publication Publication Date Title
CN112514386B (zh) 网格编解码量化系数编解码
CN112352429B (zh) 对视频数据进行编解码的方法、设备和存储介质
WO2020125595A1 (zh) 视频译码器及相应方法
JP7277586B2 (ja) モードおよびサイズに依存したブロックレベル制限の方法および装置
WO2023039859A1 (zh) 视频编解码方法、设备、系统、及存储介质
WO2021037053A1 (en) An encoder, a decoder and corresponding methods of cabac coding for the indices of geometric partition flag
WO2020143585A1 (zh) 视频编码器、视频解码器及相应方法
CN116760987A (zh) 图像编解码方法、装置及存储介质
WO2024022359A1 (zh) 一种图像编解码方法及装置
WO2022174475A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
EP3890322A1 (en) Video coder-decoder and corresponding method
CN113647103A (zh) 用于基于矩阵的帧内预测技术的量化系数的方法和设备
CN113170108A (zh) 使用显式和隐式信令对不可用参考帧进行自适应块更新
WO2022193868A1 (zh) 未匹配像素的解码方法、编码方法、解码器以及编码器
CN112567740A (zh) 用于帧内预测的方法和装置
WO2022116105A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
WO2022117036A1 (zh) 量化参数的解码方法和装置
WO2022217447A1 (zh) 视频编解码方法与系统、及视频编解码器
WO2020259353A1 (zh) 语法元素的熵编码/解码方法、装置以及编解码器
WO2022193389A1 (zh) 视频编解码方法与系统、及视频编解码器
WO2022193390A1 (zh) 视频编解码方法与系统、及视频编解码器
WO2023092404A1 (zh) 视频编解码方法、设备、系统、及存储介质
WO2023122968A1 (zh) 帧内预测方法、设备、系统、及存储介质
WO2022155922A1 (zh) 视频编解码方法与系统、及视频编码器与视频解码器
WO2023236113A1 (zh) 视频编解码方法、装置、设备、系统及存储介质

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: 21936342

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21936342

Country of ref document: EP

Kind code of ref document: A1