WO2023173255A1 - Image encoding and decoding methods and apparatuses, device, system, and storage medium - Google Patents

Image encoding and decoding methods and apparatuses, device, system, and storage medium Download PDF

Info

Publication number
WO2023173255A1
WO2023173255A1 PCT/CN2022/080706 CN2022080706W WO2023173255A1 WO 2023173255 A1 WO2023173255 A1 WO 2023173255A1 CN 2022080706 W CN2022080706 W CN 2022080706W WO 2023173255 A1 WO2023173255 A1 WO 2023173255A1
Authority
WO
WIPO (PCT)
Prior art keywords
transformation
image area
current
flag
image
Prior art date
Application number
PCT/CN2022/080706
Other languages
French (fr)
Chinese (zh)
Inventor
唐桐
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Priority to PCT/CN2022/080706 priority Critical patent/WO2023173255A1/en
Publication of WO2023173255A1 publication Critical patent/WO2023173255A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/12Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties

Definitions

  • the present application relates to the field of video coding and decoding technology, and in particular, to an image coding and decoding method, device, equipment, system, and storage medium.
  • Digital video technology can be incorporated into a variety of video devices, such as digital televisions, smartphones, computers, e-readers, or video players.
  • video data includes a larger amount of data.
  • video devices implement video compression technology to make the video data more efficiently transmitted or stored.
  • Video compression is achieved through coding, and the coding process includes prediction, transformation, and quantization. For example, determine the prediction block of the current block through intra-frame prediction and/or inter-frame prediction, subtract the prediction block from the current block to obtain the residual block, transform the residual block to obtain the transform coefficient, and quantize the transform coefficient to obtain the quantized coefficient, And the quantized coefficients are encoded to form a code stream.
  • MTS Multiple Transform Selection
  • Embodiments of the present application provide an image encoding and decoding method, device, equipment, system, and storage medium, which determine the transformation method of the current encoding block through the continuity parameters of the image area, avoid unnecessary calculation overhead, and improve the encoding speed.
  • the current coding block is transformed to obtain the transformation coefficient of the current coding block.
  • embodiments of the present application provide an image decoding method, including:
  • the first flag is determined based on the continuity parameter of the image area, and the first flag is used to indicate whether the image area is allowed to transform from M candidates
  • the transformation mode is determined in the mode, the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area, and the M is a positive integer greater than 1;
  • the transformation coefficient of the current decoding block is inversely transformed to obtain the residual value of the current decoding block.
  • the present application provides an image encoding device for performing the method in the above first aspect or its respective implementations.
  • the encoder includes a functional unit for performing the method in the above-mentioned first aspect or its respective implementations.
  • the present application provides an image decoding device for performing the method in the above second aspect or its respective implementations.
  • the decoder includes a functional unit for performing the method in the above-mentioned second aspect or its respective implementations.
  • a video encoder including a processor and a memory.
  • the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the above first aspect or its respective implementations.
  • a sixth aspect provides a video decoder, including a processor and a memory.
  • the memory is used to store a computer program
  • the processor is used to call and run the computer program stored in the memory to execute the method in the above second aspect or its respective implementations.
  • a seventh aspect provides a video encoding and decoding system, including a video encoder and a video decoder.
  • the video encoder is used to perform the method in the above-mentioned first aspect or its various implementations
  • the video decoder is used to perform the method in the above-mentioned second aspect or its various implementations.
  • An eighth aspect provides a chip for implementing any one of the above-mentioned first to second aspects or the method in each implementation manner thereof.
  • the chip includes: a processor, configured to call and run a computer program from a memory, so that the device installed with the chip executes any one of the above-mentioned first to second aspects or implementations thereof. method.
  • a ninth aspect provides a computer-readable storage medium for storing a computer program that causes a computer to execute any one of the above-mentioned first to second aspects or the method in each implementation thereof.
  • a computer program product including computer program instructions, which enable a computer to execute any one of the above-mentioned first to second aspects or the methods in each implementation thereof.
  • An eleventh aspect provides a computer program that, when run on a computer, causes the computer to execute any one of the above-mentioned first to second aspects or the method in each implementation thereof.
  • a twelfth aspect provides a code stream, which is generated by any one of the above-mentioned first aspects or implementations thereof.
  • the continuity parameter is used to indicate the continuity of changes in the pixels in the image area; according to the continuity parameter of the image area, the transformation method of the current coding block is determined ; According to the transformation method, transform the current coding block to obtain the transformation coefficient of the current coding block. That is, in this embodiment of the present application, the transformation method of the current coding block is determined according to the size of the continuity parameter.
  • the default first transformation method can be used as The transformation method of the current coding block, and skips the operation of selecting the optimal transformation method from multiple transformation methods to save unnecessary computing overhead and improve coding efficiency.
  • Figure 1 is a schematic block diagram of a video encoding and decoding system related to an embodiment of the present application
  • Figure 2 is a schematic block diagram of a video encoder involved in an embodiment of the present application
  • Figure 3 is a schematic block diagram of a video decoder involved in an embodiment of the present application.
  • Figure 4 is a schematic flow chart of an image encoding method provided by an embodiment of the present application.
  • Figure 5 is a schematic flow chart of an image encoding method provided by an embodiment of the present application.
  • Figure 6 is a schematic flow chart of a video decoding method provided by an embodiment of the present application.
  • Figure 7 is a schematic flow chart of an image decoding method provided by an embodiment of the present application.
  • Figure 8 is a schematic block diagram of an image encoding device provided by an embodiment of the present application.
  • Figure 9 is a schematic block diagram of an image decoding device provided by an embodiment of the present application.
  • Figure 10 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • Figure 11 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • This application can be applied to the fields of image encoding and decoding, video encoding and decoding, hardware video encoding and decoding, dedicated circuit video encoding and decoding, real-time video encoding and decoding, etc.
  • the solution of this application can be combined with the audio and video coding standard (AVS for short), such as H.264/audio video coding (AVC for short) standard, H.265/high-efficiency video coding (AVS for short) high efficiency video coding (HEVC) standard and H.266/versatile video coding (VVC) standard.
  • AVC audio video coding
  • HEVC high efficiency video coding
  • VVC variatile video coding
  • the solution of this application can be operated in conjunction with other proprietary or industry standards, including ITU-TH.261, ISO/IECMPEG-1Visual, ITU-TH.262 or ISO/IECMPEG-2Visual, ITU-TH.263 , ISO/IECMPEG-4Visual, ITU-TH.264 (also known as ISO/IECMPEG-4AVC), including scalable video codec (SVC) and multi-view video codec (MVC) extensions.
  • SVC scalable video codec
  • MVC multi-view video codec
  • FIG. 1 For ease of understanding, the video encoding and decoding system involved in the embodiment of the present application is first introduced with reference to FIG. 1 .
  • Figure 1 is a schematic block diagram of a video encoding and decoding system related to an embodiment of the present application. It should be noted that Figure 1 is only an example, and the video encoding and decoding system in the embodiment of the present application includes but is not limited to what is shown in Figure 1 .
  • the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120 .
  • the encoding device is used to encode the video data (which can be understood as compression) to generate a code stream, and transmit the code stream to the decoding device.
  • the decoding device decodes the code stream generated by the encoding device to obtain decoded video data.
  • the encoding device 110 in the embodiment of the present application can be understood as a device with a video encoding function
  • the decoding device 120 can be understood as a device with a video decoding function. That is, the embodiment of the present application includes a wider range of devices for the encoding device 110 and the decoding device 120. Examples include smartphones, desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, vehicle-mounted computers, and the like.
  • the encoding device 110 may transmit the encoded video data (eg, code stream) to the decoding device 120 via the channel 130 .
  • Channel 130 may include one or more media and/or devices capable of transmitting encoded video data from encoding device 110 to decoding device 120 .
  • channel 130 includes one or more communication media that enables encoding device 110 to transmit encoded video data directly to decoding device 120 in real time.
  • encoding device 110 may modulate the encoded video data according to the communication standard and transmit the modulated video data to decoding device 120.
  • the communication media includes wireless communication media, such as radio frequency spectrum.
  • the communication media may also include wired communication media, such as one or more physical transmission lines.
  • channel 130 includes a storage medium that can store video data encoded by encoding device 110 .
  • Storage media include a variety of local access data storage media, such as optical disks, DVDs, flash memories, etc.
  • the decoding device 120 may obtain the encoded video data from the storage medium.
  • channel 130 may include a storage server that may store video data encoded by encoding device 110 .
  • the decoding device 120 may download the stored encoded video data from the storage server.
  • the storage server may store the encoded video data and may transmit the encoded video data to the decoding device 120, such as a web server (eg, for a website), a File Transfer Protocol (FTP) server, etc.
  • FTP File Transfer Protocol
  • the encoding device 110 includes a video encoder 112 and an output interface 113.
  • the output interface 113 may include a modulator/demodulator (modem) and/or a transmitter.
  • the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113 .
  • Video source 111 may include at least one of a video capture device (eg, a video camera), a video archive, a video input interface for receiving video data from a video content provider, a computer graphics system Used to generate video data.
  • a video capture device eg, a video camera
  • a video archive e.g., a video archive
  • video input interface for receiving video data from a video content provider
  • computer graphics system Used to generate video data.
  • the video encoder 112 encodes the video data from the video source 111 to generate a code stream.
  • Video data may include one or more images (pictures) or sequence of pictures (sequence of pictures).
  • the code stream contains the encoding information of an image or image sequence in the form of a bit stream.
  • Encoded information may include encoded image data and associated data.
  • the associated data may include sequence parameter set (SPS), picture parameter set (PPS) and other syntax structures.
  • SPS sequence parameter set
  • PPS picture parameter set
  • An SPS can contain parameters that apply to one or more sequences.
  • a PPS can contain parameters that apply to one or more images.
  • a syntax structure refers to a collection of zero or more syntax elements arranged in a specified order in a code stream.
  • the video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113 .
  • the encoded video data can also be stored on a storage medium or storage server for subsequent reading by the decoding device 120 .
  • decoding device 120 includes input interface 121 and video decoder 122.
  • the decoding device 120 may also include a display device 123.
  • the input interface 121 includes a receiver and/or a modem. Input interface 121 may receive encoded video data over channel 130.
  • the video decoder 122 is used to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123 .
  • the display device 123 displays the decoded video data.
  • Display device 123 may be integrated with decoding device 120 or external to decoding device 120 .
  • Display device 123 may include a variety of display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.
  • LCD liquid crystal display
  • plasma display a plasma display
  • OLED organic light emitting diode
  • Figure 1 is only an example, and the technical solutions of the embodiments of the present application are not limited to Figure 1.
  • the technology of the present application can also be applied to unilateral video encoding or unilateral video decoding.
  • FIG. 2 is a schematic block diagram of a video encoder related to an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression of images (lossy compression), or can also be used to perform lossless compression (lossless compression) of images.
  • the lossless compression can be visually lossless compression (visually lossless compression) or mathematically lossless compression (mathematically lossless compression).
  • the video encoder 200 can be applied to image data in a luminance-chrominance (YCbCr, YUV) format.
  • YUV ratio can be 4:2:0, 4:2:2 or 4:4:4, Y represents brightness (Luma), Cb(U) represents blue chroma, Cr(V) represents red chroma, U and V represent Chroma, which is used to describe color and saturation.
  • 4:2:0 means that every 4 pixels have 4 luminance components and 2 chrominance components (YYYYCbCr)
  • 4:2:2 means that every 4 pixels have 4 luminance components and 4 Chroma component (YYYYCbCrCbCr)
  • 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr).
  • the video encoder 200 reads video data, and for each frame of image in the video data, divides one frame of image into several coding tree units (coding tree units, CTU).
  • CTB may be called “Tree block", “Largest Coding unit” (LCU for short) or “coding tree block” (CTB for short).
  • LCU Large Coding unit
  • CTB coding tree block
  • Each CTU can be associated with an equal-sized block of pixels within the image.
  • Each pixel can correspond to one luminance (luminance or luma) sample and two chrominance (chrominance or chroma) samples. Therefore, each CTU can be associated with one block of luma samples and two blocks of chroma samples.
  • a CTU size is, for example, 128 ⁇ 128, 64 ⁇ 64, 32 ⁇ 32, etc.
  • a CTU can be further divided into several coding units (Coding Units, CUs) for encoding.
  • CUs can be rectangular blocks or square blocks.
  • CU can be further divided into prediction unit (PU for short) and transform unit (TU for short), thus enabling coding, prediction, and transformation to be separated and processing more flexible.
  • the CTU is divided into CUs in a quad-tree manner, and the CU is divided into TUs and PUs in a quad-tree manner.
  • Video encoders and video decoders can support various PU sizes. Assuming that the size of a specific CU is 2N ⁇ 2N, the video encoder and video decoder can support a PU size of 2N ⁇ 2N or N ⁇ N for intra prediction, and support 2N ⁇ 2N, 2N ⁇ N, N ⁇ 2N, N ⁇ N or similar sized symmetric PU for inter prediction. The video encoder and video decoder can also support 2N ⁇ nU, 2N ⁇ nD, nL ⁇ 2N and nR ⁇ 2N asymmetric PUs for inter prediction.
  • the video encoder 200 may include: a prediction unit 210, a residual unit 220, a transform/quantization unit 230, an inverse transform/quantization unit 240, a reconstruction unit 250, and a loop filter unit. 260. Decode the image cache 270 and the entropy encoding unit 280. It should be noted that the video encoder 200 may include more, less, or different functional components.
  • the current block may be called the current coding unit (CU) or the current prediction unit (PU), etc.
  • the prediction block may also be called a predicted image block or an image prediction block
  • the reconstructed image block may also be called a reconstruction block or an image reconstructed image block.
  • prediction unit 210 includes inter prediction unit 211 and intra estimation unit 212. Since there is a strong correlation between adjacent pixels in a video frame, the intra-frame prediction method is used in video encoding and decoding technology to eliminate the spatial redundancy between adjacent pixels. Since there is a strong similarity between adjacent frames in the video, the interframe prediction method is used in video coding and decoding technology to eliminate the temporal redundancy between adjacent frames, thereby improving coding efficiency.
  • the inter-frame prediction unit 211 can be used for inter-frame prediction.
  • Inter-frame prediction can include motion estimation (motion estimation) and motion compensation (motion compensation). It can refer to image information of different frames.
  • Inter-frame prediction uses motion information to find a reference from a reference frame. block, a prediction block is generated based on the reference block to eliminate temporal redundancy; the frames used in inter-frame prediction can be P frames and/or B frames, P frames refer to forward prediction frames, and B frames refer to bidirectional predictions frame.
  • Inter-frame prediction uses motion information to find reference blocks from reference frames and generate prediction blocks based on the reference blocks.
  • the motion information includes the reference frame list where the reference frame is located, the reference frame index, and the motion vector.
  • the motion vector can be in whole pixels or sub-pixels.
  • the reference frame found according to the motion vector is A block of whole pixels or sub-pixels is called a reference block.
  • Some technologies will directly use the reference block as a prediction block, and some technologies will process the reference block to generate a prediction block. Reprocessing to generate a prediction block based on a reference block can also be understood as using the reference block as a prediction block and then processing to generate a new prediction block based on the prediction block.
  • the intra-frame estimation unit 212 only refers to the information of the same frame image and predicts the pixel information in the current coded image block to eliminate spatial redundancy.
  • the frames used in intra prediction may be I frames.
  • Intra-frame prediction has multiple prediction modes. Taking the international digital video coding standard H series as an example, the H.264/AVC standard has 8 angle prediction modes and 1 non-angle prediction mode, and H.265/HEVC has been extended to 33 angles. prediction mode and 2 non-angle prediction modes.
  • the intra-frame prediction modes used by HEVC include planar mode (Planar), DC and 33 angle modes, for a total of 35 prediction modes.
  • the intra-frame modes used by VVC include Planar, DC and 65 angle modes, for a total of 67 prediction modes.
  • Residual unit 220 may generate a residual block of the CU based on the pixel block of the CU and the prediction block of the PU. For example, residual unit 220 may generate a residual block of a CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the PU of the CU. Predict the corresponding sample in the block.
  • Transform/quantization unit 230 may quantize the transform coefficients. Transform/quantization unit 230 may quantize transform coefficients associated with the TU of the CU based on quantization parameter (QP) values associated with the CU. Video encoder 200 may adjust the degree of quantization applied to transform coefficients associated with the CU by adjusting the QP value associated with the CU.
  • QP quantization parameter
  • Inverse transform/quantization unit 240 may apply inverse quantization and inverse transform to the quantized transform coefficients, respectively, to reconstruct the residual block from the quantized transform coefficients.
  • Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to produce a reconstructed image block associated with the TU. By reconstructing blocks of samples for each TU of a CU in this manner, video encoder 200 can reconstruct blocks of pixels of the CU.
  • the loop filtering unit 260 is used to process the inversely transformed and inversely quantized pixels to compensate for distortion information and provide a better reference for subsequent encoding of pixels. For example, a deblocking filtering operation can be performed to reduce the number of pixel blocks associated with the CU. block effect.
  • the loop filtering unit 260 includes a deblocking filtering unit and a sample adaptive compensation/adaptive loop filtering (SAO/ALF) unit, where the deblocking filtering unit is used to remove blocking effects, and the SAO/ALF unit Used to remove ringing effects.
  • SAO/ALF sample adaptive compensation/adaptive loop filtering
  • Decoded image cache 270 may store reconstructed pixel blocks.
  • Inter prediction unit 211 may perform inter prediction on PUs of other images using reference images containing reconstructed pixel blocks.
  • intra estimation unit 212 may use the reconstructed pixel blocks in decoded image cache 270 to perform intra prediction on other PUs in the same image as the CU.
  • Entropy encoding unit 280 may receive the quantized transform coefficients from transform/quantization unit 230 . Entropy encoding unit 280 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy encoded data.
  • Figure 3 is a schematic block diagram of a video decoder related to an embodiment of the present application.
  • the video decoder 300 includes an entropy decoding unit 310 , a prediction unit 320 , an inverse quantization/transformation unit 330 , a reconstruction unit 340 , a loop filtering unit 350 and a decoded image cache 360 . It should be noted that the video decoder 300 may include more, less, or different functional components.
  • Video decoder 300 can receive the code stream.
  • Entropy decoding unit 310 may parse the codestream to extract syntax elements from the codestream. As part of parsing the code stream, the entropy decoding unit 310 may parse entropy-encoded syntax elements in the code stream.
  • the prediction unit 320, the inverse quantization/transformation unit 330, the reconstruction unit 340 and the loop filtering unit 350 may decode the video data according to the syntax elements extracted from the code stream, that is, generate decoded video data.
  • prediction unit 320 includes inter prediction unit 321 and intra estimation unit 322.
  • Intra estimation unit 322 may perform intra prediction to generate predicted blocks for the PU. Intra estimation unit 322 may use an intra prediction mode to generate predicted blocks for a PU based on pixel blocks of spatially neighboring PUs. Intra estimation unit 322 may also determine the intra prediction mode of the PU based on one or more syntax elements parsed from the codestream.
  • the inter prediction unit 321 may construct a first reference image list (List 0) and a second reference image list (List 1) according to syntax elements parsed from the code stream. Additionally, if the PU uses inter-prediction encoding, entropy decoding unit 310 may parse the motion information of the PU. Inter prediction unit 321 may determine one or more reference blocks for the PU based on the motion information of the PU. Inter prediction unit 321 may generate a predictive block for the PU based on one or more reference blocks of the PU.
  • Inverse quantization/transform unit 330 may inversely quantize (ie, dequantize) transform coefficients associated with a TU. Inverse quantization/transform unit 330 may use the QP value associated with the CU of the TU to determine the degree of quantization.
  • inverse quantization/transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients to produce a residual block associated with the TU.
  • Reconstruction unit 340 uses the residual blocks associated with the TU of the CU and the prediction blocks of the PU of the CU to reconstruct the pixel blocks of the CU. For example, reconstruction unit 340 may add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.
  • Loop filtering unit 350 may perform deblocking filtering operations to reduce blocking artifacts for blocks of pixels associated with the CU.
  • Video decoder 300 may store the reconstructed image of the CU in decoded image cache 360 .
  • the video decoder 300 may use the reconstructed image in the decoded image cache 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
  • the basic process of video encoding and decoding is as follows: at the encoding end, an image frame is divided into blocks.
  • the prediction unit 210 uses intra prediction or inter prediction to generate a prediction block of the current block.
  • the residual unit 220 may calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block.
  • the residual block may also be called residual information.
  • the residual block undergoes transformation and quantization processes such as transformation/quantization unit 230 to remove information that is insensitive to human eyes to eliminate visual redundancy.
  • the residual block before transformation and quantization by the transformation/quantization unit 230 may be called a time domain residual block, and the time domain residual block after transformation and quantization by the transformation/quantization unit 230 may be called a frequency residual block. or frequency domain residual block.
  • the entropy encoding unit 280 receives the quantized change coefficient output from the change quantization unit 230, and may perform entropy encoding on the quantized change coefficient to output a code stream. For example, the entropy encoding unit 280 may eliminate character redundancy according to the target context model and probability information of the binary code stream.
  • the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block.
  • the prediction unit 320 uses intra prediction or inter prediction for the current block based on the prediction information to generate a prediction block of the current block.
  • the inverse quantization/transform unit 330 uses the quantization coefficient matrix obtained from the code stream to perform inverse quantization and inverse transformation on the quantization coefficient matrix to obtain a residual block.
  • the reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstruction block.
  • the reconstructed blocks constitute a reconstructed image, and the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image.
  • the encoding end also needs similar operations as the decoding end to obtain the decoded image.
  • the decoded image may also be called a reconstructed image, and the reconstructed image may be used as a reference frame for inter-frame prediction for
  • the block division information determined by the encoding end as well as mode information or parameter information such as prediction, transformation, quantization, entropy coding, loop filtering, etc., are carried in the code stream when necessary.
  • the decoding end determines the same block division information as the encoding end by parsing the code stream and analyzing the existing information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information, thereby ensuring the decoded image obtained by the encoding end It is the same as the decoded image obtained by the decoding end.
  • the current block can be the current coding unit (CU) or the current prediction unit (PU), etc.
  • the general hybrid coding framework will first perform prediction, and the prediction uses the correlation performance in space or time to obtain an image that is the same or similar to the current block.
  • the prediction uses the correlation performance in space or time to obtain an image that is the same or similar to the current block.
  • the hybrid coding framework will subtract the predicted image from the original image of the current block to obtain the residual image, or the current block minus the predicted block will obtain the residual block.
  • Residual blocks are usually much simpler than the original image, so prediction can significantly improve compression efficiency.
  • the residual block is not directly encoded, but is usually transformed first. Transformation is to transform the residual image from the spatial domain to the frequency domain and remove the correlation of the residual image. After the residual image is transformed into the frequency domain, since the energy is mostly concentrated in the low-frequency region, most of the transformed non-zero coefficients are concentrated in the upper left corner. Next, quantization is used for further compression. And since the human eye is not sensitive to high frequencies, a larger quantization step size can be used in high-frequency areas.
  • the current common transformation method is DCT-II.
  • DCT-II cannot achieve optimal transformation. Therefore, multiple transformation kernels are designed to adaptively select the optimal transformation kernel for different image blocks, which is closer to the theoretical optimum. Excellent transformation performance.
  • MTS Multiple Transform Selection
  • N is the number of points of the original signal
  • ⁇ 0 is the compensation coefficient
  • MTS image sequence level
  • Both length and width are less than or equal to 32;
  • the current TU is in non-transform skip mode
  • the transformation method is selected from the candidate set composed of the combination of DST-VII and DCT-VIII.
  • the candidate set is shown in Table 2 below, and the rate distortion costs RD2, RD3... are calculated.
  • An implementation of an encoder using MTS is as follows. First, the input image is divided into multiple non-overlapping CTU blocks. Then, each CTU is processed in sequence according to the raster scanning order, and the CTU is divided into several CUs according to the prediction cost.
  • An implementation of a decoder using MTS is as follows.
  • the input code stream undergoes entropy decoding, inverse quantization, and inverse transformation.
  • the inverse transformation process mainly includes the following steps: (1) First, derive the transformation type trType based on code stream information such as sps_mts_enabled_flag. (2) Derive the transformation matrix transMatrix according to the transformation type trType and CU size. (3) Use the transformation matrix transMatrix and the transformation coefficient to calculate the inverse transformation value to obtain the prediction residual value, and reconstruct the image based on the residual block. Finally, the reconstructed image is sent to the DBF/SAO/ALF filter, and the filtered image is sent to the buffer to wait for video playback.
  • the essence of MTS is to select the deformation body of DCT (DCT-VIII, DST-VII) for transformation.
  • DCT-VIII, DST-VII DCT-VIII, DST-VII
  • the premise to ensure the effectiveness of DCT is that the signal energy of the image block is concentrated, so that the high-frequency components can be transformed after DCT transformation. Concentrated in the upper left corner, most areas in the lower right corner are low-frequency components. In other words, only for images with concentrated signal energy, DCT transformation can achieve better compression performance. On the contrary, when the signal energy is not concentrated, the DCT transformation performance is poor, so the performance gain brought by choosing the best among the poor is very limited.
  • the embodiment of the present application first determines the continuity parameter of the image area where the current coding block is located.
  • the continuity parameter is used to indicate the continuity of changes in pixels in the image area, where the continuity of changes in pixels can also be Understood as the correlation of pixels. Due to the poor continuity of the image area, it means that the signal energy is not concentrated, and the DCT transformation effect is poor. At this time, there is no need to spend a lot of computing resources to select the optimal transformation method from multiple transformation methods. Based on this, the embodiment of the present application determines the transformation method of the current coding block according to the continuity parameter of the image area.
  • DTC- II method for transformation there is no need to select the optimal transformation method from multiple transformation methods for transformation, thus avoiding unnecessary calculation overhead and improving coding speed.
  • FIG. 4 is a schematic flowchart of an image encoding method provided by an embodiment of the present application. The embodiment of the present application is applied to the video encoder shown in FIGS. 1 and 2 .
  • the method in the embodiment of this application includes:
  • This continuity parameter is used to indicate the continuity of changes in pixels in the image area.
  • the encoder receives a video stream, which is composed of a series of image frames, and performs video encoding on each frame of image in the video stream.
  • the video encoder divides the image frames into blocks to obtain the current encoding block.
  • the current coding block is also called a current block, a current image block, a coding block, a current coding unit, a current block to be coded, a current image block to be coded, etc.
  • the blocks divided by the traditional method contain both the chrominance component of the current coding block position and the luminance component of the current coding block position.
  • the separation tree technology can be divided into separate component blocks, such as separate brightness blocks and separate chroma blocks.
  • the brightness block can be understood as containing only the brightness component of the current coding block position
  • the chroma block can be understood as containing only the current coding block position. Encode the chroma component of the block position. In this way, luminance components and chrominance components at the same position can belong to different blocks, and the division can be more flexible. If the separation tree is used in CU partitioning, then some CUs contain both luminance and chrominance components, some CUs only contain luminance components, and some CUs only contain chrominance components.
  • the current coding block in the embodiment of the present application only includes chrominance components, which can be understood as chrominance blocks.
  • the current coding block in the embodiment of the present application only includes the luminance component, which can be understood as a luminance block.
  • the current coding block includes both luma and chrominance components.
  • the encoding process in this embodiment of the present application is to divide the current image frame into blocks to obtain the current coding block, and use the intra-frame or inter-frame prediction method to predict the current coding block to obtain the prediction value of the current coding block.
  • the original value of the current coding block is subtracted from the predicted value to obtain the residual value of the current coding block.
  • Determine the transformation method corresponding to the current coding block use this transformation method to transform the residual value, and obtain the transformation coefficient.
  • the transform coefficients are quantized, and the quantized transform coefficients are encoded to obtain a code stream.
  • the embodiment of the present application involves the transformation process in the above encoding process.
  • adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods can improve the transformation effect.
  • the compression effect brought by the transformation is poor.
  • adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods to transform these images whose signal energy is not concentrated not only has an insignificant compression effect, but also generates unnecessary computational overhead and increases encoding time.
  • the current coding block before transforming the current coding block, it first determines whether the signal energy in the image area where the current coding block is located is concentrated. For an image, if the changes in pixel points in the image are discontinuous, it means that the spatial correlation of the image is weak and the signal energy is not concentrated. If the changes in pixels in the image are continuous, it means that the spatial correlation of the image is strong and the signal energy is concentrated.
  • the embodiment of the present application uses the size of the continuity parameter of the image area to indicate whether the signal energy of the image area is concentrated. For example, if the continuity parameter of the image area is large, it indicates the intensity of the pixels in the image area. The change is continuous, which indicates that the signal energy in this image area is concentrated. If the continuity parameter of the image area is small, it indicates that the changes in pixel points in the image area are discontinuous, which further indicates that the signal energy in the image area is not concentrated. For image areas where signal energy is not concentrated, selecting the optimal transformation method from multiple transformation methods will not only fail to bring significant transformation effects, but also generate unnecessary computational overhead and increase encoding time. Therefore, in the embodiment of the present application, For image areas where signal energy is not concentrated, skip the operation of selecting the optimal transformation method from multiple transformation methods (such as skipping MTS technology) to save unnecessary computing overhead and improve coding efficiency.
  • the continuity parameter of the image area is large, it indicates the intensity of the pixels in the image area. The change is continuous, which indicates that the signal energy in this image area is concentrated
  • this embodiment of the present application first determines the continuity parameter of the image area where the current coding block is located.
  • the continuity parameter is used to indicate the continuity of changes in pixels in the image area.
  • the transformation method of the current coding block is determined. For example, if the continuity parameter is small, the default first transformation method is used as the transformation method of the current coding block, and the selection of the best transformation method from multiple transformation methods is skipped. Optimize transformation operations to save unnecessary computing overhead and improve coding efficiency.
  • the embodiment of the present application does not limit the size of the image area, and it can be any image area including the current coding block.
  • the image area is the current image frame
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixel points in the current image frame.
  • the image area is the current image sequence
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image sequence. In this way, the embodiment of the present application can determine the transformation method of any coding block in the current image sequence based on the continuity parameter of the current image sequence.
  • the image area is the current image patch
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image patch. In this way, the embodiment of the present application can determine the transformation method of any coding block in the current image slice according to the continuity parameter of the current image slice.
  • the image area is the current coding block
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current coding block.
  • the methods for determining the continuity parameters of the image area include but are not limited to the following:
  • Method 1 is to determine the continuity parameters of the image area through the gradient map, that is, the above S401 includes the following steps of S401-A1 and S401-A2:
  • S401-A2 Determine the continuity parameter of the image area according to the gradient map of the gradient map.
  • the gradient map of the image area can reflect the change trend of the pixels in the image area, and the gradient map of the gradient map of the image area can reflect the change rate of the pixels in the image area, that is, the continuity of change.
  • the continuity parameter of the image area is determined by calculating the gradient map of the gradient map of the image area.
  • the gradient map Gmap of the image area is determined according to the following formula (1):
  • I(x, y) is the pixel value of image area I at position (x, y)
  • I(x+1, y) is the pixel value of image area I at position (x+1, y)
  • I(x, y+1) is the pixel value of image area I at position (x, y+1)
  • Gmap(x, y) is the gradient value of the pixel point at position (x, y) in image area I .
  • the gradient map GGmap of the gradient map of the image area is determined according to the following formula (2):
  • GGmap(x,y)
  • Gmap(x+1,y) is the gradient value of the pixel at position (x+1,y) in image area I
  • Gmap(x,y+1) is the position (x,y+ The gradient value of the pixel at 1)
  • Gmap(x+1,y) and Gmap(x,y+1) can be determined according to the above formula (1)
  • GGmap(x,y) is the gradient value of the gradient value of the pixel at position (x,y) in image area I.
  • the above formula (1) and formula (2) show that the gradient value and the gradient value of the pixel point (x, y) of the image area I are determined. Other pixel points in the image area I refer to the pixel point (x, y). ) method, determine the gradient value of each pixel in the image area I, and obtain the gradient map Gmap of the image area I. Use the above formula (2) to calculate the gradient value corresponding to each pixel in the gradient map Gmap of the image area I, and then obtain the gradient map GGmap of the gradient map of the image area I.
  • the above formula (1) and formula (2) are just examples.
  • the embodiments of the present application can also use other methods to determine the gradient map of the image area and the gradient map of the gradient map.
  • the above formula ( 1) and formula (2) are deformed, and the gradient map is determined using the deformed formula, as well as the gradient map of the gradient map.
  • the continuity parameter of the image area is determined based on the gradient map GGmap of the gradient map.
  • the embodiment of the present application does not limit the method of determining the continuity parameter of the image area based on the gradient map of the gradient map in S401-A2 above.
  • the median value of each gradient value in the gradient map of the image region is determined as the continuity parameter of the image region.
  • the average value of the gradient values in the gradient map of the image area is determined as the continuity parameter of the image area.
  • the above-mentioned method 1 determines the continuity parameter of the image area by determining the gradient map of the gradient map of the image area.
  • the calculation method is simple and the calculation cost is small, thereby improving the coding efficiency.
  • the following method two can also be used to determine the continuity parameter of the image area.
  • the second method is to determine the continuity parameters of the image area by determining the spatial redundancy of the image area. That is, the above S401 includes the following steps of S401-B1 and S401-B2:
  • S401-B2 Determine the continuity parameter of the image area according to the residual value of the image area, where the residual value is negatively correlated with the continuity parameter.
  • the spatial redundancy of the image area is small, it means that the correlation of the image area is strong, the changes of pixel points in the image area are more continuous, and the signal energy of the image area is more concentrated. If the spatial redundancy of the image area is large, it means that the correlation of the image area is weak, the changes of pixel points in the image area are discontinuous, and the signal energy of the image area is not concentrated.
  • the spatial redundancy of the image area can be represented by the residual value of the image area, that is, a large residual value indicates that the spatial redundancy of the image area is large, and a small residual value indicates that the spatial redundancy of the image area is small.
  • intra-frame prediction is used to calculate the spatial redundancy of the image. Therefore, the embodiment of the present application uses the intra-frame prediction method to calculate the predicted value of the image area, and calculates the difference between the original value and the predicted value of the image area. Determine the residual value of this image area.
  • the residual value of the image area may be a superposition of the residual values of each coding block included in the image area.
  • the image area includes N coding blocks, and N is a positive integer.
  • Intra-frame prediction is used to determine the predicted value of each coding block.
  • the original value of the coding block is subtracted from the predicted value, and we get The residual value of this coding block.
  • the residual values of N coding blocks are superimposed to obtain the residual value of the image area.
  • the continuity parameter of the image area is determined.
  • the residual value of the image area is negatively correlated with the continuity parameter. That is, the greater the residual value of the image area, the greater the continuity parameter of the image area. The smaller the value, the smaller the residual value of the image area, and the greater the continuity parameter of the image area.
  • the embodiment of the present application does not limit the method of determining the continuity parameter of the image area based on the residual value of the image area.
  • the reciprocal of the residual value of the image area is determined as the continuity parameter of the image area. For example, if the residual value of the image area is a, then the continuity parameter of the image area is determined to be 1. /a.
  • the difference between the preset value and the residual value of the image area is determined as the continuity parameter of the image area.
  • the preset value is a positive number, such as the preset value.
  • the value is 1.
  • the continuity parameter of the image area is determined to be 1-a.
  • step S402 is performed to determine the transformation method of the current coding block based on the continuity parameter of the image area.
  • S402. Determine the transformation method of the current coding block according to the continuity parameter of the image area.
  • the continuity parameter of the image area is used to indicate the continuity of changes in the pixels in the image area. If the continuity parameter of the image area is small, it means that the signal energy in the image area is not concentrated. In this case, DTC is used The transformation cannot bring significant compression effect. In this case, calculating the rate distortion cost of multiple transformation methods to select the optimal transformation method from these multiple transformation methods will not only not bring beneficial compression effects, but also The computational cost is high. Therefore, when the continuity parameter of the image area is large, the operation of selecting the optimal transformation method from multiple transformation methods is skipped to save computing resources and improve coding efficiency.
  • the methods for determining the transformation method of the current coding block according to the continuity parameter of the image area include but are not limited to the following:
  • Method 1 If the continuity parameter of the image area is less than the preset threshold, it is determined that the transformation mode of the current coding block is the first transformation mode.
  • the encoder skips the operation of selecting the optimal transform scheme from multiple transform schemes, for example, skips the MTS operation, and directly determines the first transform scheme as the target transform scheme of the current coding block.
  • the above-mentioned first transformation mode is one of multiple preset transformation modes.
  • the first transformation mode is DTC-II mode, DST-VII mode and DCT-VIII mode. any transformation method.
  • the first conversion mode is the DTC-II mode.
  • the embodiment of the present application does not place a limit on the preset threshold, which is determined based on actual needs.
  • Method 2 If the continuity parameter of the image area is greater than or equal to the preset threshold, the transformation method of the current coding block is determined from M candidate transformation methods, where M is a positive integer greater than 1.
  • the encoder performs an operation of selecting the optimal transform method from M transform methods, such as performing an MTS operation, to determine the transform method of the current coding block from these M candidate transform methods.
  • This embodiment of the present application does not limit the number and types of M candidate transformation methods.
  • the M candidate transformation modes include transformation modes composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode. Since the images are all 2-dimensional, the amount of computation and memory overhead of directly performing two-dimensional transformation were unacceptable to the hardware conditions at the time. Therefore, when using the above-mentioned DCT-II, DCT-VIII, and DST-VII in the standard for transformation, both are split into horizontal and vertical directions, and a two-step one-dimensional transformation is performed. For example, perform horizontal transformation first and then vertical transformation, or perform vertical transformation first and then horizontal transformation.
  • the M candidate transformation modes in the embodiment of the present application can be any combination of DTC-II mode, DST-VII mode and DCT-VIII mode in the horizontal and vertical directions.
  • candidate transformation method 1 is DTC-II in the horizontal direction and DST-VII in the vertical direction
  • candidate transformation method 2 is DTC-II in the horizontal direction and DCT-VIII in the vertical direction
  • candidate transformation method 3 is The horizontal direction is DST-VII mode and the vertical direction is DTC-II mode.
  • the horizontal direction of candidate transformation method 4 is DST-VII mode and the vertical direction is DCT-VIII mode.
  • the horizontal direction of candidate transformation method 5 is DCT- The VIII mode and the vertical direction are DTC-II mode.
  • the horizontal direction and vertical direction of candidate transformation mode 6 are DCT-VIII mode and the vertical direction are DST-VII mode.
  • the horizontal and vertical modes of candidate transformation mode 7 are both DTC-II mode
  • the horizontal direction and the vertical mode of candidate transformation mode 8 are both DST-VII mode
  • the horizontal direction and vertical mode of candidate transformation mode 9 are both DCT-VIII mode.
  • the M candidate transformation modes include multiple transformation modes corresponding to MTS, such as the DTC-II mode, and the combined transformation modes shown in Table 2 above.
  • determining the transformation mode of the current coding block from M candidate transformation modes includes the following steps:
  • Step 1 Determine the rate distortion cost when using M candidate transformation methods to transform the current coding block
  • Step 2 Select a candidate transformation method from the M candidate transformation methods as the transformation method of the current coding block according to the rate distortion cost corresponding to the M candidate transformation methods.
  • the method of determining the transformation mode of the current coding block from the M candidate transformation modes may be: first, use the first candidate transformation mode among the M candidate transformation modes to transform the current coding block. , and calculate the rate distortion cost corresponding to the first candidate transformation method. If the rate distortion cost corresponding to the first candidate transformation method is less than or equal to the preset value, the first candidate transformation method is used as the transformation method of the current coding block. If the rate distortion cost corresponding to the first candidate transformation method is greater than the preset value, use the second candidate transformation method among the M candidate transformation methods to transform the current coding block, and calculate the corresponding rate distortion cost of the second candidate transformation method. rate distortion cost.
  • the second candidate transformation method is used as the transformation method of the current coding block. If the rate distortion cost corresponding to the second candidate transformation method is greater than the preset value, repeat the above steps, use the third candidate transformation method among the M candidate transformation methods to transform the current coding block, and calculate the third candidate transformation method The rate distortion cost corresponding to the transformation method.
  • a candidate transformation method is selected from M candidate transformation methods as the transformation method of the current coding block.
  • the method of determining the transformation mode of the current coding block from M candidate transformation modes may be: using these M candidate transformation modes to transform the current coding block respectively, and calculating the M candidates The rate distortion cost corresponding to each candidate transformation method in the transformation method.
  • the candidate transformation mode with the smallest rate distortion cost is determined as the transformation mode of the current coding block.
  • the encoder determines the transformation method of the current coding block according to the continuity parameter of the image area.
  • the encoder may also use the following method 3 to determine the transformation mode of the current coding block.
  • the encoder first determines a flag based on the continuity parameter of the image area, and determines the transformation mode of the current coding block based on the flag. That is, the above S402 includes the following steps of S402-A1 and S402-A2:
  • the first flag is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes, where M is a positive integer greater than 1.
  • the first flag is used to indicate whether the image area is allowed to use the MTS technology, or the first flag is used to indicate the image area. Whether to skip MTS operations.
  • the method of determining the first mark according to the continuity parameter of the image area in the above S402-A1 includes the following examples:
  • Example 1 If the continuity parameter of the image area is less than the preset threshold, it means that the signal energy in the image area is not concentrated. At this time, the value of the first flag is determined to be the first value. The first value is used to indicate that the image area is not allowed. The transformation method is determined from M candidate transformation methods.
  • Example 2 if the continuity parameter of the image area is greater than or equal to the preset threshold, it means that the signal energy in the image area is concentrated. At this time, the value of the first flag is determined to be the second value. The second value is used to indicate that the image area is allowed to change from The transformation method is determined among M candidate transformation methods.
  • the first value is not equal to the second value.
  • the first value is 0.
  • the second value is 1.
  • the transformation mode of the current coding block is determined based on the first flag.
  • the value of the first flag is the first value, it indicates that the image area is not allowed to determine the transformation mode from the M candidate transformation modes. At this time, the step of determining the transformation mode from the M candidate transformation modes is skipped. operation, but directly determines the default first transformation mode as the transformation mode of the current coding block.
  • the value of the first flag is the second value, it indicates that the image area is allowed to determine the transformation mode from M candidate transformation modes. At this time, the transformation mode of the current coding block is determined from the M candidate transformation modes.
  • the current coding block is transformed using the first candidate transformation method among the M candidate transformation methods, and the rate distortion cost corresponding to the first candidate transformation method is calculated. If the rate distortion cost corresponding to the first candidate transformation method is less than or equal to the preset value, the first candidate transformation method is used as the transformation method of the current coding block. If the rate distortion cost corresponding to the first candidate transformation method is greater than the preset value, use the second candidate transformation method among the M candidate transformation methods to transform the current coding block, and calculate the corresponding rate distortion cost of the second candidate transformation method. rate distortion cost.
  • a candidate transformation method is selected from M candidate transformation methods as the transformation method of the current coding block.
  • the M candidate transformation methods are used to transform the current coding block respectively, and the rate distortion cost corresponding to each of the M candidate transformation methods is calculated.
  • the candidate transformation mode with the smallest rate distortion cost is determined as the transformation mode of the current coding block.
  • the encoder determines the transformation mode of the current coding block according to the above method, it performs the following steps of S403.
  • the current coding block is predicted using the intra prediction method and/or the inter prediction method to obtain the prediction value of the current coding block. Then, based on the prediction value of the current coding block and the current coding block, the prediction value of the current coding block is obtained. Residual value. For example, subtract the predicted value from the pixel value of the current coding block to obtain the residual value of the current coding block.
  • the transformation method of the current coding block determined according to the above method is the DCT-II transformation method
  • the DCT-II transformation method is used to transform the residual of the current coding block Transform the value to obtain the transformation coefficient of the current coding block.
  • the transformation method of the current coding block determined according to the above method is the DCT-VIII transformation method, then according to the formula shown in Table 2 above, the DCT-VIII transformation method is used to transform the residual of the current coding block. The difference value is transformed to obtain the transformation coefficient of the current coding block.
  • the transformation method of the current coding block determined according to the above method is the DST-VII transformation method
  • the DST-VII transformation method is used to transform the residual of the current coding block.
  • the difference value is transformed to obtain the transformation coefficient of the current coding block.
  • the encoder writes the above-mentioned first flag into the code stream, so that the decoder determines the transform type based on the first flag and implements inverse transformation of the transform coefficients.
  • the code stream also includes a second flag.
  • the second flag is used to indicate whether the current picture sequence is allowed to be copied from The transformation method is determined among M candidate transformation methods. In the MTS technology, the second flag is specifically used to indicate whether the current image sequence allows the use of the MTS technology. If the second flag indicates that the current image sequence is not allowed to use the MTS technology, it is determined that all coded image blocks under the current image sequence do not use the MTS technology, and the first transformation method is determined as the target transformation method to calculate the residual value. Transform to get the transformation coefficients. If the second flag indicates that the current image sequence is allowed to use the MTS technology, then all coded image blocks under the current image sequence use the MTS technology to determine the transformation method.
  • the first flag multiplexes the second flag if the image area is the current image sequence.
  • the embodiment of the present application does not limit the specific positions of the first mark and the second mark in the code stream.
  • pic_mts_enable_flag can be used to represent the first flag.
  • sps_explicit_mts_inter_enabled_flag may be used to represent the second flag.
  • the first flag and the second flag are located in the coding unit. At this time, part of the syntax of the coding unit is as shown in Table 3:
  • a constraint first flag is added to the existing coding unit syntax, and the first flag is used to indicate whether the current area skips the MTS operation.
  • the decoding end can determine the transformation type trType of the current coding block according to the first flag during decoding.
  • the image coding method provided by the embodiment of the present application determines the continuity parameter of the image area where the current coding block is located.
  • the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area; based on the continuity parameter of the image area, the current coding block is determined based on the continuity parameter of the image area.
  • the default first transformation method can be used as The transformation method of the current coding block, and skips the operation of selecting the optimal transformation method from multiple transformation methods to save unnecessary computing overhead and improve coding efficiency.
  • Figure 5 is a schematic flowchart of an image encoding method provided by an embodiment of the present application.
  • Figure 5 can be understood as a more specific encoding method of the encoding method shown in Figure 4.
  • the encoding method according to the embodiment of the present application includes the following steps:
  • the image area is the current image frame as an example.
  • the continuity parameter is used to indicate the continuity of changes in pixels in the current image frame.
  • a gradient map of the current image frame is determined, and a gradient map of the gradient map is determined, and a continuity parameter of the current image frame is determined based on the gradient map of the gradient map. For example, the average value of the gradient values in the gradient map of the current image frame is determined as the continuity parameter of the current image frame.
  • a residual value of the current image frame is determined, and a continuity parameter of the current image frame is determined based on the residual value of the current image frame, where the residual value is negatively correlated with the continuity parameter.
  • the current image frame skips the MTS operation, and sets the value of the first flag to the first value.
  • the embodiment of this application takes MTS technology as an example.
  • the current image frame skips the MTS operation. That is to say, all coding blocks under the current image frame do not use MTS technology to determine the transformation method.
  • the default first transformation mode is determined as the transformation mode of all coding blocks in the current image frame.
  • pic_mts_enable_flag is used to represent the first flag.
  • the first value is 0.
  • the first transformation mode is the DCT-II mode.
  • the continuity parameter of the current image frame is greater than or equal to the preset threshold, it means that the signal energy of the current image frame is concentrated.
  • the current image frame is allowed to perform MTS operations. At this time, when determining the specific transformation method for the coding block in the current image frame, MTS technology can be used to determine the optimal transformation method.
  • pic_mts_enable_flag is used to represent the first flag.
  • the second value is 1.
  • the DCT-II method is directly selected as the transformation method of the current coding block.
  • the transform coefficients of the current transform block are directly encoded without quantization to obtain a code stream.
  • the transform coefficient of the current encoding block is quantized to obtain the quantized coefficient, and the quantized coefficient is encoded to obtain the code stream.
  • the encoder writes the above-mentioned first flag into the code stream, so that the decoder determines the transformation type corresponding to the inverse transformation according to the first flag.
  • the image coding method provided by the embodiment of the present application determines the continuity parameter of the current image frame, and compares the continuity parameter with the preset threshold. If the continuity parameter is less than the preset threshold, the MTS operation is skipped and the MTS operation is skipped.
  • the first transformation mode is determined as the transformation mode of the current coding block, thereby saving unnecessary calculation overhead and improving coding efficiency.
  • FIG. 6 is a schematic flowchart of a video decoding method provided by an embodiment of the present application.
  • the embodiment of the present application is applied to the decoders shown in FIGS. 1 and 3 .
  • the method in the embodiment of this application includes:
  • the current decoding block may also be referred to as the current block, the current decoding unit, the decoding block, the block to be decoded, the current block to be decoded, etc.
  • the currently decoded block when the currently decoded block includes a chroma component and does not include a luma component, the currently decoded block may be called a chroma block.
  • the currently decoded block when the currently decoded block includes a luma component and does not include a chrominance component, the currently decoded block may be called a luma block.
  • the above-mentioned transform coefficients are transform coefficients obtained by transforming the residual value of the current decoding block at the encoding end.
  • the decoding end decodes the code stream and obtains the transform coefficients of the current decoded block, including but not limited to the following:
  • Method 1 If the encoding end is encoding, the transform coefficients are not quantized, but the transform coefficients are directly encoded to obtain a code stream. In this way, the decoding end decodes the code stream and can directly obtain the transform coefficient of the current decoding block from the code stream.
  • Method 2 During encoding, the encoding end quantizes the transform coefficients to obtain quantized coefficients, and then encodes the quantized coefficients to obtain a code stream. In this way, the decoder decodes the code stream to obtain the quantized coefficients of the current decoded block, and performs inverse quantization on the quantized coefficients to obtain the transform coefficients of the current decoded block.
  • S602. Determine the first flag of the image area where the current coding block is located.
  • the above-mentioned first flag is used to determine the transform type of the current coding block.
  • the above-mentioned first flag is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes.
  • the first flag in the embodiment of the present application is determined based on the continuity parameter of the image area.
  • the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area.
  • adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods can improve the transformation effect.
  • the compression effect brought by the transformation is poor.
  • adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods to transform these images whose signal energy is not concentrated not only has an insignificant compression effect, but also generates unnecessary computational overhead and increases encoding time.
  • the embodiment of the present application uses the size of the continuity parameter of the image area to indicate whether the signal energy of the image area is concentrated. For example, if the continuity parameter of the image area is large, it indicates the intensity of the pixels in the image area. The change is continuous, which indicates that the signal energy in this image area is concentrated. If the continuity parameter of the image area is small, it indicates that the changes in pixel points in the image area are discontinuous, which further indicates that the signal energy in the image area is not concentrated. For image areas where signal energy is not concentrated, selecting the optimal transformation method from multiple transformation methods will not only fail to bring significant transformation effects, but also generate unnecessary computational overhead and increase encoding and decoding time. Therefore, in the embodiment of the present application, for image areas where signal energy is not concentrated, skip the operation of selecting the optimal transformation method from M candidate transformation methods (such as skipping MTS technology) to save unnecessary computing overhead.
  • M candidate transformation methods such as skipping MTS technology
  • the embodiment of the present application does not limit the size of the image area, and it can be any image area including the current decoding block.
  • the image area is the current image frame
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixel points in the current image frame.
  • the first flag is used to indicate whether the current image frame is allowed to determine the transformation mode from M candidate transformation modes.
  • the image area is the current image sequence
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image sequence.
  • the first flag is used to indicate whether the current image sequence is allowed to determine the transformation mode from M candidate transformation modes.
  • the image area is the current image patch
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image patch.
  • the first flag is used to indicate whether the current image slice is allowed to determine the transformation mode from M candidate transformation modes.
  • the image area is the current coding block
  • the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current coding block.
  • the first flag is used to indicate whether the current coding block is allowed to determine the transformation mode from M candidate transformation modes.
  • This embodiment of the present application does not limit the number and types of M candidate transformation methods.
  • the M candidate transformation modes include transformation modes composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode. Since the images are all 2-dimensional, the amount of computation and memory overhead of directly performing two-dimensional transformation were unacceptable to the hardware conditions at the time. Therefore, when using the above-mentioned DCT-II, DCT-VIII, and DST-VII in the standard for transformation, both are split into horizontal and vertical directions, and a two-step one-dimensional transformation is performed. For example, perform horizontal transformation first and then vertical transformation, or perform vertical transformation first and then horizontal transformation.
  • the M candidate transformation modes in the embodiment of the present application can be any combination of DTC-II mode, DST-VII mode and DCT-VIII mode in the horizontal and vertical directions.
  • candidate transformation method 1 is DTC-II in the horizontal direction and DST-VII in the vertical direction
  • candidate transformation method 2 is DTC-II in the horizontal direction and DCT-VIII in the vertical direction
  • candidate transformation method 3 is The horizontal direction is DST-VII mode and the vertical direction is DTC-II mode.
  • the horizontal direction of candidate transformation method 4 is DST-VII mode and the vertical direction is DCT-VIII mode.
  • the horizontal direction of candidate transformation method 5 is DCT- The VIII mode and the vertical direction are DTC-II mode.
  • the horizontal direction and vertical direction of candidate transformation mode 6 are DCT-VIII mode and the vertical direction are DST-VII mode.
  • the horizontal and vertical modes of candidate transformation mode 7 are both DTC-II mode
  • the horizontal direction and the vertical mode of candidate transformation mode 8 are both DST-VII mode
  • the horizontal direction and vertical mode of candidate transformation mode 9 are both DCT-VIII mode.
  • the M candidate transformation modes include multiple transformation modes corresponding to MTS, such as the DTC-II mode, and the combined transformation modes shown in Table 2 above.
  • the transform type trType when inversely transforming the transform coefficients of the current decoding block, the transform type trType needs to be determined first, and then the transform coefficients of the current decoding block are inversely transformed according to the transform type trType to obtain the residual value of the current decoding block.
  • the transformation type trType is determined according to the first flag. For example, when the first flag is 0, it means that the image area does not allow the optimal transformation method to be selected from M candidate transformation methods, and then the current decoding block can be determined.
  • the transformation type trType is 0.
  • the methods for determining the first mark include but are not limited to the following:
  • Method 1 The decoder determines the first flag based on the continuity parameter of the image area.
  • the above S602 includes the following steps S602-A1 and S602-A2, that is, first determines the continuity parameter of the image area, and then determines the first flag based on the continuity parameter of the image area. Parameters determine the first marker of the image area.
  • the decoding end determines the continuity parameter of the image area
  • the image area is not completely decoded.
  • the continuity parameters of adjacent decoded areas of the image area can be used as the continuity parameters of the image area.
  • the methods for determining the continuity parameters of the image area include but are not limited to the following examples:
  • Example 1 determine the continuity parameters of the image area through the gradient map, that is, the above S602-A1 includes the following steps from S602-A1-11 to S602-A1-13:
  • adjacent decoded regions are consistent in size with image regions.
  • adjacent decoded regions are not consistent in size with image regions.
  • the gradient map of an image can reflect the change trend of pixels in the image, and the gradient map of the image can reflect the rate of change of pixels in the image, that is, the continuity of change.
  • the continuity parameter of the adjacent decoded region can be determined by calculating the gradient map of the gradient map of the adjacent decoded region.
  • the gradient map Gmap' of the adjacent decoded area is determined according to the following formula (3):
  • I'(x, y) is the pixel value of the adjacent decoded area I' at the position (x, y)
  • I'(x+1, y) is the adjacent decoded area I' at the position (x +1, y)
  • I'(x, y+1) is the pixel value of the adjacent decoded area I' at position (x, y+1)
  • Gmap'(x, y) is the corresponding The gradient value of the pixel at position (x, y) in the adjacent decoded area I'.
  • the gradient map GGmap' of the gradient map of the adjacent decoded area is determined according to the following formula (4):
  • GGmap'(x,y)
  • Gmap'(x+1,y)' is the gradient value of the pixel at position (x+1,y) in the adjacent decoded area I'
  • Gmap(x,y+1)' is the adjacent decoded area I'.
  • the gradient value of the pixel at position (x, y+1) in area I', where Gmap'(x+1,y) and Gmap'(x,y+1) can be determined according to the above formula (3).
  • GGmap’ (x, y) is the gradient value of the gradient value of the pixel at position (x, y) in the adjacent decoded area I’.
  • the above formulas (3) and (4) show that the gradient value of the pixel point (x, y) in the adjacent decoded area I' and the gradient value of the gradient value are determined. Other pixels in the adjacent decoded area I' By referring to the pixel point (x, y), the gradient value of each pixel point in the adjacent decoded area I' is determined, and the gradient map Gmap' of the adjacent decoded area I' is obtained. Use the above formula (4) to calculate the gradient value corresponding to each pixel point in the gradient map Gmap' of the adjacent decoded area I', and then obtain the gradient map GGmap' of the gradient map of the adjacent decoded area I'.
  • the above formula (3) and formula (4) are just examples.
  • the embodiments of the present application can also use other methods to determine the gradient map of the adjacent decoded area and the gradient map of the gradient map.
  • the above formulas (3) and (4) are deformed, and the gradient map is determined using the deformed formula, as well as the gradient map of the gradient map.
  • the continuity parameter of the adjacent decoded area is determined based on the gradient map GGmap of the adjacent decoded area.
  • the continuity parameter of the adjacent decoded area is determined based on the gradient map of the adjacent decoded area, and the continuity parameter of the adjacent decoded area is determined as the continuity parameter of the image area.
  • the embodiment of the present application does not limit the method of determining the continuity parameters of adjacent decoded areas based on the gradient map of the gradient map in S602-A1-13 above.
  • the median value of each gradient value in the gradient map of the adjacent decoded area is determined as the continuity parameter of the image area.
  • the average of the gradient values in the gradient maps of adjacent decoded areas is determined as the continuity parameter of the image area.
  • the continuity parameter of the image area is determined by determining the gradient map of the gradient map of the adjacent decoded area.
  • the calculation method is simple and the calculation cost is small, thereby improving the coding efficiency.
  • the method of the following example 2 can also be used to determine the continuity parameter of the image area.
  • Example 2 Determine the continuity parameters of the image area by determining the spatial redundancy of adjacent decoded areas. That is, the above S602-A1 includes the following steps of S602-A1-21 and S602-A1-23:
  • S602-A1-2 Determine adjacent decoded areas of the image area.
  • a decoded area with the same size as the image area among decoded areas adjacent to the image area is regarded as an adjacent decoded area of the image area.
  • the decoded area of the decoded area adjacent to the image area that is inconsistent with the size of the image area is regarded as the adjacent decoded area of the image area.
  • S602-A1-23. Determine the continuity parameter of the image area based on the residual value of the adjacent decoded area, where the residual value is negatively correlated with the continuity parameter.
  • the spatial redundancy of the image is small, it means that the correlation of the image is strong, the changes of pixels in the image are more continuous, and the signal energy of the image is more concentrated. If the spatial redundancy of the image is large, it means that the correlation of the image is weak, the changes of pixels in the image are discontinuous, and the signal energy of the image is not concentrated.
  • the spatial redundancy of an image can be represented by the residual value of the image, that is, a large residual value indicates that the image has large spatial redundancy, and a small residual value indicates that the image has small spatial redundancy.
  • intra-frame prediction is used to calculate the spatial redundancy of the image. Therefore, the embodiment of the present application uses the intra-frame prediction method to calculate the predicted value of the adjacent decoded area, and convert the original value of the adjacent decoded area into The difference from the predicted value is determined as the residual value of the adjacent decoded region.
  • the residual value of an adjacent decoded area may be a superposition of the residual values of each decoded block included in the adjacent decoded area.
  • the adjacent decoded area includes N decoding blocks, N is a positive integer, decode the code stream, and obtain the residual value of each decoding block in the N decoding blocks.
  • the residual values of the N decoding blocks are superimposed to obtain The residual value of this adjacent decoded region.
  • the continuity parameter of the image area is determined based on the residual value of the adjacent decoded area, where the residual value of the adjacent decoded area is negatively correlated with the continuity parameter, that is, the greater the residual value of the adjacent decoded area, the greater the residual value of the adjacent decoded area. , the smaller the continuity parameter of the image area is and the smaller the residual value of the adjacent decoded area is, the larger the continuity parameter of the image area is.
  • the embodiment of the present application does not limit the method of determining the continuity parameters of the image area based on the residual values of adjacent decoded areas.
  • the reciprocal of the residual value of the adjacent decoded area is determined as the continuity parameter of the image area. For example, if the residual value of the adjacent decoded area is a, then the image area is determined The continuity parameter is 1/a.
  • the difference between the preset value and the residual value of the adjacent decoded area is determined as the continuity parameter of the image area.
  • the preset value is a positive number, for example The default value is 1.
  • the continuity parameter of the image area is determined to be 1-a.
  • S602-A2 Determine the first mark according to the continuity parameter of the image area.
  • the first flag is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes, where M is a positive integer greater than 1.
  • the first flag is used to indicate whether the image area is allowed to use the MTS technology, or the first flag is used to indicate the image area. Whether to skip MTS operations.
  • the method of determining the first mark according to the continuity parameter of the image area in the above S602-A2 includes the following examples:
  • Example 1 If the continuity parameter of the image area is less than the preset threshold, the value of the first flag is determined to be the first value, and the first value is used to indicate that the image area is not allowed to determine the transformation method from M candidate transformation methods.
  • Example 2 If the continuity parameter of the image area is greater than or equal to the preset threshold, the value of the first flag is determined to be a second value, and the second value is used to indicate that the image area is allowed to determine the transformation method from M candidate transformation methods.
  • the first value is not equal to the second value.
  • the first value is 0.
  • the second value is 1.
  • the decoder in addition to determining the first flag through the continuity parameter of the image area according to the above-mentioned method one, the decoder can also determine the first flag according to the method two.
  • Method 2 decode the code stream and obtain the first flag.
  • the encoding end determines the first flag based on the continuity parameters of the image area, and writes the first flag into the code stream as shown in Table 3. In this way, the decoding end obtains the first flag by decoding the code stream. logo.
  • the decoding end can quickly obtain the first mark through this second method, which saves computing resources and improves the decoding speed.
  • step S603 is performed to determine the transformation type of the current decoding block based on the first flag.
  • a transform type is also called a transform kernel type.
  • the first flag in the embodiment of this application is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes. In this way, the decoding end can determine the transformation type of the current decoding block based on the first flag.
  • the transformation types include horizontal transformation type trTypeHor and vertical transformation type trTypeVer.
  • Method 1 If the value of the first flag is a first value, the index of the transformation type of the current decoding block is determined to be 0, where the first value is used to indicate that the image area is not allowed to determine the transformation mode from M candidate transformation modes. .
  • the transformation types i.e., transformation methods used in the embodiments of the present application mainly include DCT-II, DCT-VIII, and DST-VII.
  • the index of DCT-II is 0, the index of DCT-VIII is 1, and the index of DST -VII has an index of 2, or, DCT-VIII has an index of 2 and DST-VII has an index of 1.
  • the value of the first flag is a first value (for example, 0)
  • the transformation type includes a horizontal transformation type trTypeHor and a vertical transformation type trTypeVer.
  • the horizontal transformation type trTypeHor and the vertical transformation type of the current decoding block are determined.
  • trTypeVer is both 0, that is, the current decoding block uses DCT-II in both the horizontal and vertical directions.
  • a first flag is added to the standard document as a condition for determining the transformation type.
  • the standard document before modification and the standard document after modification are now compared as follows.
  • IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT and lfnst_idx is not equal to 0.
  • cIdx is the color component index
  • 0 represents the brightness component
  • 1 and 2 represent the chrominance component
  • 1 represents the cb component and 2 represents the cr component.
  • IntraSubPartitionsSplitType indicates the division type of the current luminance coding block
  • ISP_NO_SPLIT indicates that the current intra-frame block is not divided.
  • lfnst_idx represents the usage of two inseparable low-frequency transformation cores.
  • IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT and lfnst_idx is not equal to 0.
  • the value of the first flag is a first value, such as 0, it is determined that the index of the transform type of the current decoding block is 0, and then the transform matrix is determined based on the transform type index 0.
  • Method 2 if the value of the first flag is a second value, determine the transformation type of the current decoding block according to the second flag, where the second flag is obtained by decoding the code stream, and the second value is used to indicate that the image area is allowed to change from
  • the transformation mode is determined from M candidate transformation modes, and the second flag is used to indicate whether the current picture sequence allows the transformation mode to be determined from the M candidate transformation modes.
  • implicitMtsEnabled is determined based on the second flag, and the transformation type of the current decoding block is determined based on implicitMtsEnabled.
  • the decoder first decodes the code stream to obtain the second flag, and determines based on the second flag that the current picture sequence is allowed to be converted from M
  • the first flag is decoded, and the transformation type of the currently decoded block is determined according to the first flag. Specifically, if the value of the first flag is a first numerical value, the index of the transform type of the current decoding block is determined to be 0. If the value of the first flag is a second numerical value, the index of the transformation type of the current decoding block is determined according to the second flag. Transformation type.
  • the second flag and the first flag are the same flag.
  • the second value indicates that the current image sequence allows the transformation mode to be determined from M candidate transformation modes.
  • the current transformation mode is determined according to the following method. Transform type of decoding block.
  • implicitMtsEnabled is determined to be 1. Otherwise, implicitMtsEnabled is determined to be 0.
  • sps_mts_enabled_flag is used to represent the second flag.
  • the second value is 1.
  • the export process of the above variable implicitMtsEnabled is as follows:
  • IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT
  • cu_sbt_flag is equal to 1 and Max(nTbW,nTbH) is less than or equal to 32
  • sps_explicit_mts_intra_enabled_flag is equal to 0 and CuPredMode[0][xTbY][yTbY] is equal to MODE_INTRA and lfnst_idx is equal to 0 and IntraMipFlag[x0][y0] is equal to 0.
  • cu_sbt_flag indicates whether sub-block transformation is used for the current coding unit.
  • sps_explicit_mts_intra_enabled_flag indicates whether mts_idx will explicitly appear in the entropy coding syntax unit of intra-frame coding.
  • mts_idx is the index specifying the transform core.
  • CuPredMode[0][xTbY][yTbY] represents the prediction mode of the coding unit whose luminance component is at the (xTbY, yTbY) position.
  • MODE_INTRA indicates that the prediction mode is intra prediction
  • the transformation type of the current decoding block is determined according to the implicitMtsEnabled.
  • the transformation type of the current decoding block can be determined in the following manner:
  • cu_sbt_horizontal_flag indicates whether the current coding unit should be divided horizontally into two transformation units
  • cu_sbt_pos_flag indicates whether the tu_y_coded_flag, tu_cb_coded_flag and tu_cr_coded_flag of the first transformation unit of the current coding unit exist.
  • tu_y_coded_flag indicates whether the current luma block contains non-0 transform coefficients
  • tu_cb_coded_flag indicates whether the current chroma block (cb component) contains non-0 transform coefficients
  • tu_cr_coded_flag indicates whether the current chroma block (cr component) contains non-0 transform coefficients.
  • trTypeHor 2
  • trTypeVer 1.
  • implicitMtsEnabled if implicitMtsEnabled is not equal to 1, look up table 5 according to mts_idx to obtain trTypeHor and trTypeVer.
  • mts_idx can be obtained by decoding the code stream.
  • the transformation coefficients of the current decoding block are inversely transformed according to trTypeHor and trTypeVer to obtain the residual value of the current decoding block.
  • the transformation matrix is determined according to the transformation type of the current decoding block and the size of the current decoding block; the transformation matrix is used to perform an inverse transformation operation on the transformation coefficient to obtain the residual value of the current decoding block.
  • the transformation matrix transMatrix is used to inversely transform the transformation coefficient of the current decoding block to obtain the residual value of the current decoding block.
  • the residual value of the current decoding block is obtained:
  • T is the transformation matrix
  • the transformation coefficient can be inversely transformed based on the transformation matrix to obtain the residual value of the current decoding block.
  • the current block is predicted according to the prediction mode of the current decoding block to obtain the prediction value of the current decoding block.
  • the predicted value and the residual value are added to obtain the reconstructed value of the current decoded block.
  • the decoding method in the embodiment of the present application determines the transform coefficient of the current decoding block by decoding the code stream; determines the first flag of the image area where the current encoding block is located, and the first flag is determined based on the continuity parameter of the image area.
  • the first flag Used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes.
  • the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area; according to the first flag, determine the transformation type of the current decoding block; according to the current
  • the transformation type of the decoding block inversely transforms the transformation coefficient of the current decoding block to obtain the residual value of the current decoding block. That is, the embodiment of the present application adds a condition for determining the transformation type of the current decoding block. For example, if the value of the first flag is 0, it is determined that the transformation type of the current decoding block is 0, thereby improving the speed of determining the transformation type. , improve decoding efficiency.
  • Figure 7 is a schematic flowchart of an image decoding method provided by an embodiment of the present application.
  • Figure 7 can be understood as a specific implementation of the decoding method shown in Figure 6.
  • the decoding method in this embodiment of the present application includes:
  • the image area is the current image frame as an example.
  • the embodiment of this application takes MTS technology as an example.
  • the above-mentioned first flag is used to indicate whether the current image frame is allowed to perform an MTS operation.
  • the encoding end writes the first flag into the code stream, so that after the decoding end obtains the code stream, it decodes the code stream to obtain the first flag.
  • the decoding end decodes the code stream and can directly obtain the transform coefficient of the current decoding block from the code stream.
  • the encoding when encoding, the encoding end quantizes the transform coefficients to obtain quantized coefficients, and then encodes the quantized coefficients to obtain a code stream.
  • the decoder decodes the code stream to obtain the quantized coefficients of the current decoded block, and performs inverse quantization on the quantized coefficients to obtain the transform coefficients of the current decoded block.
  • S707 Obtain the reconstruction value of the current decoding block based on the prediction value and residual value of the current decoding block.
  • the decoding method in the embodiment of the present application obtains the first identifier of the current image frame by decoding the code stream. According to the first identifier, the transformation type of the current decoding block is determined; according to the transformation type of the current decoding block, the transformation of the current decoding block is The coefficients are inversely transformed to obtain the residual value of the current decoded block. That is, the embodiment of the present application adds a condition for determining the transformation type of the current decoding block. For example, if the value of the first flag is 0, it is determined that the transformation type of the current decoding block is 0, thereby improving the speed of determining the transformation type. , improve decoding efficiency.
  • the size of the sequence numbers of the above-mentioned processes does not mean the order of execution.
  • the execution order of each process should be determined by its functions and internal logic, and should not be used in this application.
  • the implementation of the examples does not constitute any limitations.
  • the term "and/or" is only an association relationship describing associated objects, indicating that three relationships can exist. Specifically, A and/or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
  • the character "/" in this article generally indicates that the related objects are an "or" relationship.
  • Figure 8 is a schematic block diagram of an image encoding device provided by an embodiment of the present application.
  • the image encoding device 10 includes:
  • Parameter determination unit 11 used to determine the continuity parameter of the image area where the current coding block is located, the continuity parameter being used to indicate the continuity of changes in the pixel points in the image area;
  • Mode determination unit 12 configured to determine the transformation mode of the current coding block according to the continuity parameter of the image area
  • the transformation unit 13 is configured to transform the current coding block according to the transformation method to obtain the transformation coefficient of the current coding block.
  • the parameter determination unit 11 is specifically configured to determine the gradient map of the image area and the gradient map of the gradient map; determine the continuity parameters of the image area based on the gradient map of the gradient map. .
  • the parameter determination unit 11 is specifically configured to determine the average value of the gradient values in the gradient map of the gradient map as the continuity parameter of the image area.
  • the parameter determination unit 11 is specifically configured to determine the residual value of the image area; determine the continuity parameter of the image area according to the residual value of the image area, wherein the residual value Negatively related to the continuity parameter.
  • the mode determination unit 12 is specifically configured to determine the transformation mode of the current coding block to be the first transformation mode if the continuity parameter of the image area is less than a preset threshold.
  • the mode determination unit 12 determines the transformation mode of the current coding block from M candidate transformation modes if the continuity parameter of the image area is greater than or equal to the preset threshold, and the M is greater than or equal to A positive integer of 1.
  • the mode determination unit 12 determines a first flag according to the continuity parameter of the image area, and the first flag is used to indicate whether the image area is allowed to determine a transformation mode from M candidate transformation modes.
  • the M is a positive integer greater than 1; according to the first flag, the transformation mode of the current coding block is determined.
  • the mode determination unit 12 determines that the value of the first flag is a first value if the continuity parameter of the image area is less than a preset threshold, and the first value is used to indicate that it is not allowed.
  • the image area determines a transformation mode from the M candidate transformation modes.
  • the mode determining unit 12 determines that the transformation mode of the current coding block is the first transformation mode if the value of the first flag is the first numerical value.
  • the mode determination unit 12 determines that the value of the first flag is a second value if the continuity parameter of the image area is greater than or equal to the preset threshold, and the second value is The instruction allows the image region to determine a transformation mode from the M candidate transformation modes.
  • the mode determining unit 12 determines the transformation mode of the current coding block from M candidate transformation modes if the value of the first flag is the second value.
  • the mode determination unit 12 determines the rate distortion cost when using the M candidate transformation modes to transform the current coding block; according to the rate distortion costs corresponding to the M candidate transformation modes, from the Select one candidate transformation mode from the M candidate transformation modes as the transformation mode of the current coding block.
  • the mode determination unit 12 determines the candidate transformation mode with the smallest rate distortion cost among the M candidate transformation modes as the transformation mode of the current coding block.
  • the transformation unit 13 is used to write the first flag into the code stream.
  • the image area is the current image frame, or the current image sequence, or the current image slice, or the current coding block.
  • the code stream further includes a second flag, and the third The second flag is used to indicate whether the current picture sequence allows the transformation mode to be determined from the M candidate transformation modes.
  • the first mark multiplexes the second mark.
  • the first conversion mode is DTC-II mode.
  • the M candidate transformation modes include a transformation mode composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode.
  • the M candidate transformation modes include multiple transformation modes corresponding to the multi-transform core selection MTS.
  • the device 10 shown in Figure 8 can execute the encoding method of the embodiment of the present application, and perform the aforementioned and other operations and/or functions of each unit in the device 10 in order to implement the corresponding processes in each method such as the above encoding method.
  • the device 10 shown in Figure 8 can execute the encoding method of the embodiment of the present application, and perform the aforementioned and other operations and/or functions of each unit in the device 10 in order to implement the corresponding processes in each method such as the above encoding method.
  • the device 10 shown in Figure 8 can execute the encoding method of the embodiment of the present application, and perform the aforementioned and other operations and/or functions of each unit in the device 10 in order to implement the corresponding processes in each method such as the above encoding method.
  • Figure 9 is a schematic block diagram of an image decoding device provided by an embodiment of the present application.
  • the image decoding device 20 includes:
  • Decoding unit 21 used to decode the code stream and determine the transform coefficient of the current decoding block
  • the flag determination unit 22 is used to determine the first flag of the image area where the current encoding block is located.
  • the first flag is determined based on the continuity parameter of the image area.
  • the first flag is used to indicate whether the The image area determines the transformation mode from M candidate transformation modes, the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area, and the M is a positive integer greater than 1;
  • Type determination unit 23 configured to determine the transformation type of the current decoding block according to the first flag
  • the inverse transform unit 24 is configured to inversely transform the transform coefficient of the current decoded block according to the transform type of the current decoded block to obtain the residual value of the current decoded block.
  • the flag determining unit 22 is specifically configured to determine the continuity parameter of the image area; determine the first flag according to the continuity parameter of the image area.
  • the flag determining unit 22 is specifically configured to determine the adjacent decoded area of the image area; determine the gradient map of the adjacent decoded area, and the gradient map of the gradient map; according to the A gradient map of a gradient map that determines the continuity parameters of the image region.
  • the flag determining unit 22 is specifically configured to determine the average value of the gradient values in the gradient map of the gradient map as the continuity parameter of the image area.
  • the flag determining unit 22 is specifically configured to determine adjacent decoded areas of the image area; determine the residual value of the adjacent decoded area; and determine the residual value of the adjacent decoded area according to the residual value of the adjacent decoded area. value to determine the continuity parameter of the image region, wherein the residual value is negatively correlated with the continuity parameter.
  • the flag determination unit 22 is specifically configured to determine that the value of the first flag is a first value if the continuity parameter of the image area is less than a preset threshold, and the first value is used for Indicates that the image area is not allowed to determine the transformation mode from the M candidate transformation modes.
  • the flag determination unit 22 is specifically configured to determine that the value of the first flag is a second value if the continuity parameter of the image area is greater than or equal to a preset threshold, and the second value Used to indicate that the image area is allowed to determine the transformation mode from the M candidate transformation modes.
  • the flag determining unit 22 is specifically configured to decode the code stream to obtain the first flag.
  • the type determination unit 23 is configured to determine that the index of the transform type of the current decoding block is 0 if the value of the first flag is a first value, and the first value is used for Indicates that the image area is not allowed to determine the transformation mode from the M candidate transformation modes.
  • the type determination unit 23 is configured to determine the transformation type of the current decoding block according to the second flag if the value of the first flag is a second value, and the second The flag is obtained by decoding the code stream.
  • the second value is used to indicate that the image area is allowed to determine the transformation mode from the M candidate transformation modes.
  • the second flag is used to indicate whether the current picture sequence is allowed to be transformed from all the candidate transformation modes.
  • the transformation method is determined among the M candidate transformation methods.
  • the transformation type includes a horizontal transformation type and a vertical transformation type.
  • the image area is the current image frame, or the current image sequence, or the current image slice, or the current coding block.
  • the second mark and the first mark are the same mark.
  • the inverse transformation unit 24 is configured to determine a transformation matrix according to the transformation type of the current decoding block and the size of the current decoding block; use the transformation matrix to perform an inverse transformation operation on the transformation coefficient, Obtain the residual value of the current decoding block.
  • the M candidate transformation modes include a transformation mode composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode.
  • the M candidate transformation modes include multiple transformation modes corresponding to the multi-transform core selection MTS.
  • the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here.
  • the device 20 shown in FIG. 9 may correspond to the corresponding subject in performing the decoding method of the embodiment of the present application, and the foregoing and other operations and/or functions of each unit in the device 20 are respectively to implement the decoding method and other methods. The corresponding process in , for the sake of brevity, will not be repeated here.
  • the software unit may be located in a mature storage medium in this field such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register, etc.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in combination with its hardware.
  • Figure 10 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 30 may be the video encoder or video decoder described in the embodiment of the present application.
  • the electronic device 30 may include:
  • Memory 33 and processor 32 the memory 33 is used to store the computer program 34 and transmit the program code 34 to the processor 32.
  • the processor 32 can call and run the computer program 34 from the memory 33 to implement the method in the embodiment of the present application.
  • the processor 32 may be configured to perform the steps in the above method 200 according to instructions in the computer program 34 .
  • the processor 32 may include but is not limited to:
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • the memory 33 includes but is not limited to:
  • Non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile memory may be Random Access Memory (RAM), which is used as an external cache.
  • RAM Random Access Memory
  • RAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • Double Data Rate SDRAM DDR SDRAM
  • ESDRAM enhanced synchronous dynamic random access memory
  • SLDRAM synchronous link dynamic random access memory
  • Direct Rambus RAM Direct Rambus RAM
  • the computer program 34 can be divided into one or more units, and the one or more units are stored in the memory 33 and executed by the processor 32 to complete the tasks provided by this application.
  • the one or more units may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program 34 in the electronic device 30 .
  • the electronic device 30 may also include:
  • Transceiver 33 the transceiver 33 can be connected to the processor 32 or the memory 33 .
  • the processor 32 can control the transceiver 33 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices.
  • Transceiver 33 may include a transmitter and a receiver.
  • the transceiver 33 may further include an antenna, and the number of antennas may be one or more.
  • bus system where in addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus.
  • Figure 11 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
  • the video encoding and decoding system 40 may include: a video encoder 41 and a video decoder 42, where the video encoder 41 is used to perform the video encoding method involved in the embodiment of the present application, and the video decoder 42 is used to perform
  • the embodiment of the present application relates to a video decoding method.
  • This application also provides a computer storage medium on which a computer program is stored.
  • the computer program When the computer program is executed by a computer, the computer can perform the method of the above method embodiment.
  • embodiments of the present application also provide a computer program product containing instructions, which when executed by a computer causes the computer to perform the method of the above method embodiments.
  • This application also provides a code stream, which is generated by the above encoding method.
  • the code stream includes a first flag.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted over a wired connection from a website, computer, server, or data center (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website, computer, server or data center.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the available media may be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as digital video discs (DVD)), or semiconductor media (such as solid state disks (SSD)), etc.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or may be Integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • a unit described as a separate component may or may not be physically separate.
  • a component shown as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

Abstract

The present application provides image encoding and decoding methods and apparatuses, a device, a system, and a storage medium. The method comprises: determining a continuity parameter of an image region where a current encoding block is located, the continuity parameter being used for indicating change continuity of pixel points in the image region; determining a transformation mode of the current encoding block according to the continuity parameter of the image region; and transforming the current encoding block according to the transformation mode to obtain a transformation coefficient of the current encoding block. According to embodiments of the present application, the transformation mode of the current encoding block is determined according to the value of the continuity parameter, for example, if the value of the continuity parameter is small, such that it is indicated that signal energy of the image region is not concentrated, a default first transformation mode can be used as a transformation mode of the current encoding block, and an operation of selecting the optimal transformation mode from a plurality of transformation modes is skipped, so that unnecessary calculation overhead is saved, and encoding efficiency is improved.

Description

图像编解码方法、装置、设备、系统、及存储介质Image coding and decoding methods, devices, equipment, systems, and storage media 技术领域Technical field
本申请涉及视频编解码技术领域,尤其涉及一种图像编解码方法、装置、设备、系统、及存储介质。The present application relates to the field of video coding and decoding technology, and in particular, to an image coding and decoding method, device, equipment, system, and storage medium.
背景技术Background technique
数字视频技术可以并入多种视频装置中,例如数字电视、智能手机、计算机、电子阅读器或视频播放器等。随着视频技术的发展,视频数据所包括的数据量较大,为了便于视频数据的传输,视频装置执行视频压缩技术,以使视频数据更加有效的传输或存储。Digital video technology can be incorporated into a variety of video devices, such as digital televisions, smartphones, computers, e-readers, or video players. With the development of video technology, video data includes a larger amount of data. In order to facilitate the transmission of video data, video devices implement video compression technology to make the video data more efficiently transmitted or stored.
视频通过编码实现压缩,其编码过程包括预测、变换和量化等过程。例如,通过帧内预测和/或帧间预测,确定当前块的预测块,当前块减去预测块得到残差块,对残差块进行变换得到变换系数,对变换系数进行量化得到量化系数,并对量化系数进行编码,形成码流。Video compression is achieved through coding, and the coding process includes prediction, transformation, and quantization. For example, determine the prediction block of the current block through intra-frame prediction and/or inter-frame prediction, subtract the prediction block from the current block to obtain the residual block, transform the residual block to obtain the transform coefficient, and quantize the transform coefficient to obtain the quantized coefficient, And the quantized coefficients are encoded to form a code stream.
为了提高变换效果,提出多变换核选择(Multiple Transform Selection,简称MTS)技术,即从多个变换方式中为当前块选择最优的变换方式。但是,MTS技术在选择变换方式的时候,需要多次计算率失真代价,其计算开销大,编码效率低。In order to improve the transformation effect, Multiple Transform Selection (MTS) technology is proposed, which selects the optimal transformation method for the current block from multiple transformation methods. However, MTS technology requires multiple calculations of the rate-distortion cost when selecting a transformation method, which results in high computational overhead and low coding efficiency.
发明内容Contents of the invention
本申请实施例提供了一种图像编解码方法、装置、设备、系统、及存储介质,通过图像区域的连续性参数,确定当前编码块的变换方式,避免不必要的计算开销,提高编码速度。Embodiments of the present application provide an image encoding and decoding method, device, equipment, system, and storage medium, which determine the transformation method of the current encoding block through the continuity parameters of the image area, avoid unnecessary calculation overhead, and improve the encoding speed.
确定当前编码块所在的图像区域的连续性参数,所述连续性参数用于指示所述图像区域中像素点的变化连续性;Determine the continuity parameter of the image area where the current coding block is located, the continuity parameter being used to indicate the continuity of changes in pixels in the image area;
根据所述图像区域的连续性参数,确定所述当前编码块的变换方式;Determine the transformation mode of the current coding block according to the continuity parameter of the image area;
根据所述变换方式,对所述当前编码块进行变换,得到所述当前编码块的变换系数。According to the transformation method, the current coding block is transformed to obtain the transformation coefficient of the current coding block.
第二方面,本申请实施例提供一种图像解码方法,包括:In a second aspect, embodiments of the present application provide an image decoding method, including:
解码码流,确定当前解码块的变换系数;Decode the code stream and determine the transform coefficient of the current decoding block;
确定所述当前编码块所在的图像区域的第一标志,所述第一标志基于所述图像区域的连续性参数确定,所述第一标志用于指示是否允许所述图像区域从M个候选变换方式中确定变换方式,所述连续性参数用于指示所述图像区域中像素点的变化连续性,所述M为大于1的正整数;Determine the first flag of the image area where the current coding block is located, the first flag is determined based on the continuity parameter of the image area, and the first flag is used to indicate whether the image area is allowed to transform from M candidates The transformation mode is determined in the mode, the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area, and the M is a positive integer greater than 1;
根据所述第一标志,确定所述当前解码块的变换类型;Determine the transform type of the current decoding block according to the first flag;
根据所述当前解码块的变换类型,对所述当前解码块的变换系数进行反变换,得到所述当前解码块的残差值。According to the transformation type of the current decoding block, the transformation coefficient of the current decoding block is inversely transformed to obtain the residual value of the current decoding block.
第三方面,本申请提供了一种图像编码装置,用于执行上述第一方面或其各实现方式中的方法。具体地,该编码器包括用于执行上述第一方面或其各实现方式中的方法的功能单元。In a third aspect, the present application provides an image encoding device for performing the method in the above first aspect or its respective implementations. Specifically, the encoder includes a functional unit for performing the method in the above-mentioned first aspect or its respective implementations.
第四方面,本申请提供了一种图像解码装置,用于执行上述第二方面或其各实现方式中的方法。具体地,该解码器包括用于执行上述第二方面或其各实现方式中的方法的功能单元。In a fourth aspect, the present application provides an image decoding device for performing the method in the above second aspect or its respective implementations. Specifically, the decoder includes a functional unit for performing the method in the above-mentioned second aspect or its respective implementations.
第五方面,提供了一种视频编码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第一方面或其各实现方式中的方法。In a fifth aspect, a video encoder is provided, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the above first aspect or its respective implementations.
第六方面,提供了一种视频解码器,包括处理器和存储器。该存储器用于存储计算机程序,该处理器用于调用并运行该存储器中存储的计算机程序,以执行上述第二方面或其各实现方式中的方法。A sixth aspect provides a video decoder, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the above second aspect or its respective implementations.
第七方面,提供了一种视频编解码系统,包括视频编码器和视频解码器。视频编码器用于执行上述第一方面或其各实现方式中的方法,视频解码器用于执行上述第二方面或其各实现方式中的方法。A seventh aspect provides a video encoding and decoding system, including a video encoder and a video decoder. The video encoder is used to perform the method in the above-mentioned first aspect or its various implementations, and the video decoder is used to perform the method in the above-mentioned second aspect or its various implementations.
第八方面,提供了一种芯片,用于实现上述第一方面至第二方面中的任一方面或其各实现方式中的方法。具体地,该芯片包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有该芯片的设备执行如上述第一方面至第二方面中的任一方面或其各实现方式中的方法。An eighth aspect provides a chip for implementing any one of the above-mentioned first to second aspects or the method in each implementation manner thereof. Specifically, the chip includes: a processor, configured to call and run a computer program from a memory, so that the device installed with the chip executes any one of the above-mentioned first to second aspects or implementations thereof. method.
第九方面,提供了一种计算机可读存储介质,用于存储计算机程序,该计算机程序使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。A ninth aspect provides a computer-readable storage medium for storing a computer program that causes a computer to execute any one of the above-mentioned first to second aspects or the method in each implementation thereof.
第十方面,提供了一种计算机程序产品,包括计算机程序指令,该计算机程序指令使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。In a tenth aspect, a computer program product is provided, including computer program instructions, which enable a computer to execute any one of the above-mentioned first to second aspects or the methods in each implementation thereof.
第十一方面,提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面至第二方面中的任一方面或其各实现方式中的方法。An eleventh aspect provides a computer program that, when run on a computer, causes the computer to execute any one of the above-mentioned first to second aspects or the method in each implementation thereof.
第十二方面,提供了一种码流,该码流是通过上述第一方面中的任一方面或其各实现方式生成的。A twelfth aspect provides a code stream, which is generated by any one of the above-mentioned first aspects or implementations thereof.
基于以上技术方案,通过确定当前编码块所在的图像区域的连续性参数,连续性参数用于指示图像区域中像素点的变化连续性;根据图像区域的连续性参数,确定当前编码块的变换方式;根据变换方式,对当前编码块进行变换,得到当前编码块的变换系数。即本申请实施例,根据该连续性参数的大小,确定当前编码块的变换方式,例如若连续性参数较小,说明该图像区域的信号能量不集中时,可以使用默认的第一变换方式作为当前编码块的变换方式,而跳过从多个变换方式中选择最优变换方式的操作,以节省不必要的计算开销,提高编码效率。Based on the above technical solution, by determining the continuity parameter of the image area where the current coding block is located, the continuity parameter is used to indicate the continuity of changes in the pixels in the image area; according to the continuity parameter of the image area, the transformation method of the current coding block is determined ; According to the transformation method, transform the current coding block to obtain the transformation coefficient of the current coding block. That is, in this embodiment of the present application, the transformation method of the current coding block is determined according to the size of the continuity parameter. For example, if the continuity parameter is small, indicating that the signal energy in the image area is not concentrated, the default first transformation method can be used as The transformation method of the current coding block, and skips the operation of selecting the optimal transformation method from multiple transformation methods to save unnecessary computing overhead and improve coding efficiency.
附图说明Description of the drawings
图1为本申请实施例涉及的一种视频编解码系统的示意性框图;Figure 1 is a schematic block diagram of a video encoding and decoding system related to an embodiment of the present application;
图2是本申请实施例涉及的视频编码器的示意性框图;Figure 2 is a schematic block diagram of a video encoder involved in an embodiment of the present application;
图3是本申请实施例涉及的视频解码器的示意性框图;Figure 3 is a schematic block diagram of a video decoder involved in an embodiment of the present application;
图4为本申请一实施例提供的图像编码方法流程示意图;Figure 4 is a schematic flow chart of an image encoding method provided by an embodiment of the present application;
图5为本申请一实施例提供的图像编码方法流程示意图;Figure 5 is a schematic flow chart of an image encoding method provided by an embodiment of the present application;
图6为本申请一实施例提供的视频解码方法流程示意图;Figure 6 is a schematic flow chart of a video decoding method provided by an embodiment of the present application;
图7为本申请一实施例提供的图像解码方法流程示意图;Figure 7 is a schematic flow chart of an image decoding method provided by an embodiment of the present application;
图8是本申请一实施例提供的图像编码装置的示意性框图;Figure 8 is a schematic block diagram of an image encoding device provided by an embodiment of the present application;
图9是本申请一实施例提供的图像解码装置的示意性框图;Figure 9 is a schematic block diagram of an image decoding device provided by an embodiment of the present application;
图10是本申请实施例提供的电子设备的示意性框图;Figure 10 is a schematic block diagram of an electronic device provided by an embodiment of the present application;
图11是本申请实施例提供的视频编解码系统的示意性框图。Figure 11 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
具体实施方式Detailed ways
本申请可应用于图像编解码领域、视频编解码领域、硬件视频编解码领域、专用电路视频编解码领域、实时视频编解码领域等。例如,本申请的方案可结合至音视频编码标准(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)扩展。应理解,本申请的技术不限于任何特定编解码标准或技术。This application can be applied to the fields of image encoding and decoding, video encoding and decoding, hardware video encoding and decoding, dedicated circuit video encoding and decoding, real-time video encoding and decoding, etc. For example, the solution of this application can be combined with the audio and video coding standard (AVS for short), such as H.264/audio video coding (AVC for short) standard, H.265/high-efficiency video coding (AVS for short) high efficiency video coding (HEVC) standard and H.266/versatile video coding (VVC) standard. Alternatively, the solution of this application can be operated in conjunction with other proprietary or industry standards, including ITU-TH.261, ISO/IECMPEG-1Visual, ITU-TH.262 or ISO/IECMPEG-2Visual, ITU-TH.263 , ISO/IECMPEG-4Visual, ITU-TH.264 (also known as ISO/IECMPEG-4AVC), including scalable video codec (SVC) and multi-view video codec (MVC) extensions. It should be understood that the technology of this application is not limited to any specific codec standard or technology.
为了便于理解,首先结合图1对本申请实施例涉及的视频编解码系统进行介绍。For ease of understanding, the video encoding and decoding system involved in the embodiment of the present application is first introduced with reference to FIG. 1 .
图1为本申请实施例涉及的一种视频编解码系统的示意性框图。需要说明的是,图1只是一种示例,本申请实施例的视频编解码系统包括但不限于图1所示。如图1所示,该视频编解码系统100包含编码设备110和解码设备120。其中编码设备用于对视频数据进行编码(可以理解成压缩)产生码流,并将码流传输给解码设备。解码设备对编码设备编码产生的码流进行解码,得到解码后的视频数据。Figure 1 is a schematic block diagram of a video encoding and decoding system related to an embodiment of the present application. It should be noted that Figure 1 is only an example, and the video encoding and decoding system in the embodiment of the present application includes but is not limited to what is shown in Figure 1 . As shown in FIG. 1 , the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120 . The encoding device is used to encode the video data (which can be understood as compression) to generate a code stream, and transmit the code stream to the decoding device. The decoding device decodes the code stream generated by the encoding device to obtain decoded video data.
本申请实施例的编码设备110可以理解为具有视频编码功能的设备,解码设备120可以理解为具有视频解码功能的设备,即本申请实施例对编码设备110和解码设备120包括更广泛的装置,例如包含智能手机、台式计算机、移动计算装置、笔记本(例如,膝上型)计算机、平板计算机、机顶盒、电视、相机、显示装置、数字媒体播放器、视频游戏控制台、车载计算机等。The encoding device 110 in the embodiment of the present application can be understood as a device with a video encoding function, and the decoding device 120 can be understood as a device with a video decoding function. That is, the embodiment of the present application includes a wider range of devices for the encoding device 110 and the decoding device 120. Examples include smartphones, desktop computers, mobile computing devices, notebook (eg, laptop) computers, tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, vehicle-mounted computers, and the like.
在一些实施例中,编码设备110可以经由信道130将编码后的视频数据(如码流)传输给解码设备120。信道130可以包括能够将编码后的视频数据从编码设备110传输到解码设备120的一个或多个媒体和/或装置。In some embodiments, the encoding device 110 may transmit the encoded video data (eg, code stream) to the decoding device 120 via the channel 130 . Channel 130 may include one or more media and/or devices capable of transmitting encoded video data from encoding device 110 to decoding device 120 .
在一个实例中,信道130包括使编码设备110能够实时地将编码后的视频数据直接发射到解码设备120的一个或多个通信媒体。在此实例中,编码设备110可根据通信标准来调制编码后的视频数据,且将调制后的视频数据发射到解码设备120。其中通信媒体包含无线通信媒体,例如射频频谱,可选的,通信媒体还可以包含有线通信媒体,例如一根或多根物理传输线。In one example, 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. In this example, encoding device 110 may modulate the encoded video data according to the communication standard and transmit the modulated video data to decoding device 120. The communication media includes wireless communication media, such as radio frequency spectrum. Optionally, the communication media may also include wired communication media, such as one or more physical transmission lines.
在另一实例中,信道130包括存储介质,该存储介质可以存储编码设备110编码后的视频数据。存储介质包含多种本地存取式数据存储介质,例如光盘、DVD、快闪存储器等。在该实例中,解码设备120可从该存储介质中获取编码后的视频数据。In another example, channel 130 includes a storage medium that can store video data encoded by encoding device 110 . Storage media include a variety of local access data storage media, such as optical disks, DVDs, flash memories, etc. In this example, the decoding device 120 may obtain the encoded video data from the storage medium.
在另一实例中,信道130可包含存储服务器,该存储服务器可以存储编码设备110编码后的视频数据。在此实例中,解码设备120可以从该存储服务器中下载存储的编码后的视频数据。可选的,该存储服务器可以存储编码后的视频数据且可以将该编码后的视频数据发射到解码设备120,例如web服务器(例如,用于网站)、文件传送协议(FTP)服务器等。In another example, channel 130 may include a storage server that may store video data encoded by encoding device 110 . In this example, the decoding device 120 may download the stored encoded video data from the storage server. Optionally, the storage server may store the encoded video data and may transmit the encoded video data to the decoding device 120, such as a web server (eg, for a website), a File Transfer Protocol (FTP) server, etc.
一些实施例中,编码设备110包含视频编码器112及输出接口113。其中,输出接口113可以包含调制器/解调器(调制解调器)和/或发射器。In some embodiments, the encoding device 110 includes a video encoder 112 and an output interface 113. Among other things, the output interface 113 may include a modulator/demodulator (modem) and/or a transmitter.
在一些实施例中,编码设备110除了包括视频编码器112和输入接口113外,还可以包括视频源111。In some embodiments, the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113 .
视频源111可包含视频采集装置(例如,视频相机)、视频存档、视频输入接口、计算机图形系统中的至少一个,其中,视频输入接口用于从视频内容提供者处接收视频数据,计算机图形系统用于产生视频数据。Video source 111 may include at least one of a video capture device (eg, a video camera), a video archive, a video input interface for receiving video data from a video content provider, a computer graphics system Used to generate video data.
视频编码器112对来自视频源111的视频数据进行编码,产生码流。视频数据可包括一个或多个图像(picture)或图像序列(sequence of pictures)。码流以比特流的形式包含了图像或图像序列的编码信息。编码信息可以包含编码图像数据及相关联数据。相关联数据可包含序列参数集(sequence parameter set,简称SPS)、图像参数集(picture parameter set,简称PPS)及其它语法结构。SPS可含有应用于一个或多个序列的参数。PPS可含有应用于一个或多个图像的参数。语法结构是指码流中以指定次序排列的零个或多个语法元素的集合。The video encoder 112 encodes the video data from the video source 111 to generate a code stream. Video data may include one or more images (pictures) or sequence of pictures (sequence of pictures). The code stream contains the encoding information of an image or image sequence in the form of a bit stream. Encoded information may include encoded image data and associated data. The associated data may include sequence parameter set (SPS), picture parameter set (PPS) and other syntax structures. An SPS can contain parameters that apply to one or more sequences. A PPS can contain parameters that apply to one or more images. A syntax structure refers to a collection of zero or more syntax elements arranged in a specified order in a code stream.
视频编码器112经由输出接口113将编码后的视频数据直接传输到解码设备120。编码后的视频数据还可存储于存储介质或存储服务器上,以供解码设备120后续读取。The video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113 . The encoded video data can also be stored on a storage medium or storage server for subsequent reading by the decoding device 120 .
在一些实施例中,解码设备120包含输入接口121和视频解码器122。In some embodiments, decoding device 120 includes input interface 121 and video decoder 122.
在一些实施例中,解码设备120除包括输入接口121和视频解码器122外,还可以包括显示装置123。In some embodiments, in addition to the input interface 121 and the video decoder 122, the decoding device 120 may also include a display device 123.
其中,输入接口121包含接收器及/或调制解调器。输入接口121可通过信道130接收编码后的视频数据。The input interface 121 includes a receiver and/or a modem. Input interface 121 may receive encoded video data over channel 130.
视频解码器122用于对编码后的视频数据进行解码,得到解码后的视频数据,并将解码后的视频数据传输至显示装置123。The video decoder 122 is used to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123 .
显示装置123显示解码后的视频数据。显示装置123可与解码设备120整合或在解码设备120外部。显示装置123可包括多种显示装置,例如液晶显示器(LCD)、等离子体显示器、有机发光二极管(OLED)显示器或其它类型的显示装置。The display device 123 displays the decoded video data. Display device 123 may be integrated with decoding device 120 or external to decoding device 120 . Display device 123 may include a variety of display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.
此外,图1仅为实例,本申请实施例的技术方案不限于图1,例如本申请的技术还可以应用于单侧的视频编码或 单侧的视频解码。In addition, Figure 1 is only an example, and the technical solutions of the embodiments of the present application are not limited to Figure 1. For example, the technology of the present application can also be applied to unilateral video encoding or unilateral video decoding.
下面对本申请实施例涉及的视频编码框架进行介绍。The video coding framework involved in the embodiments of this application is introduced below.
图2是本申请实施例涉及的视频编码器的示意性框图。应理解,该视频编码器200可用于对图像进行有损压缩(lossy compression),也可用于对图像进行无损压缩(lossless compression)。该无损压缩可以是视觉无损压缩(visually lossless compression),也可以是数学无损压缩(mathematically lossless compression)。Figure 2 is a schematic block diagram of a video encoder related to an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression of images (lossy compression), or can also be used to perform lossless compression (lossless compression) of images. The lossless compression can be visually lossless compression (visually lossless compression) or mathematically lossless compression (mathematically lossless compression).
该视频编码器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)。The video encoder 200 can be applied to image data in a luminance-chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2 or 4:4:4, Y represents brightness (Luma), Cb(U) represents blue chroma, Cr(V) represents red chroma, U and V represent Chroma, which is used to describe color and saturation. For example, in the color format, 4:2:0 means that every 4 pixels have 4 luminance components and 2 chrominance components (YYYYCbCr), 4:2:2 means that every 4 pixels have 4 luminance components and 4 Chroma component (YYYYCbCrCbCr), 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr).
例如,该视频编码器200读取视频数据,针对视频数据中的每帧图像,将一帧图像划分成若干个编码树单元(coding tree unit,CTU),在一些例子中,CTB可被称作“树型块”、“最大编码单元”(Largest Coding unit,简称LCU)或“编码树型块”(coding tree block,简称CTB)。每一个CTU可以与图像内的具有相等大小的像素块相关联。每一像素可对应一个亮度(luminance或luma)采样及两个色度(chrominance或chroma)采样。因此,每一个CTU可与一个亮度采样块及两个色度采样块相关联。一个CTU大小例如为128×128、64×64、32×32等。一个CTU又可以继续被划分成若干个编码单元(Coding Unit,CU)进行编码,CU可以为矩形块也可以为方形块。CU可以进一步划分为预测单元(prediction Unit,简称PU)和变换单元(transform unit,简称TU),进而使得编码、预测、变换分离,处理的时候更灵活。在一种示例中,CTU以四叉树方式划分为CU,CU以四叉树方式划分为TU、PU。For example, the video encoder 200 reads video data, and for each frame of image in the video data, divides one frame of image into several coding tree units (coding tree units, CTU). In some examples, CTB may be called "Tree block", "Largest Coding unit" (LCU for short) or "coding tree block" (CTB for short). Each CTU can be associated with an equal-sized block of pixels within the image. Each pixel can correspond to one luminance (luminance or luma) sample and two chrominance (chrominance or chroma) samples. Therefore, each CTU can be associated with one block of luma samples and two blocks of chroma samples. A CTU size is, for example, 128×128, 64×64, 32×32, etc. A CTU can be further divided into several coding units (Coding Units, CUs) for encoding. CUs can be rectangular blocks or square blocks. CU can be further divided into prediction unit (PU for short) and transform unit (TU for short), thus enabling coding, prediction, and transformation to be separated and processing more flexible. In an example, the CTU is divided into CUs in a quad-tree manner, and the CU is divided into TUs and PUs in a quad-tree manner.
视频编码器及视频解码器可支持各种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以用于帧间预测。Video encoders and video decoders can support various PU sizes. Assuming that the size of a specific CU is 2N×2N, the video encoder and video decoder can support a PU size of 2N×2N or N×N for intra prediction, and support 2N×2N, 2N×N, N×2N, N×N or similar sized symmetric PU for inter prediction. The video encoder and video decoder can also support 2N×nU, 2N×nD, nL×2N and nR×2N asymmetric PUs for inter prediction.
在一些实施例中,如图2所示,该视频编码器200可包括:预测单元210、残差单元220、变换/量化单元230、反变换/量化单元240、重建单元250、环路滤波单元260、解码图像缓存270和熵编码单元280。需要说明的是,视频编码器200可包含更多、更少或不同的功能组件。In some embodiments, as shown in Figure 2, the video encoder 200 may include: a prediction unit 210, a residual unit 220, a transform/quantization unit 230, an inverse transform/quantization unit 240, a reconstruction unit 250, and a loop filter unit. 260. Decode the image cache 270 and the entropy encoding unit 280. It should be noted that the video encoder 200 may include more, less, or different functional components.
可选的,在本申请中,当前块(current block)可以称为当前编码单元(CU)或当前预测单元(PU)等。预测块也可称为预测图像块或图像预测块,重建图像块也可称为重建块或图像重建图像块。Optionally, in this application, the current block (current block) may be called the current coding unit (CU) or the current prediction unit (PU), etc. The prediction block may also be called a predicted image block or an image prediction block, and the reconstructed image block may also be called a reconstruction block or an image reconstructed image block.
在一些实施例中,预测单元210包括帧间预测单元211和帧内估计单元212。由于视频的一个帧中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。由于视频中的相邻帧之间存在着很强的相似性,在视频编解码技术中使用帧间预测方法消除相邻帧之间的时间冗余,从而提高编码效率。In some embodiments, prediction unit 210 includes inter prediction unit 211 and intra estimation unit 212. Since there is a strong correlation between adjacent pixels in a video frame, the intra-frame prediction method is used in video encoding and decoding technology to eliminate the spatial redundancy between adjacent pixels. Since there is a strong similarity between adjacent frames in the video, the interframe prediction method is used in video coding and decoding technology to eliminate the temporal redundancy between adjacent frames, thereby improving coding efficiency.
帧间预测单元211可用于帧间预测,帧间预测可以包括运动估计(motion estimation)和运动补偿(motion compensation),可以参考不同帧的图像信息,帧间预测使用运动信息从参考帧中找到参考块,根据参考块生成预测块,用于消除时间冗余;帧间预测所使用的帧可以为P帧和/或B帧,P帧指的是向前预测帧,B帧指的是双向预测帧。帧间预测使用运动信息从参考帧中找到参考块,根据参考块生成预测块。运动信息包括参考帧所在的参考帧列表,参考帧索引,以及运动矢量。运动矢量可以是整像素的或者是分像素的,如果运动矢量是分像素的,那么需要在参考帧中使用插值滤波做出所需的分像素的块,这里把根据运动矢量找到的参考帧中的整像素或者分像素的块叫参考块。有的技术会直接把参考块作为预测块,有的技术会在参考块的基础上再处理生成预测块。在参考块的基础上再处理生成预测块也可以理解为把参考块作为预测块然后再在预测块的基础上处理生成新的预测块。The inter-frame prediction unit 211 can be used for inter-frame prediction. Inter-frame prediction can include motion estimation (motion estimation) and motion compensation (motion compensation). It can refer to image information of different frames. Inter-frame prediction uses motion information to find a reference from a reference frame. block, a prediction block is generated based on the reference block to eliminate temporal redundancy; the frames used in inter-frame prediction can be P frames and/or B frames, P frames refer to forward prediction frames, and B frames refer to bidirectional predictions frame. Inter-frame prediction uses motion information to find reference blocks from reference frames and generate prediction blocks based on the reference blocks. The motion information includes the reference frame list where the reference frame is located, the reference frame index, and the motion vector. The motion vector can be in whole pixels or sub-pixels. If the motion vector is in sub-pixels, then interpolation filtering needs to be used in the reference frame to make the required sub-pixel blocks. Here, the reference frame found according to the motion vector is A block of whole pixels or sub-pixels is called a reference block. Some technologies will directly use the reference block as a prediction block, and some technologies will process the reference block to generate a prediction block. Reprocessing to generate a prediction block based on a reference block can also be understood as using the reference block as a prediction block and then processing to generate a new prediction block based on the prediction block.
帧内估计单元212只参考同一帧图像的信息,预测当前码图像块内的像素信息,用于消除空间冗余。帧内预测所使用的帧可以为I帧。The intra-frame estimation unit 212 only refers to the information of the same frame image and predicts the pixel information in the current coded image block to eliminate spatial redundancy. The frames used in intra prediction may be I frames.
帧内预测有多种预测模式,以国际数字视频编码标准H系列为例,H.264/AVC标准有8种角度预测模式和1种非角度预测模式,H.265/HEVC扩展到33种角度预测模式和2种非角度预测模式。HEVC使用的帧内预测模式有平面模式(Planar)、DC和33种角度模式,共35种预测模式。VVC使用的帧内模式有Planar、DC和65种角度模式,共67种预测模式。Intra-frame prediction has multiple prediction modes. Taking the international digital video coding standard H series as an example, the H.264/AVC standard has 8 angle prediction modes and 1 non-angle prediction mode, and H.265/HEVC has been extended to 33 angles. prediction mode and 2 non-angle prediction modes. The intra-frame prediction modes used by HEVC include planar mode (Planar), DC and 33 angle modes, for a total of 35 prediction modes. The intra-frame modes used by VVC include Planar, DC and 65 angle modes, for a total of 67 prediction modes.
需要说明的是,随着角度模式的增加,帧内预测将会更加精确,也更加符合对高清以及超高清数字视频发展的需求。It should be noted that with the increase of angle modes, intra-frame prediction will be more accurate and more in line with the development needs of high-definition and ultra-high-definition digital videos.
残差单元220可基于CU的像素块及PU的预测块来产生CU的残差块。举例来说,残差单元220可产生CU的残差块,使得残差块中的每一采样具有等于以下两者之间的差的值:CU的像素块中的采样,及CU的PU的预测块中的对应采样。 Residual unit 220 may generate a residual block of the CU based on the pixel block of the CU and the prediction block of the PU. For example, residual unit 220 may generate a residual block of a CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the PU of the CU. Predict the corresponding sample in the block.
变换/量化单元230可量化变换系数。变换/量化单元230可基于与CU相关联的量化参数(QP)值来量化与CU的TU相关联的变换系数。视频编码器200可通过调整与CU相关联的QP值来调整应用于与CU相关联的变换系数的量化程度。Transform/quantization unit 230 may quantize the transform coefficients. Transform/quantization unit 230 may quantize transform coefficients associated with the TU of the CU based on quantization parameter (QP) values associated with the CU. Video encoder 200 may adjust the degree of quantization applied to transform coefficients associated with the CU by adjusting the QP value associated with the CU.
反变换/量化单元240可分别将逆量化及逆变换应用于量化后的变换系数,以从量化后的变换系数重建残差块。Inverse transform/quantization unit 240 may apply inverse quantization and inverse transform to the quantized transform coefficients, respectively, to reconstruct the residual block from the quantized transform coefficients.
重建单元250可将重建后的残差块的采样加到预测单元210产生的一个或多个预测块的对应采样,以产生与TU相关联的重建图像块。通过此方式重建CU的每一个TU的采样块,视频编码器200可重建CU的像素块。 Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to produce a reconstructed image block associated with the TU. By reconstructing blocks of samples for each TU of a CU in this manner, video encoder 200 can reconstruct blocks of pixels of the CU.
环路滤波单元260用于对反变换与反量化后的像素进行处理,弥补失真信息,为后续编码像素提供更好的参考,例如可执行消块滤波操作以减少与CU相关联的像素块的块效应。The loop filtering unit 260 is used to process the inversely transformed and inversely quantized pixels to compensate for distortion information and provide a better reference for subsequent encoding of pixels. For example, a deblocking filtering operation can be performed to reduce the number of pixel blocks associated with the CU. block effect.
在一些实施例中,环路滤波单元260包括去块滤波单元和样点自适应补偿/自适应环路滤波(SAO/ALF)单元,其中去块滤波单元用于去方块效应,SAO/ALF单元用于去除振铃效应。In some embodiments, the loop filtering unit 260 includes a deblocking filtering unit and a sample adaptive compensation/adaptive loop filtering (SAO/ALF) unit, where the deblocking filtering unit is used to remove blocking effects, and the SAO/ALF unit Used to remove ringing effects.
解码图像缓存270可存储重建后的像素块。帧间预测单元211可使用含有重建后的像素块的参考图像来对其它图像的PU执行帧间预测。另外,帧内估计单元212可使用解码图像缓存270中的重建后的像素块来对在与CU相同的 图像中的其它PU执行帧内预测。Decoded image cache 270 may store reconstructed pixel blocks. Inter prediction unit 211 may perform inter prediction on PUs of other images using reference images containing reconstructed pixel blocks. Additionally, intra estimation unit 212 may use the reconstructed pixel blocks in decoded image cache 270 to perform intra prediction on other PUs in the same image as the CU.
熵编码单元280可接收来自变换/量化单元230的量化后的变换系数。熵编码单元280可对量化后的变换系数执行一个或多个熵编码操作以产生熵编码后的数据。 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.
图3是本申请实施例涉及的视频解码器的示意性框图。Figure 3 is a schematic block diagram of a video decoder related to an embodiment of the present application.
如图3所示,视频解码器300包含:熵解码单元310、预测单元320、反量化/变换单元330、重建单元340、环路滤波单元350及解码图像缓存360。需要说明的是,视频解码器300可包含更多、更少或不同的功能组件。As shown in FIG. 3 , the video decoder 300 includes an entropy decoding unit 310 , a prediction unit 320 , an inverse quantization/transformation unit 330 , a reconstruction unit 340 , a loop filtering unit 350 and a decoded image cache 360 . It should be noted that the video decoder 300 may include more, less, or different functional components.
视频解码器300可接收码流。熵解码单元310可解析码流以从码流提取语法元素。作为解析码流的一部分,熵解码单元310可解析码流中的经熵编码后的语法元素。预测单元320、反量化/变换单元330、重建单元340及环路滤波单元350可根据从码流中提取的语法元素来解码视频数据,即产生解码后的视频数据。Video decoder 300 can receive the code stream. Entropy decoding unit 310 may parse the codestream to extract syntax elements from the codestream. As part of parsing the code stream, the entropy decoding unit 310 may parse entropy-encoded syntax elements in the code stream. The prediction unit 320, the inverse quantization/transformation unit 330, the reconstruction unit 340 and the loop filtering unit 350 may decode the video data according to the syntax elements extracted from the code stream, that is, generate decoded video data.
在一些实施例中,预测单元320包括帧间预测单元321和帧内估计单元322。In some embodiments, prediction unit 320 includes inter prediction unit 321 and intra estimation unit 322.
帧内估计单元322可执行帧内预测以产生PU的预测块。帧内估计单元322可使用帧内预测模式以基于空间相邻PU的像素块来产生PU的预测块。帧内估计单元322还可根据从码流解析的一个或多个语法元素来确定PU的帧内预测模式。Intra estimation unit 322 may perform intra prediction to generate predicted blocks for the PU. Intra estimation unit 322 may use an intra prediction mode to generate predicted blocks for a PU based on pixel blocks of spatially neighboring PUs. Intra estimation unit 322 may also determine the intra prediction mode of the PU based on one or more syntax elements parsed from the codestream.
帧间预测单元321可根据从码流解析的语法元素来构造第一参考图像列表(列表0)及第二参考图像列表(列表1)。此外,如果PU使用帧间预测编码,则熵解码单元310可解析PU的运动信息。帧间预测单元321可根据PU的运动信息来确定PU的一个或多个参考块。帧间预测单元321可根据PU的一个或多个参考块来产生PU的预测块。The inter prediction unit 321 may construct a first reference image list (List 0) and a second reference image list (List 1) according to syntax elements parsed from the code stream. Additionally, if the PU uses inter-prediction encoding, entropy decoding unit 310 may parse the motion information of the PU. Inter prediction unit 321 may determine one or more reference blocks for the PU based on the motion information of the PU. Inter prediction unit 321 may generate a predictive block for the PU based on one or more reference blocks of the PU.
反量化/变换单元330可逆量化(即,解量化)与TU相关联的变换系数。反量化/变换单元330可使用与TU的CU相关联的QP值来确定量化程度。Inverse quantization/transform unit 330 may inversely quantize (ie, dequantize) transform coefficients associated with a TU. Inverse quantization/transform unit 330 may use the QP value associated with the CU of the TU to determine the degree of quantization.
在逆量化变换系数之后,反量化/变换单元330可将一个或多个逆变换应用于逆量化变换系数,以便产生与TU相关联的残差块。After inversely quantizing the transform coefficients, inverse quantization/transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients to produce a residual block associated with the TU.
重建单元340使用与CU的TU相关联的残差块及CU的PU的预测块以重建CU的像素块。例如,重建单元340可将残差块的采样加到预测块的对应采样以重建CU的像素块,得到重建图像块。 Reconstruction unit 340 uses the residual blocks associated with the TU of the CU and the prediction blocks of the PU of the CU to reconstruct the pixel blocks of the CU. For example, reconstruction unit 340 may add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.
环路滤波单元350可执行消块滤波操作以减少与CU相关联的像素块的块效应。Loop filtering unit 350 may perform deblocking filtering operations to reduce blocking artifacts for blocks of pixels associated with the CU.
视频解码器300可将CU的重建图像存储于解码图像缓存360中。视频解码器300可将解码图像缓存360中的重建图像作为参考图像用于后续预测,或者,将重建图像传输给显示装置呈现。Video decoder 300 may store the reconstructed image of the CU in decoded image cache 360 . The video decoder 300 may use the reconstructed image in the decoded image cache 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
视频编解码的基本流程如下:在编码端,将一帧图像划分成块,针对当前块,预测单元210使用帧内预测或帧间预测产生当前块的预测块。残差单元220可基于预测块与当前块的原始块计算残差块,即预测块和当前块的原始块的差值,该残差块也可称为残差信息。该残差块经由变换/量化单元230变换与量化等过程,可以去除人眼不敏感的信息,以消除视觉冗余。可选的,经过变换/量化单元230变换与量化之前的残差块可称为时域残差块,经过变换/量化单元230变换与量化之后的时域残差块可称为频率残差块或频域残差块。熵编码单元280接收到变化量化单元230输出的量化后的变化系数,可对该量化后的变化系数进行熵编码,输出码流。例如,熵编码单元280可根据目标上下文模型以及二进制码流的概率信息消除字符冗余。The basic process of video encoding and decoding is as follows: at the encoding end, an image frame is divided into blocks. For the current block, the prediction unit 210 uses intra prediction or inter prediction to generate a prediction block of the current block. The residual unit 220 may calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block. The residual block may also be called residual information. The residual block undergoes transformation and quantization processes such as transformation/quantization unit 230 to remove information that is insensitive to human eyes to eliminate visual redundancy. Optionally, the residual block before transformation and quantization by the transformation/quantization unit 230 may be called a time domain residual block, and the time domain residual block after transformation and quantization by the transformation/quantization unit 230 may be called a frequency residual block. or frequency domain residual block. The entropy encoding unit 280 receives the quantized change coefficient output from the change quantization unit 230, and may perform entropy encoding on the quantized change coefficient to output a code stream. For example, the entropy encoding unit 280 may eliminate character redundancy according to the target context model and probability information of the binary code stream.
在解码端,熵解码单元310可解析码流得到当前块的预测信息、量化系数矩阵等,预测单元320基于预测信息对当前块使用帧内预测或帧间预测产生当前块的预测块。反量化/变换单元330使用从码流得到的量化系数矩阵,对量化系数矩阵进行反量化、反变换得到残差块。重建单元340将预测块和残差块相加得到重建块。重建块组成重建图像,环路滤波单元350基于图像或基于块对重建图像进行环路滤波,得到解码图像。编码端同样需要和解码端类似的操作获得解码图像。该解码图像也可以称为重建图像,重建图像可以为后续的帧作为帧间预测的参考帧。At the decoding end, the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block. The prediction unit 320 uses intra prediction or inter prediction for the current block based on the prediction information to generate a prediction block of the current block. The inverse quantization/transform unit 330 uses the quantization coefficient matrix obtained from the code stream to perform inverse quantization and inverse transformation on the quantization coefficient matrix to obtain a residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstruction block. The reconstructed blocks constitute a reconstructed image, and the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image. The encoding end also needs similar operations as the decoding end to obtain the decoded image. The decoded image may also be called a reconstructed image, and the reconstructed image may be used as a reference frame for inter-frame prediction for subsequent frames.
需要说明的是,编码端确定的块划分信息,以及预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息等在必要时携带在码流中。解码端通过解析码流及根据已有信息进行分析确定与编码端相同的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息,从而保证编码端获得的解码图像和解码端获得的解码图像相同。It should be noted that the block division information determined by the encoding end, as well as mode information or parameter information such as prediction, transformation, quantization, entropy coding, loop filtering, etc., are carried in the code stream when necessary. The decoding end determines the same block division information as the encoding end by parsing the code stream and analyzing the existing information, prediction, transformation, quantization, entropy coding, loop filtering and other mode information or parameter information, thereby ensuring the decoded image obtained by the encoding end It is the same as the decoded image obtained by the decoding end.
当前块(current block)可以是当前编码单元(CU)或当前预测单元(PU)等。The current block can be the current coding unit (CU) or the current prediction unit (PU), etc.
上述是基于块的混合编码框架下的视频编解码器的基本流程,随着技术的发展,该框架或流程的一些模块或步骤可能会被优化,本申请适用于该基于块的混合编码框架下的视频编解码器的基本流程,但不限于该框架及流程。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 is not limited to this framework and process.
由上述可知编码时,通用的混合编码框架会先进行预测,预测利用空间或者时间上的相关性能得到一个跟当前块相同或相似的图像。对一个块来说,预测块和当前块是完全相同的情况是有可能出现的,但是很难保证一个视频中的所有块都如此,特别是对自然视频,或者说相机拍摄的视频,因为有噪音的存在。而且视频中不规则的运动,扭曲形变,遮挡,亮度等的变化,很难被完全预测。所以混合编码框架会将当前块的原始图像减去预测图像得到残差图像,或者说当前块减去预测块得到残差块。残差块通常要比原始图像简单很多,因而预测可以显著提升压缩效率。对残差块也不是直接进行编码,而是通常先进行变换。变换是把残差图像从空间域变换到频率域,去除残差图像的相关性。残差图像变换到频率域以后,由于能量大多集中在低频区域,变换后的非零系数大多集中在左上角。接下来利用量化来进一步压缩。而且由于人眼对高频不敏感,高频区域可以使用更大的量化步长。It can be seen from the above that when encoding, the general hybrid coding framework will first perform prediction, and the prediction uses the correlation performance in space or time to obtain an image that is the same or similar to the current block. For a block, it is possible that the predicted block and the current block are exactly the same, but it is difficult to guarantee that this is true for all blocks in a video, especially for natural videos, or videos captured by cameras, because there are The presence of noise. Moreover, irregular motion, distortion, occlusion, brightness, etc. changes in the video are difficult to completely predict. Therefore, the hybrid coding framework will subtract the predicted image from the original image of the current block to obtain the residual image, or the current block minus the predicted block will obtain the residual block. Residual blocks are usually much simpler than the original image, so prediction can significantly improve compression efficiency. The residual block is not directly encoded, but is usually transformed first. Transformation is to transform the residual image from the spatial domain to the frequency domain and remove the correlation of the residual image. After the residual image is transformed into the frequency domain, since the energy is mostly concentrated in the low-frequency region, most of the transformed non-zero coefficients are concentrated in the upper left corner. Next, quantization is used for further compression. And since the human eye is not sensitive to high frequencies, a larger quantization step size can be used in high-frequency areas.
原始图像经过离散余弦变换(Discrete Cosine Transform,简称DCT)后,在左上角区域存在非零系数。After the original image undergoes Discrete Cosine Transform (DCT), there are non-zero coefficients in the upper left corner area.
目前常见的变换方式为DCT-II,但是对于一些图像内容,DCT-II无法实现最优变换,因此设计多个变换核,对不同的图像块自适应地选择最优变换核,更逼近理论最优变换的性能。The current common transformation method is DCT-II. However, for some image contents, DCT-II cannot achieve optimal transformation. Therefore, multiple transformation kernels are designed to adaptively select the optimal transformation kernel for different image blocks, which is closer to the theoretical optimum. Excellent transformation performance.
多变换核选择(Multiple Transform Selection,简称MTS)技术,是VVC中新增加的一种变换技术。除了HEVC中的DCT-II变换,VVC引进了两种新的变换方式离散正弦变换DST-VII和DCT-VIII,帧内帧间编码块从这三种变换方式中进行选择,下表1为变换方式的基础函数:Multiple Transform Selection (MTS) technology is a newly added transformation technology in VVC. In addition to the DCT-II transform in HEVC, VVC introduces two new transform methods, discrete sine transform DST-VII and DCT-VIII. Intra-frame and inter-frame coding blocks can choose from these three transform methods. Table 1 below shows the transform Basic functions of the method:
表1Table 1
Figure PCTCN2022080706-appb-000001
Figure PCTCN2022080706-appb-000001
其中,上述表1中,N为原始信号的点数,ω 0为补偿系数, Among them, in the above Table 1, N is the number of points of the original signal, ω 0 is the compensation coefficient,
由于图像都是2维的,而直接进行二维的变换运算量和内存开销都是当时硬件条件所不能接受的,因而在标准中使用上述DCT-II,DCT-VIII,DST-VII进行变换时,均是拆分成水平方向和竖直方向,进行两步一维变换。如先进行水平方向的变换再进行竖直方向的变换,或者先进行竖直方向的变换再进行水平方向的变换。Since the images are all 2-dimensional, the amount of computation and memory overhead of directly performing two-dimensional transformation were unacceptable to the hardware conditions at the time. Therefore, when using the above-mentioned DCT-II, DCT-VIII, and DST-VII in the standard for transformation, , both are split into horizontal and vertical directions, and a two-step one-dimensional transformation is performed. For example, perform horizontal transformation first and then vertical transformation, or perform vertical transformation first and then horizontal transformation.
为了控制MTS的复杂度,分别在帧内和帧间的图像序列级(SPS level)对是否使用MTS进行标记,若SPS level标记表示可以使用MTS,则每个CU也有一个Flag标记当前CU是否使用MTS。MTS在CU级别的flag只有在满足以下两种情况时才会存在:In order to control the complexity of MTS, whether to use MTS is marked at the image sequence level (SPS level) within the frame and between frames. If the SPS level mark indicates that MTS can be used, each CU also has a Flag to mark whether the current CU uses it. MTS. The flag of MTS at the CU level will only exist when the following two conditions are met:
1)长和宽都小于等于32;1) Both length and width are less than or equal to 32;
2)当前TU是非变换跳过模式;2) The current TU is in non-transform skip mode;
需要指出的是,MTS仅仅适用于亮度分量。It should be pointed out that MTS only applies to the brightness component.
当CU级别的MTS存在时,变换流程大致分为三步:When CU-level MTS exists, the transformation process is roughly divided into three steps:
(1)对当前CU使用DCT-II变换,计算其率失真代价RD1。(1) Use DCT-II transformation on the current CU to calculate its rate distortion cost RD1.
(2)对当前CU使用新变换,变换方式从DST-VII和DCT-VIII组合构成的候选集中选取,候选集如下表2所示,计算率失真代价RD2,RD3….(2) Use a new transformation for the current CU. The transformation method is selected from the candidate set composed of the combination of DST-VII and DCT-VIII. The candidate set is shown in Table 2 below, and the rate distortion costs RD2, RD3... are calculated.
表2Table 2
Figure PCTCN2022080706-appb-000002
Figure PCTCN2022080706-appb-000002
(3)选择使率失真代价最小的变换作为当前CU的最终变换方式。(3) Select the transformation that minimizes rate distortion cost as the final transformation method of the current CU.
一种使用MTS的编码器的实施方法如下。首先,输入图像被划分成不重叠的多个CTU块。然后,按照光栅扫描顺序依次处理每个CTU,根据预测代价将CTU按照划分成若干个CU,确定每个CU最优变换方式的大致步骤如下:(1)若当前CU的MTS flag=0,则直接选取DCT-II作为当前CU的变换方式;(2)否则,先对当前CU使用DCT-II变换,计算其率失真代价RDCostTmp1,再选取表2中的候选变换方式对当前CU进行变换,选出率失真代价最小的变换方式MTOpt,率失真代价为RDCostTmp2。(3)比较RDCostTmp1和RDCostTmp2,选择代价较小的变换作为当前CU的变换方式。最后,按照最优的块划分方式对残差块进行变换、量化、熵编码,并对块划分模式等预测信息进行编码,输出码流等待传输。An implementation of an encoder using MTS is as follows. First, the input image is divided into multiple non-overlapping CTU blocks. Then, each CTU is processed in sequence according to the raster scanning order, and the CTU is divided into several CUs according to the prediction cost. The general steps to determine the optimal transformation method for each CU are as follows: (1) If the MTS flag of the current CU=0, then Directly select DCT-II as the transformation method of the current CU; (2) Otherwise, first use DCT-II transformation on the current CU, calculate its rate distortion cost RDCostTmp1, and then select the candidate transformation method in Table 2 to transform the current CU, select The transformation method with the smallest rate distortion cost is MTOpt, and the rate distortion cost is RDCostTmp2. (3) Compare RDCostTmp1 and RDCostTmp2, and select the transformation with less cost as the transformation method of the current CU. Finally, the residual block is transformed, quantized, and entropy encoded according to the optimal block division method, and the prediction information such as the block division mode is encoded, and the output code stream is waiting for transmission.
一种使用MTS的解码器的实施方法如下。首先,输入码流进行熵解码,反量化,反变换,其中,反变换过程主要包含以下步骤:(1)先根据sps_mts_enabled_flag等码流信息导出变换类型trType。(2)根据变换类型trType和CU尺寸导出变换矩阵transMatrix。(3)利用变换矩阵transMatrix和变换系数计算反变换值,从而得到预测残差值,根据残差块重建图像。最后,将重建图像送入DBF/SAO/ALF滤波器,滤波后的图像送入缓冲区,等待视频播放。An implementation of a decoder using MTS is as follows. First, the input code stream undergoes entropy decoding, inverse quantization, and inverse transformation. The inverse transformation process mainly includes the following steps: (1) First, derive the transformation type trType based on code stream information such as sps_mts_enabled_flag. (2) Derive the transformation matrix transMatrix according to the transformation type trType and CU size. (3) Use the transformation matrix transMatrix and the transformation coefficient to calculate the inverse transformation value to obtain the prediction residual value, and reconstruct the image based on the residual block. Finally, the reconstructed image is sent to the DBF/SAO/ALF filter, and the filtered image is sent to the buffer to wait for video playback.
由上述可知,MTS技术虽然可以为图像块选择最优的变换核,但是在选择变换核的时候需要多次计算率失真代价,因此需要增加大量的计算开销。It can be seen from the above that although MTS technology can select the optimal transformation kernel for an image block, it requires multiple calculations of the rate-distortion cost when selecting the transformation kernel, so it requires a large amount of calculation overhead.
另一方面,MTS本质是选择DCT的变形体(DCT-VIII、DST-VII)进行变换,而保证DCT有效性的前提是图像块的信号能量具有集中性,才能在DCT变换后将高频分量集中在左上角,右下角大部分区域都是低频分量。换句话说,只要对于信号能量集中的图像,DCT变换才能取得较好的压缩性能。反之,当信号能量不集中时,DCT变换性能就较差,那么差中选优所带来的性能增益就很有限。On the other hand, the essence of MTS is to select the deformation body of DCT (DCT-VIII, DST-VII) for transformation. The premise to ensure the effectiveness of DCT is that the signal energy of the image block is concentrated, so that the high-frequency components can be transformed after DCT transformation. Concentrated in the upper left corner, most areas in the lower right corner are low-frequency components. In other words, only for images with concentrated signal energy, DCT transformation can achieve better compression performance. On the contrary, when the signal energy is not concentrated, the DCT transformation performance is poor, so the performance gain brought by choosing the best among the poor is very limited.
因此,在编码信号能量不集中的视频图像时,MTS技术计算很可能会产生大量不必要的开销,浪费计算资源,增加编码时间。Therefore, when encoding video images whose signal energy is not concentrated, MTS technology calculations are likely to generate a lot of unnecessary overhead, waste computing resources, and increase encoding time.
为了解决上述技术问题,本申请实施例首先确定当前编码块所在的图像区域的连续性参数,该连续性参数用于指示图像区域中像素点的变化连续性,其中像素点的变化连续性也可以理解为像素点的相关性。由于图像区域的连续性差,说明信号能量不集中,采用DCT变换效果差,此时,无需花费大量计算资源从多个变换方式中选择最优变换方式。基于此,本申请实施例根据图像区域的连续性参数,来确定当前编码块的变换方式,例如,图像区域的连续性参数较小,表示该图像区域的信号能量不集中时,直接采用DTC-Ⅱ方式进行变换,无需从多个变换方式中选择最优变换方式进行变换,进而避免不必要的计算开销,提高编码速度。In order to solve the above technical problem, the embodiment of the present application first determines the continuity parameter of the image area where the current coding block is located. The continuity parameter is used to indicate the continuity of changes in pixels in the image area, where the continuity of changes in pixels can also be Understood as the correlation of pixels. Due to the poor continuity of the image area, it means that the signal energy is not concentrated, and the DCT transformation effect is poor. At this time, there is no need to spend a lot of computing resources to select the optimal transformation method from multiple transformation methods. Based on this, the embodiment of the present application determines the transformation method of the current coding block according to the continuity parameter of the image area. For example, if the continuity parameter of the image area is small, indicating that the signal energy of the image area is not concentrated, DTC- II method for transformation, there is no need to select the optimal transformation method from multiple transformation methods for transformation, thus avoiding unnecessary calculation overhead and improving coding speed.
下面结合具体的实施例,对本申请实施例提供的图像编解码方法进行介绍。The image encoding and decoding method provided by the embodiment of the present application will be introduced below with reference to specific embodiments.
首先结合图4,以编码端为例,对本申请实施例提供的视频编码方法进行介绍。First, with reference to Figure 4, the video encoding method provided by the embodiment of the present application is introduced, taking the encoding end as an example.
图4为本申请一实施例提供的图像编码方法流程示意图,本申请实施例应用于图1和图2所示视频编码器。FIG. 4 is a schematic flowchart of an image encoding method provided by an embodiment of the present application. The embodiment of the present application is applied to the video encoder shown in FIGS. 1 and 2 .
如图4所示,本申请实施例的方法包括:As shown in Figure 4, the method in the embodiment of this application includes:
S401、确定当前编码块所在的图像区域的连续性参数。S401. Determine the continuity parameter of the image area where the current coding block is located.
该连续性参数用于指示图像区域中像素点的变化连续性。This continuity parameter is used to indicate the continuity of changes in pixels in the image area.
在图像编码过程中,编码器接收视频流,该视频流由一系列图像帧组成,针对视频流中的每一帧图像进行视频编码,视频编码器对图像帧进行块划分,得到当前编码块。During the image encoding process, the encoder receives a video stream, which is composed of a series of image frames, and performs video encoding on each frame of image in the video stream. The video encoder divides the image frames into blocks to obtain the current encoding block.
在一些实施例中,当前编码块也称为当前块、当前图像块、编码块、当前编码单元、当前待编码块、当前待编码的图像块等。In some embodiments, the current coding block is also called a current block, a current image block, a coding block, a current coding unit, a current block to be coded, a current image block to be coded, etc.
在块划分时,传统方法划分后的块既包含了当前编码块位置的色度分量,又包含了当前编码块位置的亮度分量。而分离树技术(dual tree)可以划分单独分量块,例如单独的亮度块和单独的色度块,其中亮度块可以理解为只包含当前编码块位置的亮度分量,色度块理解为只包含当前编码块位置的色度分量。这样相同位置的亮度分量和色度分量可以属于不同的块,划分可以有更大的灵活性。如果分离树用在CU划分中,那么有的CU既包含亮度分量又包含色度分量,有的CU只包含亮度分量,有的CU只包含色度分量。When dividing blocks, the blocks divided by the traditional method contain both the chrominance component of the current coding block position and the luminance component of the current coding block position. The separation tree technology (dual tree) can be divided into separate component blocks, such as separate brightness blocks and separate chroma blocks. The brightness block can be understood as containing only the brightness component of the current coding block position, and the chroma block can be understood as containing only the current coding block position. Encode the chroma component of the block position. In this way, luminance components and chrominance components at the same position can belong to different blocks, and the division can be more flexible. If the separation tree is used in CU partitioning, then some CUs contain both luminance and chrominance components, some CUs only contain luminance components, and some CUs only contain chrominance components.
在一些实施例中,本申请实施例的当前编码块只包括色度分量,可以理解为色度块。In some embodiments, the current coding block in the embodiment of the present application only includes chrominance components, which can be understood as chrominance blocks.
在一些实施例中,本申请实施例的当前编码块只包括亮度分量,可以理解为亮度块。In some embodiments, the current coding block in the embodiment of the present application only includes the luminance component, which can be understood as a luminance block.
在一些实施例中,该当前编码块即包括亮度分量又包括色度分量。In some embodiments, the current coding block includes both luma and chrominance components.
本申请实施例的编码过程为,对当前图像帧进行块划分,得到当前编码块,采用帧内或帧间预测方法,对当前编码块进行预测,得到当前编码块的预测值。当前编码块的原始值与预测值相减,得到当前编码块的残差值。确定当前编码块对应的变换方式,使用该变换方式对残差值进行变换,得到变换系数。可选的,对变换系数进行量化,并将量化后的变换系数进行编码,得到码流。The encoding process in this embodiment of the present application is to divide the current image frame into blocks to obtain the current coding block, and use the intra-frame or inter-frame prediction method to predict the current coding block to obtain the prediction value of the current coding block. The original value of the current coding block is subtracted from the predicted value to obtain the residual value of the current coding block. Determine the transformation method corresponding to the current coding block, use this transformation method to transform the residual value, and obtain the transformation coefficient. Optionally, the transform coefficients are quantized, and the quantized transform coefficients are encoded to obtain a code stream.
本申请实施例涉及的上述编码过程中的变换过程。The embodiment of the present application involves the transformation process in the above encoding process.
由上述描述可知,从多个变换方式中自适应选择当前编码块最优的变换方式,可以提高变换效果。但是,对于信号能量不集中的图像,变换带来的压缩效果较差。此时,从多个变换方式中自适应选择当前编码块最优的变换方式,对这些信号能量不集中的图像进行变换,不仅压缩效果不显著,且产生不必要的计算开销,增加编码时间。It can be seen from the above description that adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods can improve the transformation effect. However, for images where the signal energy is not concentrated, the compression effect brought by the transformation is poor. At this time, adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods to transform these images whose signal energy is not concentrated not only has an insignificant compression effect, but also generates unnecessary computational overhead and increases encoding time.
因此,本申请实施例在对当前编码块进行变换之前,首先判断当前编码块所在的图像区域的的信号能量是否集中。对于一张图像来说,若该图像中像素点的变化不连续,说明该图像的空域相关性弱,信号能量不集中。若该图像中像素点的变化连续,则说明该图像的空域相关性强,信号能量集中。Therefore, in this embodiment of the present application, before transforming the current coding block, it first determines whether the signal energy in the image area where the current coding block is located is concentrated. For an image, if the changes in pixel points in the image are discontinuous, it means that the spatial correlation of the image is weak and the signal energy is not concentrated. If the changes in pixels in the image are continuous, it means that the spatial correlation of the image is strong and the signal energy is concentrated.
基于此,本申请实施例使用图像区域的连续性参数的大小,来表示该图像区域的信号能量是否集中,例如,若该图像区域的连续性参数较大时,指示该图像区域中像素点的变化连续,进而说明该图像区域的信号能量集中。若该图像区域的连续性参数较小时,指示该图像区域中像素点的变化不连续,进而说明该图像区域的信号能量不集中。对于信号能量不集中的图像区域,从多个变换方式中选择最优变换方式,不仅无法带来显著的变换效果,且产生不必要的计算开销,增加编码时间,因此,本申请实施例中,对于信号能量不集中的图像区域,跳过从多个变换方式中选择最优变换方式的操作(例如跳过MTS技术),以节省不必要的计算开销,提高编码效率。Based on this, the embodiment of the present application uses the size of the continuity parameter of the image area to indicate whether the signal energy of the image area is concentrated. For example, if the continuity parameter of the image area is large, it indicates the intensity of the pixels in the image area. The change is continuous, which indicates that the signal energy in this image area is concentrated. If the continuity parameter of the image area is small, it indicates that the changes in pixel points in the image area are discontinuous, which further indicates that the signal energy in the image area is not concentrated. For image areas where signal energy is not concentrated, selecting the optimal transformation method from multiple transformation methods will not only fail to bring significant transformation effects, but also generate unnecessary computational overhead and increase encoding time. Therefore, in the embodiment of the present application, For image areas where signal energy is not concentrated, skip the operation of selecting the optimal transformation method from multiple transformation methods (such as skipping MTS technology) to save unnecessary computing overhead and improve coding efficiency.
这样,本申请实施例在变换之前,首先确定当前编码块所在的图像区域的连续性参数,该连续性参数用于指示该图像区域中像素点的变化连续性。根据该连续性参数的大小,确定当前编码块的变换方式,例如若连续性参数较小时,使用默认的第一变换方式作为当前编码块的变换方式,而跳过从多个变换方式中选择最优变换方式的操作,以节省不必要的计算开销,提高编码效率。In this way, before transformation, this embodiment of the present application first determines the continuity parameter of the image area where the current coding block is located. The continuity parameter is used to indicate the continuity of changes in pixels in the image area. According to the size of the continuity parameter, the transformation method of the current coding block is determined. For example, if the continuity parameter is small, the default first transformation method is used as the transformation method of the current coding block, and the selection of the best transformation method from multiple transformation methods is skipped. Optimize transformation operations to save unnecessary computing overhead and improve coding efficiency.
本申请实施例对图像区域的大小不做限制,为任意包括当前编码块的图像区域。The embodiment of the present application does not limit the size of the image area, and it can be any image area including the current coding block.
在一些实施例中,该图像区域为当前图像帧,此时图像区域的连续性参数用于指示当前图像帧中像素点的变化连续性。这样,本申请实施例可以根据当前图像帧的连续性参数,来确定当前图像帧中任意一个编码块的变换方式。In some embodiments, the image area is the current image frame, and the continuity parameter of the image area is used to indicate the continuity of changes in pixel points in the current image frame. In this way, the embodiment of the present application can determine the transformation method of any coding block in the current image frame according to the continuity parameter of the current image frame.
在一些实施例中,该图像区域为当前图像序列,此时图像区域的连续性参数用于指示当前图像序列中像素点的变化连续性。这样,本申请实施例可以根据当前图像序列的连续性参数,来确定当前图像序列中任意一个编码块的变换方式。In some embodiments, the image area is the current image sequence, and the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image sequence. In this way, the embodiment of the present application can determine the transformation method of any coding block in the current image sequence based on the continuity parameter of the current image sequence.
在一些实施例中,该图像区域为当前图像片,此时图像区域的连续性参数用于指示当前图像片中像素点的变化连续性。这样,本申请实施例可以根据当前图像片的连续性参数,来确定当前图像片中任意一个编码块的变换方式。In some embodiments, the image area is the current image patch, and the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image patch. In this way, the embodiment of the present application can determine the transformation method of any coding block in the current image slice according to the continuity parameter of the current image slice.
在一些实施例中,该图像区域为当前编码块,此时图像区域的连续性参数用于指示当前编码块中像素点的变化连续性。这样,本申请实施例在编码每个编码块时,需要确定每个编码块的连续性参数,以确定每个编码块的变换方式。In some embodiments, the image area is the current coding block, and the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current coding block. In this way, when encoding each coding block in this embodiment of the present application, it is necessary to determine the continuity parameters of each coding block to determine the transformation method of each coding block.
本申请实施例中,确定图像区域的连续性参数的方式包括但不限于如下几种:In the embodiment of this application, the methods for determining the continuity parameters of the image area include but are not limited to the following:
方式一,通过梯度图确定图像区域的连续性参数,即上述S401包括如下S401-A1和S401-A2的步骤:Method 1 is to determine the continuity parameters of the image area through the gradient map, that is, the above S401 includes the following steps of S401-A1 and S401-A2:
S401-A1、确定图像区域的梯度图,以及该梯度图的梯度图;S401-A1. Determine the gradient map of the image area and the gradient map of the gradient map;
S401-A2、根据该梯度图的梯度图,确定图像区域的连续性参数。S401-A2: Determine the continuity parameter of the image area according to the gradient map of the gradient map.
图像区域的梯度图可以反映出图像区域中像素点的变化趋势,图像区域的梯度图的梯度图可以反映出图像区域中像素点的变化率,即变化连续性。The gradient map of the image area can reflect the change trend of the pixels in the image area, and the gradient map of the gradient map of the image area can reflect the change rate of the pixels in the image area, that is, the continuity of change.
因此,在该方式一中,通过计算图像区域的梯度图的梯度图来确定图像区域的连续性参数。Therefore, in the first method, the continuity parameter of the image area is determined by calculating the gradient map of the gradient map of the image area.
示例性的,根据如下公式(1)确定图像区域的梯度图Gmap:For example, the gradient map Gmap of the image area is determined according to the following formula (1):
Gmap(x,y)=|I(x,y)-I(x+1,y)|+|I(x,y)-I(x,y+1)|    (1)Gmap(x,y)=|I(x,y)-I(x+1,y)|+|I(x,y)-I(x,y+1)| (1)
其中,I(x,y)是图像区域I在位置(x,y)处的像素值,I(x+1,y)是图像区域I在位置(x+1,y)处的像素值,I(x,y+1)是图像区域I在位置(x,y+1)处的像素值,Gmap(x,y)为图像区域I中位置(x,y)处的像素点的梯度值。Among them, I(x, y) is the pixel value of image area I at position (x, y), I(x+1, y) is the pixel value of image area I at position (x+1, y), I(x, y+1) is the pixel value of image area I at position (x, y+1), Gmap(x, y) is the gradient value of the pixel point at position (x, y) in image area I .
示例性的,根据如下公式(2)确定图像区域的梯度图的梯度图GGmap:For example, the gradient map GGmap of the gradient map of the image area is determined according to the following formula (2):
GGmap(x,y)=|Gmap(x,y)-Gmap(x+1,y)|+|Gmap(x,y)-Gmap(x,y+1)|   (2)GGmap(x,y)=|Gmap(x,y)-Gmap(x+1,y)|+|Gmap(x,y)-Gmap(x,y+1)| (2)
其中,Gmap(x+1,y)为图像区域I中位置(x+1,y)处的像素点的梯度值,Gmap(x,y+1)为图像区域I中位置(x,y+1)处的像素点的梯度值,其中Gmap(x+1,y)和Gmap(x,y+1)可以根据上述公式(1)确定。GGmap(x,y)为图像区域I中位置(x,y)处的像素点的梯度值的梯度值。Among them, Gmap(x+1,y) is the gradient value of the pixel at position (x+1,y) in image area I, Gmap(x,y+1) is the position (x,y+ The gradient value of the pixel at 1), where Gmap(x+1,y) and Gmap(x,y+1) can be determined according to the above formula (1). GGmap(x,y) is the gradient value of the gradient value of the pixel at position (x,y) in image area I.
上述公式(1)和公式(2)示出了确定图像区域I的像素点(x,y)的梯度值和梯度值的梯度值,图像区域I中的其他像素点参照像素点(x,y)的方式,确定出图像区域I中每个像素点的梯度值,得到图像区域I的梯度图Gmap。采用上述公式(2)对图像区域I的梯度图Gmap中每个像素点对应的梯度值再计算梯度值,得到图像区域I的梯度图的梯度图GGmap。The above formula (1) and formula (2) show that the gradient value and the gradient value of the pixel point (x, y) of the image area I are determined. Other pixel points in the image area I refer to the pixel point (x, y). ) method, determine the gradient value of each pixel in the image area I, and obtain the gradient map Gmap of the image area I. Use the above formula (2) to calculate the gradient value corresponding to each pixel in the gradient map Gmap of the image area I, and then obtain the gradient map GGmap of the gradient map of the image area I.
需要说明的是,上述公式(1)和公式(2)只是一种示例,本申请实施例还可以采用其他的方式,确定图像区域的梯度图,以及梯度图的梯度图,例如对上述公式(1)和公式(2)进行变形,使用变形后的公式确定梯度图,以及梯度图的梯度图。It should be noted that the above formula (1) and formula (2) are just examples. The embodiments of the present application can also use other methods to determine the gradient map of the image area and the gradient map of the gradient map. For example, the above formula ( 1) and formula (2) are deformed, and the gradient map is determined using the deformed formula, as well as the gradient map of the gradient map.
根据上述方式,确定出图像区域的梯度图的梯度图后,根据该梯度图的梯度图GGmap,确定图像区域的连续性参数。According to the above method, after the gradient map of the gradient map of the image area is determined, the continuity parameter of the image area is determined based on the gradient map GGmap of the gradient map.
本申请实施例对上述S401-A2中根据该梯度图的梯度图,确定图像区域的连续性参数的方式不做限制。The embodiment of the present application does not limit the method of determining the continuity parameter of the image area based on the gradient map of the gradient map in S401-A2 above.
在一种示例中,将图像区域的梯度图的梯度图中各梯度值的中值,确定为该图像区域的连续性参数。In one example, the median value of each gradient value in the gradient map of the image region is determined as the continuity parameter of the image region.
在另一种示例中,将图像区域的梯度图的梯度图中梯度值的平均值,确定为该图像区域的连续性参数。In another example, the average value of the gradient values in the gradient map of the image area is determined as the continuity parameter of the image area.
上述方式一,通过确定图像区域的梯度图的梯度图,以确定图像区域的连续性参数,其计算方法简单,且计算开销小,进而提高编码效率。The above-mentioned method 1 determines the continuity parameter of the image area by determining the gradient map of the gradient map of the image area. The calculation method is simple and the calculation cost is small, thereby improving the coding efficiency.
在一些实施例中,除了采用上述方式一确定图像区域的连续性参数外,还可以采用下面方式二来确定确定图像区域的连续性参数。In some embodiments, in addition to using the above method one to determine the continuity parameter of the image area, the following method two can also be used to determine the continuity parameter of the image area.
方式二,通过确定图像区域的空域冗余,来确定图像区域的连续性参数。即上述S401包括如下S401-B1和S401-B2的步骤:The second method is to determine the continuity parameters of the image area by determining the spatial redundancy of the image area. That is, the above S401 includes the following steps of S401-B1 and S401-B2:
S401-B1、确定图像区域的残差值;S401-B1. Determine the residual value of the image area;
S401-B2、根据图像区域的残差值,确定图像区域的连续性参数,其中残差值与连续性参数负相关。S401-B2. Determine the continuity parameter of the image area according to the residual value of the image area, where the residual value is negatively correlated with the continuity parameter.
图像区域的空域冗余小,则表示图像区域的相关强,图像区域中像素点的变化较连续性,图像区域的信号能量较集中。图像区域的空域冗余大,则表示图像区域的相关弱,图像区域中像素点的变化不连续性,图像区域的信号能量不集中。图像区域的空域冗余可以通过图像区域的残差值来表示,即残差值大,说明该图像区域的空域冗余大,残差值小,则说明该图像区域的空域冗余小。If the spatial redundancy of the image area is small, it means that the correlation of the image area is strong, the changes of pixel points in the image area are more continuous, and the signal energy of the image area is more concentrated. If the spatial redundancy of the image area is large, it means that the correlation of the image area is weak, the changes of pixel points in the image area are discontinuous, and the signal energy of the image area is not concentrated. The spatial redundancy of the image area can be represented by the residual value of the image area, that is, a large residual value indicates that the spatial redundancy of the image area is large, and a small residual value indicates that the spatial redundancy of the image area is small.
在图像编码过程中,采用帧内预测来计算图像的空域冗余,因此,本申请实施例采用帧内预测方式,计算图像区域的预测值,将该图像区域的原始值与预测值的差值确定为该图像区域的残差值。In the image coding process, intra-frame prediction is used to calculate the spatial redundancy of the image. Therefore, the embodiment of the present application uses the intra-frame prediction method to calculate the predicted value of the image area, and calculates the difference between the original value and the predicted value of the image area. Determine the residual value of this image area.
在编码时,是以块为单元进行编码,因此,本申请实施例中图像区域的残差值可以是该图像区域所包括的各编码块的残差值叠加。例如,图像区域包括N个编码块,N为正整数,采用帧内预测方式确定每个编码块的预测值,针对每个编码块,将该编码块的原始值与预测值进行相减,得到该编码块的残差值。将N个编码块的残差值进行叠加,得到该图像区域的残差值。During encoding, encoding is performed in units of blocks. Therefore, in the embodiment of the present application, the residual value of the image area may be a superposition of the residual values of each coding block included in the image area. For example, the image area includes N coding blocks, and N is a positive integer. Intra-frame prediction is used to determine the predicted value of each coding block. For each coding block, the original value of the coding block is subtracted from the predicted value, and we get The residual value of this coding block. The residual values of N coding blocks are superimposed to obtain the residual value of the image area.
接着,根据图像区域的残差值,确定图像区域的连续性参数,其中图像区域的残差值与连续性参数负相关,即图像区域的残差值越大,则该图像区域的连续性参数越小,图像区域的残差值越小,则该图像区域的连续性参数越大。Next, according to the residual value of the image area, the continuity parameter of the image area is determined. The residual value of the image area is negatively correlated with the continuity parameter. That is, the greater the residual value of the image area, the greater the continuity parameter of the image area. The smaller the value, the smaller the residual value of the image area, and the greater the continuity parameter of the image area.
本申请实施例对根据图像区域的残差值,确定图像区域的连续性参数的方式不做限制。The embodiment of the present application does not limit the method of determining the continuity parameter of the image area based on the residual value of the image area.
在一种可能的实现方式中,将图像区域的残差值的倒数,确定为图像区域的连续性参数,例如,图像区域的残差值为a,则确定该图像区域的连续性参数为1/a。In a possible implementation, the reciprocal of the residual value of the image area is determined as the continuity parameter of the image area. For example, if the residual value of the image area is a, then the continuity parameter of the image area is determined to be 1. /a.
在另一种可能的实现方式中,将预设值与图像区域的残差值的差,确定为图像区域的连续性参数,可选的,该预设值为一正数,例如该预设值为1。例如,图像区域的残差值为a,则确定该图像区域的连续性参数为1-a。In another possible implementation, the difference between the preset value and the residual value of the image area is determined as the continuity parameter of the image area. Optionally, the preset value is a positive number, such as the preset value. The value is 1. For example, if the residual value of the image area is a, then the continuity parameter of the image area is determined to be 1-a.
可选的,还可以采用其他的方式,基于图像区域的残差值,确定图像区域的连续性参数,本申请实施例对此不作限制,只要保证图像区域的残差值与连续性参数负相关即可。Optionally, other methods can be used to determine the continuity parameter of the image area based on the residual value of the image area. The embodiment of the present application does not limit this, as long as it is ensured that the residual value of the image area is negatively correlated with the continuity parameter. That’s it.
根据上述方式一或方式二,确定出图像区域的连续性参数后,执行如下S402的步骤,根据该图像区域的连续性参数,确定当前编码块的变换方式。After determining the continuity parameter of the image area according to the above-mentioned method 1 or 2, the following step S402 is performed to determine the transformation method of the current coding block based on the continuity parameter of the image area.
S402、根据图像区域的连续性参数,确定当前编码块的变换方式。S402. Determine the transformation method of the current coding block according to the continuity parameter of the image area.
本申请实施例中,图像区域的连续性参数用于指示该图像区域中像素点的变化连续性,若该图像区域的连续性参数较小时,说明该图像区域信号能量不集中,此时使用DTC变换无法带来显著的压缩效果,在这种情况下,计算多种变换方式的率失真代价,以从这多个变换方式中选择最优的变换方式,不仅不能带来有益的压缩效果,且计算开销大。因此,当图像区域的连续性参数较大时,跳过从多种变换方式中选择最优变换方式的操作,以节省计算资源,提高编码效率。In the embodiment of the present application, the continuity parameter of the image area is used to indicate the continuity of changes in the pixels in the image area. If the continuity parameter of the image area is small, it means that the signal energy in the image area is not concentrated. In this case, DTC is used The transformation cannot bring significant compression effect. In this case, calculating the rate distortion cost of multiple transformation methods to select the optimal transformation method from these multiple transformation methods will not only not bring beneficial compression effects, but also The computational cost is high. Therefore, when the continuity parameter of the image area is large, the operation of selecting the optimal transformation method from multiple transformation methods is skipped to save computing resources and improve coding efficiency.
上述S402中根据图像区域的连续性参数,确定当前编码块的变换方式的方式包括但不限于如下几种:In the above S402, the methods for determining the transformation method of the current coding block according to the continuity parameter of the image area include but are not limited to the following:
方式一,若图像区域的连续性参数小于预设阈值,则确定当前编码块的变换方式为第一变换方式。Method 1: If the continuity parameter of the image area is less than the preset threshold, it is determined that the transformation mode of the current coding block is the first transformation mode.
由上述描述可知,若图像区域的连续性参数小于预设阈值时,说明该图像区域的信号能量不集中,此时,如果从多个变换方式中选择最优的变换方式(例如采用MTS技术),不仅不能带来有益的压缩效果,且增加不必要的计算。因此,在这种情况下,编码器跳过从多个变换方式中选择最优的变换方式的操作,例如跳过MTS操作,直接将第一变换方式,确定为当前编码块的目标变换方式。It can be seen from the above description that if the continuity parameter of the image area is less than the preset threshold, it means that the signal energy of the image area is not concentrated. At this time, if the optimal transformation method is selected from multiple transformation methods (for example, using MTS technology) , not only cannot bring beneficial compression effects, but also increases unnecessary calculations. Therefore, in this case, the encoder skips the operation of selecting the optimal transform scheme from multiple transform schemes, for example, skips the MTS operation, and directly determines the first transform scheme as the target transform scheme of the current coding block.
在一种可能的实现方式中,上述第一变换方式为预设的多个变换方式中的一种变换方式,例如第一变换方式为DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式中的任意一个变换方式。In a possible implementation, the above-mentioned first transformation mode is one of multiple preset transformation modes. For example, the first transformation mode is DTC-II mode, DST-VII mode and DCT-VIII mode. any transformation method.
可选的,第一变换方式为DTC-Ⅱ方式。Optionally, the first conversion mode is the DTC-II mode.
本申请实施例对预设阈值不做限制,具体根据实际需要进行确定。The embodiment of the present application does not place a limit on the preset threshold, which is determined based on actual needs.
方式二,若图像区域的连续性参数大于或等于预设阈值,则从M个候选变换方式中确定当前编码块的变换方式,M为大于1的正整数。Method 2: If the continuity parameter of the image area is greater than or equal to the preset threshold, the transformation method of the current coding block is determined from M candidate transformation methods, where M is a positive integer greater than 1.
若图像区域的连续性参数大于或等于预设阈值时,说明该图像区域的信号能量较集中,此时,从多个变换方式(例如M个变换方式)中选择最优的变换方式,可以提高压缩效果。因此,在这种情况下,编码器执行从M个变换方式中选择最优的变换方式的操作,例如执行MTS操作,以从这M个候选变换方式中确定当前编码块的变换方式。If the continuity parameter of the image area is greater than or equal to the preset threshold, it means that the signal energy in the image area is relatively concentrated. At this time, selecting the optimal transformation method from multiple transformation methods (such as M transformation methods) can improve Compression effect. Therefore, in this case, the encoder performs an operation of selecting the optimal transform method from M transform methods, such as performing an MTS operation, to determine the transform method of the current coding block from these M candidate transform methods.
本申请实施例对M个候选变换方式的数量和类型不做限制。This embodiment of the present application does not limit the number and types of M candidate transformation methods.
在一些实施例中,M个候选变换方式包括DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式组合构成的变换方式。由于图像都是2维的,而直接进行二维的变换运算量和内存开销都是当时硬件条件所不能接受的,因而在标准中使用上述DCT-II,DCT-VIII,DST-VII进行变换时,均是拆分成水平方向和竖直方向,进行两步一维变换。如先进行水平方向的变换再进行竖直方向的变换,或者先进行竖直方向的变换再进行水平方向的变换。基于此,本申请实施例的M个候选变换方式可以为水平方向和竖直方向由DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式任意两两组合而成。例如,候选变换方式1的水平方向为DTC-Ⅱ方式、竖直方向为DST-VII方式,候选变换方式2的水平方向为DTC-Ⅱ方式、竖直方向为DCT-VIII方式,候选变换方式3的水平方向为DST-VII方式、竖直方向为DTC-Ⅱ方式,候选变换方式4的水平方向为DST-VII方式、竖直方向为DCT-VIII方式,候选变换方式5的水平方向为DCT-VIII方式、竖直方向为DTC-Ⅱ方式,候选变换方式6的水平方向为DCT-VIII方式、竖直方向为DST-VII方式,候选变换方式7的水平方向和竖直方式均为DTC-Ⅱ方式,候选变换方式8的水平方向和竖直方式均为DST-VII方式,候选变换方式9的水平方向和竖直方式均为DCT-VIII方式。In some embodiments, the M candidate transformation modes include transformation modes composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode. Since the images are all 2-dimensional, the amount of computation and memory overhead of directly performing two-dimensional transformation were unacceptable to the hardware conditions at the time. Therefore, when using the above-mentioned DCT-II, DCT-VIII, and DST-VII in the standard for transformation, , both are split into horizontal and vertical directions, and a two-step one-dimensional transformation is performed. For example, perform horizontal transformation first and then vertical transformation, or perform vertical transformation first and then horizontal transformation. Based on this, the M candidate transformation modes in the embodiment of the present application can be any combination of DTC-II mode, DST-VII mode and DCT-VIII mode in the horizontal and vertical directions. For example, candidate transformation method 1 is DTC-II in the horizontal direction and DST-VII in the vertical direction; candidate transformation method 2 is DTC-II in the horizontal direction and DCT-VIII in the vertical direction; candidate transformation method 3 is The horizontal direction is DST-VII mode and the vertical direction is DTC-Ⅱ mode. The horizontal direction of candidate transformation method 4 is DST-VII mode and the vertical direction is DCT-VIII mode. The horizontal direction of candidate transformation method 5 is DCT- The VIII mode and the vertical direction are DTC-Ⅱ mode. The horizontal direction and vertical direction of candidate transformation mode 6 are DCT-VIII mode and the vertical direction are DST-VII mode. The horizontal and vertical modes of candidate transformation mode 7 are both DTC-Ⅱ mode, the horizontal direction and the vertical mode of candidate transformation mode 8 are both DST-VII mode, and the horizontal direction and vertical mode of candidate transformation mode 9 are both DCT-VIII mode.
在一些实施例中,M个候选变换方式包括MTS对应的多个变换方式,例如包括DTC-Ⅱ方式,以及上述表2所示的各组合变换方式。In some embodiments, the M candidate transformation modes include multiple transformation modes corresponding to MTS, such as the DTC-II mode, and the combined transformation modes shown in Table 2 above.
在该方式二中,从M个候选变换方式中确定当前编码块的变换方式,包括如下步骤:In the second method, determining the transformation mode of the current coding block from M candidate transformation modes includes the following steps:
步骤1,确定使用M个候选变换方式对当前编码块进行变换时的率失真代价;Step 1: Determine the rate distortion cost when using M candidate transformation methods to transform the current coding block;
步骤2,根据M个候选变换方式对应的率失真代价,从M个候选变换方式中选择一候选变换方式,作为当前编码块的变换方式。Step 2: Select a candidate transformation method from the M candidate transformation methods as the transformation method of the current coding block according to the rate distortion cost corresponding to the M candidate transformation methods.
在一种可能的实现方式中,从M个候选变换方式中,确定当前编码块的变换方式的方法可以是:首先使用M个候选变换方式中的第一个候选变换方式对当前编码块进行变换,并计算该第一个候选变换方式对应的率失真代价。若第一个候选变换方式对应的率失真代价小于或等于预设值,则将该第一个候选变换方式作为当前编码块的变换方式。若第一个候选变换方式对应的率失真代价大于预设值,则使用M个候选变换方式中的第二个候选变换方式对当前编码块进行变换,并计算该第二个候选变换方式对应的率失真代价。若第二个候选变换方式对应的率失真代价小于或等于预设值,则将该第二个候选变换方式作为当前编码块的变换方式。若第二个候选变换方式对应的率失真代价大于预设值,则重复上述步骤,使用M个候选变换方式中的第三个候选变换方式对当前编码块进行变换,并计算该第三个候选变换方式对应的率失真代价。以此类推,从M个候选变换方式中选择一候选变换方式,作为当前编码块的变换方式。In a possible implementation, the method of determining the transformation mode of the current coding block from the M candidate transformation modes may be: first, use the first candidate transformation mode among the M candidate transformation modes to transform the current coding block. , and calculate the rate distortion cost corresponding to the first candidate transformation method. If the rate distortion cost corresponding to the first candidate transformation method is less than or equal to the preset value, the first candidate transformation method is used as the transformation method of the current coding block. If the rate distortion cost corresponding to the first candidate transformation method is greater than the preset value, use the second candidate transformation method among the M candidate transformation methods to transform the current coding block, and calculate the corresponding rate distortion cost of the second candidate transformation method. rate distortion cost. If the rate distortion cost corresponding to the second candidate transformation method is less than or equal to the preset value, the second candidate transformation method is used as the transformation method of the current coding block. If the rate distortion cost corresponding to the second candidate transformation method is greater than the preset value, repeat the above steps, use the third candidate transformation method among the M candidate transformation methods to transform the current coding block, and calculate the third candidate transformation method The rate distortion cost corresponding to the transformation method. By analogy, a candidate transformation method is selected from M candidate transformation methods as the transformation method of the current coding block.
在另一种可能的实现方式中,从M个候选变换方式中,确定当前编码块的变换方式的方法可以是:使用这M个候选变换方式分别对当前编码块进行变换,并计算M个候选变换方式中每一个候选变换方式对应的率失真代价。将M个候选变换方式中,率失真代价最小的候选变换方式确定为当前编码块的变换方式。In another possible implementation, the method of determining the transformation mode of the current coding block from M candidate transformation modes may be: using these M candidate transformation modes to transform the current coding block respectively, and calculating the M candidates The rate distortion cost corresponding to each candidate transformation method in the transformation method. Among the M candidate transformation modes, the candidate transformation mode with the smallest rate distortion cost is determined as the transformation mode of the current coding block.
上述方式一和方式二中,编码器根据图像区域的连续性参数来确定当前编码块的变换方式。In the above-mentioned methods one and two, the encoder determines the transformation method of the current coding block according to the continuity parameter of the image area.
在一些实施例中,编码器除了采用上述方式一和方式二确定当前编码块的变换方式外,还可以采用下面的方式三来确定当前编码块的变换方式。In some embodiments, in addition to using the above-mentioned method 1 and 2 to determine the transformation mode of the current coding block, the encoder may also use the following method 3 to determine the transformation mode of the current coding block.
方式三,编码器首先根据图像区域的连续性参数确定一标志,并根据该标志来确定当前编码块的变换方式。即上述S402包括如下S402-A1和S402-A2的步骤:In the third method, the encoder first determines a flag based on the continuity parameter of the image area, and determines the transformation mode of the current coding block based on the flag. That is, the above S402 includes the following steps of S402-A1 and S402-A2:
S402-A1、根据图像区域的连续性参数,确定第一标志。S402-A1. Determine the first mark according to the continuity parameter of the image area.
该第一标志用于指示是否允许图像区域从M个候选变换方式中确定变换方式,M为大于1的正整数。The first flag is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes, where M is a positive integer greater than 1.
在一些实施例中,若上述M个候选变换方式为MTS技术对应的M个候选变换方式时,则该第一标志用于指示是否允许图像区域使用MTS技术,或者第一标志用于指示图像区域是否跳过MTS操作。In some embodiments, if the above M candidate transformation methods are M candidate transformation methods corresponding to the MTS technology, the first flag is used to indicate whether the image area is allowed to use the MTS technology, or the first flag is used to indicate the image area. Whether to skip MTS operations.
其中,上述S402-A1中根据图像区域的连续性参数,确定第一标志的方式包括如下几种示例:Among them, the method of determining the first mark according to the continuity parameter of the image area in the above S402-A1 includes the following examples:
示例1,若图像区域的连续性参数小于预设阈值,则说明图像区域的信号能量不集中,此时确定第一标志的取值为第一数值,该第一数值用于指示不允许图像区域从M个候选变换方式中确定变换方式。Example 1: If the continuity parameter of the image area is less than the preset threshold, it means that the signal energy in the image area is not concentrated. At this time, the value of the first flag is determined to be the first value. The first value is used to indicate that the image area is not allowed. The transformation method is determined from M candidate transformation methods.
示例2,若图像区域的连续性参数大于或等于预设阈值,则说明图像区域的信号能量集中,此时确定第一标志的取值为第二数值,第二数值用于指示允许图像区域从M个候选变换方式中确定变换方式。Example 2, if the continuity parameter of the image area is greater than or equal to the preset threshold, it means that the signal energy in the image area is concentrated. At this time, the value of the first flag is determined to be the second value. The second value is used to indicate that the image area is allowed to change from The transformation method is determined among M candidate transformation methods.
其中,第一数值不等于第二数值。Wherein, the first value is not equal to the second value.
本申请实施例对第一数值和第二数值的具体取值不做限制。The embodiments of this application do not limit the specific values of the first numerical value and the second numerical value.
可选的,第一数值为0。Optional, the first value is 0.
可选的,第二数值为1。Optional, the second value is 1.
S402-A2、根据第一标志,确定当前编码块的变换方式。S402-A2. Determine the transformation mode of the current coding block according to the first flag.
根据上述S402-A1的方法,确定出图像区域的第一标志后,根据该第一标志确定该当前编码块的变换方式。According to the method of S402-A1, after the first flag of the image area is determined, the transformation mode of the current coding block is determined based on the first flag.
由上述可知,若第一标志的取值为第一数值时,则指示不允许图像区域从M个候选变换方式中确定变换方式,此时,跳过从M个候选变换方式中确定变换方式的操作,而是直接将默认的第一变换方式确定为当前编码块的变换方式。As can be seen from the above, if the value of the first flag is the first value, it indicates that the image area is not allowed to determine the transformation mode from the M candidate transformation modes. At this time, the step of determining the transformation mode from the M candidate transformation modes is skipped. operation, but directly determines the default first transformation mode as the transformation mode of the current coding block.
若第一标志的取值为第二数值时,则指示允许图像区域从M个候选变换方式中确定变换方式,此时,从M个候 选变换方式中确定所述当前编码块的变换方式。If the value of the first flag is the second value, it indicates that the image area is allowed to determine the transformation mode from M candidate transformation modes. At this time, the transformation mode of the current coding block is determined from the M candidate transformation modes.
其中,从M个候选变换方式中确定所述当前编码块的变换方式可以参照上述方式二的描述。For determining the transformation mode of the current coding block from the M candidate transformation modes, reference may be made to the description of the second mode above.
例如,使用M个候选变换方式中的第一个候选变换方式对当前编码块进行变换,并计算该第一个候选变换方式对应的率失真代价。若第一个候选变换方式对应的率失真代价小于或等于预设值,则将该第一个候选变换方式作为当前编码块的变换方式。若第一个候选变换方式对应的率失真代价大于预设值,则使用M个候选变换方式中的第二个候选变换方式对当前编码块进行变换,并计算该第二个候选变换方式对应的率失真代价。以此类推,从M个候选变换方式中选择一候选变换方式,作为当前编码块的变换方式。For example, the current coding block is transformed using the first candidate transformation method among the M candidate transformation methods, and the rate distortion cost corresponding to the first candidate transformation method is calculated. If the rate distortion cost corresponding to the first candidate transformation method is less than or equal to the preset value, the first candidate transformation method is used as the transformation method of the current coding block. If the rate distortion cost corresponding to the first candidate transformation method is greater than the preset value, use the second candidate transformation method among the M candidate transformation methods to transform the current coding block, and calculate the corresponding rate distortion cost of the second candidate transformation method. rate distortion cost. By analogy, a candidate transformation method is selected from M candidate transformation methods as the transformation method of the current coding block.
再例如,使用这M个候选变换方式分别对当前编码块进行变换,并计算M个候选变换方式中每一个候选变换方式对应的率失真代价。将M个候选变换方式中,率失真代价最小的候选变换方式确定为当前编码块的变换方式。For another example, the M candidate transformation methods are used to transform the current coding block respectively, and the rate distortion cost corresponding to each of the M candidate transformation methods is calculated. Among the M candidate transformation modes, the candidate transformation mode with the smallest rate distortion cost is determined as the transformation mode of the current coding block.
本申请实施例,编码器根据上述方法,确定出当前编码块的变换方式后,执行如下S403的步骤。In this embodiment of the present application, after the encoder determines the transformation mode of the current coding block according to the above method, it performs the following steps of S403.
S403、根据变换方式,对当前编码块进行变换,得到当前编码块的变换系数。S403. Transform the current coding block according to the transformation method to obtain the transformation coefficient of the current coding block.
具体是,使用帧内预测方式和/或帧间预测方式,对当前编码块进行预测,得到当前编码块的预测值,接着,根据当前编码块的预测值和当前编码块,得到当前编码块的残差值。例如,当前编码块的像素值减去预测值,得到当前编码块的残差值。Specifically, the current coding block is predicted using the intra prediction method and/or the inter prediction method to obtain the prediction value of the current coding block. Then, based on the prediction value of the current coding block and the current coding block, the prediction value of the current coding block is obtained. Residual value. For example, subtract the predicted value from the pixel value of the current coding block to obtain the residual value of the current coding block.
接着,使用上述方法确定的变换方式,对当前编码块的残差值进行变换,得到当前编码块的变换系数。Then, use the transformation method determined by the above method to transform the residual value of the current coding block to obtain the transformation coefficient of the current coding block.
在一种示例中,若根据上述方法,确定的当前编码块的变换方式为DCT-II变换方式时,则根据上述表2所示的公式,使用DCT-II变换方式对当前编码块的残差值进行变换,得到当前编码块的变换系数。In one example, if the transformation method of the current coding block determined according to the above method is the DCT-II transformation method, then according to the formula shown in Table 2 above, the DCT-II transformation method is used to transform the residual of the current coding block Transform the value to obtain the transformation coefficient of the current coding block.
在另一种示例中,若根据上述方法,确定的当前编码块的变换方式为DCT-VIII变换方式时,则根据上述表2所示的公式,使用DCT-VIII变换方式对当前编码块的残差值进行变换,得到当前编码块的变换系数。In another example, if the transformation method of the current coding block determined according to the above method is the DCT-VIII transformation method, then according to the formula shown in Table 2 above, the DCT-VIII transformation method is used to transform the residual of the current coding block. The difference value is transformed to obtain the transformation coefficient of the current coding block.
在另一种示例中,若根据上述方法,确定的当前编码块的变换方式为DST-VII变换方式时,则根据上述表2所示的公式,使用DST-VII变换方式对当前编码块的残差值进行变换,得到当前编码块的变换系数。In another example, if the transformation method of the current coding block determined according to the above method is the DST-VII transformation method, then according to the formula shown in Table 2 above, the DST-VII transformation method is used to transform the residual of the current coding block. The difference value is transformed to obtain the transformation coefficient of the current coding block.
在一些实施例中,编码器将上述第一标志写入码流中,以使解码端根据该第一标志确定变换类型,实现变换系数的反变换。In some embodiments, the encoder writes the above-mentioned first flag into the code stream, so that the decoder determines the transform type based on the first flag and implements inverse transformation of the transform coefficients.
在一些实施例中,若图像区域为当前图像帧、当前图像片和当前编码块中的任意一个时,则码流中还包括第二标志,该第二标志用于指示当前图序列是否允许从M个候选变换方式中确定变换方式。在MTS技术中,该第二标志具体用于指示当前图像序列是否允许使用MTS技术。若该第二标志指示不允许当前图像序列使用MTS技术时,则确定该当前图像序列下的所有编码图像块均不使用MTS技术,且将第一变换方式确定为目标变换方式进行残差值的变换,得到变换系数。若该第二标志指示允许当前图像序列使用MTS技术时,则该当前图像序列下的所有编码图像块采用MTS技术确定变换方式。In some embodiments, if the image area is any one of the current image frame, the current image slice, and the current coding block, the code stream also includes a second flag. The second flag is used to indicate whether the current picture sequence is allowed to be copied from The transformation method is determined among M candidate transformation methods. In the MTS technology, the second flag is specifically used to indicate whether the current image sequence allows the use of the MTS technology. If the second flag indicates that the current image sequence is not allowed to use the MTS technology, it is determined that all coded image blocks under the current image sequence do not use the MTS technology, and the first transformation method is determined as the target transformation method to calculate the residual value. Transform to get the transformation coefficients. If the second flag indicates that the current image sequence is allowed to use the MTS technology, then all coded image blocks under the current image sequence use the MTS technology to determine the transformation method.
在一些实施例中,若图像区域为当前图像序列,则第一标志复用所述第二标志。In some embodiments, if the image area is the current image sequence, the first flag multiplexes the second flag.
本申请实施例对第一标志和第二标志在码流中的具体位置不做限制。The embodiment of the present application does not limit the specific positions of the first mark and the second mark in the code stream.
示例性的,以MTS技术为例,可以使用pic_mts_enable_flag表示第一标志。For example, taking MTS technology as an example, pic_mts_enable_flag can be used to represent the first flag.
示例性的,可以使用sps_explicit_mts_inter_enabled_flag表示第二标志。For example, sps_explicit_mts_inter_enabled_flag may be used to represent the second flag.
在一些实施例中,该第一标志和第二标志位于编码单元中,此时,编码单元的部分语法如表3所示:In some embodiments, the first flag and the second flag are located in the coding unit. At this time, part of the syntax of the coding unit is as shown in Table 3:
表3table 3
Figure PCTCN2022080706-appb-000003
Figure PCTCN2022080706-appb-000003
本申请实施例中,在已有的编码单元语法中增加约束第一标志,通过第一标志指示当前区域是否跳过MTS操作。这样解码端在解码时,可以根据该第一标志来确定当前编码块的变换类型trType。In the embodiment of the present application, a constraint first flag is added to the existing coding unit syntax, and the first flag is used to indicate whether the current area skips the MTS operation. In this way, the decoding end can determine the transformation type trType of the current coding block according to the first flag during decoding.
本申请实施例提供的图像编码方法,通过确定当前编码块所在的图像区域的连续性参数,连续性参数用于指示图像区域中像素点的变化连续性;根据图像区域的连续性参数,确定当前编码块的变换方式;根据变换方式,对当前编码块进行变换,得到当前编码块的变换系数。即本申请实施例,根据该连续性参数的大小,确定当前编码块的变换方式,例如若连续性参数较小,说明该图像区域的信号能量不集中时,可以使用默认的第一变换方式作为当前编码块的变换方式,而跳过从多个变换方式中选择最优变换方式的操作,以节省不必要的计算开销,提高编码效率。The image coding method provided by the embodiment of the present application determines the continuity parameter of the image area where the current coding block is located. The continuity parameter is used to indicate the continuity of changes in the pixel points in the image area; based on the continuity parameter of the image area, the current coding block is determined based on the continuity parameter of the image area. The transformation method of the coding block; according to the transformation method, the current coding block is transformed to obtain the transformation coefficient of the current coding block. That is, in this embodiment of the present application, the transformation method of the current coding block is determined according to the size of the continuity parameter. For example, if the continuity parameter is small, indicating that the signal energy in the image area is not concentrated, the default first transformation method can be used as The transformation method of the current coding block, and skips the operation of selecting the optimal transformation method from multiple transformation methods to save unnecessary computing overhead and improve coding efficiency.
图5为本申请一实施例提供的图像编码方法流程示意图。图5可以理解为图4所示的编码方法的一种更为具体的编码方式,如图5所示,本申请实施例的编码方法包括如下步骤:Figure 5 is a schematic flowchart of an image encoding method provided by an embodiment of the present application. Figure 5 can be understood as a more specific encoding method of the encoding method shown in Figure 4. As shown in Figure 5, the encoding method according to the embodiment of the present application includes the following steps:
S501、确定当前图像帧的连续性参数。S501. Determine the continuity parameter of the current image frame.
本申请实施例以图像区域为当前图像帧为例。此时,连续性参数用于指示当前图像帧中像素点的变化连续性。In the embodiment of this application, the image area is the current image frame as an example. At this time, the continuity parameter is used to indicate the continuity of changes in pixels in the current image frame.
在一些实施例中,确定当前图像帧的梯度图,以及该梯度图的梯度图,根据该梯度图的梯度图,确定当前图像帧的连续性参数。例如,将当前图像帧的梯度图的梯度图中梯度值的平均值,确定为该当前图像帧的连续性参数。In some embodiments, a gradient map of the current image frame is determined, and a gradient map of the gradient map is determined, and a continuity parameter of the current image frame is determined based on the gradient map of the gradient map. For example, the average value of the gradient values in the gradient map of the current image frame is determined as the continuity parameter of the current image frame.
在一些实施例中,确定当前图像帧的残差值,并根据当前图像帧的残差值,确定当前图像帧的连续性参数,其中残差值与连续性参数负相关。In some embodiments, a residual value of the current image frame is determined, and a continuity parameter of the current image frame is determined based on the residual value of the current image frame, where the residual value is negatively correlated with the continuity parameter.
需要说明的是,上述S501的实现方式与上述S401的实现方式基本相同,具体参照上述S401的描述,在此不再赘述。It should be noted that the implementation of the above S501 is basically the same as the implementation of the above S401. For details, refer to the description of the above S401, which will not be described again here.
S502、判断当前图像帧的连续性参数是否小于预设阈值。S502. Determine whether the continuity parameter of the current image frame is less than a preset threshold.
若当前图像帧的连续性参数小于预设阈值时,则执行如下S503的步骤,若当前图像帧的连续性参数大于或等于预设阈值时,则执行如下S504的步骤。If the continuity parameter of the current image frame is less than the preset threshold, the following steps of S503 are performed. If the continuity parameter of the current image frame is greater than or equal to the preset threshold, the following steps of S504 are performed.
S503、当前图像帧跳过MTS操作,且令第一标志的取值为第一数值。S503. The current image frame skips the MTS operation, and sets the value of the first flag to the first value.
本申请实施例以MTS技术为例。The embodiment of this application takes MTS technology as an example.
若当前图像帧的连续性参数小于预设阈值,则说明当前图像帧的信号能量不集中。为了节约计算资源,提高编码效果,则当前图像帧跳过MTS操作,也就是说,当前图像帧下的所有编码块均不采用MTS技术来确定变换方式。If the continuity parameter of the current image frame is less than the preset threshold, it means that the signal energy of the current image frame is not concentrated. In order to save computing resources and improve coding effects, the current image frame skips the MTS operation. That is to say, all coding blocks under the current image frame do not use MTS technology to determine the transformation method.
可选的,此时将默认的第一变换方式确定为当前图像帧下的所有编码块的变换方式。Optionally, at this time, the default first transformation mode is determined as the transformation mode of all coding blocks in the current image frame.
示例性的,使用pic_mts_enable_flag表示第一标志。For example, pic_mts_enable_flag is used to represent the first flag.
可选的,第一数值为0。Optional, the first value is 0.
此时,则令pic_mts_enable_flag=0。At this time, let pic_mts_enable_flag=0.
可选的,第一变换方式为DCT-II方式。Optionally, the first transformation mode is the DCT-II mode.
S504、当前图像帧执行MTS操作,且令第一标志的取值为第二数值。S504. Perform an MTS operation on the current image frame, and set the value of the first flag to the second value.
若当前图像帧的连续性参数大于或等于预设阈值,则说明当前图像帧的信号能量集中。为了提高变换效果,则允许当前图像帧执行MTS操作。此时,当前图像帧下的编码块在确定具体的变换方式时,可以采用MTS技术来确定最优的变换方式。If the continuity parameter of the current image frame is greater than or equal to the preset threshold, it means that the signal energy of the current image frame is concentrated. In order to improve the transformation effect, the current image frame is allowed to perform MTS operations. At this time, when determining the specific transformation method for the coding block in the current image frame, MTS technology can be used to determine the optimal transformation method.
示例性的,使用pic_mts_enable_flag表示第一标志。For example, pic_mts_enable_flag is used to represent the first flag.
可选的,第二数值为1。Optional, the second value is 1.
此时,则令pic_mts_enable_flag=1。At this time, let pic_mts_enable_flag=1.
S505、根据第一标志,确定当前编码块的变换方式。S505. Determine the transformation mode of the current coding block according to the first flag.
即本申请实施例中,在对当前编码块进行编码时,若当前编码块的MTS flag=0或者pic_mts_enable_flag=0,则直接选取DCT-II方式作为当前编码块的变换方式。That is, in the embodiment of this application, when encoding the current coding block, if the MTS flag of the current coding block=0 or pic_mts_enable_flag=0, the DCT-II method is directly selected as the transformation method of the current coding block.
若当前编码块的MTS flag=1且pic_mts_enable_flag=1,先对当前编码块使用DCT-II变换,计算其率失真代价RDCostTmp1,再选取表2中的候选变换方式对当前编码块进行变换,选出率失真代价最小的变换方式MTOpt,该MTOpt对应的率失真代价为RDCostTmp2。比较RDCostTmp1和RDCostTmp2,选择代价较小的变换方式作为当前编码块的变换方式。If the MTS flag of the current coding block = 1 and pic_mts_enable_flag = 1, first use DCT-II transformation on the current coding block, calculate its rate distortion cost RDCostTmp1, and then select the candidate transformation method in Table 2 to transform the current coding block, and select The transformation method MTOpt with the smallest rate distortion cost, and the rate distortion cost corresponding to this MTOpt is RDCostTmp2. Compare RDCostTmp1 and RDCostTmp2, and select the transformation method with less cost as the transformation method of the current coding block.
S506、使用当前编码块的变换方式对当前编码块进行变换,得到变换系数。S506: Transform the current coding block using the transformation method of the current coding block to obtain transformation coefficients.
其中,上述S506的实现方式参照上述S403的描述,在此不再赘述。For the implementation of the above S506, refer to the description of the above S403, which will not be described again here.
S507、对变换系数进行编码,得到码流。S507. Encode the transform coefficient to obtain a code stream.
在一种示例中,对当前变换块的变换系数不进行量化,直接进行编码,得到码流。In one example, the transform coefficients of the current transform block are directly encoded without quantization to obtain a code stream.
在一种示例中,对当前编码块的变换系数进行量化,得到量化系数,对量化系数进行编码,得到码流。In one example, the transform coefficient of the current encoding block is quantized to obtain the quantized coefficient, and the quantized coefficient is encoded to obtain the code stream.
进一步的,编码器将上述第一标志写入码流中,以使解码器根据该第一标志确定反变换对应的变换类型。Further, the encoder writes the above-mentioned first flag into the code stream, so that the decoder determines the transformation type corresponding to the inverse transformation according to the first flag.
本申请实施例提供的图像编码方法,确定当前图像帧的连续性参数,并将该连续性参数与预设阈值进行比较,若连续性参数小于预设阈值时,则跳过MTS操作,直接将第一变换方式确定为当前编码块的变换方式,进而节省不必要的计算开销,提高编码效率。The image coding method provided by the embodiment of the present application determines the continuity parameter of the current image frame, and compares the continuity parameter with the preset threshold. If the continuity parameter is less than the preset threshold, the MTS operation is skipped and the MTS operation is skipped. The first transformation mode is determined as the transformation mode of the current coding block, thereby saving unnecessary calculation overhead and improving coding efficiency.
上文对本申请实施例的编码方法进行介绍,在此基础上,下面对本申请实施例提供的解码方法进行介绍。The encoding method of the embodiment of the present application is introduced above. On this basis, the decoding method provided by the embodiment of the present application is introduced below.
图6为本申请一实施例提供的视频解码方法流程示意图,本申请实施例应用于图1和图3所示解码器。如图6所示,本申请实施例的方法包括:FIG. 6 is a schematic flowchart of a video decoding method provided by an embodiment of the present application. The embodiment of the present application is applied to the decoders shown in FIGS. 1 and 3 . As shown in Figure 6, the method in the embodiment of this application includes:
S601、解码码流,确定当前解码块的变换系数。S601. Decode the code stream and determine the transform coefficient of the current decoding block.
在一些实施例中,当前解码块也可以称为当前块、当前解码单元、解码块、待解码块、待解码的当前块等。In some embodiments, the current decoding block may also be referred to as the current block, the current decoding unit, the decoding block, the block to be decoded, the current block to be decoded, etc.
在一些实施例中,当前解码块包括色度分量不包括亮度分量时,当前解码块可以称为色度块。In some embodiments, when the currently decoded block includes a chroma component and does not include a luma component, the currently decoded block may be called a chroma block.
在一些实施例中,当前解码块包括亮度分量不包括色度分量时,当前解码块可以称为亮度块。In some embodiments, when the currently decoded block includes a luma component and does not include a chrominance component, the currently decoded block may be called a luma block.
上述变换系数为编码端对当前解码块的残差值经过变换得到的变换系数。The above-mentioned transform coefficients are transform coefficients obtained by transforming the residual value of the current decoding block at the encoding end.
本实施例中,上述S601中解码端解码码流,得到当前解码块的变换系数的方式包括但不限于如下几种:In this embodiment, in the above-mentioned S601, the decoding end decodes the code stream and obtains the transform coefficients of the current decoded block, including but not limited to the following:
方式一,若编码端在编码时,对变换系数不进行量化,而是直接对变换系数进行编码,得到码流。这样解码端解码码流,可以从码流中直接得到当前解码块的变换系数。Method 1: If the encoding end is encoding, the transform coefficients are not quantized, but the transform coefficients are directly encoded to obtain a code stream. In this way, the decoding end decodes the code stream and can directly obtain the transform coefficient of the current decoding block from the code stream.
方式二,编码端在编码时,对变换系数进行量化,得到量化系数,再对量化系数进行编码,得到码流。这样,解码端解码码流,得到当前解码块的量化系数,对量化系数进行反量化,得到当前解码块的变换系数。Method 2: During encoding, the encoding end quantizes the transform coefficients to obtain quantized coefficients, and then encodes the quantized coefficients to obtain a code stream. In this way, the decoder decodes the code stream to obtain the quantized coefficients of the current decoded block, and performs inverse quantization on the quantized coefficients to obtain the transform coefficients of the current decoded block.
S602、确定当前编码块所在的图像区域的第一标志。S602. Determine the first flag of the image area where the current coding block is located.
上述第一标志用于确定当前编码块的变换类型。The above-mentioned first flag is used to determine the transform type of the current coding block.
上述第一标志用于指示是否允许图像区域从M个候选变换方式中确定变换方式。The above-mentioned first flag is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes.
本申请实施例的第一标志基于图像区域的连续性参数确定,该连续性参数用于指示所述图像区域中像素点的变化连续性。The first flag in the embodiment of the present application is determined based on the continuity parameter of the image area. The continuity parameter is used to indicate the continuity of changes in the pixel points in the image area.
由上述描述可知,从多个变换方式中自适应选择当前编码块最优的变换方式,可以提高变换效果。但是,对于信号能量不集中的图像,变换带来的压缩效果较差。此时,从多个变换方式中自适应选择当前编码块最优的变换方式,对这些信号能量不集中的图像进行变换,不仅压缩效果不显著,且产生不必要的计算开销,增加编码时间。It can be seen from the above description that adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods can improve the transformation effect. However, for images where the signal energy is not concentrated, the compression effect brought by the transformation is poor. At this time, adaptively selecting the optimal transformation method for the current coding block from multiple transformation methods to transform these images whose signal energy is not concentrated not only has an insignificant compression effect, but also generates unnecessary computational overhead and increases encoding time.
基于此,本申请实施例使用图像区域的连续性参数的大小,来表示该图像区域的信号能量是否集中,例如,若该图像区域的连续性参数较大时,指示该图像区域中像素点的变化连续,进而说明该图像区域的信号能量集中。若该图像区域的连续性参数较小时,指示该图像区域中像素点的变化不连续,进而说明该图像区域的信号能量不集中。对于 信号能量不集中的图像区域,从多个变换方式中选择最优变换方式,不仅无法带来显著的变换效果,且产生不必要的计算开销,增加编解码时间,因此,本申请实施例中,对于信号能量不集中的图像区域,跳过从M个候选变换方式中选择最优变换方式的操作(例如跳过MTS技术),以节省不必要的计算开销。Based on this, the embodiment of the present application uses the size of the continuity parameter of the image area to indicate whether the signal energy of the image area is concentrated. For example, if the continuity parameter of the image area is large, it indicates the intensity of the pixels in the image area. The change is continuous, which indicates that the signal energy in this image area is concentrated. If the continuity parameter of the image area is small, it indicates that the changes in pixel points in the image area are discontinuous, which further indicates that the signal energy in the image area is not concentrated. For image areas where signal energy is not concentrated, selecting the optimal transformation method from multiple transformation methods will not only fail to bring significant transformation effects, but also generate unnecessary computational overhead and increase encoding and decoding time. Therefore, in the embodiment of the present application, , for image areas where signal energy is not concentrated, skip the operation of selecting the optimal transformation method from M candidate transformation methods (such as skipping MTS technology) to save unnecessary computing overhead.
本申请实施例对图像区域的大小不做限制,为任意包括当前解码块的图像区域。The embodiment of the present application does not limit the size of the image area, and it can be any image area including the current decoding block.
在一些实施例中,该图像区域为当前图像帧,此时图像区域的连续性参数用于指示当前图像帧中像素点的变化连续性。对应的,第一标志用于指示是否允许当前图像帧从M个候选变换方式中确定变换方式。In some embodiments, the image area is the current image frame, and the continuity parameter of the image area is used to indicate the continuity of changes in pixel points in the current image frame. Correspondingly, the first flag is used to indicate whether the current image frame is allowed to determine the transformation mode from M candidate transformation modes.
在一些实施例中,该图像区域为当前图像序列,此时图像区域的连续性参数用于指示当前图像序列中像素点的变化连续性。对应的,第一标志用于指示是否允许当前图像序列从M个候选变换方式中确定变换方式。In some embodiments, the image area is the current image sequence, and the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image sequence. Correspondingly, the first flag is used to indicate whether the current image sequence is allowed to determine the transformation mode from M candidate transformation modes.
在一些实施例中,该图像区域为当前图像片,此时图像区域的连续性参数用于指示当前图像片中像素点的变化连续性。对应的,第一标志用于指示是否允许当前图像片从M个候选变换方式中确定变换方式。In some embodiments, the image area is the current image patch, and the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current image patch. Correspondingly, the first flag is used to indicate whether the current image slice is allowed to determine the transformation mode from M candidate transformation modes.
在一些实施例中,该图像区域为当前编码块,此时图像区域的连续性参数用于指示当前编码块中像素点的变化连续性。对应的,第一标志用于指示是否允许当前编码块从M个候选变换方式中确定变换方式。In some embodiments, the image area is the current coding block, and the continuity parameter of the image area is used to indicate the continuity of changes in pixels in the current coding block. Correspondingly, the first flag is used to indicate whether the current coding block is allowed to determine the transformation mode from M candidate transformation modes.
本申请实施例对M个候选变换方式的数量和类型不做限制。This embodiment of the present application does not limit the number and types of M candidate transformation methods.
在一些实施例中,M个候选变换方式包括DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式组合构成的变换方式。由于图像都是2维的,而直接进行二维的变换运算量和内存开销都是当时硬件条件所不能接受的,因而在标准中使用上述DCT-II,DCT-VIII,DST-VII进行变换时,均是拆分成水平方向和竖直方向,进行两步一维变换。如先进行水平方向的变换再进行竖直方向的变换,或者先进行竖直方向的变换再进行水平方向的变换。基于此,本申请实施例的M个候选变换方式可以为水平方向和竖直方向由DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式任意两两组合而成。例如,候选变换方式1的水平方向为DTC-Ⅱ方式、竖直方向为DST-VII方式,候选变换方式2的水平方向为DTC-Ⅱ方式、竖直方向为DCT-VIII方式,候选变换方式3的水平方向为DST-VII方式、竖直方向为DTC-Ⅱ方式,候选变换方式4的水平方向为DST-VII方式、竖直方向为DCT-VIII方式,候选变换方式5的水平方向为DCT-VIII方式、竖直方向为DTC-Ⅱ方式,候选变换方式6的水平方向为DCT-VIII方式、竖直方向为DST-VII方式,候选变换方式7的水平方向和竖直方式均为DTC-Ⅱ方式,候选变换方式8的水平方向和竖直方式均为DST-VII方式,候选变换方式9的水平方向和竖直方式均为DCT-VIII方式。In some embodiments, the M candidate transformation modes include transformation modes composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode. Since the images are all 2-dimensional, the amount of computation and memory overhead of directly performing two-dimensional transformation were unacceptable to the hardware conditions at the time. Therefore, when using the above-mentioned DCT-II, DCT-VIII, and DST-VII in the standard for transformation, , both are split into horizontal and vertical directions, and a two-step one-dimensional transformation is performed. For example, perform horizontal transformation first and then vertical transformation, or perform vertical transformation first and then horizontal transformation. Based on this, the M candidate transformation modes in the embodiment of the present application can be any combination of DTC-II mode, DST-VII mode and DCT-VIII mode in the horizontal and vertical directions. For example, candidate transformation method 1 is DTC-II in the horizontal direction and DST-VII in the vertical direction; candidate transformation method 2 is DTC-II in the horizontal direction and DCT-VIII in the vertical direction; candidate transformation method 3 is The horizontal direction is DST-VII mode and the vertical direction is DTC-Ⅱ mode. The horizontal direction of candidate transformation method 4 is DST-VII mode and the vertical direction is DCT-VIII mode. The horizontal direction of candidate transformation method 5 is DCT- The VIII mode and the vertical direction are DTC-Ⅱ mode. The horizontal direction and vertical direction of candidate transformation mode 6 are DCT-VIII mode and the vertical direction are DST-VII mode. The horizontal and vertical modes of candidate transformation mode 7 are both DTC-Ⅱ mode, the horizontal direction and the vertical mode of candidate transformation mode 8 are both DST-VII mode, and the horizontal direction and vertical mode of candidate transformation mode 9 are both DCT-VIII mode.
在一些实施例中,M个候选变换方式包括MTS对应的多个变换方式,例如包括DTC-Ⅱ方式,以及上述表2所示的各组合变换方式。In some embodiments, the M candidate transformation modes include multiple transformation modes corresponding to MTS, such as the DTC-II mode, and the combined transformation modes shown in Table 2 above.
本申请实施例,在对当前解码块的变换系数进行反变换时,首先需要确定变换类型trType,接着根据变换类型trType对当前解码块的变换系数进行反变换,得到当前解码块的残差值。本申请实施例中,根据第一标志确定变换类型trType,例如,第一标志为0时,则说明该图像区域不允许从M个候选变换方式中选择最优变换方式,进而可以确定当前解码块的变换类型trType为0。In the embodiment of the present application, when inversely transforming the transform coefficients of the current decoding block, the transform type trType needs to be determined first, and then the transform coefficients of the current decoding block are inversely transformed according to the transform type trType to obtain the residual value of the current decoding block. In the embodiment of the present application, the transformation type trType is determined according to the first flag. For example, when the first flag is 0, it means that the image area does not allow the optimal transformation method to be selected from M candidate transformation methods, and then the current decoding block can be determined. The transformation type trType is 0.
本申请实施例中,确定第一标志的方式包括但不限于如下几种:In the embodiment of this application, the methods for determining the first mark include but are not limited to the following:
方式一,解码器根据图像区域的连续性参数,确定第一标志,具体的,上述S602包括如下S602-A1和S602-A2步骤,即首先确定图像区域的连续性参数,再根据图像区域的连续性参数,确定图像区域的第一标志。Method 1: The decoder determines the first flag based on the continuity parameter of the image area. Specifically, the above S602 includes the following steps S602-A1 and S602-A2, that is, first determines the continuity parameter of the image area, and then determines the first flag based on the continuity parameter of the image area. Parameters determine the first marker of the image area.
S602-A1、确定图像区域的连续性参数。S602-A1. Determine the continuity parameters of the image area.
解码端在确定图像区域的连续性参数时,该图像区域未完全解码,此时,可以将该图像区域的相邻已解码区域的连续性参数作为该图像区域的连续性参数。When the decoding end determines the continuity parameter of the image area, the image area is not completely decoded. At this time, the continuity parameters of adjacent decoded areas of the image area can be used as the continuity parameters of the image area.
本申请实施例中,确定图像区域的连续性参数的方式包括但不限于如下几种示例:In the embodiments of this application, the methods for determining the continuity parameters of the image area include but are not limited to the following examples:
示例1,通过梯度图确定图像区域的连续性参数,即上述S602-A1包括如下S602-A1-11至S602-A1-13的步骤:Example 1, determine the continuity parameters of the image area through the gradient map, that is, the above S602-A1 includes the following steps from S602-A1-11 to S602-A1-13:
S602-A1-11、确定图像区域的相邻已解码区域。S602-A1-11. Determine adjacent decoded areas of the image area.
在一些实施例中,相邻已解码区域与图像区域的大小一致。In some embodiments, adjacent decoded regions are consistent in size with image regions.
在一些实施例中,相邻已解码区域与图像区域的大小不一致。In some embodiments, adjacent decoded regions are not consistent in size with image regions.
S602-A1-12、确定相邻已解码区域的梯度图,以及梯度图的梯度图。S602-A1-12. Determine the gradient map of the adjacent decoded area and the gradient map of the gradient map.
图像的梯度图可以反映出图像中像素点的变化趋势,图像的梯度图的梯度图可以反映出图像中像素点的变化率,即变化连续性。The gradient map of an image can reflect the change trend of pixels in the image, and the gradient map of the image can reflect the rate of change of pixels in the image, that is, the continuity of change.
因此,本申请实施例,可以通过计算相邻已解码区域的梯度图的梯度图来确定相邻已解码区域的连续性参数。Therefore, in the embodiment of the present application, the continuity parameter of the adjacent decoded region can be determined by calculating the gradient map of the gradient map of the adjacent decoded region.
示例性的,根据如下公式(3)确定相邻已解码区域的梯度图Gmap’:For example, the gradient map Gmap' of the adjacent decoded area is determined according to the following formula (3):
Gmap'(x,y)=|I'(x,y)-I'(x+1,y)|+|I'(x,y)-I'(x,y+1)|   (3)Gmap'(x,y)=|I'(x,y)-I'(x+1,y)|+|I'(x,y)-I'(x,y+1)| (3)
其中,I’(x,y)是相邻已解码区域I’在位置(x,y)处的像素值,I’(x+1,y)是相邻已解码区域I’在位置(x+1,y)处的像素值,I’(x,y+1)是相邻已解码区域I’在位置(x,y+1)处的像素值,Gmap’(x,y)为相邻已解码区域I’中位置(x,y)处的像素点的梯度值。Among them, I'(x, y) is the pixel value of the adjacent decoded area I' at the position (x, y), I'(x+1, y) is the adjacent decoded area I' at the position (x +1, y), I'(x, y+1) is the pixel value of the adjacent decoded area I' at position (x, y+1), Gmap'(x, y) is the corresponding The gradient value of the pixel at position (x, y) in the adjacent decoded area I'.
示例性的,根据如下公式(4)确定相邻已解码区域的梯度图的梯度图GGmap’:For example, the gradient map GGmap' of the gradient map of the adjacent decoded area is determined according to the following formula (4):
GGmap'(x,y)=|Gmap'(x,y)-Gmap'(x+1,y)|+|Gmap'(x,y)-Gmap'(x,y+1)|     (4)GGmap'(x,y)=|Gmap'(x,y)-Gmap'(x+1,y)|+|Gmap'(x,y)-Gmap'(x,y+1)| (4)
其中,Gmap’(x+1,y)为相邻已解码区域I’中位置(x+1,y)处的像素点的梯度值,Gmap(x,y+1)’为相邻已解码区域I’中位置(x,y+1)处的像素点的梯度值,其中Gmap’(x+1,y)和Gmap’(x,y+1)可以根据上述公式(3)确定。GGmap’(x,y)为相邻已解码区域I’中位置(x,y)处的像素点的梯度值的梯度值。Among them, Gmap'(x+1,y)' is the gradient value of the pixel at position (x+1,y) in the adjacent decoded area I', and Gmap(x,y+1)' is the adjacent decoded area I'. The gradient value of the pixel at position (x, y+1) in area I', where Gmap'(x+1,y) and Gmap'(x,y+1) can be determined according to the above formula (3). GGmap’ (x, y) is the gradient value of the gradient value of the pixel at position (x, y) in the adjacent decoded area I’.
上述公式(3)和公式(4)示出了确定相邻已解码区域I’的像素点(x,y)的梯度值和梯度值的梯度值,相邻已解码区域I’中的其他像素点参照像素点(x,y)的方式,确定出相邻已解码区域I’中每个像素点的梯度值,得到相邻已解码区域I’的梯度图Gmap’。采用上述公式(4)对相邻已解码区域I’的梯度图Gmap’中每个像素点对应的梯度值再计算梯度值,得到相邻已解码区域I’的梯度图的梯度图GGmap’。The above formulas (3) and (4) show that the gradient value of the pixel point (x, y) in the adjacent decoded area I' and the gradient value of the gradient value are determined. Other pixels in the adjacent decoded area I' By referring to the pixel point (x, y), the gradient value of each pixel point in the adjacent decoded area I' is determined, and the gradient map Gmap' of the adjacent decoded area I' is obtained. Use the above formula (4) to calculate the gradient value corresponding to each pixel point in the gradient map Gmap' of the adjacent decoded area I', and then obtain the gradient map GGmap' of the gradient map of the adjacent decoded area I'.
需要说明的是,上述公式(3)和公式(4)只是一种示例,本申请实施例还可以采用其他的方式,确定相邻已解码区域的梯度图,以及梯度图的梯度图,例如对上述公式(3)和公式(4)进行变形,使用变形后的公式确定梯度图,以及梯度图的梯度图。It should be noted that the above formula (3) and formula (4) are just examples. The embodiments of the present application can also use other methods to determine the gradient map of the adjacent decoded area and the gradient map of the gradient map. For example, The above formulas (3) and (4) are deformed, and the gradient map is determined using the deformed formula, as well as the gradient map of the gradient map.
根据上述方式,确定出相邻已解码区域的梯度图的梯度图后,根据该相邻已解码区域的梯度图GGmap,确定相邻已解码区域的连续性参数。According to the above method, after the gradient map of the gradient map of the adjacent decoded area is determined, the continuity parameter of the adjacent decoded area is determined based on the gradient map GGmap of the adjacent decoded area.
S602-A1-13、根据相邻已解码区域的梯度图的梯度图,确定图像区域的连续性参数。S602-A1-13. Determine the continuity parameter of the image area based on the gradient map of the gradient map of the adjacent decoded area.
本申请实施例,根据相邻已解码区域的梯度图的梯度图,确定相邻已解码区域的连续性参数,并将相邻已解码区域的连续性参数确定为该图像区域的连续性参数。In this embodiment of the present application, the continuity parameter of the adjacent decoded area is determined based on the gradient map of the adjacent decoded area, and the continuity parameter of the adjacent decoded area is determined as the continuity parameter of the image area.
本申请实施例对上述S602-A1-13中根据该梯度图的梯度图,确定相邻已解码区域的连续性参数的方式不做限制。The embodiment of the present application does not limit the method of determining the continuity parameters of adjacent decoded areas based on the gradient map of the gradient map in S602-A1-13 above.
在一种示例中,将相邻已解码区域的梯度图的梯度图中各梯度值的中值,确定为该图像区域的连续性参数。In one example, the median value of each gradient value in the gradient map of the adjacent decoded area is determined as the continuity parameter of the image area.
在另一种示例中,将相邻已解码区域的梯度图的梯度图中梯度值的平均值,确定为该图像区域的连续性参数。In another example, the average of the gradient values in the gradient maps of adjacent decoded areas is determined as the continuity parameter of the image area.
上述示例1,通过确定相邻已解码区域的梯度图的梯度图,以确定图像区域的连续性参数,其计算方法简单,且计算开销小,进而提高编码效率。In the above example 1, the continuity parameter of the image area is determined by determining the gradient map of the gradient map of the adjacent decoded area. The calculation method is simple and the calculation cost is small, thereby improving the coding efficiency.
在一些实施例中,除了采用上述示例1确定图像区域的连续性参数外,还可以采用下面示例2的方法来确定确定图像区域的连续性参数。In some embodiments, in addition to using the above example 1 to determine the continuity parameter of the image area, the method of the following example 2 can also be used to determine the continuity parameter of the image area.
示例2,通过确定相邻已解码区域的空域冗余,来确定图像区域的连续性参数。即上述S602-A1包括如下S602-A1-21和S602-A1-23的步骤:Example 2: Determine the continuity parameters of the image area by determining the spatial redundancy of adjacent decoded areas. That is, the above S602-A1 includes the following steps of S602-A1-21 and S602-A1-23:
S602-A1-21、确定图像区域的相邻已解码区域。S602-A1-21. Determine adjacent decoded areas of the image area.
例如,将与该图像区域相邻的已解码区域中与图像区域大小一致的解码区域,作为该图像区域的相邻已解码区域。For example, a decoded area with the same size as the image area among decoded areas adjacent to the image area is regarded as an adjacent decoded area of the image area.
再例如,将与该图像区域相邻的已解码区域中与图像区域大小不一致的解码区域,作为该图像区域的相邻已解码区域。For another example, the decoded area of the decoded area adjacent to the image area that is inconsistent with the size of the image area is regarded as the adjacent decoded area of the image area.
S602-A1-22、确定相邻已解码区域的残差值;S602-A1-22. Determine the residual value of the adjacent decoded area;
S602-A1-23、根据相邻已解码区域的残差值,确定图像区域的连续性参数,其中残差值与连续性参数负相关。S602-A1-23. Determine the continuity parameter of the image area based on the residual value of the adjacent decoded area, where the residual value is negatively correlated with the continuity parameter.
图像的空域冗余小,则表示图像的相关强,图像中像素点的变化较连续性,图像的信号能量较集中。图像的空域冗余大,则表示图像的相关弱,图像中像素点的变化不连续性,图像的信号能量不集中。图像的空域冗余可以通过图像的残差值来表示,即残差值大,说明该图像的空域冗余大,残差值小,则说明该图像的空域冗余小。If the spatial redundancy of the image is small, it means that the correlation of the image is strong, the changes of pixels in the image are more continuous, and the signal energy of the image is more concentrated. If the spatial redundancy of the image is large, it means that the correlation of the image is weak, the changes of pixels in the image are discontinuous, and the signal energy of the image is not concentrated. The spatial redundancy of an image can be represented by the residual value of the image, that is, a large residual value indicates that the image has large spatial redundancy, and a small residual value indicates that the image has small spatial redundancy.
在图像解码过程中,采用帧内预测来计算图像的空域冗余,因此,本申请实施例采用帧内预测方式,计算相邻已解码区域的预测值,将该相邻已解码区域的原始值与预测值的差值确定为该相邻已解码区域的残差值。During the image decoding process, intra-frame prediction is used to calculate the spatial redundancy of the image. Therefore, the embodiment of the present application uses the intra-frame prediction method to calculate the predicted value of the adjacent decoded area, and convert the original value of the adjacent decoded area into The difference from the predicted value is determined as the residual value of the adjacent decoded region.
在解码时,是以块为单元进行解码,因此,本申请实施例中相邻已解码区域的残差值可以是该相邻已解码区域所包括的各解码块的残差值叠加。例如,相邻已解码区域包括N个解码块,N为正整数,解码码流,得到N个解码块中每个解码块的残差值,将N个解码块的残差值进行叠加,得到该相邻已解码区域的残差值。During decoding, decoding is performed in units of blocks. Therefore, in this embodiment of the present application, the residual value of an adjacent decoded area may be a superposition of the residual values of each decoded block included in the adjacent decoded area. For example, the adjacent decoded area includes N decoding blocks, N is a positive integer, decode the code stream, and obtain the residual value of each decoding block in the N decoding blocks. The residual values of the N decoding blocks are superimposed to obtain The residual value of this adjacent decoded region.
接着,根据相邻已解码区域的残差值,确定图像区域的连续性参数,其中相邻已解码区域的残差值与连续性参数负相关,即相邻已解码区域的残差值越大,则该图像区域的连续性参数越小,相邻已解码区域的残差值越小,则该图像区域的连续性参数越大。Next, the continuity parameter of the image area is determined based on the residual value of the adjacent decoded area, where the residual value of the adjacent decoded area is negatively correlated with the continuity parameter, that is, the greater the residual value of the adjacent decoded area, the greater the residual value of the adjacent decoded area. , the smaller the continuity parameter of the image area is and the smaller the residual value of the adjacent decoded area is, the larger the continuity parameter of the image area is.
本申请实施例对根据相邻已解码区域的残差值,确定图像区域的连续性参数的方式不做限制。The embodiment of the present application does not limit the method of determining the continuity parameters of the image area based on the residual values of adjacent decoded areas.
在一种可能的实现方式中,将相邻已解码区域的残差值的倒数,确定为图像区域的连续性参数,例如,相邻已解码区域的残差值为a,则确定该图像区域的连续性参数为1/a。In a possible implementation, the reciprocal of the residual value of the adjacent decoded area is determined as the continuity parameter of the image area. For example, if the residual value of the adjacent decoded area is a, then the image area is determined The continuity parameter is 1/a.
在另一种可能的实现方式中,将预设值与相邻已解码区域的残差值的差,确定为图像区域的连续性参数,可选的,该预设值为一正数,例如该预设值为1。例如,相邻已解码区域的残差值为a,则确定该图像区域的连续性参数为1-a。In another possible implementation, the difference between the preset value and the residual value of the adjacent decoded area is determined as the continuity parameter of the image area. Optionally, the preset value is a positive number, for example The default value is 1. For example, if the residual value of an adjacent decoded area is a, then the continuity parameter of the image area is determined to be 1-a.
可选的,还可以采用其他的方式,基于相邻已解码区域的残差值,确定图像区域的连续性参数,本申请实施例对此不作限制,只要保证相邻已解码区域的残差值与连续性参数负相关即可。Optionally, other methods can be used to determine the continuity parameters of the image area based on the residual values of adjacent decoded areas. The embodiments of the present application do not limit this, as long as the residual values of adjacent decoded areas are ensured. Just be negatively correlated with the continuity parameter.
根据上述示例1或示例2,确定出图像区域的连续性参数后,执行如下S602-A2的步骤,根据该图像区域的连续性参数,确定第一标志。According to the above example 1 or example 2, after the continuity parameter of the image area is determined, the following steps of S602-A2 are performed to determine the first flag according to the continuity parameter of the image area.
S602-A2、根据图像区域的连续性参数,确定第一标志。S602-A2. Determine the first mark according to the continuity parameter of the image area.
该第一标志用于指示是否允许图像区域从M个候选变换方式中确定变换方式,M为大于1的正整数。The first flag is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes, where M is a positive integer greater than 1.
在一些实施例中,若上述M个候选变换方式为MTS技术对应的M个候选变换方式时,则该第一标志用于指示是否允许图像区域使用MTS技术,或者第一标志用于指示图像区域是否跳过MTS操作。In some embodiments, if the above M candidate transformation methods are M candidate transformation methods corresponding to the MTS technology, the first flag is used to indicate whether the image area is allowed to use the MTS technology, or the first flag is used to indicate the image area. Whether to skip MTS operations.
其中,上述S602-A2中根据图像区域的连续性参数,确定第一标志的方式包括如下几种示例:Among them, the method of determining the first mark according to the continuity parameter of the image area in the above S602-A2 includes the following examples:
示例1,若图像区域的连续性参数小于预设阈值,则确定第一标志的取值为第一数值,第一数值用于指示不允许图像区域从M个候选变换方式中确定变换方式。Example 1: If the continuity parameter of the image area is less than the preset threshold, the value of the first flag is determined to be the first value, and the first value is used to indicate that the image area is not allowed to determine the transformation method from M candidate transformation methods.
示例2,若图像区域的连续性参数大于或等于预设阈值,则确定第一标志的取值为第二数值,第二数值用于指示允许图像区域从M个候选变换方式中确定变换方式。Example 2: If the continuity parameter of the image area is greater than or equal to the preset threshold, the value of the first flag is determined to be a second value, and the second value is used to indicate that the image area is allowed to determine the transformation method from M candidate transformation methods.
其中,第一数值不等于第二数值。Wherein, the first value is not equal to the second value.
本申请实施例对第一数值和第二数值的具体取值不做限制。The embodiments of this application do not limit the specific values of the first numerical value and the second numerical value.
可选的,第一数值为0。Optional, the first value is 0.
可选的,第二数值为1。Optional, the second value is 1.
本申请实施例中,解码端除了根据上述方式一通过图像区域的连续性参数确定第一标志外,还可以根据方式二确定第一标志。In the embodiment of the present application, in addition to determining the first flag through the continuity parameter of the image area according to the above-mentioned method one, the decoder can also determine the first flag according to the method two.
方式二,解码码流,得到第一标志。Method 2: decode the code stream and obtain the first flag.
该方式二中,编码端根据图像区域的连续性参数,确定出第一标志,并如表3所示,将该第一标志写入码流,这 样解码端通过解码码流,得到该第一标志。In the second method, the encoding end determines the first flag based on the continuity parameters of the image area, and writes the first flag into the code stream as shown in Table 3. In this way, the decoding end obtains the first flag by decoding the code stream. logo.
解码端通过该方式二可以快速获取第一标志,且节省了计算资源,提高解码速度。The decoding end can quickly obtain the first mark through this second method, which saves computing resources and improves the decoding speed.
本申请实施例中,解码端根据上述方式一或方式二,确定出图像区域的第一标志后,执行如下S603的步骤,以根据该第一标志,确定当前解码块的变换类型。In this embodiment of the present application, after the decoding end determines the first flag of the image area according to the above-mentioned method 1 or 2, the following step S603 is performed to determine the transformation type of the current decoding block based on the first flag.
S603、根据第一标志,确定当前解码块的变换类型。S603. Determine the transformation type of the current decoding block according to the first flag.
在一些实施例中,变换类型也称为变换核类型。In some embodiments, a transform type is also called a transform kernel type.
本申请实施例的第一标志用于指示是否允许图像区域从M个候选变换方式中确定变换方式,这样,解码端可以根据该第一标志,确定出当前解码块的变换类型。The first flag in the embodiment of this application is used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes. In this way, the decoding end can determine the transformation type of the current decoding block based on the first flag.
其中,变换类型包括水平变换类型trTypeHor和垂直变换类型trTypeVer。Among them, the transformation types include horizontal transformation type trTypeHor and vertical transformation type trTypeVer.
方式1,若第一标志的取值为第一数值时,则确定当前解码块的变换类型的索引为0,其中第一数值用于指示不允许图像区域从M个候选变换方式中确定变换方式。Method 1: If the value of the first flag is a first value, the index of the transformation type of the current decoding block is determined to be 0, where the first value is used to indicate that the image area is not allowed to determine the transformation mode from M candidate transformation modes. .
由上述可知,本申请实施例采用的变换类型(即变换方式)主要包括DCT-II,DCT-VIII,DST-VII,其中,DCT-II的索引为0,DCT-VIII的索引为1,DST-VII的索引为2,或者,DCT-VIII的索引为2,DST-VII的索引为1。在后续变换矩阵导出时,根据变换类型的索引导出。本申请实施例中,若第一标志的取值为第一数值(例如0)时,则确定当前解码块的变换类型的索引为0,即确定当前解码块的变换类型为DCT-II。As can be seen from the above, the transformation types (i.e., transformation methods) used in the embodiments of the present application mainly include DCT-II, DCT-VIII, and DST-VII. Among them, the index of DCT-II is 0, the index of DCT-VIII is 1, and the index of DST -VII has an index of 2, or, DCT-VIII has an index of 2 and DST-VII has an index of 1. When the subsequent transformation matrix is exported, it is exported according to the index of the transformation type. In this embodiment of the present application, if the value of the first flag is a first value (for example, 0), it is determined that the index of the transform type of the current decoding block is 0, that is, it is determined that the transform type of the current decoding block is DCT-II.
在一些实施例中,变换类型包括水平变换类型trTypeHor和垂直变换类型trTypeVer,当第一标志的取值为第一数值(例如0)时,则确定当前解码块的水平变换类型trTypeHor和垂直变换类型trTypeVer均为0,即当前解码块的水平方向和垂直方向均采用DCT-II。In some embodiments, the transformation type includes a horizontal transformation type trTypeHor and a vertical transformation type trTypeVer. When the value of the first flag is a first value (for example, 0), the horizontal transformation type trTypeHor and the vertical transformation type of the current decoding block are determined. trTypeVer is both 0, that is, the current decoding block uses DCT-II in both the horizontal and vertical directions.
本申请实施例在标准文件中增加了第一标志作为确定变换类型的条件,现将修改前的标准文件与修改后的标准文件进行对比如下。In the embodiment of this application, a first flag is added to the standard document as a condition for determining the transformation type. The standard document before modification and the standard document after modification are now compared as follows.
修改前的标准文件为:The standard document before modification is:
水平变换类型trTypeHor和垂直变换类型trTypeVer导出如下:The horizontal transformation type trTypeHor and the vertical transformation type trTypeVer are exported as follows:
如果以下一个或多个条件为真,则设置trTypeHor和trTypeVer等于0。Sets trTypeHor and trTypeVer equal to 0 if one or more of the following conditions are true.
条件1,cIdx大于0;Condition 1, cIdx is greater than 0;
条件2,IntraSubPartitionsSplitType不等于ISP_NO_SPLIT且lfnst_idx不等于0。Condition 2, IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT and lfnst_idx is not equal to 0.
其中,cIdx为颜色分量索引(colour component index),取0表示亮度分量,1和2表示色度分量,其中1表示cb分量,2表示cr分量。IntraSubPartitionsSplitType表示当前亮度编码块的划分类型,ISP_NO_SPLIT表示当前的帧内块不做划分。lfnst_idx表示两个不可分的低频变换核使用情况。Among them, cIdx is the color component index, 0 represents the brightness component, 1 and 2 represent the chrominance component, where 1 represents the cb component and 2 represents the cr component. IntraSubPartitionsSplitType indicates the division type of the current luminance coding block, and ISP_NO_SPLIT indicates that the current intra-frame block is not divided. lfnst_idx represents the usage of two inseparable low-frequency transformation cores.
修改后的标准文件为:The revised standard document is:
水平变换类型trTypeHor和垂直变换类型trTypeVer导出如下:The horizontal transformation type trTypeHor and the vertical transformation type trTypeVer are exported as follows:
如果以下一个或多个条件为真,则设置trTypeHor和trTypeVer等于0。Sets trTypeHor and trTypeVer equal to 0 if one or more of the following conditions are true.
条件1,cIdx大于0;Condition 1, cIdx is greater than 0;
条件2,IntraSubPartitionsSplitType不等于ISP_NO_SPLIT且lfnst_idx不等于0。Condition 2, IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT and lfnst_idx is not equal to 0.
条件3,第一标志等于第一数值,例如第一标志=0。Condition 3: the first flag is equal to the first value, for example, the first flag=0.
由上述方式一可知,当第一标志的取值为第一数值,例如0时,则确定当前解码块的变换类型的索引为0,进而根据变换类型索引0确定变换矩阵。It can be seen from the above method 1 that when the value of the first flag is a first value, such as 0, it is determined that the index of the transform type of the current decoding block is 0, and then the transform matrix is determined based on the transform type index 0.
方式2,若第一标志的取值为第二数值时,则根据第二标志,确定当前解码块的变换类型,其中第二标志通过解码码流得到,第二数值用于指示允许图像区域从M个候选变换方式中确定变换方式,第二标志用于指示当前图序列是否允许从所述M个候选变换方式中确定变换方式。Method 2, if the value of the first flag is a second value, determine the transformation type of the current decoding block according to the second flag, where the second flag is obtained by decoding the code stream, and the second value is used to indicate that the image area is allowed to change from The transformation mode is determined from M candidate transformation modes, and the second flag is used to indicate whether the current picture sequence allows the transformation mode to be determined from the M candidate transformation modes.
具体的,根据该第二标志,确定implicitMtsEnabled(隐式MTS使能),根据implicitMtsEnabled,确定当前解码块的变换类型。Specifically, implicitMtsEnabled is determined based on the second flag, and the transformation type of the current decoding block is determined based on implicitMtsEnabled.
在一些实施例中,若第一标志为图像级标志,第二标志为序列级标志,则解码端首先从码流中解码得到第二标志,根据第二标志在确定允许当前图序列从M个候选变换方式中确定变换方式时,解码第一标志,并根据第一标志确定当前解码块的变换类型。具体是,若第一标志的取值为第一数值,则确定当前解码块的变换类型的索引为0,若第一标志的取值为第二数值,则根据第二标志确定当前解码块的变换类型。In some embodiments, if the first flag is a picture-level flag and the second flag is a sequence-level flag, the decoder first decodes the code stream to obtain the second flag, and determines based on the second flag that the current picture sequence is allowed to be converted from M When the transformation mode is determined among the candidate transformation modes, the first flag is decoded, and the transformation type of the currently decoded block is determined according to the first flag. Specifically, if the value of the first flag is a first numerical value, the index of the transform type of the current decoding block is determined to be 0. If the value of the first flag is a second numerical value, the index of the transformation type of the current decoding block is determined according to the second flag. Transformation type.
在一些实施例中,若图像区域为当前图像序列时,则第二标志与第一标志为同一个标志。In some embodiments, if the image area is the current image sequence, the second flag and the first flag are the same flag.
在一种可能的实现方式中,若第二标志的取值为第二数值,该第二数值指示当前图序列允许从M个候选变换方式中确定变换方式,此时根据如下方式,确定出当前解码块的变换类型。In a possible implementation, if the value of the second flag is a second value, the second value indicates that the current image sequence allows the transformation mode to be determined from M candidate transformation modes. At this time, the current transformation mode is determined according to the following method. Transform type of decoding block.
下面以MTS技术为例。The following takes MTS technology as an example.
若第二标志的取值为第二数值,且预设的至少一个条件为真时,则确定implicitMtsEnabled为1。否则,则确定implicitMtsEnabled为0。If the value of the second flag is the second value and at least one preset condition is true, then implicitMtsEnabled is determined to be 1. Otherwise, implicitMtsEnabled is determined to be 0.
示例性,用sps_mts_enabled_flag表示第二标志。For example, sps_mts_enabled_flag is used to represent the second flag.
可选的,第二数值为1。Optional, the second value is 1.
在一些实施例中,上述变量implicitMtsEnabled导出过程如下:In some embodiments, the export process of the above variable implicitMtsEnabled is as follows:
如果sps_mts_enabled_flag等于1并且以下一个或多个条件为真,则将implicitMtsEnabled设置为1:Set implicitMtsEnabled to 1 if sps_mts_enabled_flag equals 1 and one or more of the following conditions are true:
条件1,IntraSubPartitionsSplitType不等于ISP_NO_SPLITCondition 1, IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT
条件2,cu_sbt_flag等于1且Max(nTbW,nTbH)小于或等于32Condition 2, cu_sbt_flag is equal to 1 and Max(nTbW,nTbH) is less than or equal to 32
条件3,sps_explicit_mts_intra_enabled_flag等于0并且CuPredMode[0][xTbY][yTbY]等于MODE_INTRA并且lfnst_idx等于0并且IntraMipFlag[x0][y0]等于0。Condition 3, sps_explicit_mts_intra_enabled_flag is equal to 0 and CuPredMode[0][xTbY][yTbY] is equal to MODE_INTRA and lfnst_idx is equal to 0 and IntraMipFlag[x0][y0] is equal to 0.
若sps_mts_enabled_flag等于0,或者上述条件1和条件2均不成立时,则implicitMtsEnabled设置为0。If sps_mts_enabled_flag is equal to 0, or when neither condition 1 nor condition 2 above is true, implicitMtsEnabled is set to 0.
其中,cu_sbt_flag表示对于当前编码单元,子块变换是否使用。sps_explicit_mts_intra_enabled_flag表示mts_idx是否会显式出现在帧内编码的熵编码语法单元里面,mts_idx是指定用变换核的索引。CuPredMode[0][xTbY][yTbY]表示亮度分量在(xTbY,yTbY)位置的编码单元的预测模式。MODE_INTRA表示预测模式是帧内预测Among them, cu_sbt_flag indicates whether sub-block transformation is used for the current coding unit. sps_explicit_mts_intra_enabled_flag indicates whether mts_idx will explicitly appear in the entropy coding syntax unit of intra-frame coding. mts_idx is the index specifying the transform core. CuPredMode[0][xTbY][yTbY] represents the prediction mode of the coding unit whose luminance component is at the (xTbY, yTbY) position. MODE_INTRA indicates that the prediction mode is intra prediction
根据上述步骤确定出implicitMtsEnabled后,则根据implicitMtsEnabled确定当前解码块的变换类型。After the implicitMtsEnabled is determined according to the above steps, the transformation type of the current decoding block is determined according to the implicitMtsEnabled.
在一些实施例中,如果implicitMtsEnabled等于1,则可以通过如下方式,确定当前解码块的变换类型:In some embodiments, if implicitMtsEnabled is equal to 1, the transformation type of the current decoding block can be determined in the following manner:
方式一,如果cu_sbt_flag等于1,则根据cu_sbt_horizontal_flag和cu_sbt_pos_flag在表4中查询trTypeHor和trTypeVer。Method 1, if cu_sbt_flag is equal to 1, query trTypeHor and trTypeVer in Table 4 based on cu_sbt_horizontal_flag and cu_sbt_pos_flag.
表4Table 4
cu_sbt_horizontal_flagcu_sbt_horizontal_flag cu_sbt_pos_flagcu_sbt_pos_flag trTypeHortrTypeHor trTypeVertrTypeVer
00 00 22 11
00 11 11 11
11 00 11 22
11 11 11 11
其中,cu_sbt_horizontal_flag表示当前编码单元是否要水平划分成两个变换单元,cu_sbt_pos_flag表示当前编码单元的第一个变换单元的tu_y_coded_flag、tu_cb_coded_flag和tu_cr_coded_flag是否存在。其中,tu_y_coded_flag表示当前亮度块是否包含非0变换系数,tu_cb_coded_flag表示当前色度块(cb分量)是否包含非0变换系数,tu_cr_coded_flag表示当前色度块(cr分量)是否包含非0变换系数。Among them, cu_sbt_horizontal_flag indicates whether the current coding unit should be divided horizontally into two transformation units, and cu_sbt_pos_flag indicates whether the tu_y_coded_flag, tu_cb_coded_flag and tu_cr_coded_flag of the first transformation unit of the current coding unit exist. Among them, tu_y_coded_flag indicates whether the current luma block contains non-0 transform coefficients, tu_cb_coded_flag indicates whether the current chroma block (cb component) contains non-0 transform coefficients, and tu_cr_coded_flag indicates whether the current chroma block (cr component) contains non-0 transform coefficients.
例如,cu_sbt_horizontal_flag和cu_sbt_pos_flag均等于0时,则trTypeHor为2,trTypeVer为1。For example, when cu_sbt_horizontal_flag and cu_sbt_pos_flag are both equal to 0, then trTypeHor is 2 and trTypeVer is 1.
方式二,如果cu_sbt_flag等于0,则根据如下公式(5)和(6)推导trTypeHor和trTypeVer:Method 2, if cu_sbt_flag is equal to 0, trTypeHor and trTypeVer are derived according to the following formulas (5) and (6):
trTypeHor=(nTbW>=4&&nTbW<=16)?1:0   (5)trTypeHor=(nTbW>=4&&nTbW<=16)? 1:0 (5)
trTypeVer=(nTbH>=4&&nTbH<=16)?1:0   (6)trTypeVer=(nTbH>=4&&nTbH<=16)? 1:0 (6)
在一些实施例中,若implicitMtsEnabled不等于1,则根据mts_idx查表5,得到trTypeHor和trTypeVer。In some embodiments, if implicitMtsEnabled is not equal to 1, look up table 5 according to mts_idx to obtain trTypeHor and trTypeVer.
其中,mts_idx通过解码码流可以得到。Among them, mts_idx can be obtained by decoding the code stream.
表5table 5
mts_idxmts_idx 00 11 22 33 44
trTypeHortrTypeHor 00 11 22 11 22
trTypeVertrTypeVer 00 11 11 22 22
例如,若mts_idx为1,则确定trTypeHor和trTypeVer均为1。For example, if mts_idx is 1, it is determined that both trTypeHor and trTypeVer are 1.
根据上述步骤,确定出当前解码块的变换类型trTypeHor和trTypeVer后,根据trTypeHor和trTypeVer对当前解码块的变换系数进行反变换,得到当前解码块的残差值。According to the above steps, after the transformation types trTypeHor and trTypeVer of the current decoding block are determined, the transformation coefficients of the current decoding block are inversely transformed according to trTypeHor and trTypeVer to obtain the residual value of the current decoding block.
S604、根据当前解码块的变换类型,对当前解码块的变换系数进行反变换,得到当前解码块的残差值。S604. According to the transformation type of the current decoding block, perform inverse transformation on the transformation coefficient of the current decoding block to obtain the residual value of the current decoding block.
具体的,根据当前解码块的变换类型和当前解码块的大小,确定变换矩阵;使用变换矩阵对变换系数进行反变换运算,得到当前解码块的残差值。Specifically, the transformation matrix is determined according to the transformation type of the current decoding block and the size of the current decoding block; the transformation matrix is used to perform an inverse transformation operation on the transformation coefficient to obtain the residual value of the current decoding block.
例如,以当前解码块的大小nTbS和变换类型trType作为输入,输出对应的变换矩阵transMatrix。For example, take the current decoding block size nTbS and the transformation type trType as input, and output the corresponding transformation matrix transMatrix.
接着,使用该变换矩阵transMatrix对当前解码块的变换系数进行反变换,得到当前解码块的残差值。Then, the transformation matrix transMatrix is used to inversely transform the transformation coefficient of the current decoding block to obtain the residual value of the current decoding block.
例如,根据如下公式(7),得到当前解码块的残差值:For example, according to the following formula (7), the residual value of the current decoding block is obtained:
Figure PCTCN2022080706-appb-000004
Figure PCTCN2022080706-appb-000004
其中,
Figure PCTCN2022080706-appb-000005
为当前块的变换系数,T为变换矩阵,
Figure PCTCN2022080706-appb-000006
为当前解码块的残差值。
in,
Figure PCTCN2022080706-appb-000005
is the transformation coefficient of the current block, T is the transformation matrix,
Figure PCTCN2022080706-appb-000006
is the residual value of the current decoded block.
根据上述公式(7)可以基于变换矩阵,对变换系数进行反变换,得到当前解码块的残差值。According to the above formula (7), the transformation coefficient can be inversely transformed based on the transformation matrix to obtain the residual value of the current decoding block.
需要说明的是,上述公式(7)只是一种示例,上述S604的实现方式包括但不限于上述公式(7)所示。It should be noted that the above formula (7) is just an example, and the implementation of the above S604 includes but is not limited to the above formula (7).
在一些实施例中,根据当前解码块的预测模式对当前块进行预测,得到当前解码块的预测值。In some embodiments, the current block is predicted according to the prediction mode of the current decoding block to obtain the prediction value of the current decoding block.
根据上述步骤,得到当前解码块的残差值和预测值后,将预测值与残差值相加,得到当前解码块的重建值。According to the above steps, after obtaining the residual value and the predicted value of the current decoded block, the predicted value and the residual value are added to obtain the reconstructed value of the current decoded block.
本申请实施例的解码方法,通过解码码流,确定当前解码块的变换系数;确定当前编码块所在的图像区域的第一标志,第一标志基于图像区域的连续性参数确定,该第一标志用于指示是否允许图像区域从M个候选变换方式中确定变换方式,该连续性参数用于指示图像区域中像素点的变化连续性;根据第一标志,确定当前解码块的变换类型;根据当前解码块的变换类型,对当前解码块的变换系数进行反变换,得到当前解码块的残差值。即本申请实施例,增加了确定当前解码块的变换类型的条件,例如,若第一标志的取值为0时,则确定当前解码块的变换类型为0,进而提高了变换类型的确定速度,提高解码效率。The decoding method in the embodiment of the present application determines the transform coefficient of the current decoding block by decoding the code stream; determines the first flag of the image area where the current encoding block is located, and the first flag is determined based on the continuity parameter of the image area. The first flag Used to indicate whether the image area is allowed to determine the transformation mode from M candidate transformation modes. The continuity parameter is used to indicate the continuity of changes in the pixel points in the image area; according to the first flag, determine the transformation type of the current decoding block; according to the current The transformation type of the decoding block, inversely transforms the transformation coefficient of the current decoding block to obtain the residual value of the current decoding block. That is, the embodiment of the present application adds a condition for determining the transformation type of the current decoding block. For example, if the value of the first flag is 0, it is determined that the transformation type of the current decoding block is 0, thereby improving the speed of determining the transformation type. , improve decoding efficiency.
图7为本申请一实施例提供的图像解码方法流程示意图,图7可以理解为上述图6所示的解码方法的一具体实现方式。Figure 7 is a schematic flowchart of an image decoding method provided by an embodiment of the present application. Figure 7 can be understood as a specific implementation of the decoding method shown in Figure 6.
如图7所示,本申请实施例的解码方法包括:As shown in Figure 7, the decoding method in this embodiment of the present application includes:
S701、解码码流,得到第一标志。S701. Decode the code stream and obtain the first flag.
本申请实施例以图像区域为当前图像帧为例。In the embodiment of this application, the image area is the current image frame as an example.
另外,本申请实施例以MTS技术为例。In addition, the embodiment of this application takes MTS technology as an example.
此时,上述第一标志用于指示是否允许当前图像帧执行MTS操作。At this time, the above-mentioned first flag is used to indicate whether the current image frame is allowed to perform an MTS operation.
本申请实施例中,编码端将第一标志写入码流中,这样解码端获得码流后,对该码流进行解码,得到第一标志。In the embodiment of the present application, the encoding end writes the first flag into the code stream, so that after the decoding end obtains the code stream, it decodes the code stream to obtain the first flag.
S702、解码码流,得到当前解码块的变换系数。S702. Decode the code stream to obtain the transform coefficient of the current decoded block.
示例性的,若编码端在编码时,对变换系数不进行量化,而是直接对变换系数进行编码,得到码流。这样解码端解码码流,可以从码流中直接得到当前解码块的变换系数。For example, if the encoding end is encoding, the transform coefficients are not quantized, but the transform coefficients are directly encoded to obtain a code stream. In this way, the decoding end decodes the code stream and can directly obtain the transform coefficient of the current decoding block from the code stream.
示例性的,编码端在编码时,对变换系数进行量化,得到量化系数,再对量化系数进行编码,得到码流。这样,解码端解码码流,得到当前解码块的量化系数,对量化系数进行反量化,得到当前解码块的变换系数。For example, when encoding, the encoding end quantizes the transform coefficients to obtain quantized coefficients, and then encodes the quantized coefficients to obtain a code stream. In this way, the decoder decodes the code stream to obtain the quantized coefficients of the current decoded block, and performs inverse quantization on the quantized coefficients to obtain the transform coefficients of the current decoded block.
S703、根据第一标志,确定当前解码块的变换类型。S703. Determine the transformation type of the current decoding block according to the first flag.
上述S703的实现过程与上述S603一致,参照上述S603的描述,在此不再赘述。The implementation process of the above S703 is consistent with the above S603. Refer to the description of the above S603 and will not be repeated here.
S704、根据当前解码块的变换类型和当前解码块的大小,确定当前解码块的变换矩阵。S704. Determine the transformation matrix of the current decoding block according to the transformation type of the current decoding block and the size of the current decoding block.
S705、使用变换矩阵对变换系数进行反变换运算,得到当前解码块的残差值。S705. Use the transformation matrix to perform an inverse transformation operation on the transformation coefficient to obtain the residual value of the current decoding block.
S706、确定当前解码块的预测值。S706. Determine the prediction value of the current decoding block.
S707、根据当前解码块的预测值和残差值,得到当前解码块的重建值。S707: Obtain the reconstruction value of the current decoding block based on the prediction value and residual value of the current decoding block.
本申请实施例的解码方法,通过解码码流,得到当前图像帧的第一标识,根据该第一标识,确定当前解码块的变换类型;根据当前解码块的变换类型,对当前解码块的变换系数进行反变换,得到当前解码块的残差值。即本申请实施例,增加了确定当前解码块的变换类型的条件,例如,若第一标志的取值为0时,则确定当前解码块的变换类型为0,进而提高了变换类型的确定速度,提高解码效率。The decoding method in the embodiment of the present application obtains the first identifier of the current image frame by decoding the code stream. According to the first identifier, the transformation type of the current decoding block is determined; according to the transformation type of the current decoding block, the transformation of the current decoding block is The coefficients are inversely transformed to obtain the residual value of the current decoded block. That is, the embodiment of the present application adds a condition for determining the transformation type of the current decoding block. For example, if the value of the first flag is 0, it is determined that the transformation type of the current decoding block is 0, thereby improving the speed of determining the transformation type. , improve decoding efficiency.
应理解,图4至图7仅为本申请的示例,不应理解为对本申请的限制。It should be understood that Figures 4 to 7 are only examples of the present application and should not be understood as limitations of the present application.
以上结合附图详细描述了本申请的优选实施方式,但是,本申请并不限于上述实施方式中的具体细节,在本申请的技术构思范围内,可以对本申请的技术方案进行多种简单变型,这些简单变型均属于本申请的保护范围。例如,在上述具体实施方式中所描述的各个具体技术特征,在不矛盾的情况下,可以通过任何合适的方式进行组合,为了避免不必要的重复,本申请对各种可能的组合方式不再另行说明。又例如,本申请的各种不同的实施方式之间也可以进行任意组合,只要其不违背本申请的思想,其同样应当视为本申请所公开的内容。The preferred embodiments of the present application have been described in detail above with reference to the accompanying drawings. However, the present application is not limited to the specific details of the above-mentioned embodiments. Within the scope of the technical concept of the present application, various simple modifications can be made to the technical solutions of the present application. These simple modifications all belong to the protection scope of this application. For example, each specific technical feature described in the above-mentioned specific embodiments can be combined in any suitable way without conflict. In order to avoid unnecessary repetition, this application will no longer describe various possible combinations. Specify otherwise. For another example, any combination of various embodiments of the present application can be carried out. As long as they do not violate the idea of the present application, they should also be regarded as the contents disclosed in the present application.
还应理解,在本申请的各种方法实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。另外,本申请实施例中,术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系。具体地,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should also be understood that in the various method embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its functions and internal logic, and should not be used in this application. The implementation of the examples does not constitute any limitations. In addition, in the embodiment of this application, the term "and/or" is only an association relationship describing associated objects, indicating that three relationships can exist. Specifically, A and/or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in this article generally indicates that the related objects are an "or" relationship.
上文结合图4至图7,详细描述了本申请的方法实施例,下文结合图8至图11,详细描述本申请的装置实施例。The method embodiment of the present application is described in detail above with reference to FIGS. 4 to 7 , and the device embodiment of the present application is described in detail below with reference to FIGS. 8 to 11 .
图8是本申请一实施例提供的图像编码装置的示意性框图。Figure 8 is a schematic block diagram of an image encoding device provided by an embodiment of the present application.
如图8所示,图像编码装置10包括:As shown in Figure 8, the image encoding device 10 includes:
参数确定单元11,用于确定当前编码块所在的图像区域的连续性参数,所述连续性参数用于指示所述图像区域中像素点的变化连续性;Parameter determination unit 11, used to determine the continuity parameter of the image area where the current coding block is located, the continuity parameter being used to indicate the continuity of changes in the pixel points in the image area;
方式确定单元12,用于根据所述图像区域的连续性参数,确定所述当前编码块的变换方式;Mode determination unit 12, configured to determine the transformation mode of the current coding block according to the continuity parameter of the image area;
变换单元13,用于根据所述变换方式,对所述当前编码块进行变换,得到所述当前编码块的变换系数。The transformation unit 13 is configured to transform the current coding block according to the transformation method to obtain the transformation coefficient of the current coding block.
在一些实施例中,参数确定单元11,具体用于确定所述图像区域的梯度图,以及所述梯度图的梯度图;根据所述梯度图的梯度图,确定所述图像区域的连续性参数。In some embodiments, the parameter determination unit 11 is specifically configured to determine the gradient map of the image area and the gradient map of the gradient map; determine the continuity parameters of the image area based on the gradient map of the gradient map. .
在一些实施例中,参数确定单元11,具体用于将所述梯度图的梯度图中梯度值的平均值,确定为所述图像区域的连续性参数。In some embodiments, the parameter determination unit 11 is specifically configured to determine the average value of the gradient values in the gradient map of the gradient map as the continuity parameter of the image area.
在一些实施例中,参数确定单元11,具体用于确定所述图像区域的残差值;根据所述图像区域的残差值,确定所述图像区域的连续性参数,其中所述残差值与所述连续性参数负相关。In some embodiments, the parameter determination unit 11 is specifically configured to determine the residual value of the image area; determine the continuity parameter of the image area according to the residual value of the image area, wherein the residual value Negatively related to the continuity parameter.
在一些实施例中,方式确定单元12,具体用于若所述图像区域的连续性参数小于预设阈值,则确定所述当前编码块的变换方式为第一变换方式。In some embodiments, the mode determination unit 12 is specifically configured to determine the transformation mode of the current coding block to be the first transformation mode if the continuity parameter of the image area is less than a preset threshold.
在一些实施例中,方式确定单元12,若所述图像区域的连续性参数大于或等于预设阈值,则从M个候选变换方式中确定所述当前编码块的变换方式,所述M为大于1的正整数。In some embodiments, the mode determination unit 12 determines the transformation mode of the current coding block from M candidate transformation modes if the continuity parameter of the image area is greater than or equal to the preset threshold, and the M is greater than or equal to A positive integer of 1.
在一些实施例中,方式确定单元12,根据所述图像区域的连续性参数,确定第一标志,所述第一标志用于指示是否允许所述图像区域从M个候选变换方式中确定变换方式,所述M为大于1的正整数;根据所述第一标志,确定所述当前编码块的变换方式。In some embodiments, the mode determination unit 12 determines a first flag according to the continuity parameter of the image area, and the first flag is used to indicate whether the image area is allowed to determine a transformation mode from M candidate transformation modes. , the M is a positive integer greater than 1; according to the first flag, the transformation mode of the current coding block is determined.
在一些实施例中,方式确定单元12,若所述图像区域的连续性参数小于预设阈值,则确定所述第一标志的取值为第一数值,所述第一数值用于指示不允许所述图像区域从所述M个候选变换方式中确定变换方式。In some embodiments, the mode determination unit 12 determines that the value of the first flag is a first value if the continuity parameter of the image area is less than a preset threshold, and the first value is used to indicate that it is not allowed. The image area determines a transformation mode from the M candidate transformation modes.
在一些实施例中,方式确定单元12,若所述第一标志的取值为所述第一数值时,则确定所述当前编码块的变换方式为第一变换方式。In some embodiments, the mode determining unit 12 determines that the transformation mode of the current coding block is the first transformation mode if the value of the first flag is the first numerical value.
在一些实施例中,方式确定单元12,若所述图像区域的连续性参数大于或等于所述预设阈值,则确定所述第一标志的取值为第二数值,所述第二数值用于指示允许所述图像区域从所述M个候选变换方式中确定变换方式。In some embodiments, the mode determination unit 12 determines that the value of the first flag is a second value if the continuity parameter of the image area is greater than or equal to the preset threshold, and the second value is The instruction allows the image region to determine a transformation mode from the M candidate transformation modes.
在一些实施例中,方式确定单元12,若所述第一标志的取值为所述第二数值时,则从M个候选变换方式中确定所述当前编码块的变换方式。In some embodiments, the mode determining unit 12 determines the transformation mode of the current coding block from M candidate transformation modes if the value of the first flag is the second value.
在一些实施例中,方式确定单元12,确定使用所述M个候选变换方式对所述当前编码块进行变换时的率失真代价;根据所述M个候选变换方式对应的率失真代价,从所述M个候选变换方式中选择一候选变换方式,作为所述当前编码块的变换方式。In some embodiments, the mode determination unit 12 determines the rate distortion cost when using the M candidate transformation modes to transform the current coding block; according to the rate distortion costs corresponding to the M candidate transformation modes, from the Select one candidate transformation mode from the M candidate transformation modes as the transformation mode of the current coding block.
在一些实施例中,方式确定单元12,将所述M个候选变换方式中,率失真代价最小的候选变换方式确定为所述当前编码块的变换方式。In some embodiments, the mode determination unit 12 determines the candidate transformation mode with the smallest rate distortion cost among the M candidate transformation modes as the transformation mode of the current coding block.
在一些实施例中,变换单元13,用于将所述第一标志写入码流。In some embodiments, the transformation unit 13 is used to write the first flag into the code stream.
在一些实施例中,所述图像区域为当前图像帧,或者为当前图像序列、或者为当前图像片、或者为所述当前编码 块。In some embodiments, the image area is the current image frame, or the current image sequence, or the current image slice, or the current coding block.
在一些实施例中,若所述图像区域为所述当前图像帧、所述当前图像片和所述当前编码块中的任意一个时,则所述码流中还包括第二标志,所述第二标志用于指示当前图序列是否允许从所述M个候选变换方式中确定变换方式。In some embodiments, if the image area is any one of the current image frame, the current image slice, and the current coding block, the code stream further includes a second flag, and the third The second flag is used to indicate whether the current picture sequence allows the transformation mode to be determined from the M candidate transformation modes.
可选的,若所述图像区域为所述当前图像序列,则所述第一标志复用所述第二标志。Optionally, if the image area is the current image sequence, the first mark multiplexes the second mark.
可选的,所述第一变换方式为DTC-Ⅱ方式。Optionally, the first conversion mode is DTC-II mode.
可选的,所述M个候选变换方式包括DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式组合构成的变换方式。Optionally, the M candidate transformation modes include a transformation mode composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode.
可选的,所述M个候选变换方式包括多变换核选择MTS对应的多个变换方式。Optionally, the M candidate transformation modes include multiple transformation modes corresponding to the multi-transform core selection MTS.
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图8所示的装置10可以执行本申请实施例的编码方法,并且转10中的各个单元的前述和其它操作和/或功能分别为了实现上述编码方法等各个方法中的相应流程,为了简洁,在此不再赘述。It should be understood that the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here. Specifically, the device 10 shown in Figure 8 can execute the encoding method of the embodiment of the present application, and perform the aforementioned and other operations and/or functions of each unit in the device 10 in order to implement the corresponding processes in each method such as the above encoding method. For the sake of brevity, no further details will be given here.
图9是本申请一实施例提供的图像解码装置的示意性框图。Figure 9 is a schematic block diagram of an image decoding device provided by an embodiment of the present application.
如图9所示,图像解码装置20包括:As shown in Figure 9, the image decoding device 20 includes:
解码单元21,用于解码码流,确定当前解码块的变换系数;Decoding unit 21, used to decode the code stream and determine the transform coefficient of the current decoding block;
标志确定单元22,用于确定所述当前编码块所在的图像区域的第一标志,所述第一标志基于所述图像区域的连续性参数确定,所述第一标志用于指示是否允许所述图像区域从M个候选变换方式中确定变换方式,所述连续性参数用于指示所述图像区域中像素点的变化连续性,所述M为大于1的正整数;The flag determination unit 22 is used to determine the first flag of the image area where the current encoding block is located. The first flag is determined based on the continuity parameter of the image area. The first flag is used to indicate whether the The image area determines the transformation mode from M candidate transformation modes, the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area, and the M is a positive integer greater than 1;
类型确定单元23,用于根据所述第一标志,确定所述当前解码块的变换类型;Type determination unit 23, configured to determine the transformation type of the current decoding block according to the first flag;
反变换单元24,用于根据所述当前解码块的变换类型,对所述当前解码块的变换系数进行反变换,得到所述当前解码块的残差值。The inverse transform unit 24 is configured to inversely transform the transform coefficient of the current decoded block according to the transform type of the current decoded block to obtain the residual value of the current decoded block.
在一些实施例中,标志确定单元22,具体用于确定所述图像区域的连续性参数;根据所述图像区域的连续性参数,确定所述第一标志。In some embodiments, the flag determining unit 22 is specifically configured to determine the continuity parameter of the image area; determine the first flag according to the continuity parameter of the image area.
在一些实施例中,标志确定单元22,具体用于确定所述图像区域的相邻已解码区域;确定所述相邻已解码区域的梯度图,以及所述梯度图的梯度图;根据所述梯度图的梯度图,确定所述图像区域的连续性参数。In some embodiments, the flag determining unit 22 is specifically configured to determine the adjacent decoded area of the image area; determine the gradient map of the adjacent decoded area, and the gradient map of the gradient map; according to the A gradient map of a gradient map that determines the continuity parameters of the image region.
在一些实施例中,标志确定单元22,具体用于将所述梯度图的梯度图中梯度值的平均值,确定为所述图像区域的连续性参数。In some embodiments, the flag determining unit 22 is specifically configured to determine the average value of the gradient values in the gradient map of the gradient map as the continuity parameter of the image area.
在一些实施例中,标志确定单元22,具体用于确定所述图像区域的相邻已解码区域;确定所述相邻已解码区域的残差值;根据所述相邻已解码区域的残差值,确定所述图像区域的连续性参数,其中所述残差值与所述连续性参数负相关。In some embodiments, the flag determining unit 22 is specifically configured to determine adjacent decoded areas of the image area; determine the residual value of the adjacent decoded area; and determine the residual value of the adjacent decoded area according to the residual value of the adjacent decoded area. value to determine the continuity parameter of the image region, wherein the residual value is negatively correlated with the continuity parameter.
在一些实施例中,标志确定单元22,具体用于若所述图像区域的连续性参数小于预设阈值,则确定所述第一标志的取值为第一数值,所述第一数值用于指示不允许所述图像区域从所述M个候选变换方式中确定变换方式。In some embodiments, the flag determination unit 22 is specifically configured to determine that the value of the first flag is a first value if the continuity parameter of the image area is less than a preset threshold, and the first value is used for Indicates that the image area is not allowed to determine the transformation mode from the M candidate transformation modes.
在一些实施例中,标志确定单元22,具体用于若所述图像区域的连续性参数大于或等于预设阈值,则确定所述第一标志的取值为第二数值,所述第二数值用于指示允许所述图像区域从所述M个候选变换方式中确定变换方式。In some embodiments, the flag determination unit 22 is specifically configured to determine that the value of the first flag is a second value if the continuity parameter of the image area is greater than or equal to a preset threshold, and the second value Used to indicate that the image area is allowed to determine the transformation mode from the M candidate transformation modes.
在一些实施例中,标志确定单元22,具体用于解码所述码流,得到所述第一标志。In some embodiments, the flag determining unit 22 is specifically configured to decode the code stream to obtain the first flag.
在一些实施例中,类型确定单元23,用于若所述第一标志的取值为第一数值时,则确定所述当前解码块的变换类型的索引为0,所述第一数值用于指示不允许所述图像区域从所述M个候选变换方式中确定变换方式。In some embodiments, the type determination unit 23 is configured to determine that the index of the transform type of the current decoding block is 0 if the value of the first flag is a first value, and the first value is used for Indicates that the image area is not allowed to determine the transformation mode from the M candidate transformation modes.
在一些实施例中,类型确定单元23,用于若所述第一标志的取值为第二数值时,则根据所述第二标志,确定所述当前解码块的变换类型,所述第二标志通过解码所述码流得到,所述第二数值用于指示允许所述图像区域从所述M个候选变换方式中确定变换方式,所述第二标志用于指示当前图序列是否允许从所述M个候选变换方式中确定变换方式。In some embodiments, the type determination unit 23 is configured to determine the transformation type of the current decoding block according to the second flag if the value of the first flag is a second value, and the second The flag is obtained by decoding the code stream. The second value is used to indicate that the image area is allowed to determine the transformation mode from the M candidate transformation modes. The second flag is used to indicate whether the current picture sequence is allowed to be transformed from all the candidate transformation modes. The transformation method is determined among the M candidate transformation methods.
可选的,所述变换类型包括水平变换类型和垂直变换类型。Optionally, the transformation type includes a horizontal transformation type and a vertical transformation type.
可选的,所述图像区域为当前图像帧,或者为当前图像序列、或者为当前图像片、或者为所述当前编码块。Optionally, the image area is the current image frame, or the current image sequence, or the current image slice, or the current coding block.
可选的,若所述图像区域为所述当前图像序列时,则所述第二标志与所述第一标志为同一个标志。Optionally, if the image area is the current image sequence, the second mark and the first mark are the same mark.
在一些实施例中,反变换单元24,用于根据所述当前解码块的变换类型和所述当前解码块的大小,确定变换矩阵;使用所述变换矩阵对所述变换系数进行反变换运算,得到所述当前解码块的残差值。In some embodiments, the inverse transformation unit 24 is configured to determine a transformation matrix according to the transformation type of the current decoding block and the size of the current decoding block; use the transformation matrix to perform an inverse transformation operation on the transformation coefficient, Obtain the residual value of the current decoding block.
可选的,所述M个候选变换方式包括DTC-Ⅱ方式、DST-VII方式和DCT-VIII方式组合构成的变换方式。Optionally, the M candidate transformation modes include a transformation mode composed of a combination of DTC-II mode, DST-VII mode and DCT-VIII mode.
可选的,所述M个候选变换方式包括多变换核选择MTS对应的多个变换方式。Optionally, the M candidate transformation modes include multiple transformation modes corresponding to the multi-transform core selection MTS.
应理解,装置实施例与方法实施例可以相互对应,类似的描述可以参照方法实施例。为避免重复,此处不再赘述。具体地,图9所示的装置20可以对应于执行本申请实施例的解码方法中的相应主体,并且装置20中的各个单元的前述和其它操作和/或功能分别为了实现解码方法等各个方法中的相应流程,为了简洁,在此不再赘述。It should be understood that the device embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, they will not be repeated here. Specifically, the device 20 shown in FIG. 9 may correspond to the corresponding subject in performing the decoding method of the embodiment of the present application, and the foregoing and other operations and/or functions of each unit in the device 20 are respectively to implement the decoding method and other methods. The corresponding process in , for the sake of brevity, will not be repeated here.
上文中结合附图从功能单元的角度描述了本申请实施例的装置和系统。应理解,该功能单元可以通过硬件形式实现,也可以通过软件形式的指令实现,还可以通过硬件和软件单元组合实现。具体地,本申请实施例中的方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路和/或软件形式的指令完成,结合本申请实施例公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件单元组合执行完成。可选地,软件单元可以位于随机存储器,闪存、只读存储器、可编程只读存储器、电可擦写可编程存储器、寄存器等本领域的成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法实施例中的步骤。The device and system of the embodiments of the present application are described above from the perspective of functional units in conjunction with the accompanying drawings. It should be understood that this functional unit can be implemented in the form of hardware, can also be implemented in the form of instructions in the software, or can also be implemented in a combination of hardware and software units. Specifically, each step of the method embodiments in the embodiments of the present application can be completed by integrated logic circuits of hardware in the processor and/or instructions in the form of software. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly embodied in hardware. The execution of the decoding processor is completed, or the execution is completed using a combination of hardware and software units in the decoding processor. Optionally, the software unit may be located in a mature storage medium in this field such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in combination with its hardware.
图10是本申请实施例提供的电子设备的示意性框图。Figure 10 is a schematic block diagram of an electronic device provided by an embodiment of the present application.
如图32所示,该电子设备30可以为本申请实施例所述的视频编码器,或者视频解码器,该电子设备30可包括:As shown in Figure 32, the electronic device 30 may be the video encoder or video decoder described in the embodiment of the present application. The electronic device 30 may include:
存储器33和处理器32,该存储器33用于存储计算机程序34,并将该程序代码34传输给该处理器32。换言之,该处理器32可以从存储器33中调用并运行计算机程序34,以实现本申请实施例中的方法。 Memory 33 and processor 32, the memory 33 is used to store the computer program 34 and transmit the program code 34 to the processor 32. In other words, the processor 32 can call and run the computer program 34 from the memory 33 to implement the method in the embodiment of the present application.
例如,该处理器32可用于根据该计算机程序34中的指令执行上述方法200中的步骤。For example, the processor 32 may be configured to perform the steps in the above method 200 according to instructions in the computer program 34 .
在本申请的一些实施例中,该处理器32可以包括但不限于:In some embodiments of the present application, the processor 32 may include but is not limited to:
通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等等。General processor, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates Or transistor logic devices, discrete hardware components, etc.
在本申请的一些实施例中,该存储器33包括但不限于:In some embodiments of the present application, the memory 33 includes but is not limited to:
易失性存储器和/或非易失性存储器。其中,非易失性存储器可以是只读存储器(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)。Volatile memory and/or non-volatile memory. Among them, non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. Volatile memory may be Random Access Memory (RAM), which is used as an external cache. By way of illustration, but not limitation, many forms of RAM are available, such as static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
在本申请的一些实施例中,该计算机程序34可以被分割成一个或多个单元,该一个或者多个单元被存储在该存储器33中,并由该处理器32执行,以完成本申请提供的方法。该一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述该计算机程序34在该电子设备30中的执行过程。In some embodiments of the present application, the computer program 34 can be divided into one or more units, and the one or more units are stored in the memory 33 and executed by the processor 32 to complete the tasks provided by this application. Methods. The one or more units may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program 34 in the electronic device 30 .
如图10所示,该电子设备30还可包括:As shown in Figure 10, the electronic device 30 may also include:
收发器33,该收发器33可连接至该处理器32或存储器33。 Transceiver 33 , the transceiver 33 can be connected to the processor 32 or the memory 33 .
其中,处理器32可以控制该收发器33与其他设备进行通信,具体地,可以向其他设备发送信息或数据,或接收其他设备发送的信息或数据。收发器33可以包括发射机和接收机。收发器33还可以进一步包括天线,天线的数量可以为一个或多个。The processor 32 can control the transceiver 33 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices. Transceiver 33 may include a transmitter and a receiver. The transceiver 33 may further include an antenna, and the number of antennas may be one or more.
应当理解,该电子设备30中的各个组件通过总线系统相连,其中,总线系统除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。It should be understood that various components in the electronic device 30 are connected through a bus system, where in addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus.
图11是本申请实施例提供的视频编解码系统的示意性框图。Figure 11 is a schematic block diagram of a video encoding and decoding system provided by an embodiment of the present application.
如图11所示,该视频编解码系统40可包括:视频编码器41和视频解码器42,其中视频编码器41用于执行本申请实施例涉及的视频编码方法,视频解码器42用于执行本申请实施例涉及的视频解码方法。As shown in Figure 11, the video encoding and decoding system 40 may include: a video encoder 41 and a video decoder 42, where the video encoder 41 is used to perform the video encoding method involved in the embodiment of the present application, and the video decoder 42 is used to perform The embodiment of the present application relates to a video decoding method.
本申请还提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得该计算机能够执行上述方法实施例的方法。或者说,本申请实施例还提供一种包含指令的计算机程序产品,该指令被计算机执行时使得计算机执行上述方法实施例的方法。This application also provides a computer storage medium on which a computer program is stored. When the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, embodiments of the present application also provide a computer program product containing instructions, which when executed by a computer causes the computer to perform the method of the above method embodiments.
本申请还提供了一种码流,该码流是通过上述编码方式生成的。可选的,该码流中包括第一标志。This application also provides a code stream, which is generated by the above encoding method. Optionally, the code stream includes a first flag.
当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted over a wired connection from a website, computer, server, or data center (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website, computer, server or data center. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media. The available media may be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as digital video discs (DVD)), or semiconductor media (such as solid state disks (SSD)), etc.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or may be Integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。例如,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。A unit described as a separate component may or may not be physically separate. A component shown as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, each functional unit in various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以该权利要求的保护范围为准。The above contents are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, and should are covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (43)

  1. 一种图像编码方法,其特征在于,包括:An image coding method, characterized by including:
    确定当前编码块所在的图像区域的连续性参数,所述连续性参数用于指示所述图像区域中像素点的变化连续性;Determine the continuity parameter of the image area where the current coding block is located, the continuity parameter being used to indicate the continuity of changes in pixels in the image area;
    根据所述图像区域的连续性参数,确定所述当前编码块的变换方式;Determine the transformation mode of the current coding block according to the continuity parameter of the image area;
    根据所述变换方式,对所述当前编码块进行变换,得到所述当前编码块的变换系数。According to the transformation method, the current coding block is transformed to obtain the transformation coefficient of the current coding block.
  2. 根据权利要求1所述的方法,其特征在于,所述确定当前编码块所在的图像区域的连续性参数,包括:The method according to claim 1, characterized in that determining the continuity parameter of the image area where the current coding block is located includes:
    确定所述图像区域的梯度图,以及所述梯度图的梯度图;Determine the gradient map of the image area, and the gradient map of the gradient map;
    根据所述梯度图的梯度图,确定所述图像区域的连续性参数。A continuity parameter of the image region is determined based on the gradient map of the gradient map.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述梯度图的梯度图,确定所述图像区域的连续性参数,包括:The method of claim 2, wherein determining the continuity parameter of the image area according to the gradient map of the gradient map includes:
    将所述梯度图的梯度图中梯度值的平均值,确定为所述图像区域的连续性参数。The average value of the gradient values in the gradient map of the gradient map is determined as the continuity parameter of the image area.
  4. 根据权利要求1所述的方法,其特征在于,所述确定当前编码块所在的图像区域的连续性参数,包括:The method according to claim 1, characterized in that determining the continuity parameter of the image area where the current coding block is located includes:
    确定所述图像区域的残差值;Determine the residual value of the image area;
    根据所述图像区域的残差值,确定所述图像区域的连续性参数,其中所述残差值与所述连续性参数负相关。A continuity parameter of the image region is determined based on a residual value of the image region, wherein the residual value is negatively correlated with the continuity parameter.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定所述当前编码块的变换方式,包括:The method according to any one of claims 1 to 4, characterized in that determining the transformation mode of the current coding block according to the continuity parameter of the image area includes:
    若所述图像区域的连续性参数小于预设阈值,则确定所述当前编码块的变换方式为第一变换方式。If the continuity parameter of the image area is less than the preset threshold, it is determined that the transformation mode of the current coding block is the first transformation mode.
  6. 根据权利要求1-4任一项所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定所述当前编码块的变换方式,包括:The method according to any one of claims 1 to 4, characterized in that determining the transformation mode of the current coding block according to the continuity parameter of the image area includes:
    若所述图像区域的连续性参数大于或等于预设阈值,则从M个候选变换方式中确定所述当前编码块的变换方式,所述M为大于1的正整数。If the continuity parameter of the image area is greater than or equal to the preset threshold, then the transformation mode of the current coding block is determined from M candidate transformation modes, where M is a positive integer greater than 1.
  7. 根据权利要求1-4任一项所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定所述当前编码块的变换方式,包括:The method according to any one of claims 1 to 4, characterized in that determining the transformation mode of the current coding block according to the continuity parameter of the image area includes:
    根据所述图像区域的连续性参数,确定第一标志,所述第一标志用于指示是否允许所述图像区域从M个候选变换方式中确定变换方式,所述M为大于1的正整数;Determine a first flag according to the continuity parameter of the image area. The first flag is used to indicate whether the image area is allowed to determine a transformation mode from M candidate transformation modes, where M is a positive integer greater than 1;
    根据所述第一标志,确定所述当前编码块的变换方式。According to the first flag, the transformation mode of the current coding block is determined.
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定第一标志,包括:The method of claim 7, wherein determining the first mark according to the continuity parameter of the image area includes:
    若所述图像区域的连续性参数小于预设阈值,则确定所述第一标志的取值为第一数值,所述第一数值用于指示不允许所述图像区域从所述M个候选变换方式中确定变换方式。If the continuity parameter of the image area is less than the preset threshold, it is determined that the value of the first flag is a first value, and the first value is used to indicate that the image area is not allowed to transform from the M candidates. Determine the transformation method in the method.
  9. 根据权利要求8所述的方法,其特征在于,所述根据所述第一标志,确定所述当前编码块的变换方式,包括:The method of claim 8, wherein determining the transformation mode of the current coding block according to the first flag includes:
    若所述第一标志的取值为所述第一数值时,则确定所述当前编码块的变换方式为第一变换方式。If the value of the first flag is the first numerical value, it is determined that the transformation mode of the current coding block is the first transformation mode.
  10. 根据权利要求7所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定第一标志,包括:The method of claim 7, wherein determining the first mark according to the continuity parameter of the image area includes:
    若所述图像区域的连续性参数大于或等于所述预设阈值,则确定所述第一标志的取值为第二数值,所述第二数值用于指示允许所述图像区域从所述M个候选变换方式中确定变换方式。If the continuity parameter of the image area is greater than or equal to the preset threshold, it is determined that the value of the first flag is a second value, and the second value is used to indicate that the image area is allowed to move from the M Determine the transformation method among candidate transformation methods.
  11. 根据权利要求10所述的方法,其特征在于,所述根据所述第一标志,确定所述当前编码块的变换方式,包括:The method of claim 10, wherein determining the transformation mode of the current coding block according to the first flag includes:
    若所述第一标志的取值为所述第二数值时,则从M个候选变换方式中确定所述当前编码块的变换方式。If the value of the first flag is the second value, the transformation mode of the current coding block is determined from M candidate transformation modes.
  12. 根据权利要求6或11所述的方法,其特征在于,所述从M个候选变换方式中确定所述当前编码块的变换方式,包括:The method according to claim 6 or 11, characterized in that determining the transformation mode of the current coding block from M candidate transformation modes includes:
    确定使用所述M个候选变换方式对所述当前编码块进行变换时的率失真代价;Determine the rate distortion cost when using the M candidate transformation methods to transform the current coding block;
    根据所述M个候选变换方式对应的率失真代价,从所述M个候选变换方式中选择一候选变换方式,作为所述当前编码块的变换方式。According to the rate distortion cost corresponding to the M candidate transformation modes, a candidate transformation mode is selected from the M candidate transformation modes as the transformation mode of the current coding block.
  13. 根据权利要求12所述的方法,其特征在于,所述根据所述M个候选变换方式对应的率失真代价,从所述M个候选变换方式中选择一候选变换方式,作为所述当前编码块的变换方式,包括:The method according to claim 12, characterized in that, according to the rate distortion cost corresponding to the M candidate transformation modes, a candidate transformation mode is selected from the M candidate transformation modes as the current coding block. Transformation methods include:
    将所述M个候选变换方式中,率失真代价最小的候选变换方式确定为所述当前编码块的变换方式。Among the M candidate transformation modes, the candidate transformation mode with the smallest rate distortion cost is determined as the transformation mode of the current coding block.
  14. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7, further comprising:
    将所述第一标志写入码流。Write the first flag into the code stream.
  15. 根据权利要求14所述的方法,其特征在于,所述图像区域为当前图像帧,或者为当前图像序列、或者为当前图像片、或者为所述当前编码块。The method of claim 14, wherein the image area is a current image frame, a current image sequence, a current image slice, or the current coding block.
  16. 根据权利要求15所述的方法,其特征在于,若所述图像区域为所述当前图像帧、所述当前图像片和所述当前编码块中的任意一个时,则所述码流中还包括第二标志,所述第二标志用于指示当前图像序列是否允许从所述M个候选变换方式中确定变换方式。The method according to claim 15, characterized in that if the image area is any one of the current image frame, the current image slice and the current coding block, the code stream also includes The second flag is used to indicate whether the current image sequence allows the transformation mode to be determined from the M candidate transformation modes.
  17. 根据权利要求16所述的方法,其特征在于,若所述图像区域为所述当前图像序列,则所述第一标志复用所述第二标志。The method according to claim 16, characterized in that if the image area is the current image sequence, the first mark multiplexes the second mark.
  18. 根据权利要求5所述的方法,其特征在于,所述第一变换方式为离散余弦变换DTC-Ⅱ方式。The method according to claim 5, characterized in that the first transformation method is a discrete cosine transform DTC-II method.
  19. 根据权利要求6所述的方法,其特征在于,所述M个候选变换方式包括离散余弦变换DTC-Ⅱ方式、离散正弦变换DST-VII方式和离散余弦变换DCT-VIII方式组合构成的变换方式。The method according to claim 6, wherein the M candidate transformation methods include a combination of discrete cosine transform DTC-II, discrete sine transform DST-VII, and discrete cosine transform DCT-VIII.
  20. 根据权利要求19所述的方法,其特征在于,所述M个候选变换方式包括多变换核选择MTS对应的多个变换方式。The method according to claim 19, characterized in that the M candidate transformation modes include multiple transformation modes corresponding to multi-transform core selection MTS.
  21. 一种图像解码方法,其特征在于,包括:An image decoding method, characterized by including:
    解码码流,确定当前解码块的变换系数;Decode the code stream and determine the transform coefficient of the current decoding block;
    确定所述当前编码块所在的图像区域的第一标志,所述第一标志基于所述图像区域的连续性参数确定,所述第一标志用于指示是否允许所述图像区域从M个候选变换方式中确定变换方式,所述连续性参数用于指示所述图像区域中像素点的变化连续性,所述M为大于1的正整数;Determine the first flag of the image area where the current coding block is located, the first flag is determined based on the continuity parameter of the image area, and the first flag is used to indicate whether the image area is allowed to transform from M candidates The transformation mode is determined in the mode, the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area, and the M is a positive integer greater than 1;
    根据所述第一标志,确定所述当前解码块的变换类型;Determine the transform type of the current decoding block according to the first flag;
    根据所述当前解码块的变换类型,对所述当前解码块的变换系数进行反变换,得到所述当前解码块的残差值。According to the transformation type of the current decoding block, the transformation coefficient of the current decoding block is inversely transformed to obtain the residual value of the current decoding block.
  22. 根据权利要求21所述的方法,其特征在于,所述确定所述当前编码块所在的图像区域的第一标志,包括:The method according to claim 21, characterized in that determining the first flag of the image area where the current coding block is located includes:
    确定所述图像区域的连续性参数;Determine continuity parameters of the image area;
    根据所述图像区域的连续性参数,确定所述第一标志。The first flag is determined based on the continuity parameter of the image area.
  23. 根据权利要求22所述的方法,其特征在于,所述确定所述图像区域的连续性参数,包括:The method of claim 22, wherein determining the continuity parameter of the image area includes:
    确定所述图像区域的相邻已解码区域;Determine adjacent decoded areas of the image area;
    确定所述相邻已解码区域的梯度图,以及所述梯度图的梯度图;Determine the gradient map of the adjacent decoded region, and the gradient map of the gradient map;
    根据所述梯度图的梯度图,确定所述图像区域的连续性参数。A continuity parameter of the image region is determined based on the gradient map of the gradient map.
  24. 根据权利要求23所述的方法,其特征在于,所述根据所述梯度图的梯度图,确定所述图像区域的连续性参数,包括:The method of claim 23, wherein determining the continuity parameter of the image area according to the gradient map of the gradient map includes:
    将所述梯度图的梯度图中梯度值的平均值,确定为所述图像区域的连续性参数。The average value of the gradient values in the gradient map of the gradient map is determined as the continuity parameter of the image area.
  25. 根据权利要求22所述的方法,其特征在于,所述确定所述图像区域的连续性参数,包括:The method of claim 22, wherein determining the continuity parameter of the image area includes:
    确定所述图像区域的相邻已解码区域;Determine adjacent decoded areas of the image area;
    确定所述相邻已解码区域的残差值;Determine the residual value of the adjacent decoded region;
    根据所述相邻已解码区域的残差值,确定所述图像区域的连续性参数,其中所述残差值与所述连续性参数负相关。The continuity parameter of the image region is determined according to the residual value of the adjacent decoded region, wherein the residual value is negatively correlated with the continuity parameter.
  26. 根据权利要求22-25任一项所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定第一标志,包括:The method according to any one of claims 22 to 25, characterized in that determining the first mark according to the continuity parameter of the image area includes:
    若所述图像区域的连续性参数小于预设阈值,则确定所述第一标志的取值为第一数值,所述第一数值用于指示不允许所述图像区域从所述M个候选变换方式中确定变换方式。If the continuity parameter of the image area is less than the preset threshold, it is determined that the value of the first flag is a first value, and the first value is used to indicate that the image area is not allowed to transform from the M candidates. Determine the transformation method in the method.
  27. 根据权利要求22-25任一项所述的方法,其特征在于,所述根据所述图像区域的连续性参数,确定第一标志,包括:The method according to any one of claims 22 to 25, characterized in that determining the first mark according to the continuity parameter of the image area includes:
    若所述图像区域的连续性参数大于或等于预设阈值,则确定所述第一标志的取值为第二数值,所述第二数值用于指示允许所述图像区域从所述M个候选变换方式中确定变换方式。If the continuity parameter of the image area is greater than or equal to the preset threshold, the value of the first flag is determined to be a second value, and the second value is used to indicate that the image area is allowed to be selected from the M candidates. Determine the transformation method in the transformation method.
  28. 根据权利要求21所述的方法,其特征在于,所述确定所述当前编码块所在的图像区域的第一标志,包括:The method according to claim 21, characterized in that determining the first flag of the image area where the current coding block is located includes:
    解码所述码流,得到所述第一标志。Decode the code stream to obtain the first flag.
  29. 根据权利要求21所述的方法,其特征在于,所述根据所述第一标志,确定所述当前解码块的变换类型,包括:The method of claim 21, wherein determining the transformation type of the current decoding block according to the first flag includes:
    若所述第一标志的取值为第一数值时,则确定所述当前解码块的变换类型索引为0,所述第一数值用于指示不允许所述图像区域从所述M个候选变换方式中确定变换方式。If the value of the first flag is a first value, it is determined that the transformation type index of the current decoding block is 0, and the first value is used to indicate that the image area is not allowed to transform from the M candidates. Determine the transformation method in the method.
  30. 根据权利要求21所述的方法,其特征在于,所述根据所述第一标志,确定所述当前解码块的变换类型,包括:The method of claim 21, wherein determining the transformation type of the current decoding block according to the first flag includes:
    若所述第一标志的取值为第二数值时,则根据第二标志,确定所述当前解码块的变换类型,所述第二标志通过解析所述码流得到,所述第二数值用于指示允许所述图像区域从所述M个候选变换方式中确定变换方式,所述第二标志用于指示当前图序列是否允许从所述M个候选变换方式中确定变换方式。If the value of the first flag is a second value, the transformation type of the current decoding block is determined according to the second flag. The second flag is obtained by parsing the code stream. The second value is In order to indicate that the image region is allowed to determine a transformation mode from the M candidate transformation modes, the second flag is used to indicate whether the current image sequence is allowed to determine a transformation mode from the M candidate transformation modes.
  31. 根据权利要求30所述的方法,其特征在于,所述变换类型包括水平变换类型和垂直变换类型。The method of claim 30, wherein the transformation type includes a horizontal transformation type and a vertical transformation type.
  32. 根据权利要求31所述的方法,其特征在于,所述图像区域为当前图像帧,或者为当前图像序列、或者为当前图像片、或者为所述当前编码块。The method according to claim 31, characterized in that the image area is a current image frame, a current image sequence, a current image slice, or the current coding block.
  33. 根据权利要求32所述的方法,其特征在于,若所述图像区域为所述当前图像序列时,则所述第二标志与所述第一标志为同一个标志。The method according to claim 32, characterized in that if the image area is the current image sequence, the second mark and the first mark are the same mark.
  34. 根据权利要求21所述的方法,其特征在于,所述根据所述当前解码块的变换类型,对所述当前解码块的变换系数进行反变换,得到所述当前解码块的残差值,包括:The method according to claim 21, characterized in that, according to the transformation type of the current decoding block, the transformation coefficient of the current decoding block is inversely transformed to obtain the residual value of the current decoding block, including :
    根据所述当前解码块的变换类型和所述当前解码块的大小,确定变换矩阵;Determine a transformation matrix according to the transformation type of the current decoding block and the size of the current decoding block;
    使用所述变换矩阵对所述变换系数进行反变换运算,得到所述当前解码块的残差值。Use the transformation matrix to perform an inverse transformation operation on the transformation coefficient to obtain the residual value of the current decoding block.
  35. 根据权利要求21所述的方法,其特征在于,所述M个候选变换方式包括离散余弦变换DTC-Ⅱ方式、离散正弦变换DST-VII方式和DCT-VIII方式组合构成的变换方式。The method according to claim 21, characterized in that the M candidate transformation modes include a transformation mode composed of a combination of discrete cosine transform DTC-II mode, discrete sine transform DST-VII mode and DCT-VIII mode.
  36. 根据权利要求35所述的方法,其特征在于,所述M个候选变换方式包括多变换核选择MTS对应的多个变换方式。The method according to claim 35, characterized in that the M candidate transformation modes include multiple transformation modes corresponding to multi-transform core selection MTS.
  37. 一种图像编码装置,其特征在于,包括:An image coding device, characterized in that it includes:
    参数确定单元,用于确定当前编码块所在的图像区域的连续性参数,所述连续性参数用于指示所述图像区域中像素点的变化连续性;A parameter determination unit, used to determine the continuity parameter of the image area where the current coding block is located, the continuity parameter being used to indicate the continuity of changes in the pixel points in the image area;
    方式确定单元,用于根据所述图像区域的连续性参数,确定所述当前编码块的变换方式;A mode determination unit, configured to determine the transformation mode of the current coding block according to the continuity parameter of the image area;
    变换单元,用于根据所述变换方式,对所述当前编码块进行变换,得到所述当前编码块的变换系数。A transformation unit, configured to transform the current coding block according to the transformation method to obtain the transformation coefficient of the current coding block.
  38. 一图像解码装置,其特征在于,包括:An image decoding device, characterized by including:
    解码单元,用于解码码流,确定当前解码块的变换系数;The decoding unit is used to decode the code stream and determine the transform coefficient of the current decoding block;
    标志确定单元,用于确定所述当前编码块所在的图像区域的第一标志,所述第一标志基于所述图像区域的连续性参数确定,所述第一标志用于指示是否允许所述图像区域从M个候选变换方式中确定变换方式,所述连续性参数用于指示所述图像区域中像素点的变化连续性,所述M为大于1的正整数;A flag determination unit, used to determine a first flag of the image area where the current encoding block is located, the first flag is determined based on the continuity parameter of the image area, and the first flag is used to indicate whether the image is allowed The region determines the transformation method from M candidate transformation methods, the continuity parameter is used to indicate the continuity of changes in the pixel points in the image area, and the M is a positive integer greater than 1;
    类型确定单元,用于根据所述第一标志,确定所述当前解码块的变换类型;A type determination unit, configured to determine the transformation type of the current decoding block according to the first flag;
    反变换单元,用于根据所述当前解码块的变换类型,对所述当前解码块的变换系数进行反变换,得到所述当前解码块的残差值。An inverse transform unit, configured to perform inverse transform on the transform coefficient of the current decoded block according to the transform type of the current decoded block, to obtain the residual value of the current decoded block.
  39. 一种视频编码器,其特征在于,包括处理器和存储器;A video encoder, characterized by including a processor and a memory;
    所示存储器用于存储计算机程序;The memory shown is used to store computer programs;
    所述处理器用于调用并运行所述存储器中存储的计算机程序,以实现如上述权利要求1至20任一项所述的方法。The processor is configured to call and run the computer program stored in the memory to implement the method as described in any one of claims 1 to 20.
  40. 一种视频解码器,其特征在于,包括处理器和存储器;A video decoder, characterized by including a processor and a memory;
    所示存储器用于存储计算机程序;The memory shown is used to store computer programs;
    所述处理器用于调用并运行所述存储器中存储的计算机程序,以实现如上述权利要求21至36任一项所述的方法。The processor is configured to call and run the computer program stored in the memory to implement the method as described in any one of claims 21 to 36.
  41. 一种编解码系统,其特征在于,包括:A coding and decoding system, characterized by including:
    根据权利要求39所述的视频编码器;A video encoder according to claim 39;
    以及根据权利要求40所述的视频解码器。And a video decoder according to claim 40.
  42. 一种计算机可读存储介质,其特征在于,用于存储计算机程序;A computer-readable storage medium, characterized in that it is used to store a computer program;
    所述计算机程序使得计算机执行如上述权利要求1至20或21至36任一项所述的方法。The computer program causes the computer to perform the method according to any one of claims 1 to 20 or 21 to 36 above.
  43. 一种码流,其特征在于,所述码流是通过如上述权利要求1至20或21至36任一项所述的方法生成的。A code stream, characterized in that the code stream is generated by the method described in any one of claims 1 to 20 or 21 to 36.
PCT/CN2022/080706 2022-03-14 2022-03-14 Image encoding and decoding methods and apparatuses, device, system, and storage medium WO2023173255A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/080706 WO2023173255A1 (en) 2022-03-14 2022-03-14 Image encoding and decoding methods and apparatuses, device, system, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/080706 WO2023173255A1 (en) 2022-03-14 2022-03-14 Image encoding and decoding methods and apparatuses, device, system, and storage medium

Publications (1)

Publication Number Publication Date
WO2023173255A1 true WO2023173255A1 (en) 2023-09-21

Family

ID=88022026

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/080706 WO2023173255A1 (en) 2022-03-14 2022-03-14 Image encoding and decoding methods and apparatuses, device, system, and storage medium

Country Status (1)

Country Link
WO (1) WO2023173255A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200404272A1 (en) * 2018-06-08 2020-12-24 Panasonic Intellectual Property Corporation Of America Encoder, decoder, encoding method, and decoding method
WO2021096173A1 (en) * 2019-11-11 2021-05-20 엘지전자 주식회사 Image coding method based on conversion, and device for same
CN113574880A (en) * 2019-03-13 2021-10-29 北京字节跳动网络技术有限公司 Partitioning with respect to sub-block transform modes

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200404272A1 (en) * 2018-06-08 2020-12-24 Panasonic Intellectual Property Corporation Of America Encoder, decoder, encoding method, and decoding method
CN113574880A (en) * 2019-03-13 2021-10-29 北京字节跳动网络技术有限公司 Partitioning with respect to sub-block transform modes
WO2021096173A1 (en) * 2019-11-11 2021-05-20 엘지전자 주식회사 Image coding method based on conversion, and device for same

Similar Documents

Publication Publication Date Title
CN111327904B (en) Image reconstruction method and device
CN112889286B (en) Method and apparatus for mode-dependent and size-dependent block-level limiting of position-dependent prediction combinations
KR20210107131A (en) Image prediction method, apparatus and system, device and storage medium
WO2023044868A1 (en) Video encoding method, video decoding method, device, system, and storage medium
WO2023071557A1 (en) Media file encapsulation method and apparatus, device, and storage medium
WO2023173255A1 (en) Image encoding and decoding methods and apparatuses, device, system, and storage medium
WO2023044919A1 (en) Video encoding and decoding method, device and system, and storage medium
WO2023197229A1 (en) Video coding/decoding method, apparatus, device and system and storage medium
WO2023220970A1 (en) Video coding method and apparatus, and device, system and storage medium
WO2023220969A1 (en) Video encoding method and apparatus, video decoding method and apparatus, device, system, and storage medium
WO2023236113A1 (en) Video encoding and decoding methods, apparatuses and devices, system, and storage medium
WO2023184747A1 (en) Video encoding method, video decoding method, apparatus, device, system, and storage medium
WO2022116054A1 (en) Image processing method and system, video encoder, and video decoder
WO2022155922A1 (en) Video coding method and system, video decoding method and system, video coder and video decoder
WO2023220946A1 (en) Video encoding method and apparatus, video decoding method and apparatus, and device, system and storage medium
WO2022179394A1 (en) Image block prediction sample determining method, and encoding and decoding devices
CN116760976B (en) Affine prediction decision method, affine prediction decision device, affine prediction decision equipment and affine prediction decision storage medium
WO2022174475A1 (en) Video encoding method and system, video decoding method and system, video encoder, and video decoder
US20230319267A1 (en) Video coding method and video decoder
WO2023221599A1 (en) Image filtering method and apparatus and device
WO2023122968A1 (en) Intra-frame prediction method, device and system, and storage medium
WO2023122969A1 (en) Intra-frame prediction method, device, system, and storage medium
WO2023184248A1 (en) Video coding and decoding method, apparatus, device and system, and storage medium
WO2024050723A1 (en) Image prediction method and apparatus, and computer readable storage medium
WO2022193390A1 (en) Video coding and decoding method and system, and video coder and video decoder

Legal Events

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

Ref document number: 22931295

Country of ref document: EP

Kind code of ref document: A1