[go: up one dir, main page]

WO2025065670A1 - 编解码方法、码流、编码器、解码器以及存储介质 - Google Patents

编解码方法、码流、编码器、解码器以及存储介质 Download PDF

Info

Publication number
WO2025065670A1
WO2025065670A1 PCT/CN2023/122981 CN2023122981W WO2025065670A1 WO 2025065670 A1 WO2025065670 A1 WO 2025065670A1 CN 2023122981 W CN2023122981 W CN 2023122981W WO 2025065670 A1 WO2025065670 A1 WO 2025065670A1
Authority
WO
WIPO (PCT)
Prior art keywords
current block
transform
component
mode
block
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
PCT/CN2023/122981
Other languages
English (en)
French (fr)
Inventor
王凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to PCT/CN2023/122981 priority Critical patent/WO2025065670A1/zh
Publication of WO2025065670A1 publication Critical patent/WO2025065670A1/zh
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding

Definitions

  • the embodiments of the present application relate to the field of video coding and decoding technology, and in particular, to a coding and decoding method, a bit stream, an encoder, a decoder, and a storage medium.
  • high-resolution videos such as HD and UHD have emerged.
  • high-resolution videos usually have more information and therefore require more bandwidth.
  • video coding standards involving video compression have been introduced.
  • the current block partitioning techniques include single-tree partitioning and dual-tree partitioning.
  • the luminance block can use transformation modes such as Multiple Transform Selection (MTS), Low Frequency Non-Separable Transform (LFNST) or Non-Separable Primary Transform (NSPT), but the chrominance block uses the default Discrete Cosine Transform (DCT), which is not conducive to improving compression efficiency.
  • MTS Multiple Transform Selection
  • LNNST Low Frequency Non-Separable Transform
  • NPT Non-Separable Primary Transform
  • DCT Discrete Cosine Transform
  • the embodiments of the present application provide a coding and decoding method, a bit stream, an encoder, a decoder and a storage medium, which can improve compression efficiency.
  • an embodiment of the present application provides a decoding method, which is applied to a decoder, and the method includes:
  • a transform coefficient of a chrominance component of a current block is determined, and the transform coefficient of the chrominance component of the current block is inversely transformed according to a first transform kernel to determine a residual block of the chrominance component of the current block.
  • an embodiment of the present application provides an encoding method, which is applied to an encoder, and the method includes:
  • the transform coefficients of the chrominance components of the current block are encoded, and the obtained encoded bits are written into the bitstream.
  • an embodiment of the present application provides a code stream, wherein the code stream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: a quantization coefficient of a chrominance component of a current block and a value of first syntax identification information; wherein the first syntax identification information is used to indicate whether the current block is allowed to use a first transform mode and the corresponding transform kernel index used.
  • an encoder including a first determining unit, a transforming unit, and an encoding unit, wherein:
  • a first determining unit configured to determine a mode parameter of a chroma component of a current block; and when the mode parameter satisfies a first condition, determine a first transform kernel of the chroma component of the current block;
  • a transform unit configured to determine a residual block of a chrominance component of a current block, and transform the residual block of the chrominance component of the current block according to a first transform kernel to determine a transform coefficient of the chrominance component of the current block;
  • the encoding unit is configured to perform encoding processing on the transform coefficients of the chrominance components of the current block and write the obtained encoding bits into the bit stream.
  • an encoder including a first memory and a first processor, wherein:
  • a first memory for storing a computer program that can be run on the first processor
  • the first processor is configured to execute the method according to the second aspect when running the computer program.
  • an embodiment of the present application provides a decoder, including a second determination unit and an inverse transformation unit, wherein:
  • a second determining unit is configured to determine a mode parameter of a chroma component of the current block; and when the mode parameter satisfies a first condition, determine a first transform kernel of the chroma component of the current block;
  • the inverse transform unit is configured to determine the transform coefficients of the chrominance components of the current block, and inversely transform the transform coefficients of the chrominance components of the current block according to the first transform kernel to determine the residual block of the chrominance components of the current block.
  • an embodiment of the present application provides a decoder, including a second memory and a second processor, wherein:
  • a second memory for storing a computer program that can be run on a second processor
  • the second processor is configured to execute the method described in the first aspect when running the computer program.
  • an embodiment of the present application provides a computer-readable storage medium, which stores a computer program.
  • the computer program When executed by at least one processor, it implements the method described in the first aspect or the method described in the second aspect.
  • the embodiment of the present application provides a coding and decoding method, a code stream, an encoder, a decoder and a storage medium.
  • the mode parameters of the chroma components of the current block are determined; when the mode parameters meet the first condition, the first transform kernel of the chroma components of the current block is determined; the residual block of the chroma components of the current block is determined, and the residual block of the chroma components of the current block is transformed according to the first transform kernel to determine the transform coefficient of the chroma components of the current block; the transform coefficient of the chroma components of the current block is encoded and processed, and the obtained encoded bits are written into the code stream.
  • the mode parameters of the chroma components of the current block are determined; when the mode parameters meet the first condition, the first transform kernel of the chroma components of the current block is determined; the transform coefficient of the chroma components of the current block is determined, and the transform coefficient of the chroma components of the current block is inversely transformed according to the first transform kernel to determine the residual block of the chroma components of the current block.
  • both the encoding end and the decoding end first determine the mode parameters of the current block; when the mode parameters meet the first condition, the first transform kernel of the chrominance component of the current block is determined, and then the residual block of the chrominance component of the current block is transformed according to the first transform kernel.
  • the determination of the first transform kernel is related to the mode parameters, and the MTS/LFNST/NSPT transform can be applied to the chrominance component of the single tree partition, thereby not only improving the compression efficiency, but also improving the encoding and decoding performance.
  • FIG1 is a schematic diagram of a flow chart of a hybrid coding framework
  • FIG2 is a schematic diagram of the structure of a group of pictures GOP
  • FIG3 is a schematic diagram of a block partition structure
  • FIG4 is a schematic diagram of a block position relationship in the spatial domain/temporal domain of a current block
  • FIG5 is a schematic diagram of motion information of a current block and a co-located block
  • FIG6 is a schematic diagram of motion displacement using a co-located reference image
  • FIG7 is a schematic diagram of a distribution using MVD characteristics
  • FIG8 is a schematic diagram of an affine motion using 2 or 3 control points
  • FIG9 is a schematic diagram of affine motion based on derivation of motion vectors of sub-blocks
  • FIG10 is a schematic diagram of weights of various modes in a GPM mode
  • FIG11 is a schematic diagram of motion information for bilateral matching
  • FIG12 is a schematic diagram of template matching of a current block
  • FIG13 is a schematic diagram of reference pixels of a current block
  • FIG14 is a schematic diagram of multiple reference rows of a current block
  • FIG15 is a schematic diagram of multiple prediction modes corresponding to an intra-frame prediction
  • FIG16 is a second schematic diagram of multiple prediction modes corresponding to an intra-frame prediction
  • FIG17 is a third schematic diagram of multiple prediction modes corresponding to an intra-frame prediction
  • FIG18 is a fourth schematic diagram of multiple prediction modes corresponding to an intra-frame prediction
  • FIG19 is a schematic diagram of encoding of screen content
  • FIG20 is a schematic diagram of a histogram of gradient and intra prediction mode
  • FIG21 is a schematic diagram of weighted fusion of three intra-frame prediction modes
  • FIG22 is a schematic diagram of reference pixels of a chrominance component and a luminance component
  • FIG23 is a schematic diagram of a grouping of a multi-model CCLM
  • FIG24 is a schematic diagram of a prediction of a multi-model CCLM
  • FIG25 is a schematic diagram of a reference area of CCCM within a frame
  • FIG26 is a schematic diagram of brightness gradient calculation of a GLM
  • FIG27 is a schematic diagram of prediction of an inter-frame CCCM
  • FIG28 is a schematic diagram of a DCT transformation
  • FIG29 is a schematic diagram of a base image of a DCT transformation
  • FIG30 is a schematic diagram of a process flow without LFNST transformation
  • FIG31 is a schematic diagram of a process flow of LFNST transformation
  • FIG32 is a detailed flowchart of a LFNST transformation
  • FIG33 is a schematic diagram of a base image of a plurality of transformation kernel groups
  • FIG34 is a schematic diagram of a base image of NSPT transformation
  • FIG35 is a schematic diagram of a structure in which brightness and chromaticity are divided separately;
  • FIG36 is a schematic diagram of a network architecture of video encoding and decoding provided in an embodiment of the present application.
  • FIG37 is a schematic diagram of a system composition block diagram of an encoder provided in an embodiment of the present application.
  • FIG38 is a schematic diagram of a system composition block diagram of a decoder provided in an embodiment of the present application.
  • FIG39 is a flowchart diagram 1 of a decoding method provided in an embodiment of the present application.
  • FIG40 is a second flow chart of a decoding method provided in an embodiment of the present application.
  • FIG41 is a third flowchart of a decoding method provided in an embodiment of the present application.
  • FIG42 is a flowchart diagram 1 of an encoding method provided in an embodiment of the present application.
  • FIG43 is a second flow chart of an encoding method provided in an embodiment of the present application.
  • FIG44 is a third flow chart of an encoding method provided in an embodiment of the present application.
  • FIG45 is a schematic diagram of the composition structure of an encoder provided in an embodiment of the present application.
  • FIG46 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of the present application.
  • FIG47 is a schematic diagram of the composition structure of a decoder provided in an embodiment of the present application.
  • FIG48 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of the present application.
  • Figure 49 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application.
  • first ⁇ second ⁇ third involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that “first ⁇ second ⁇ third” can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
  • the first color component, the second color component, and the third color component are generally used to represent a coding block (CB).
  • the three color components are a brightness component, a blue chroma component, and a red chroma component.
  • the brightness component is usually represented by the symbol Y
  • the blue chroma component is usually represented by the symbol Cb or U
  • the red chroma component is usually represented by the symbol Cr or V; thus, the video image can be represented in the YCbCr format or the YUV format.
  • HEVC High Efficiency Video Coding
  • VVC Versatile Video Coding
  • VVC reference software test platform
  • VTM VVC Test Model
  • a platform that improves compression performance after VVC Enhanced Compression Model, ECM
  • JVET Joint Video Experts Team
  • CU Coding Unit
  • CTU Coding Tree Unit
  • LCU Largest Coding Unit
  • Quantization Parameter (QP)
  • DCT Discrete Cosine Transform
  • DST Discrete Sine Transform
  • MTS Multiple Transform Selection
  • NPT Non-Separable Primary Transform
  • CABAC Context-based Adaptive Binary Arithmetic Coding
  • each image or sub-image or frame in the video is divided into square maximum coding units or coding tree units of the same size (such as 256 ⁇ 256, 128 ⁇ 128, 64 ⁇ 64, etc.).
  • Each maximum coding unit or coding tree unit can be divided into rectangular coding units according to rules. Coding units may also be divided into prediction units, transform units, etc.
  • the hybrid coding framework includes modules such as prediction, transform/quantization, entropy coding, inverse quantization/inverse transform, and in-loop filtering.
  • the prediction module can include intra-frame prediction and inter-frame prediction, and inter-frame prediction can include motion estimation and motion compensation.
  • the intra-frame prediction method is used in video coding and decoding technology to eliminate the spatial redundancy between adjacent pixels.
  • the inter-image prediction method is used in video coding and decoding technology to eliminate the temporal redundancy between adjacent images, thereby improving coding efficiency.
  • the basic process of video codec is as follows: at the encoding end, an image is divided into blocks, intra-frame prediction or inter-frame prediction is used for the current block to generate the prediction block of the current block, the original block of the current block minus the prediction block to obtain the residual block, the residual block is transformed and quantized to obtain the quantization coefficient matrix, and the quantization coefficient matrix is entropy encoded and output to the bitstream.
  • intra-frame prediction or inter-frame prediction is used for the current block to generate the prediction block of the current block, and on the other hand, the bitstream is parsed to obtain the quantization coefficient matrix, the quantization coefficient matrix is inversely quantized and inversely transformed to obtain the residual block, and the prediction block and the residual block are added to obtain the reconstructed block.
  • the reconstructed blocks form a reconstructed image, and the reconstructed image is loop-filtered based on the image or block to obtain the decoded image.
  • the encoding end also needs to perform similar operations as the decoding end to obtain the decoded image.
  • the decoded image can be used as a reference image for inter-frame prediction for subsequent images.
  • the current block can be divided into prediction units during prediction, and the current block can be divided into transformation units during transformation.
  • the division of prediction units and transformation units can be different.
  • 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. The embodiment of the present application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.
  • the current block (CB) can be a current coding unit, a current prediction unit, or a current transform unit. Due to the need for parallel processing, an image can be divided into slices, etc., and slices in the same image can be processed in parallel, that is, there is no data dependency between them. "Frame” is a commonly used term, and it can generally be understood that a frame is an image. The frame described in the embodiment of the present application can also be replaced by an image or a slice, etc.
  • Inter-frame prediction uses temporal correlation to eliminate redundancy.
  • the frame rate of general videos will be 30 frames per second, 50 frames per second, 60 frames per second, or even 120 frames per second.
  • the correlation between adjacent frames in the same scene is very high.
  • Inter-frame prediction technology uses this correlation to refer to the content of the frames that have been encoded and decoded to predict the current content to be encoded. Inter-frame prediction can greatly improve encoding performance.
  • the most basic inter-frame prediction method is translational prediction.
  • Translational prediction assumes that the content to be predicted is in translational motion between the current image and the reference image.
  • the content of the current block (coding unit or prediction unit) is in translational motion between the current image and the reference image.
  • a motion vector can be used to find this content from the reference image and use it as the prediction block of the current block.
  • Translational motion accounts for a large proportion in videos. Stationary backgrounds, objects that move as a whole, and lens translation can all be processed using translational prediction.
  • Bidirectional prediction finds two reference blocks from the reference image and performs weighted average on the two reference blocks to obtain a prediction block that is as similar to the current block as possible. For example, for some scenes, weighted average of a reference block from the front and back of the current frame may be more similar to the current block than a single reference block. Based on this, bidirectional prediction improves compression performance on the basis of unidirectional prediction.
  • the picture order count can be used as an identifier of an image.
  • each image has a unique POC.
  • the order of the POC is considered to be the same as the play order.
  • a P frame is an image that can only be predicted using a reference image with a POC before the current image.
  • the current reference image has only one reference image list. (Reference Picture List, RPL), denoted as RPL0.
  • the reference picture list RPL0 contains all reference pictures whose POC is before the current picture.
  • B picture (B Frame) is an image that can be predicted using reference pictures whose POC is before the current picture and reference pictures whose POC is after the current picture.
  • RPL0 contains all reference pictures whose POC is before the current picture
  • RPL1 contains all reference pictures whose POC is after the current picture.
  • RPL0 contains all reference pictures whose POC is before the current picture
  • RPL1 contains all reference pictures whose POC is after the current picture.
  • RPL0 contains all reference pictures whose POC is before the current picture
  • RPL1 contains all reference pictures whose POC is after the current picture.
  • RPL0 contains all reference pictures whose POC is before the current picture
  • RPL1 contains all reference pictures whose POC is after the current picture.
  • For a current block you can only refer to the reference block of a certain picture in RPL0, which is also called forward prediction; you can also only refer to the reference block of a certain picture in RPL1, which is also called backward prediction; you can also refer to the reference block of a certain picture in RPL0 and the reference block of a certain picture in RPL1 at the same time, which is also called bidirectional prediction.
  • a simple way to refer to two reference blocks at the same time is to average the pixels in each corresponding position of the two reference blocks to obtain the prediction block of the current block.
  • B-pictures are no longer restricted to reference pictures with POC before the current picture in RPL0 and reference pictures with POC after the current picture in RPL1. Therefore, there can be reference pictures with POC after the current picture in RPL0 and reference pictures with POC before the current picture in RPL1.
  • the current block can also refer to reference pictures with POC before the current picture or reference pictures with POC after the current picture at the same time.
  • This kind of B-picture is also called generalized B-picture.
  • the B picture can refer to the information before the current picture and the information after the current picture, thereby significantly improving the encoding performance.
  • a classic RA group of pictures Group Of Pictures, GOP
  • the arrows represent the reference relationship. Since the I picture does not need a reference picture, after the I picture with POC 0 is decoded, the P picture with POC 4 will be decoded, and when decoding the P picture with POC 4, the I picture with POC 0 can be referenced.
  • the B picture with POC 2 is decoded, and when decoding the B picture with POC 2, the I picture with POC 0 and the P picture with POC 4 can be referenced, and so on.
  • the POC order is ⁇ 0 1 2 3 4 5 6 7 8 ⁇
  • the corresponding decoding order is ⁇ 0 3 2 4 1 7 6 8 5 ⁇ .
  • the encoding and decoding order of the Low Delay (LD) configuration is the same as the POC order. Therefore, the current image can only refer to the information before the current image.
  • the Low Delay configuration is divided into Low Delay P and Low Delay B.
  • Low Delay P is the traditional Low Delay configuration. Its typical structure is IPPP..., that is, an I image is encoded and decoded first, and the subsequent images are all P images.
  • the typical structure of Low Delay B is IBBB..., the difference from Low Delay P is that each inter-frame image is a B image, that is, using two reference image lists, the current block can simultaneously refer to the reference block of a certain image in RPL0 and the reference block of a certain image in RPL1.
  • the compression efficiency of RA configuration is higher than that of LD configuration
  • the compression efficiency of LDB configuration is higher than that of LDP configuration. This is because bidirectional prediction can refer to backward information and can reduce prediction errors through some technologies, such as weighted averaging.
  • a reference image list of the current image can have a maximum of several reference images, such as 2, 3 or 4.
  • the codec allows the current block to refer to two reference blocks of the same reference image at the same time.
  • the codec usually uses the index value (index, idx) in the reference image list to correspond to the reference image. If the length of a reference image list is 4, the index has four values 0, 1, 2, and 3. For example, if the RPL0 of the current image has 4 reference images with POCs of 5, 4, 3, and 0. Then index 0 of RPL0 is the reference image of POC 5, index 1 of RPL0 is the reference image of POC 4, index 2 of RPL0 is the reference image of POC 3, and index 3 of RPL0 is the reference image of POC 0.
  • inter-frame prediction uses motion information to represent "motion".
  • Basic motion information includes reference picture information and motion vector (MV, motion vector) information.
  • MV motion vector
  • MV motion vector
  • unidirectional motion information and bidirectional motion information can use the same data structure, but the two sets of reference frame information and motion vector information of the bidirectional motion information are valid, while one set of reference frame information and motion vector information of the unidirectional motion information is invalid.
  • the said validity can also be said to be "used", and the said invalidity can also be said to be "not used”.
  • VVC supports two reference image lists, denoted as RPL0 and RPL1.
  • RPL0 the reference image index refIdxL0 corresponding to RPL0
  • the reference image index refIdxL1 corresponding to RPL1 the reference image index corresponding to RPL1
  • the reference image index corresponding to RPL0 and the reference image index corresponding to RPL1 here can be understood as the above-mentioned reference image information.
  • VVC uses two identification information to indicate whether the motion information corresponding to RPL0 and the motion information corresponding to RPL1 are used, respectively denoted as predFlagL0 and predFlagL1.
  • predFlagL0 and predFlagL1 indicate whether the above-mentioned unidirectional motion information is "valid". Therefore, although VVC does not explicitly mention the data structure of motion information, it uses the reference image index, motion vector and "valid" flag corresponding to each reference image list to represent the motion information. In the VVC standard text, motion information does not appear, but motion vectors are used. It can also be considered that the reference image index and the flag of whether to use the corresponding motion information are attached to the motion vector. For the convenience of description, "motion information” is still used in this article, but it should be understood that “motion vector” can also be used to describe it. “Motion information” can also be called "motion parameter".
  • the motion vector can be represented by (x, y), that is, a horizontal component and a vertical component. Components. Since videos are represented by pixels, there is a distance between pixels, and the movement of an object between adjacent images may not always correspond to the whole pixel distance. For example, in a distant video, the distance between 2 pixels is 1 meter for the distant object, and the distance the object moves between 2 frames is 0.5 meters. This scene cannot be well represented by the motion vector of the whole pixel. Therefore, the motion vector can be expressed at the sub-pixel level, such as 1/2 pixel accuracy, 1/4 pixel accuracy, 1/8 pixel accuracy, and 1/16 pixel accuracy, to express the movement more finely. And the pixel value of the sub-pixel position in the reference image is obtained by interpolation.
  • MVP motion vector prediction
  • MV MVP + MVD.
  • MVP motion vector difference
  • each inter-frame coded block requires a motion information.
  • the division of CU is equal to the division of PU, which is equal to the division of TU, that is, a coding unit has a prediction unit of the same size and position, and a transform unit of the same size and position.
  • VVC tends to weaken PU and TU relative to HEVC.
  • Differences in any link of prediction, transformation, quantization, and entropy coding may lead to CU division. For example, if the motion information of two regions is different, the encoder may divide the two regions into different CUs.
  • the encoder may also divide the two regions into different CUs. How to divide is determined by the overall compression efficiency, not entirely by a single factor. As a result, the same object or regions with the same or similar motion will be divided into different CUs.
  • FIG3 is a schematic diagram of the block division structure of HEVC.
  • (a) is the original image, in which there is an iron rod moving in the direction indicated by the arrow, and the background area moves less.
  • (b) is the block division of HEVC, and (c) is the boundary of the block with the same motion information in (b) removed. It can be seen that many adjacent blocks use the same motion information. In this case, if the motion information is encoded separately for each block, it will cause obvious waste.
  • the complete motion information of VVC mentioned above includes the reference image index, MV and whether it is used for RPL0, and the reference image index, MV and whether it is used for RPL1.
  • the basic principle of the merge mode is that the current block can inherit the motion information of the adjacent block, including the reference image information and the motion vector information.
  • Merge mode can build a merge candidate list. If the current block uses merge mode, an index can be used to indicate which motion information the current block merges with, so there is no need to encode the complete motion information.
  • an index can be used to indicate which motion information the current block merges with, so there is no need to encode the complete motion information.
  • the adjacent blocks in the spatial domain refer to blocks adjacent to the current block in the same image
  • the non-adjacent blocks in the spatial domain refer to blocks non-adjacent to the current block in the same image.
  • the motion information in the time domain and the motion information of non-adjacent blocks in the time domain refer to the motion information at a specified position on a collocated reference image.
  • the black filled block is the current block, wherein positions 1, 2, 3, 4, and 5 are the positions of the adjacent blocks in the spatial domain used by merge, and the corresponding positions of the other point filled blocks are the positions of the non-adjacent blocks in the spatial domain used by merge; position 6 is the position used for the motion information in the time domain.
  • the corresponding position at the lower right corner of the current block is not available, the position corresponding to the center of the current block is used; the corresponding positions of the other grid filled blocks are the positions used for the motion information of non-adjacent blocks in the time domain.
  • the temporal motion information is derived based on the motion information at the corresponding position of the collocated reference image. The specific derivation method is described in detail below. It should be noted that the background grid in FIG4 is only a schematic representation of pixel coordinates, not a specific block division.
  • the historical motion information is independent of the position.
  • the codec maintains a first-in-first-out motion information list. Every time a block is encoded or decoded, the codec updates the list with the motion information of the block. When updating the list, it is ensured that there is no duplication with the existing motion information in the list. The historical motion information is obtained from this list.
  • temporal motion information (vector)
  • the prediction of temporal motion information is used as a supplement to the prediction of spatial motion information.
  • the correlation between adjacent regions on the same image is stronger than that on different images.
  • temporal motion information is more useful.
  • the current block and the surrounding adjacent blocks in the current image belong to different objects, and they have completely different motions, while the motion of the block that belongs to the same object as the current block in a certain reference image can provide better motion information prediction for the current block.
  • the motion vector of the co-located block on the co-located reference image (here the block that obtains the temporal motion information is called the co-located block) is the vector from the co-located reference image col_pic to the reference image col_ref of the co-located block.
  • the motion vector it needs is the vector from the current image curr_pic to the reference image curr_ref of the current block.
  • each 4 ⁇ 4 sub-block stores a set of motion information. It is understandable that if the cost of hardware implementation is not considered, the same-position reference image can also store a set of motion information for each pixel.
  • VVC introduces sub-block-based temporal motion vector prediction, namely SbTMVP.
  • SbTMVP sub-block-based temporal motion vector prediction
  • MVP and TMVP are for the entire block, that is, the entire block shares the same MVP.
  • SbTMVP is based on sub-blocks, so SbTMVP can obtain an MVP for each sub-block. This is also the essential difference between SbTMVP and TMVP.
  • TMVP uses the position of the lower right corner of the current block or the position of the center of the current block to locate the co-located block
  • SbTMVP finds a motion offset based on the motion of the surrounding blocks to determine the position.
  • the motion displacement is set to the motion vector of A1 using the co-located reference image. Otherwise, the motion displacement is set to (0, 0).
  • the position is found according to the motion displacement, and then the MV corresponding to the position of each sub-block in the "co-located block" is scaled to obtain the MVP of each sub-block.
  • MMVD motion vector difference
  • the motion information in the merge candidate list directly selected by the Merge mode is used as the motion information of the current block.
  • MMVD is a special merge mode in VVC, which encodes the MVD in this case in an efficient way.
  • Ordinary Merge does not require encoding and decoding of MVD.
  • Ordinary inter mode requires direct encoding and decoding of MVD.
  • MMVD takes advantage of the fact that MVD is more distributed in a single horizontal direction or a single vertical direction, with more MVDs with small values and fewer MVDs with larger values, as shown in Figure 7.
  • circles of different shapes can represent MVDs of different values.
  • MMVD can only represent MVDs of specific values in some specific directions, and it cannot represent any MVD. It uses mmvd_direction_idx to represent the direction of the MVD, which can also be understood as whether the x and y of the MVD are non-zero and the positive and negative signs. mmvd_distance_idx represents the absolute value of the non-zero x and y of the MVD, MmvdDistance.
  • Table 1 shows a schematic relationship between mmvd_distance_idx[x0][y0] and MmvdDistance[x0][y0].
  • ph_mmvd_fullpel_only_flag is an image header flag that can set 2 different combinations of MMVD.
  • Table 2 shows a schematic relationship between mmvd_direction_idx[x0][y0] and MmvdSign[x0][y0].
  • (mv 0x , mv 0y ) is the motion vector of the control point at the upper left corner of the current block
  • (mv 1x , mv 1y ) is the motion vector of the control point at the upper right corner of the current block
  • (mv 2x , mv 2y ) is the motion vector of the control point at the lower left corner of the current block.
  • HEVC supports a maximum of 64 ⁇ 64 CTUs and can recursively perform quadtree partitioning.
  • VVC supports a more flexible block partitioning method than HEVC, supporting a maximum of 128 ⁇ 128 CTUs, including quadtree, ternary tree and binary tree partitioning. These partitioning methods.
  • block partitioning is becoming more and more flexible, whether it is CU, PU or TU, it can only be divided into rectangular blocks.
  • VVC has weakened the division of PU and TU.
  • the boundaries of texture or motion in natural videos are diverse. For example, if you encounter an oblique object boundary, if you simply use rectangular blocks to approach the boundary, you will divide it into many small blocks, which will significantly increase the overhead.
  • the GPM geometric partitioning mode can better handle textures and boundaries in natural videos.
  • GPM uses two prediction blocks of different sizes from the current block, that is, each takes a required part and removes the part with a weight of 0.
  • GPM can be said to be a prediction mode or prediction method because it ultimately generates a prediction block. It can also be said that GPM is a "partitioning" mode that simulates the division of the prediction block, which is similar to the implementation of PU division, but without substantial division.
  • the first prediction block and the second prediction block used by the above GPM can be prediction blocks generated by intra-frame prediction, prediction blocks generated by unidirectional prediction between frames, or prediction blocks generated by bidirectional prediction between frames.
  • one condition for starting DMVR in VVC is that the two reference images of the current block come from the front and back of the current image respectively, and the distances between the two reference images and the current image are equal.
  • Another starting condition is that the current CU uses the whole-block merge mode (including skip), which does not include sub-block-based merges such as SbTMVP and affine merge, because the motion vector in the merge mode is prone to inaccuracy.
  • BM bilateral matching
  • SAD sum of absolute differences
  • the two reference images include reference image L0 (refPic in ListL0) and reference image L1 (refPic in ListL1).
  • the search also supports sub-pixel search, so DMVR may find MVs with higher accuracy than the original MVs.
  • the search is performed according to certain rules. Generally, the integer pixel MVs within a certain range are searched first to find the integer pixel MV with the lowest matching cost, and then the sub-pixel MVs are searched based on the integer pixel MVs.
  • the MV with a lower matching cost is used for motion compensation prediction.
  • the MV improved by DMVR can theoretically be used to store MVs and surrounding blocks. For example, when the merge candidate list is constructed for the current block, if the surrounding blocks use DMVR to improve the MV, using the improved MV to construct the merge candidate list can achieve better compression effect, but for hardware implementation considerations, VVC does not do this.
  • DMVR can be processed based on sub-blocks.
  • the sub-blocks will be divided into 16-pixel blocks.
  • this is based on the consideration of hardware implementation complexity, because DMVR needs to be searched at the decoding end, and limiting the size of the sub-block can reduce the cost of cache.
  • dividing into sub-blocks provides better flexibility, and each sub-block can improve the MV independently, which to a certain extent achieves the effect of improving the division accuracy, which also improves the compression efficiency.
  • BDOF in VVC will derive a motion vector deviation (v x ,v y ), which is calculated by minimizing the difference between the predicted values in the two directions. This motion vector deviation is also used to adjust the predicted value in the corresponding sub-block.
  • the derivation process is as follows:
  • S 1 ⁇ (i,j) ⁇ Abs( ⁇ x (i,j)) (5)
  • S 2 ⁇ (i,j) ⁇ ⁇ x (i,j) ⁇ Sign( ⁇ y (i,j)) (6)
  • S 3 ⁇ (i,j) ⁇ ⁇ (i,j) ⁇ Sign( ⁇ x (i,j)) (7)
  • S 5 ⁇ (i,j) ⁇ Abs( ⁇ y (i,j)) (8)
  • S 6 ⁇ (i,j) ⁇ ⁇ (i,j) ⁇ Sign( ⁇ y (i,j)) (9)
  • na is min(1, bitDepth-11), and nb is min(4, bitDepth-8).
  • th′ BIO 2 max(5,BD-7) , is rounded down, BD is the bit depth bitDepth.
  • each prediction value within the 4 ⁇ 4 sub-block is adjusted as follows:
  • pred BDOF (x,y) (I (0) (x,y)+I (1) (x,y)+b(x,y)+o offset )>>shift (16)
  • o offset and shift are calculated according to the bit depth of brightness.
  • n a , n b and shift are all processed to reduce the bit width in the calculation process.
  • the motion vector deviation of BDOF can achieve high precision to make the prediction more accurate, and the sub-block-based processing also improves flexibility. These two aspects are similar to DMVR.
  • DMVR Multi-pass Decoder-side Motion Vector Refinement
  • the first step is to improve the motion vector based on the bidirectional matching of the whole block.
  • the second step is to improve the motion vector based on the bidirectional matching of the sub-block.
  • the block size of this step can be 16 ⁇ 16.
  • the third step is to improve the motion vector based on the bidirectional optical flow of the sub-block.
  • the sub-block size of this step can be 8 ⁇ 8.
  • the steps can be further enriched on this basis, such as a fourth step, a motion vector improvement based on the bidirectional optical flow of the 4x4 sub-block. Or a motion vector improvement based on the bidirectional optical flow of the point, etc.
  • TM Template Matching
  • the intra-frame coded block must require the reconstructed pixels on the left and upper sides as reference pixels.
  • the left and upper sides are available, that is, it is achievable to make corresponding adjustments to the hardware design.
  • the right and lower sides are not available under the current standard such as the VVC encoding order.
  • the rectangular areas on the left and upper sides of the current block are set as templates.
  • the height of the template on the left is generally the same as the height of the current block, and the width of the template on the upper side is generally the same as the width of the current block, but they can also be different.
  • the best matching position of the template is found in the reference image L0 to determine the motion information or motion vector of the current block. This process can be roughly described as starting from a starting position in a certain reference image and searching within a certain range around it.
  • the search rules such as the search range and search step length, can be pre-set. Each time a position is moved to, the matching degree of the template corresponding to the position and the template around the current block is calculated.
  • the so-called matching degree can be measured by some distortion costs, such as the sum of absolute differences (SAD), the sum of absolute transformed differences (SATD), the mean square error (MSE), etc.
  • SAD sum of absolute differences
  • SATD sum of absolute transformed differences
  • MSE mean square error
  • the cost is calculated using the prediction block of the template corresponding to the position and the reconstructed block of the template around the current block.
  • the sub-pixel position can also be searched, and the motion information of the current block is determined based on the position with the highest matching degree. Using the correlation between adjacent pixels, the motion information suitable for the template may also be the appropriate motion information for the current block.
  • Intra-frame prediction is a prediction method that uses the spatial correlation between the pixels that have been encoded and decoded around the current block and the pixels inside the current block. For example, as shown in Figure 13, the 4 ⁇ 4 white filling pixels are the current block, and the grid filling pixels in the left column and the upper row of the current block are the reference pixels of the current block. Intra-frame prediction uses these reference pixels to predict the current block. These reference pixels may all be available, that is, all have been encoded and decoded. Some may also be unavailable, for example, the current block is the leftmost of the entire frame, then the reference pixels on the left side of the current block are unavailable.
  • the reference pixels on the lower left are also unavailable.
  • available reference pixels or certain values or certain methods can be used for filling, or no filling can be performed.
  • the intra prediction method of multiple reference lines can use more reference pixels to improve coding efficiency.
  • this is a schematic diagram using 4 reference rows/columns.
  • mode 15 There are multiple prediction modes for intra-frame prediction, as shown in Figure 15.
  • 9 modes for intra-frame prediction of 4 ⁇ 4 blocks in H.264 are 9 modes for intra-frame prediction of 4 ⁇ 4 blocks in H.264.
  • mode 0 vertical mode
  • mode 1 horizontal mode
  • mode 2 DC mode
  • modes 3 ⁇ 8 copy the reference pixels to the corresponding positions of the current block at a certain angle, because some positions of the current block cannot correspond exactly to the reference pixels, and it may be necessary to use the weighted average of the reference pixels, or the sub-pixels of the interpolated reference pixels.
  • the intra-frame prediction modes used by HEVC include PLANAR, DC, and 33 angle modes, a total of 35 prediction modes, as shown in Figure 16.
  • the intra-frame modes used by VVC include PLANAR, DC, and 65 angle modes, a total of 67 prediction modes, as shown in Figure 17.
  • VVC also provides wide-angle modes for some rectangular blocks with large differences in length and width.
  • the modes indicated by the dotted lines in the figure are the two intervals of -14 to -1 and 67 to 80, which will replace some conventional modes, as shown in Figure 18.
  • IBC Intra Block Copy
  • SCC Screen Content Coding
  • IBC is the application of the inter-frame prediction method to intra-frame prediction.
  • inter-frame prediction uses the reference block on the reference image to generate the prediction block of the current block, and the reference image is not the current image.
  • IBC finds the reference block from the encoded or reconstructed part of the current image to generate the prediction block of the current block.
  • IBC can also be called intra picture block compensation or current picture referencing (CPR).
  • IBC can use block vector (BV) to represent the position difference between the current block and the reference block, which is similar to the MV of inter-frame prediction.
  • the encoder determines the best matching block of the current block within the search range through block matching and encodes the BV.
  • BV block vector
  • merge mode which is similar to inter-frame prediction and will not be described here.
  • IBC can be considered an intra-frame prediction method, or another prediction method independent of intra-frame prediction and inter-frame prediction. IBC is highly efficient in encoding screen content and can also improve compression efficiency in natural sequences captured by cameras.
  • Intra Template Matching Prediction in ECM10 can be considered as a special IBC.
  • IntraTMP also searches for reference blocks from the encoded and decoded parts of the current image to generate the prediction block of the current block.
  • IntraTMP uses the reconstructed pixels within a certain range on the left and top of the current block as the template of the current block.
  • the template of the reconstructed pixel reference block within a certain range on the left and top of the reference block of the same size as the current block is calculated.
  • the matching cost between the template of the current block and the template of the reference block is calculated, and the reference block is determined to generate the prediction block based on the matching cost.
  • DIMD uses the reconstructed pixels on the left and top of the current block to derive the prediction mode, but it does not predict on the template, but analyzes the gradient of the reconstructed pixels.
  • the three intra-frame prediction modes include M 1 mode, M 2 mode and PLANAR mode.
  • the prediction values obtained for these three intra-frame prediction modes are set to Pred 1 , Pred 2 , and Pred 3 , respectively, and the weight values of these three intra-frame prediction modes are set to w 1 , w 2 , and w 3 , respectively.
  • the specific calculation formula is as follows:
  • the final prediction block can be shown as follows:
  • LFNST has more transform kernel groups, 35 in ECM.
  • the correspondence between the transform kernel group index (LFNST set index) and the intra prediction mode (Intra pred.mode) is shown in Table 5.
  • Each transform kernel group is more efficient for the texture of the corresponding angle.
  • each transform kernel group can select 3 transform kernels.
  • NSPT In ECM10, some small blocks can use NSPT, while large blocks still use DCT2+LFNST.
  • the size of small blocks is 4 ⁇ 4, 4 ⁇ 8, 8 ⁇ 4, 8 ⁇ 8, 4 ⁇ 16, 16 ⁇ 4, 8 ⁇ 16, 16 ⁇ 8, 8 ⁇ 32, 32 ⁇ 8.
  • NSPT also matches the transform core group according to the intra prediction mode.
  • the matching method can refer to the LFNST method.
  • Each transform core group has 3 transform cores to choose from.
  • an 8 ⁇ 8 base image of an NSPT in ECM10 is shown in Figure 34, which corresponds to inter-frame angle prediction mode 7. It can be seen that it handles the texture of the corresponding angle better. It should be noted that NSPT is only applied to intra-coded blocks.
  • a network architecture of a video coding and decoding system including a decoding method and an encoding method is provided.
  • the decoder or encoder in the embodiment of the present application can be the above-mentioned electronic device.
  • the electronic device in the embodiment of the present application has a video coding and decoding function, generally including a video encoder (i.e., encoder) and a video decoder (i.e., decoder).
  • FIG37 is a block diagram of a system composition of an encoder provided by an embodiment of the present application.
  • the encoder 100 may include: a segmentation unit 101, a prediction unit 102, a first adder 107, a transform unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse transform unit 111, a second adder 112, a filtering unit 113, a decoded picture buffer (DPB) unit 114, and an entropy coding unit 115.
  • DPB decoded picture buffer
  • the input of the encoder 100 may be a video consisting of a series of pictures or a static picture
  • the output of the encoder 100 may be a bit stream (also referred to as a "code stream") for representing a compressed version of the input video.
  • the second adder 112 calculates the reconstructed CU by adding the reconstructed residual and the prediction block of the CU from the prediction unit 102.
  • the second adder 112 also sends its output to the prediction unit 102 for use as an intra-frame prediction reference.
  • the filtering unit 113 performs loop filtering on the reconstructed picture or sub-picture.
  • the filtering unit 113 includes one or more filters, such as a deblocking filter, a sample adaptive offset (Sample Adaptive Offset, SAO) filter, an adaptive loop filter (Adaptive Loop Filter, ALF), a luminance mapping and chroma scaling (Luma Mapping with Chroma Scaling, LMCS) filter, and a neural network-based filter.
  • filters such as a deblocking filter, a sample adaptive offset (Sample Adaptive Offset, SAO) filter, an adaptive loop filter (Adaptive Loop Filter, ALF), a luminance mapping and chroma scaling (Luma Mapping with Chroma Scaling, LMCS) filter, and a neural network-based filter.
  • SAO sample adaptive offset
  • ALF adaptive Loop Filter
  • LMCS luminance mapping and chroma scaling
  • LMCS luminance mapping with Chroma Scaling
  • the output of the filtering unit 113 is a decoded picture or sub-picture, which is cached to the DPB unit 114.
  • the DPB unit 114 outputs the decoded picture or sub-picture according to the timing and control information.
  • the picture stored in the DPB unit 114 can also be used as a reference for the prediction unit 102 to perform inter-frame prediction or intra-frame prediction.
  • the entropy coding unit 115 converts the parameters (such as control parameters and supplementary information, etc.) required for decoding the picture from the encoder 100 into a binary form, and writes such a binary form into the bitstream according to the grammatical structure of each data unit, that is, the encoder 100 finally outputs the bitstream.
  • the encoder 100 can be a first memory having a first processor and a recorded computer program. When the first processor reads and runs the computer program, the encoder 100 reads the input video and generates a corresponding bit stream.
  • the encoder 100 can also be a computing device having one or more chips. These units implemented as integrated circuits on the chip have connections and data exchange functions similar to the corresponding units in Figure 37.
  • FIG38 is a block diagram of a decoder system provided by an embodiment of the present application.
  • the decoder 200 may include: a parsing unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transform unit 206, an adder 207, a filtering unit 208, and a decoded picture cache unit 209.
  • the input of the decoder 200 is a bit stream representing a compressed version of a video or a static picture
  • the output of the decoder 200 may be a decoded video consisting of a series of pictures or a decoded static picture.
  • the input code stream of the decoder 200 may be a code stream generated by the encoder 100.
  • the parsing unit 201 parses the input code stream and obtains the value of the syntax element from the input code stream.
  • the parsing unit 201 converts the binary representation of the syntax element into a digital value and sends the digital value to the unit in the decoder 200 to obtain one or more decoded pictures.
  • the parsing unit 201 can also parse one or more syntax elements from the input code stream to display the decoded picture.
  • the parsing unit 201 sends the values of the syntax elements and one or more variables set or determined according to the values of the syntax elements and used to obtain one or more decoded pictures to the units in the decoder 200 .
  • the prediction unit 202 determines a prediction block of a current decoding block (e.g., CU).
  • the prediction unit 202 may include a motion compensation unit 203 and an intra prediction unit 204.
  • the prediction unit 202 passes the relevant parameters from the parsing unit 201 to the motion compensation unit 203 to obtain the inter-frame prediction block;
  • the intra-frame prediction mode including the MIP mode indicated based on the MIP mode index value
  • the prediction unit 202 transmits the relevant parameters from the parsing unit 201 to the intra-frame prediction unit 204 to obtain the intra-frame prediction block.
  • the inverse quantization unit 205 has the same function as the inverse quantization unit 110 in the encoder 100.
  • the inverse quantization unit 205 performs a scaling operation on the quantization coefficients (i.e., levels) from the parsing unit 201 to obtain a reconstructed coefficient.
  • the inverse transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100.
  • the inverse transform unit 206 performs one or more transform operations (i.e., the inverse operation of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain a reconstructed residual.
  • the adder 207 performs an addition operation on its input (the prediction block from the prediction unit 202 and the reconstructed residual from the inverse transform unit 206) to obtain a reconstructed block of the current decoded block.
  • the reconstructed block is also sent to the prediction unit 202 to be used as a reference for other blocks encoded in the intra prediction mode.
  • the filtering unit 208 After all CUs in the picture or sub-picture are reconstructed, the filtering unit 208 performs loop filtering on the reconstructed picture or sub-picture.
  • the filtering unit 208 includes one or more filters, such as a deblocking filter, a sampling adaptive compensation filter, an adaptive loop filter, a luminance mapping and chrominance scaling filter, and a filter based on a neural network.
  • filters such as a deblocking filter, a sampling adaptive compensation filter, an adaptive loop filter, a luminance mapping and chrominance scaling filter, and a filter based on a neural network.
  • the filtering unit 208 determines that the reconstructed block is not used as a reference for decoding other blocks, the filtering unit 208 performs loop filtering on one or more target pixels in the reconstructed block.
  • the output of the filtering unit 208 is a decoded picture or sub-picture, and the decoded picture or sub-picture is cached to the DPB unit 209.
  • the DPB unit 209 outputs the decoded picture or sub-picture according to the timing and control information.
  • the picture stored in the DPB unit 209 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by the prediction unit 202.
  • decoder 200 can be a second memory with a second processor and a recording computer program. When the first processor reads and runs the computer program, decoder 200 reads the input code stream and generates the corresponding decoded video.
  • decoder 200 can also be a computing device with one or more chips. These units implemented as integrated circuits on the chip have connections and data exchange functions similar to the corresponding units in Figure 38.
  • the "current block” specifically refers to the current block to be encoded in the video image (also referred to as the "encoding block” for short); when the embodiment of the present application is applied to the decoder 200, the “current block” specifically refers to the current block to be decoded in the video image (also referred to as the "decoding block” for short).
  • FIG39 a schematic flow chart of a decoding method provided by an embodiment of the present application is shown. As shown in FIG39, the method may include:
  • the method is applied to a decoder.
  • the decoding method of the embodiment of the present application can be applied to an intra-frame prediction mode and/or an inter-frame prediction mode, and here it is mainly an optimization scheme for the MTS/LFNST/NSPT transformation proposed for the chrominance component of a single tree partition to improve the compression efficiency.
  • the prediction mode of the current block may include: an inter-frame prediction mode and/or an intra-frame prediction mode.
  • the intra-frame prediction mode mainly predicts the current block based on the reconstructed area around the current block
  • the inter-frame prediction mode mainly predicts the current block based on the reference image of the current block.
  • the partition type of the current block may include single tree partition and dual tree partition.
  • the single tree the luminance component and the chrominance component are partitioned together, and a CU contains a luminance block and a chrominance block at the same position; in the dual tree, the luminance and chrominance are partitioned separately, and a CU has only a luminance block or only a chrominance block.
  • the block of the luminance component of the current block can be called a "luminance block”
  • the block of the chrominance component of the current block can be called a "chrominance block”.
  • LFNST could originally be used on the chrominance components of a single tree in the standardization stage, in order to reduce the complexity of the hardware, the effect of not using LFNST on the chrominance components is better. For example, not using LFNST on the chrominance components will shorten the pipeline compared to using it on the chrominance components. Based on this, in the embodiment of the present application, the following restrictions are added to the use of the chrominance components of a single tree.
  • the restriction condition is that the mode parameter satisfies the first condition, which may include: the partition type of the current block is single-tree partition and the prediction mode of the chrominance component of the current block is a cross-component prediction mode.
  • the cross-component prediction mode may include CCLM, CCCM, inter-CCCM, etc.
  • the preset transform kernel can be determined as the first transform kernel of the chrominance component of the current block.
  • the preset transform kernel is the default transform kernel.
  • MTS/LFNST/NSPT is not applied to the chrominance component of the current block.
  • the default transform kernel is used, such as separable DCT2 in the horizontal and vertical directions.
  • a first transform core group for the chroma component of the current block can be determined based on the first transform mode; wherein the first transform core group is different from the transform core group for the luminance component of the current block; and a first transform core is determined based on the first transform core group.
  • MTS/LFNST/NSPT can be applied to the chroma component of the current block, but the first transform kernel group used by the chroma component is different from the transform kernel group used by the luminance component.
  • MTS/LFNST/NSPT uses a different transform kernel for the chrominance component than for the luminance component.
  • the transform kernel groups of the two may be the same, but the transform kernels used are different; or the transform kernel groups of the two may be different, and the transform kernels used are also different.
  • different transform modes may correspond to different transform core groups, such as the multi-transform selection mode may determine the MTS transform core group, the low-frequency inseparable transform mode may determine the LFNST transform core group, and the inseparable basic transform mode may determine the NSPT transform core group.
  • Each transform core group may include at least one candidate transform core, and after determining the first transform core group of the chroma component, the first transform core used by the chroma component of the current block may be determined therefrom.
  • MTS/LFNST/NSPT uses a different transform kernel or transform kernel group for the chrominance component than for the luminance component.
  • LFNST/NSPT in some technologies will determine a transform kernel group based on the intra-frame prediction mode.
  • this intra-frame prediction mode represents a texture feature, such as the texture at a certain angle.
  • LFNST/NSPT can match the corresponding transform kernel group according to this texture feature.
  • intra-frame MTS also matches the transform kernel according to the intra-frame prediction mode. For inter-frame prediction, it itself does not have an intra-frame prediction mode.
  • the luminance component and the chrominance component conform to different texture features, different transform kernels or transform kernel groups can be used for them.
  • the luminance component uses its intra-frame prediction mode or virtual intra-frame prediction mode to match a transform kernel group.
  • the transform kernel group corresponding to DC or PLANAR is used for chrominance, or a transform kernel group specially optimized for cross-component prediction is used, which is not specifically limited here.
  • the above descriptions are all for texture features.
  • the number of pixels of the luminance component in the same CU is 4 times the number of pixels of the chrominance component, that is, the size of the luminance block and the chrominance block are different. For example, if the luminance block is 16 ⁇ 16, then the corresponding chrominance block is 8 ⁇ 8, then the transform kernel or transform kernel group also needs to be of corresponding size.
  • determining the first transform core according to the first transform core group may include: decoding the code stream to determine the value of the first syntax identification information; when the first syntax identification information indicates that the current block uses the first transform mode, determining the transform core index of the current block; determining the first transform core according to the first transform core group and the transform core index.
  • the first syntax identification information is used to indicate whether the current block uses the first transform mode, such as whether the current block uses MTS/LFNST/NSPT. If the value of the first syntax identification information is equal to the first value, it can be determined that the current block does not use MTS/LFNST/NSPT; if the value of the first syntax identification information is equal to the second value, it can be determined that the current block uses MTS/LFNST/NSPT.
  • the first value can be set to 0, and the second value can be set to non-0, such as 1, 2, 3, etc. That is to say, when the current block uses the first transform mode, the first syntax identification information is also used to indicate which transform core is used.
  • the first syntax identification information can also be replaced by two other syntax identification information.
  • one syntax identification information is used to indicate whether the current block uses MTS/LFNST/NSPT
  • the other syntax identification information is used to indicate the corresponding transform core index when the current block uses MTS/LFNST/NSPT.
  • the transform core index of the current block can be determined by the decoded code stream. In this way, two syntax elements need to be transmitted in the code stream, resulting in a large code stream overhead.
  • the transform core index needs to be transmitted in the code stream, if there is only one transform core in the determined first transform core group, then there is no need to transmit the transform core index at this time.
  • the only transform core in the first transform core group can be directly used as the first transform core used by the current block.
  • three other syntax identification information can be used here to replace it.
  • one syntax identification information is used to indicate whether the current block uses NSPT and which NSPT transformation core is used
  • another syntax identification information is used to indicate whether the current block uses LFNST and which LFNST transformation core is used
  • another syntax identification information is used to indicate whether the current block uses MTS and which MTS transformation core is used; they are essentially the same here and are not specifically limited here.
  • S3903 Determine a transform coefficient of a chrominance component of the current block, and perform an inverse transform on the transform coefficient of the chrominance component of the current block according to a first transform kernel to determine a residual block of the chrominance component of the current block.
  • the quantization coefficient of the chrominance component of the current block can be determined by decoding the code stream, and then the quantization coefficient of the chrominance component of the current block can be inversely quantized to determine the transform coefficient of the chrominance component of the current block.
  • the transform coefficients of the chrominance components of the current block are inversely transformed according to the second transform core to determine the residual block of the chrominance components of the current block, which may include: when the first syntax identification information indicates that the chrominance components of the current block use NSPT, the transform coefficients of the chrominance components of the current block are inversely transformed by an inseparable basic transform according to the second transform core to determine the residual block of the chrominance components of the current block; or, when the first syntax identification information indicates that the chrominance components of the current block use LFNST, the transform coefficients of the chrominance components of the current block are inversely transformed by a low-frequency inseparable transform according to the second transform core to determine the transform block of the chrominance components of the current block; and the transform block of the chrominance components is inversely transformed by a discrete cosine transform to determine the residual block of the chrominance components
  • S4001 Predict the chrominance component of the current block and determine a predicted block of the chrominance component of the current block.
  • the transform kernel of the first transform mode used by the current block is determined, and the transform coefficients of the current block are inversely transformed according to the transform kernel of the first transform mode to determine the residual block of the current block.
  • the transform kernel of the second transform mode used by the current block is determined, and the transform coefficients of the current block are inversely transformed according to the transform kernel of the second transform mode to determine the residual block of the current block.
  • the first transform mode can be MTS/LFNST/NSPT
  • the second transform mode can be other transform modes (or directly use the default transform kernel), which is not specifically limited here.
  • the first syntax identification information can be represented by lfnst_nspt_idx.
  • lfnst_nspt_idx will be parsed only when certain conditions are met. One of the conditions is that the last non-zero coefficient position is greater than or equal to 1.
  • the scanning of the quantization coefficient is performed in a hierarchical diagonal scan mode.
  • a coefficient block can be divided into 4 ⁇ 4 sub-blocks, and the 4 ⁇ 4 sub-blocks are scanned in a diagonal scan mode (diagonal scan), and the 4 ⁇ 4 sub-blocks are also scanned in a diagonal scan mode.
  • the relevant technology requires that the last non-zero coefficient position of all color components must be greater than or equal to 1. For example, for a block divided into a single tree in the YUV format, the last non-zero coefficient position of the three color components Y, U, and V must be greater than or equal to 1.
  • lfnst_nspt_idx is parsed only when certain conditions are met.
  • One of the conditions is that the last non-zero coefficient position cannot be greater than a threshold value, which is the maximum possible number of coefficients of LFNST or NSPT minus one, which can be referred to as the maximum threshold value here.
  • the maximum threshold value can be determined according to the size parameters of the current block, i.e., the length and width.
  • the last non-zero coefficient position in the transform coefficient of the current block satisfies a preset condition, which may include: when the prediction mode of the current block is an intra-frame prediction mode, the last non-zero coefficient position of all color components in the transform coefficient of the current block is less than or equal to a second threshold; or, when the prediction mode of the current block is an inter-frame prediction mode, the last non-zero coefficient position of the brightness component in the transform coefficient of the current block is less than or equal to the second threshold.
  • the embodiment of the present application does not limit the situation where the last non-zero coefficient position is equal to the second threshold. That is, the last non-zero coefficient position in the transform coefficient of the current block satisfies the preset condition, and may also include: when the prediction mode of the current block is the intra-frame prediction mode or the dual-tree partitioning, the last non-zero coefficient position of all color components in the transform coefficient of the current block is less than the second threshold; or, when the prediction mode of the current block is the inter-frame prediction mode or the single-tree partitioning, the last non-zero coefficient position of the luminance component in the transform coefficient of the current block is less than the second threshold.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of all its components is not greater than the maximum threshold; for single-tree partitioned blocks, lfnst_nspt_idx is parsed only when the last non-zero coefficient position of the Y component is not greater than its maximum threshold, and U and V components are no longer required.
  • lfnst_nspt_idx can be parsed only when the last non-zero coefficient position of the Y component is greater than or equal to the minimum threshold, and the U and V components are no longer required.
  • lfnst_nspt_idx can be parsed only when the last non-zero coefficient position of the Y component is not greater than the maximum threshold, and the U and V components are no longer required.
  • This embodiment provides a decoding method, which determines the mode parameters of the chrominance components of the current block; when the mode parameters meet the first condition, determines the first transform kernel of the chrominance components of the current block; determines the transform coefficients of the chrominance components of the current block, and inversely transforms the transform coefficients of the chrominance components of the current block according to the first transform kernel, and determines the residual block of the chrominance components of the current block.
  • the mode parameters of the current block are first determined; when the mode parameters meet the first condition, the first transform kernel of the chrominance components of the current block is determined, and then the residual block of the chrominance components of the current block is transformed according to the first transform kernel.
  • FIG. 42 a schematic flow chart of an encoding method provided by an embodiment of the present application is shown. As shown in FIG. 42 , the method may include:
  • S4201 Determine the mode parameters of the chrominance components of the current block.
  • the method is applied to an encoder.
  • the encoding method of the embodiment of the present application can be applied to an intra-frame prediction mode and/or an inter-frame prediction mode, and here it is mainly an optimization scheme for the MTS/LFNST/NSPT transformation proposed for the chrominance component of a single tree partition to improve the compression efficiency.
  • the prediction mode of the current block may include: an inter-frame prediction mode and/or an intra-frame prediction mode.
  • the intra-frame prediction mode mainly predicts the current block based on the reconstructed area around the current block
  • the inter-frame prediction mode mainly predicts the current block based on the reference image of the current block.
  • the partition type of the current block may include single tree partition and dual tree partition.
  • the single tree the luminance component and the chrominance component are partitioned together, and a CU contains a luminance block and a chrominance block at the same position; in the dual tree, the luminance and chrominance are partitioned separately, and a CU has only a luminance block or only a chrominance block.
  • the block of the luminance component of the current block can be called a "luminance block”
  • the block of the chrominance component of the current block can be called a "chrominance block”.
  • LFNST could originally be used on the chrominance components of a single tree in the standardization stage, in order to reduce the complexity of the hardware, the effect of not using LFNST on the chrominance components is better. For example, not using LFNST on the chrominance components will shorten the pipeline compared to using it on the chrominance components. Based on this, in the embodiment of the present application, the following restrictions are added to the use of the chrominance components of a single tree.
  • the restriction condition is that the mode parameter satisfies the first condition, which may include: the partition type of the current block is single-tree partition and the prediction mode of the chrominance component of the current block is a cross-component prediction mode.
  • the cross-component prediction mode may include CCLM, CCCM, inter-CCCM, etc.
  • the preset transform kernel can be determined as the first transform kernel of the chrominance component of the current block.
  • the preset transform kernel is the default transform kernel.
  • MTS/LFNST/NSPT is not applied to the chrominance component of the current block.
  • the default transform kernel is used, such as separable DCT2 in the horizontal and vertical directions.
  • a first transform core group for the chroma component of the current block can be determined based on the first transform mode; wherein the first transform core group is different from the transform core group for the luminance component of the current block; and a first transform core is determined based on the first transform core group.
  • the first transformation mode includes at least one of the following: a multi-transform selection mode (MTS), a low-frequency non-separable transformation mode (LFNST) and a non-separable basic transformation mode (NSPT).
  • MTS multi-transform selection mode
  • LNNST low-frequency non-separable transformation mode
  • NSPT non-separable basic transformation mode
  • MTS/LFNST/NSPT can be applied to the chroma component of the current block, but the first transform kernel group used by the chroma component is different from the transform kernel group used by the luminance component.
  • a first transform kernel group for the chroma component of the current block can be determined based on the first transform mode; wherein the first transform kernel group is the same as the transform kernel group for the luminance component of the current block; and a first transform kernel is determined based on the first transform kernel group; wherein the first transform kernel is different from the transform kernel for the luminance component of the current block.
  • MTS/LFNST/NSPT uses a different transform kernel for the chrominance component than for the luminance component.
  • the transform kernel groups of the two may be the same, but the transform kernels used are different; or the transform kernel groups of the two may be different, and the transform kernels used are also different.
  • the first transformation mode includes at least one of the following: a multi-transform selection mode (MTS), a low-frequency non-separable transformation mode (LFNST) and a non-separable basic transformation mode (NSPT).
  • MTS multi-transform selection mode
  • LNNST low-frequency non-separable transformation mode
  • NSPT non-separable basic transformation mode
  • MTS/LFNST/NSPT can Applied to the chrominance components of the current block, but the first transform kernel used by the chrominance components is different from the transform kernel used by the luma component.
  • different transform modes may correspond to different transform core groups, such as the multi-transform selection mode may determine the MTS transform core group, the low-frequency inseparable transform mode may determine the LFNST transform core group, and the inseparable basic transform mode may determine the NSPT transform core group.
  • Each transform core group may include at least one candidate transform core, and after determining the first transform core group of the chroma component, the first transform core used by the chroma component of the current block may be determined therefrom.
  • MTS/LFNST/NSPT uses a different transform kernel or transform kernel group for the chrominance component than for the luminance component.
  • LFNST/NSPT in some technologies will determine a transform kernel group based on the intra-frame prediction mode.
  • this intra-frame prediction mode represents a texture feature, such as the texture at a certain angle.
  • LFNST/NSPT can match the corresponding transform kernel group according to this texture feature.
  • intra-frame MTS also matches the transform kernel according to the intra-frame prediction mode. For inter-frame prediction, it itself does not have an intra-frame prediction mode.
  • a virtual intra-frame prediction mode is derived using the inter-frame prediction block.
  • This virtual prediction mode can also be called a texture feature index, which is used to match the transform kernel group of LFNST/NSPT, and then the first transform kernel of the current block is determined according to the transform kernel group.
  • Cross-component prediction is to use the reconstruction block of the luminance component to predict the chrominance component.
  • the reconstruction block of the luminance component already contains the residual of the luminance component, so the prediction block of the chrominance component contains the information converted from the residual of the luminance component.
  • the luminance component and the chrominance component conform to different texture features, different transform kernels or transform kernel groups can be used for them.
  • the luminance component uses its intra-frame prediction mode or virtual intra-frame prediction mode to match a transform kernel group.
  • the transform kernel group corresponding to DC or PLANAR is used for chrominance, or a transform kernel group specially optimized for cross-component prediction is used, which is not specifically limited here.
  • the above descriptions are all for texture features.
  • the number of pixels of the luminance component in the same CU is 4 times the number of pixels of the chrominance component, that is, the size of the luminance block and the chrominance block are different. For example, if the luminance block is 16 ⁇ 16, then the corresponding chrominance block is 8 ⁇ 8, then the transform kernel or transform kernel group also needs to be of corresponding size.
  • MTS/LFNST/NSPT uses a different transform kernel or transform kernel group for the chroma component than for the luminance component.
  • the first syntax identification information (such as lfnst_nspt_idx) will be parsed only when certain conditions are met.
  • One of the conditions is that the last non-zero coefficient position is greater than or equal to 1.
  • the scanning of the quantized coefficients is performed according to the hierarchical diagonal scan.
  • a coefficient block will be divided into 4 ⁇ 4 sub-blocks, and the 4 ⁇ 4 sub-blocks are scanned according to the diagonal scan, and the 4 ⁇ 4 sub-blocks are also scanned according to the diagonal scan.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of all its components is greater than or equal to 1.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of the Y component is greater than or equal to 1. UV components are no longer required.
  • the judgment condition is set to be greater than or equal to 1 for the last non-zero coefficient position, that is, the minimum possible threshold is 1, which is called the minimum threshold here.
  • the minimum threshold can also be set to a larger value, such as 2, 3, etc.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position is greater than or equal to 2.
  • lfnst_nspt_idx is parsed only when certain conditions are met.
  • One of the conditions is that the last non-zero coefficient position cannot be greater than a threshold value.
  • This threshold value is the maximum possible number of coefficients of LFNST or NSPT minus one, which is called the maximum threshold value here.
  • the maximum threshold value can be determined according to the size of the block, that is, the length and width.
  • the encoder LFNST performs a secondary transform on a 4 ⁇ 4 block
  • the input of LFNST is the coefficient after the 4 ⁇ 4 DCT2 transform
  • the output is 8 coefficients, that is, the LFNST output for a 4x4 block may be at most 8 coefficients.
  • the relevant technology requires that the last non-zero coefficient position of all components cannot be greater than its maximum threshold.
  • the last non-zero coefficient position of the three components Y, U, and V cannot be greater than their maximum threshold. Because this condition of LFNST/NSPT is designed for intra-frame coding, and now inter-frame coding can also use LFNST/NSPT, but their coefficients and residual rules are different, so this restriction can be modified.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of all components is not greater than its maximum threshold.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of the Y component is not greater than its maximum threshold. UV components are no longer required.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of all its components is not greater than the maximum threshold.
  • lfnst_nspt_idx is parsed only when the last non-zero coefficient position of the Y component is not greater than its maximum threshold. UV components are no longer required.
  • lfnst_nspt_idx can be parsed only when the last non-zero coefficient position of the Y component is greater than or equal to 1, and the UV component is no longer required; and lfnst_nspt_idx can be parsed only when the last non-zero coefficient position of the Y component is not greater than the maximum threshold, and the UV component is no longer required.
  • LFNST is a secondary transformation, which means that if the current block uses LFNST, then the inverse transformation of LFNST will be performed first, and then the inverse transformation of the basic transformation will be performed, which will make the pipeline longer, so LFNST is not used when the chroma uses cross-component prediction, thereby reducing the pipeline length, which is beneficial to control the complexity of the hardware, and thus improving the encoding and decoding performance.
  • Figure 45 shows a schematic diagram of the composition structure of an encoder provided by an embodiment of the present application.
  • the encoder 450 may include a first determination unit 4501, a transformation unit 4502 and an encoding unit 4503, wherein:
  • a first determining unit 4501 is configured to determine a mode parameter of a chroma component of a current block; and when the mode parameter satisfies a first condition, determine a first transform kernel of the chroma component of the current block;
  • a transform unit 4502 is configured to determine a residual block of a chrominance component of a current block, and transform the residual block of the chrominance component of the current block according to a first transform kernel to determine a transform coefficient of the chrominance component of the current block;
  • the encoding unit 4503 is configured to encode the transform coefficients of the chrominance components of the current block and write the obtained encoding bits into the bit stream.
  • the mode parameters satisfy a first condition, including: the partition type of the current block is single-tree partition and the prediction mode of the chrominance component of the current block is a cross-component prediction mode.
  • the first determining unit 4501 is further configured to determine a preset transform kernel as a first transform kernel of the chrominance component of the current block.
  • the first determination unit 4501 is further configured to determine a first transform core group of the chrominance component of the current block based on the first transform mode; wherein the first transform core group is different from the transform core group of the luminance component of the current block; and determine the first transform kernel according to the first transform core group.
  • the first determination unit 4501 is also configured to determine a first transform kernel group of the chrominance component of the current block based on the first transform mode; wherein the first transform kernel group is the same as the transform kernel group of the luminance component of the current block; and determine a first transform kernel based on the first transform kernel group; wherein the first transform kernel is different from the transform kernel of the luminance component of the current block.
  • the first transform mode includes at least one of the following: a multiple transform selection mode, a low-frequency inseparable transform mode, and an inseparable basic transform mode.
  • the first determination unit 4501 is further configured to perform cost value calculations on at least one candidate transformation core in the first transformation core group, respectively, to determine the cost value of at least one candidate transformation core; and to determine the minimum cost value from the cost values of at least one candidate transformation core, and to use the candidate transformation core corresponding to the minimum cost value as the first transformation core.
  • the first determination unit 4501 is further configured to determine the value of the first syntax identification information; wherein the first syntax identification information is used to indicate whether the current block uses the first transform mode and the corresponding transform core index used; the encoding unit 4503 is further configured to encode the value of the first syntax identification information and write the obtained encoded bits into the bit stream.
  • the first determining unit 4501 is further configured to determine that the value of the first syntax identification information is the first value when the current block does not use the first transform mode; determine that the value of the first syntax identification information is the second value when the current block uses the first transform mode; In the example, the value of the second value is associated with the transform core index of the first transform core.
  • the first determination unit 4501 is further configured to determine a second transform kernel of the chrominance component of the current block when the mode parameters do not satisfy the first condition;
  • the transform unit 4502 is further configured to determine a residual block of the chrominance component of the current block, and transform the residual block of the chrominance component of the current block according to the second transform kernel to determine the transform coefficient of the chrominance component of the current block;
  • the encoding unit 4503 is further configured to encode the transform coefficient of the chrominance component of the current block and write the obtained encoded bits into the bitstream.
  • the mode parameter does not satisfy the first condition, including: the partition type of the current block is dual-tree partition or the prediction mode of the chrominance component of the current block is a non-cross-component prediction mode.
  • the first determination unit 4501 is also configured to determine a second transform core group of the chrominance components of the current block based on the first transform mode; and determine a second transform kernel based on the second transform kernel group; wherein the first transform mode includes at least one of the following: a multi-transform selection mode, a low-frequency inseparable transform mode, and an inseparable basic transform mode.
  • the encoder 450 may further include a quantization unit 4504, wherein:
  • the first determining unit 4501 is further configured to determine a transform coefficient of a current block; wherein the transform coefficient of the current block includes a transform coefficient of a chrominance component of the current block and a transform coefficient of a luminance component of the current block;
  • the quantization unit 4504 is configured to quantize the transform coefficients of the current block to determine the quantization coefficients of the current block;
  • the encoding unit 4503 is further configured to perform encoding processing on the quantization coefficients of the current block and write the obtained encoding bits into the bit stream.
  • the encoding unit 4503 is further configured to perform a step of encoding the value of the first syntax identification information and writing the obtained encoding bits into the bitstream when the last non-zero coefficient position in the transformation coefficient of the current block meets a preset condition.
  • the first determination unit 4501 is further configured to, when the prediction mode of the current block is an intra-frame prediction mode, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is greater than or equal to a first threshold; or, when the prediction mode of the current block is an inter-frame prediction mode, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is greater than or equal to the first threshold.
  • the first determination unit 4501 is further configured to, when the partition type of the current block is dual-tree partitioning, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is greater than or equal to the first threshold; or, when the partition type of the current block is single-tree partitioning, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is greater than or equal to the first threshold.
  • the first determination unit 4501 is further configured to, when the prediction mode of the current block is an intra-frame prediction mode, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is less than or equal to the second threshold; or, when the prediction mode of the current block is an inter-frame prediction mode, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is less than or equal to the second threshold.
  • the first determination unit 4501 is further configured to, when the partition type of the current block is dual-tree partitioning, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is less than or equal to the second threshold; or, when the partition type of the current block is single-tree partitioning, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is less than or equal to the second threshold.
  • the first determination unit 4501 is further configured to determine the second threshold value according to a size parameter of the current block.
  • the first determining unit 4501 is further configured to set the second threshold to a difference between a maximum number of coefficients in the transform coefficients of the current block and one.
  • the first determination unit 4501 is further configured to determine a prediction block of a chrominance component of the current block; and determine a residual block of a chrominance component of the current block based on the original block of the chrominance component of the current block and the prediction block of the chrominance component of the current block.
  • a "unit” may be a part of a circuit, a part of a processor, a part of a program or software, etc., and of course, it may be a module, or it may be non-modular.
  • the components in the present embodiment may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional module.
  • the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of this embodiment is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in this embodiment.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
  • an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 450.
  • the computer-readable storage medium stores a computer program, and when the computer program is executed by the first processor, the method described in any one of the aforementioned embodiments is implemented.
  • the encoder 450 may include: a first communication interface 4601, a first memory 4602 and a first processor 4603; each component is coupled together through a first bus system 4604. It can be understood that the first bus system 4604 is used to achieve connection and communication between these components.
  • the first bus system 4604 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as the first bus system 4604 in Figure 46. Among them,
  • the first communication interface 4601 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
  • a first memory 4602 used to store a computer program that can be run on the first processor 4603;
  • the first processor 4603 is configured to, when running the computer program, execute:
  • the first memory 4602 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate synchronous DRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous link DRAM
  • DRRAM direct RAM bus RAM
  • the first processor 4603 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the first processor 4603.
  • the above-mentioned first processor 4603 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • the methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed.
  • the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc.
  • the storage medium is located in the first memory 4602, and the first processor 4603 reads the information in the first memory 4602 and completes the steps of the above method in combination with its hardware.
  • the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing devices (DSP Device, DSPD), programmable logic devices (Programmable Logic Device, PLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof.
  • ASIC Application Specific Integrated Circuits
  • DSP Digital Signal Processing
  • DSP Device digital signal processing devices
  • PLD programmable logic devices
  • FPGA field programmable gate array
  • general processors controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application or a combination thereof.
  • the technology described in this application can be implemented by a module (such as a process, function, etc.) that performs the functions described in this application.
  • the software code can be stored in a memory and executed by a processor.
  • the memory can be implemented in the processor or outside the processor.
  • the first processor 4603 is further configured to execute the method described in any one of the aforementioned embodiments when running the computer program.
  • This embodiment provides an encoder, in which the mode parameters of the current block are first determined; when the mode parameters meet the first condition, the first transform kernel of the chroma component of the current block is determined, and then the residual block of the chroma component of the current block is transformed according to the first transform kernel.
  • the determination of the first transform kernel is related to the mode parameters, and the MTS/LFNST/NSPT transform can be applied to the chroma component of the single tree partition, thereby not only improving the compression efficiency, but also improving the encoding and decoding performance.
  • the decoder 470 may include a second determination unit 4701 and an inverse transformation unit 4702, wherein:
  • the second determining unit 4701 is configured to determine a mode parameter of a chroma component of a current block; and when the mode parameter satisfies a first condition, determine a first transform kernel of the chroma component of the current block;
  • the inverse transform unit 4702 is configured to determine the transform coefficients of the chrominance components of the current block, and perform an inverse transform on the transform coefficients of the chrominance components of the current block according to the first transform kernel to determine the residual block of the chrominance components of the current block.
  • the mode parameters satisfy a first condition, including: the partition type of the current block is single-tree partition and the prediction mode of the chrominance component of the current block is a cross-component prediction mode.
  • the second determining unit 4701 is further configured to determine a preset transform kernel as a first transform kernel of the chrominance component of the current block.
  • the second determining unit 4701 is further configured to determine the first chrominance component of the current block based on the first transform mode.
  • a transformation kernel group wherein the first transformation kernel group is different from the transformation kernel group of the brightness component of the current block; and a first transformation kernel is determined according to the first transformation kernel group.
  • the second determination unit 4701 is also configured to determine a first transform kernel group of the chrominance component of the current block based on the first transform mode; wherein the first transform kernel group is the same as the transform kernel group of the luminance component of the current block; and determine a first transform kernel based on the first transform kernel group; wherein the first transform kernel is different from the transform kernel of the luminance component of the current block.
  • the first transform mode includes at least one of the following: a multiple transform selection mode, a low-frequency inseparable transform mode, and an inseparable basic transform mode.
  • the decoder 470 may further include a decoding unit 4703 configured to decode a code stream and determine a value of first syntax identification information; a second determination unit 4701 is further configured to determine a transform core index of a current block when the first syntax identification information indicates that the current block uses a first transform mode; and determine a first transform core based on the first transform core group and the transform core index.
  • the second determination unit 4701 is further configured to determine a second transform kernel of the chrominance component of the current block when the mode parameters do not satisfy the first condition; the inverse transform unit 4702 is further configured to determine the transform coefficient of the chrominance component of the current block, and inversely transform the transform coefficient of the chrominance component of the current block according to the second transform kernel to determine the residual block of the chrominance component of the current block.
  • the mode parameter does not satisfy the first condition, including: the partition type of the current block is dual-tree partition or the prediction mode of the chrominance component of the current block is a non-cross-component prediction mode.
  • the second determination unit 4701 is also configured to determine a second transform core group of the chrominance components of the current block based on the first transform mode; and determine a second transform kernel based on the second transform kernel group; wherein the first transform mode includes at least one of the following: a multi-transform selection mode, a low-frequency inseparable transform mode, and an inseparable basic transform mode.
  • the transformation coefficients of the current block include the transformation coefficients of the chrominance components of the current block and the transformation coefficients of the luminance components of the current block; accordingly, the decoding unit 4703 is also configured to decode the code stream to determine the quantization coefficients of the luminance components of the current block; the dequantization unit 4704 is also configured to dequantize the quantization coefficients of the luminance components of the current block to determine the transformation coefficients of the luminance components of the current block.
  • the decoding unit 4703 is further configured to perform a step of decoding the code stream and determining a value of the first syntax identification information when the last non-zero coefficient position in the transformation coefficient of the current block meets a preset condition.
  • the second determination unit 4701 is further configured to, when the prediction mode of the current block is an intra-frame prediction mode, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is greater than or equal to the first threshold; or, when the prediction mode of the current block is an inter-frame prediction mode, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is greater than or equal to the first threshold.
  • the second determination unit 4701 is further configured to, when the partition type of the current block is dual-tree partitioning, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is greater than or equal to the first threshold; or, when the partition type of the current block is single-tree partitioning, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is greater than or equal to the first threshold.
  • the second determination unit 4701 is further configured to, when the prediction mode of the current block is an intra-frame prediction mode, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is less than or equal to the second threshold; or, when the prediction mode of the current block is an inter-frame prediction mode, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is less than or equal to the second threshold.
  • the second determination unit 4701 is further configured to, when the partition type of the current block is dual-tree partitioning, the last non-zero coefficient position of all color components in the transformation coefficient of the current block is less than or equal to the second threshold; or, when the partition type of the current block is single-tree partitioning, the last non-zero coefficient position of the luminance color component in the transformation coefficient of the current block is less than or equal to the second threshold.
  • the second determination unit 4701 is further configured to determine the second threshold value according to a size parameter of the current block.
  • the second determining unit 4701 is further configured to set the second threshold to a difference between a maximum number of coefficients in the transform coefficients of the current block and one.
  • the second determination unit 4701 is further configured to determine a prediction block of the chrominance component of the current block; and determine a reconstructed block of the chrominance component of the current block based on the prediction block of the chrominance component of the current block and the residual block of the chrominance component of the current block.
  • a "unit" can be a part of a circuit, a part of a processor, a part of a program or software, etc., and of course it can also be a module, or it can be non-modular.
  • the components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional module.
  • the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • this embodiment provides a computer-readable storage medium, which is applied to the decoder 470, and the computer-readable storage medium stores a computer program. When the computer program is executed by the second processor, it implements any method in the above embodiments.
  • the decoder 470 may include: a second communication interface 4801, a second memory 4802, and a second processor 4803; each component is coupled together via a second bus system 4804. It is understandable that the second bus system 4804 is used to achieve connection and communication between these components.
  • the second bus system 4804 also includes a power bus, a control bus, and a status signal bus.
  • various buses are labeled as the second bus system 4804 in FIG. 48. Among them,
  • the second communication interface 4801 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
  • the second memory 4802 is used to store a computer program that can be run on the second processor 4803;
  • the second processor 4803 is configured to, when running the computer program, execute:
  • the second processor 4803 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
  • This embodiment provides a decoder, in which the mode parameters of the current block are first determined; when the mode parameters meet the first condition, the first transform kernel of the chrominance component of the current block is determined, and then the residual block of the chrominance component of the current block is transformed according to the first transform kernel.
  • the determination of the first transform kernel is related to the mode parameters, and the MTS/LFNST/NSPT transform can be applied to the chrominance component of the single tree partition, thereby not only improving the compression efficiency, but also improving the encoding and decoding performance.
  • FIG49 shows a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application.
  • a coding and decoding system 490 may include an encoder 4901 and a decoder 4902 .
  • the encoder 4901 may be the encoder described in any one of the aforementioned embodiments
  • the decoder 4902 may be the decoder described in any one of the aforementioned embodiments.

Landscapes

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

Abstract

本申请公开了一种编解码方法、码流、编码器、解码器以及存储介质,该方法包括:确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。如此,可以提升压缩效率。

Description

编解码方法、码流、编码器、解码器以及存储介质 技术领域
本申请实施例涉及视频编解码技术领域,尤其涉及一种编解码方法、码流、编码器、解码器以及存储介质。
背景技术
随着人们对视频显示质量要求的提高,高清和超高清等高分辨率视频应运而生。然而,高分辨率视频通常具有更多信息,因此需要更多带宽。为降低带宽要求,已经引入了涉及视频压缩的视频编码标准。
及视频压缩的视频编码标准。
在视频编码标准中当前块的划分技术包括单树划分和双树划分。其中,如果当前块使用单树划分时,这时候亮度块可以使用多变换选择(Multiple Transform Selection,MTS)、低频不可分离变换(Low Frequency Non-Separable Transform,LFNST)或不可分离的基础变换(Non-Separable Primary Transform,NSPT)等变换模式,但是色度块使用默认的离散余弦变换(Discrete Cosine Transform,DCT),不利于提高压缩效率。
发明内容
本申请实施例提供一种编解码方法、码流、编码器、解码器以及存储介质,可以提升压缩效率。
本申请实施例的技术方案可以如下实现:
第一方面,本申请实施例提供了一种解码方法,应用于解码器,该方法包括:
确定当前块的色度分量的模式参数;
在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;
确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
第二方面,本申请实施例提供了一种编码方法,应用于编码器,该方法包括:
确定当前块的色度分量的模式参数;
在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;
确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;
对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
第三方面,本申请实施例提供了一种码流,其中,码流是根据待编码信息进行比特编码生成的;其中,待编码信息包括下述至少一项:当前块的色度分量的量化系数和第一语法标识信息的取值;其中,第一语法标识信息用于指示当前块是否允许使用第一变换模式以及对应使用的变换核索引。
第四方面,本申请实施例提供了一种编码器,包括第一确定单元、变换单元和编码单元,其中:
第一确定单元,配置为确定当前块的色度分量的模式参数;以及在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;
变换单元,配置为确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;
编码单元,配置为对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
第五方面,本申请实施例提供了一种编码器,包括第一存储器和第一处理器,其中:
第一存储器,用于存储能够在第一处理器上运行的计算机程序;
第一处理器,用于在运行所述计算机程序时,执行如第二方面所述的方法。
第六方面,本申请实施例提供了一种解码器,包括第二确定单元和反变换单元,其中:
第二确定单元,配置为确定当前块的色度分量的模式参数;以及在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;
反变换单元,配置为确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
第七方面,本申请实施例提供了一种解码器,包括第二存储器和第二处理器,其中:
第二存储器,用于存储能够在第二处理器上运行的计算机程序;
第二处理器,用于在运行所述计算机程序时,执行如第一方面所述的方法。
第八方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,所述计算机程序被至少一个处理器执行时实现如第一方面所述的方法、或者如第二方面所述的方法。
本申请实施例提供了一种编解码方法、码流、编码器、解码器以及存储介质,在编码端,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。在解码端,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。这样,无论是编码端还是解码端,都是首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,而且还可以提升编解码性能。
附图说明
图1为一种混合编码框架的流程框图示意图;
图2为一种图像组GOP的结构示意图;
图3为一种块划分结构示意图;
图4为一种当前块的空域/时域上的块位置关系示意图;
图5为一种当前块与同位块的运动信息示意图;
图6为一种使用同位参考图像的运动位移示意图;
图7为一种使用MVD特性的分布示意图;
图8为一种使用2个或3个控制点的仿射运动示意图;
图9为一种基于子块推导运动矢量的仿射运动示意图;
图10为一种GPM模式下的多种模式权重示意图;
图11为一种双边匹配的运动信息示意图;
图12为一种当前块的模板匹配示意图;
图13为一种当前块的参考像素示意图;
图14为一种当前块的多参考行示意图;
图15为一种帧内预测对应的多种预测模式示意图一;
图16为一种帧内预测对应的多种预测模式示意图二;
图17为一种帧内预测对应的多种预测模式示意图三;
图18为一种帧内预测对应的多种预测模式示意图四;
图19为一种屏幕内容的编码示意图;
图20为一种梯度与帧内预测模式的柱状图示意图;
图21为一种三种帧内预测模式的加权融合示意图;
图22为一种色度分量与亮度分量的参考像素示意图;
图23为一种多模型CCLM的分组示意图;
图24为一种多模型CCLM的预测示意图;
图25为一种帧内CCCM的参考区域示意图;
图26为一种GLM的亮度梯度计算示意图;
图27为一种帧间CCCM的预测示意图;
图28为一种DCT变换示意图;
图29为一种DCT变换的基图像示意图;
图30为一种无LFNST变换的流程示意图;
图31为一种有LFNST变换的流程示意图;
图32为一种有LFNST变换的详细流程示意图;
图33为一种多个变换核组的基图像示意图;
图34为一种NSPT变换的基图像示意图;
图35为一种亮度和色度分别划分的结构示意图;
图36为本申请实施例提供的一种视频编解码的网络架构示意图;
图37为本申请实施例提供的一种编码器的系统组成框图示意图;
图38为本申请实施例提供的一种解码器的系统组成框图示意图;
图39为本申请实施例提供的一种解码方法的流程示意图一;
图40为本申请实施例提供的一种解码方法的流程示意图二;
图41为本申请实施例提供的一种解码方法的流程示意图三;
图42为本申请实施例提供的一种编码方法的流程示意图一;
图43为本申请实施例提供的一种编码方法的流程示意图二;
图44为本申请实施例提供的一种编码方法的流程示意图三;
图45为本申请实施例提供的一种编码器的组成结构示意图;
图46为本申请实施例提供的一种编码器的硬件结构示意图;
图47为本申请实施例提供的一种解码器的组成结构示意图;
图48为本申请实施例提供的一种解码器的硬件结构示意图;
图49为本申请实施例提供的一种编解码系统的组成结构示意图。
具体实施方式
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。
还需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅是用于区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
在视频图像中,一般采用第一颜色分量、第二颜色分量和第三颜色分量来表征编码块(Coding Block,CB)。其中,这三个颜色分量分别为一个亮度分量、一个蓝色色度分量和一个红色色度分量,具体地,亮度分量通常使用符号Y表示,蓝色色度分量通常使用符号Cb或者U表示,红色色度分量通常使用符号Cr或者V表示;这样,视频图像可以用YCbCr格式表示,也可以用YUV格式表示。
对本申请实施例进行进一步详细说明之前,先对本申请实施例中涉及的名词和术语进行说明,本申请实施例中涉及的名词和术语适用于如下的解释:
H.265/高效视频编码(High Efficiency Video Coding,HEVC);
H.266/多功能视频编码(Versatile Video Coding,VVC);
VVC的参考软件测试平台(VVC Test Model,VTM);
VVC之后提升压缩性能的平台(Enhanced Compression Model,ECM);
联合视频专家组(Joint Video Experts Team,JVET);
编码单元(Coding Unit,CU);
编码树单元(Coding Tree Unit,CTU);
最大编码单元(Largest Coding Unit,LCU);
运动矢量(Motion Vector,MV);
预测单元(Prediction Unit,PU);
变换单元(Transform Unit,TU);
融合技术(Merge);
跳过技术(Skip);
量化参数(Quantization Parameter,QP);
使用运动矢量差的融合技术(Merge with Motion Vector Difference,MMVD);
运动矢量预测(Motion Vector Prediction,MVP);
时域运动矢量预测(Temporal Motion Vector Prediction,TMVP);
基于子块的时域运动矢量预测(Subblock-based Temporal Motion Vector Prediction,SbTMVP);
离散余弦变换(Discrete Cosine Transform,DCT);
离散正弦变换(Discrete Sine Transform,DST);
多变换选择(Multiple Transform Selection,MTS);
低频不可分离的变换(Low Frequency Non-Separable Transform,LFNST);
不可分离的基础变换(Non-Separable Primary Transform,NSPT);
基于上下文的自适应二进制算术编码(Context-based Adaptive Binary Arithmetic Coding,CABAC)。
目前,通用的视频编解码标准都采用基于块的混合编码框架。视频中的每一个图像或子图像或一帧(frame)被分割成相同大小(如256×256,128×128,64×64等)的正方形的最大编码单元或编码树单元。每个最大编码单元或编码树单元可根据规则划分成矩形的编码单元。编码单元可能还会划分为预测单元、变换单元等。具体地,如图1所示,混合编码框架包括有预测(Prediction)、变换(Transform)/量化(Quantization)、熵编码(Entropy Coding)、反量化(Inv.quantization)/反变换(Inv.transform)、环路滤波(In Loop Filter)等模块。其中,预测模块可以包括帧内预测(Intra Prediction)和帧间预测(Inter Prediction),帧间预测可以包括运动估计(Motion Estimation)和运动补偿(Motion Compensation)。由于视频的一个图像中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。另外,由于视频中的相邻图像之间存在着很强的相似性,在视频编解码技术中使用图像间预测方法消除相邻图像之间的时间冗余,从而提高编码效率。
视频编解码器的基本流程如下:在编码端,将一个图像划分成块,对当前块使用帧内预测或帧间预测产生当前块的预测块,当前块的原始块减去预测块得到残差块,对残差块进行变换、量化得到量化系数矩阵,对量化系数矩阵进行熵编码输出到码流中。在解码端,对当前块使用帧内预测或帧间预测产生当前块的预测块,另一方面解析码流得到量化系数矩阵,对量化系数矩阵进行反量化与反变换得到残差块,将预测块和残差块相加得到重建块。重建块组成重建图像,基于图像或基于块对重建图像进行环路滤波得到解码图像。编码端同样需要和解码端类似的操作获得解码图像。解码图像可以为后续的图像作为帧间预测的参考图像。编码端确定的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息如果有必要需要在输出到码流中。解码端通过解析码流及根据已有信息进行分析确定与编码端相同的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息,从而保证编码端获得的解码图像和解码端获得的解码图像相同。编码端获得的解码图像通常也叫做重建图像。在预测时可以将当前块划分成预测单元,在变换时可以将当前块划分成变换单元,预测单元和变换单元的划分可以不同。上述是基于块的混合编码框架下的视频编解码器的基本流程,随着技术的发展,该框架或流程的一些模块或步骤可能会被优化,本申请实施例适用于该基于块的混合编码框架下的视频编解码器的基本流程,但不限于该框架及流程。
另外,在本申请实施例中,当前块(Current Block,CB)可以是当前编码单元、当前预测单元、或者当前变换单元等。由于并行处理的需要,图像可以被划分成片(slice)等,同一个图像中的slice可以并行处理,也就是说它们之间没有数据依赖。而“帧”是一种常用的说法,一般可以理解为一帧是一个图像。在本申请实施例中所述的帧也可以替换为图像或slice等。
可以理解,在预测技术中,下面分别针对帧内预测和帧间预测进行详细描述。
(一)帧间预测。
帧间预测利用时间上的相关性来消除冗余。为了使人眼看不出卡顿,一般的视频的帧率会有30帧每秒,50帧每秒,60帧每秒,甚至120帧每秒。在这样的视频中,同一个场景下的相邻帧之间的相关性很高,帧间预测技术利用这种相关性参考已经编解码的帧的内容对当前要编码的内容进行预测。帧间预测可以极大的提升编码性能。
最基本的帧间预测方法是平移(translational)预测,平移预测假定当前要预测的内容在当前图像与参考图像之间是平移运动的,比如说当前块(编码单元或预测单元)的内容在当前图像与参考图像之间是平移运动的,那么就可以通过一个运动矢量从参考图像中找到这个内容,并把它作为当前块的预测块。平移运动在视频中是占很大比例,静止不动的背景、整体平移的物体以及镜头的平移等都可以用平移预测来处理。
自然视频中的一些内容不是简单的平移,比如说在平移的过程中有一些细微地变化,包括形状,颜色等的变化。双向预测从参考图像中找到两个参考块,并将这两个参考块进行加权平均,以得到与当前块尽可能像的预测块。比如说对某些场景,从当前帧的前面和后面各找一个参考块进行加权平均,可能比单独一个参考块更像当前块。基于此双向预测在单向预测的基础上对压缩性能又有提升。
图像播放顺序(Picture Order Count,POC)可以作为图像的一个标识。在一段视频序列中,每一个图像有唯一的POC,本申请实施例中认为POC的顺序和播放顺序是相同的。P图像(P Frame)是只能使用POC在当前图像之前的参考图像进行预测的图像。当前参考图像只有一个参考图像列表 (Reference Picture List,RPL),记为RPL0。参考图像列表RPL0中都是POC在当前图像之前的参考图像。B图像(B Frame)早些时候是可以使用POC在当前图像之前的参考图像及POC在当前图像之后的参考图像进行预测的图像。B图像有两个参考图像列表,记为RPL0和RPL1。一种配置方法是RPL0中都是POC在当前图像之前的参考图像,RPL1中都是POC在当前图像之后的参考图像。对于一个当前块,可以只参考RPL0中的某一图像的参考块,这样也叫做前向预测;也可以只参考RPL1中的某一图像的参考块,这样也叫做后向预测;也可以同时参考RPL0中的某一图像的参考块和RPL1中的某一图像的参考块,这样也叫做双向预测。同时参考两个参考块的一种简单的方法是将两个参考块每一个对应位置的像素进行平均得到当前块的预测块。后来B图像不再限制RPL0中都是POC在当前图像之前的参考图像,RPL1中都是POC在当前图像之后的参考图像。所以RPL0中也可以有POC在当前图像之后的参考图像,RPL1中也可以有POC在当前图像之前的参考图像。当前块也就可以同时参考POC在当前图像之前的参考图像或同时参考POC在当前图像之后的参考图像。这种B图像也叫广义B图像。
由于随机访问(Random Access,RA)配置的编解码顺序与POC顺序不同。这样B图像可以参考当前图像之前的信息和当前图像之后的信息从而明显提高了编码性能。示例性地,RA的一种经典的图像组(Group Of Pictures,GOP)结构如图2所示。在图2中,箭头表示参考关系,由于I图像不需要参考图像,那么在POC为0的I图像解码后,将会解码POC为4的P图像,而在解码POC为4的P图像时可以参考POC为0的I图像。在POC为4的P图像解码后,然后再解码POC为2的B图像,而在解码POC为2的B图像时可以参考POC为0的I图像和POC为4的P图像,等等。这样,根据图2可以得到,POC顺序为{0 1 2 3 4 5 6 7 8}的情况下,其对应的解码顺序为{0 3 2 4 1 7 6 8 5}。
低延迟(Low Delay,LD)配置的编解码顺序与POC顺序相同。所以当前图像只能参考当前图像之前的信息。Low Delay配置又分Low Delay P和Low Delay B。Low Delay P即传统的Low Delay配置。其典型的结构是IPPP……,即先编解码一个I图像,之后的图像都是P图像。Low Delay B的典型结构是IBBB……,与Low Delay P的区别在于每个帧间图像都是B图像,即使用两个参考图像列表,当前块可以同时参考RPL0中的某一图像的参考块和RPL1中的某一图像的参考块。
通常情况下,RA配置的压缩效率高于LD配置,LDB配置的压缩效率高于LDP配置。一方面是因为双向预测可以参考到后向的信息,另一方面是因为双向预测可以通过一些技术减少预测误差,比如说加权平均等。
当前图像的一个参考图像列表最多可以有几个参考图像,如2个、3个或4个等。当编码某一个当前图像时,RPL0和RPL1中各有哪几个参考图像是由某种配置或算法决定的,不是本申请实施例所讨论的重点。但是同一个参考图像可能同时出现在RPL0和RPL1中。即编解码器允许当前块同时参考同一个参考图像的两个参考块。编解码器通常使用参考图像列表里的索引值(index,idx)来对应参考图像。如果一个参考图像列表长度为4,则index有0,1,2,3四个值。示例性地,如当前图像的RPL0有POC为5,4,3,0的4个参考图像。则RPL0的index 0为POC 5的参考图像,RPL0的index 1为POC 4的参考图像,RPL0的index 2为POC 3的参考图像,RPL0的index 3为POC 0的参考图像。
还可以理解,帧间预测使用运动信息(motion information)来表示“运动”。基本的运动信息包含参考图像(reference picture)的信息和运动矢量(MV,motion vector)的信息。一个块为了能使用双向预测,自然需要能找到2个参考块,那么就需要2组参考图像的信息和运动矢量的信息。可以把它们每一组理解为一个单向运动信息,而把这2组组合到一起就形成了一个双向运动信息。在具体实现时,单向运动信息和双向运动信息可以使用相同的数据结构,只是双向运动信息的2组参考帧的信息和运动矢量的信息都有效,而单向运动信息的其中一组参考帧的信息和运动矢量的信息是无效的。所述有效也可以说是“使用”,所述无效也可以说是“不使用”。
VVC支持2个参考图像列表,记为RPL0与RPL1。对上述的双向运动信息,VVC使用RPL0对应的参考图像索引refIdxL0,以及参RPL0对应的运动矢量mvL0,RPL1对应的参考图像索引refIdxL1,以及RPL1对应的运动矢量mvL1。这里的RPL0对应的参考图像索引,RPL1对应的参考图像索引就可以理解为上述的参考图像信息。VVC用两个标识信息来分别表示是否使用RPL0对应的运动信息以及是否使用RPL1对应的运动信息,分别记为predFlagL0和predFlagL1。也可以理解为predFlagL0和predFlagL1表示上述单向运动信息“是否有效”。所以VVC中虽然没有明确地提到运动信息这种数据结构,但是它用每个参考图像列表对应的参考图像索引,运动矢量以及“是否有效”的标志位一起来表示运动信息。在VVC的标准文本中不出现运动信息,而是使用的运动矢量,也可以认为参考图像索引和是否使用对应运动信息的标志是运动矢量的附属。本文中为了描述方便仍然用“运动信息”,但是应当理解,也可以用“运动矢量”来描述。“运动信息”也可以叫做“运动参数”。
对一个二维的图像来说,运动矢量可以用(x,y)来表示,即一个水平方向的分量和一个竖直方向 的分量。由于视频都是以像素来表示的,像素之间是有距离的,一个物体的运动在相邻图像之间不一定总是能对应到整像素距离。举个例子,一个远景的视频,2个像素之间的距离在远景的物体上有1米,而这个物体在2帧之间的时间内运动的距离是0.5米,这种场景用整像素的运动矢量就无法很好地表示。因而运动矢量可以做到分像素级别,如1/2像素精度,1/4像素精度,1/8像素精度,1/16像素精度,来把运动表示得更精细。并通过插值的方法来得到参考图像中的分像素位置的像素值。
上述的平移预测中的单向预测和双向预测都是基于块的,如编码单元或预测单元。即把一个像素矩阵作为单位进行预测。最基本的块就是矩形块,如正方形和长方形。视频编解码标准如HEVC、VVC允许编码器根据视频的内容来确定编码单元、预测单元的大小及划分方式。纹理或运动简单的区域倾向于使用较大的块,纹理或运动复杂的区域倾向于使用较小的块。块划分的层次越深,越能划分出复杂的、更贴近于实际纹理或运动的块,但相应地用于表征这些划分的开销也就更大。运动信息也可能需要在码流中传输。而且通常情况下,块划分地越细,通常运动信息的开销越大。
最原始的运动信息表示方法是直接写入完整的运动信息。后来,专家发现可以使用运动矢量预测(motion vector prediction,MVP)加运动矢量差(motion vector difference,MVD)来表示运动矢量,即MV=MVP+MVD。其中,MVP越精准,MVD就越小,这样在码流中占用的开销也就更小。
还可以理解,对于merge模式来说,每一个帧间编码的块都需要一个运动信息。为了简化问题,假设CU的划分等于PU的划分等于TU的划分,也就是一个编码单元有一个相同大小相同位置的预测单元、一个相同大小相同位置的变换单元。实际上随着CU划分更加灵活,VVC相对于HEVC就有弱化PU和TU的倾向。预测、变换、量化、熵编码中某一个环节的差异都可能导致CU的划分。例如2个区域的运动信息不同,那么编码器可能把这2个区域划分为不同的CU。又例如2个区域运动信息相同或相似,但是残差特性差别很大,那么编码器也可能把这2个区域划分为不同的CU。如何划分是根据整体的压缩效率决定的,并不完全取决于某一个因素。因而会出现同一个物体或者说运动相同或相似的区域被划分成不同的CU。
图3为示意性的HEVC的块划分结构。如图3所示,(a)为原始图像,(a)中有一根铁杆在按箭头所指的方向运动,背景区域运动较小。(b)为HEVC的块划分情况,(c)为去掉了(b)中运动信息相同的块的边界。可以看出很多相邻的块使用了相同的运动信息。这种情况下,如果对每一个块都单独编码运动信息会产生明显的浪费。上述提到VVC的完整的运动信息包括RPL0的参考图像索引、MV和是否使用的标志,RPL1的参考图像索引、MV和是否使用的标志。合并merge模式的基本原理就是当前块可以继承相邻块的运动信息,包括参考图像的信息和运动矢量的信息。
Merge模式可以构建一个合并候选列表,如果当前块使用merge模式,可以用一个index指示当前块合并哪一个运动信息,从而不需要编码完整的运动信息。构建合并候选列表时,可以加入当前块空域(spatial)上相邻块的运动信息,时域(temporal)上的运动信息,空域上不相邻块的运动信息,时域上不相邻块的运动信息,基于历史的运动信息,合成的运动信息等。
所述空域上的相邻块指同一个图像中与当前块相邻的块,所述空域上不相邻块指同一个图像中与当前块不相邻的块。所述时域上的运动信息以及时域上不相邻块的运动信息指在同位(collocated)参考图像上指定位置的运动信息。示例性地,如图4所示,黑色填充块为当前块,其中1、2、3、4、5位置为merge使用的空域上相邻的块的位置,其他点填充块对应位置为merge使用的空域上不相邻的块的位置;6位置为时域上的运动信息使用的位置,如果当前块右下角的对应的位置不可用,则使用当前块中心对应的位置;其他网格填充块对应位置为时域上的不相邻块的运动信息使用的位置。根据同位参考图像的对应位置上的运动信息导出时域运动信息,具体的导出方法详见下述介绍。需要注意的是,图4中的背景网格仅为像素坐标示意,并非是具体的块划分。
基于历史的运动信息与位置无关,编解码器会维护一个先进先出的运动信息列表,每编解码一个块,编解码器就用该块的运动信息更新这个列表,更新列表时保证与列表中已有的运动信息不重复。基于历史的运动信息就从这个列表中获取。
还可以理解,对于时域运动信息(矢量)推导来说,时域运动信息预测被当作空域运动信息预测的补充来使用。通常来说同一个图像上的相邻区域的相关性比不同图像上的相关性更强。但是也有一些情况时域运动信息更好用。举一个简单的例子,比如当前图像中当前块和周边的相邻块属于不同的物体,它们有着截然不同的运动,而在某一个参考图像上与当前块属于同一个物体的块的运动,就能为当前块提供较好的运动信息预测。
同位参考图像上的同位块(这里把获取时域运动信息的那个块叫同位块)的运动矢量是从该同位参考图像col_pic到该同位块的参考图像col_ref之间的矢量。具体如图5所示,针对当前块,它需要的运动矢量是从当前图像curr_pic到当前块的参考图像curr_ref之间的矢量。设col_pic和col_ref之间的POC距离是td,curr_pic和curr_ref之间的POC距离是tb。假设同位块上的运动到当前块上的运动是不变的, 那么可以根据td,tb来确定缩放的比例。若同位块的运动矢量为(col_mv_x,col_mv_y),则时域运动矢量预测(tmvp_x,tmvp_y)可以按如下推导:tmvp_x=col_mv_x*tb/td,tmvp_y=col_mv_y*tb/td。
在VVC中,同位参考图像上的存储运动信息的最小单元是4×4。也就是每个4×4的子块存储一组运动信息。可以理解的是,如果不考虑硬件实现的代价,同位参考图像也可以做到每个像素存储一组运动信息。
还可以理解,VVC中引入了基于子块的时域运动矢量预测,即SbTMVP。常规上说MVP,TMVP都是对整个块来说的,也就是整个块共享同一个MVP。而SbTMVP是基于子块的,这样SbTMVP就能对每一个子块获得一个MVP。这也是SbTMVP和TMVP的本质区别。
另一方面,TMVP用当前块右下角的位置或当前块中心的位置来定位同位块,而SbTMVP根据周边块的运动找一个运动偏移来确定位置。VVC中,如果A1位置的块参考了同位参考图像,那么所述运动位移设为A1使用同位参考图像的运动矢量。否则,所述运动位移设为(0,0)。如图6所示,按运动位移找到位置,然后将“同位块”中的对应于每一个子块的位置的MV进行缩放得到每一个子块的MVP。
还可以理解,对于使用运动矢量差的融合技术,即MMVD来说,Merge模式直接选中的merge候选列表中的运动信息作为当前块的运动信息。在实际的视频中,当前块实际的运动矢量和选中的merge候选列表中的运动矢量有时会有一些差别。MMVD是VVC中的一种特殊的merge模式,它用一种高效的方法编码这种情况下的MVD。普通的Merge不需要编解码MVD。普通的inter模式需要直接编解码MVD。而MMVD利用了MVD更多地分布在单水平方向或单竖直方向的特性,数值小的MVD多,数值越大的MVD越少的特性,如图7所示。在图7中,不同形状的圆可以表示不同数值的MVD。
MMVD只能表示一些特定的方向上的特定数值的MVD,它并不能表示任意的MVD。它用mmvd_direction_idx表示MVD的方向,当然也可以理解为MVD的x和y是否非零以及正负号,用mmvd_distance_idx表示MVD的x和y非零的那一个的绝对值的大小MmvdDistance。
在这里,表1示出了一种示意性的mmvd_distance_idx[x0][y0]和MmvdDistance[x0][y0]的关系。
表1
其中,ph_mmvd_fullpel_only_flag是一个图像头flag,可以设置MMVD的2个不同组合。
在这里,表2示出了一种示意性的mmvd_direction_idx[x0][y0]和MmvdSign[x0][y0]的关系.
表2
其中,MMVD的MVD按如下方法得到:
MmvdOffset[x0][y0][0]=(MmvdDistance[x0][y0]<<2)*MmvdSign[x0][y0][0];
MmvdOffset[x0][y0][1]=(MmvdDistance[x0][y0]<<2)*MmvdSign[x0][y0][1]。
还可以理解,对于仿射Affine来说,前面介绍了最简单常用的平移运动,在现实世界中,运动不只有平移,还有很多种形式如缩小,放大,旋转,运动的透视(透视:离镜头近的物体显得大,离镜头远的物体显得小),还有很多不规则的运动形式。Affine可以用来表示比平移更复杂的运动。如图8所示,Affine根据2个控制点(4个参数,一个运动矢量包括x,y两个参数)或者3个控制点(6个参数)的运动矢量,利用线性模型计算出当前块中每一个子块或者每一个像素的运动矢量。其中,(a)提供了2个控制点的情形,例如v0、v1;(b)提供了3个控制点的情形,例如v0、v1、v2
对4参数affine模型,当前块内(x,y)位置的运动矢量按如下公式推导如下:
对6参数affine模型,当前块内(x,y)位置的运动矢量按如下公式推导如下:
其中,(mv0x,mv0y)为当前块的左上角的控制点的运动矢量,(mv1x,mv1y)为当前块的右上角的控制点的运动矢量,(mv2x,mv2y)为当前块的左下角的控制点的运动矢量。
VVC中使用的Affine为了简化硬件实现的复杂度,将当前块划分为4×4的子块,为每一个子块计算一个MV并进行运动补偿。图9是Affine基于子块推导运动矢量的一个示意图。可以理解的是,随着硬件处理能力的增强,Affine也可以做到基于像素的处理。即为每一个像素推导一个运动矢量,根据该运动矢量对一个像素进行运动补偿。在这里,Affine只需要几个控制点就可以为每一个子块或每一个像素推导出各自的运动矢量,相对于基于整块的运动补偿,它可以做到更精细的预测。而相对于划分更细小的CU,Affine的开销要小得多。
还可以理解,对于几何划分模式(Geometric Partitioning Mode,GPM)来说,HEVC支持最大64×64的CTU,可以递归地进行四叉树的划分。VVC支持一套比HEVC更灵活的块划分方法,支持最大128×128的CTU,包括四叉树、三叉树和二叉树的划分。这些划分方法。虽然块划分越来越灵活,但不管是CU、PU还是TU,始终只能划分成矩形块。需要注意的是,VVC已经弱化了PU和TU的划分。自然视频中纹理或者运动的边界是多种多样的。比如遇到一个斜向的物体边界,如果单纯使用矩形块想要逼近边界就会划分出很多的小块,这样会明显地增加开销。GPM几何划分模式可以更好地处理自然视频中的纹理和边界。
GPM使用两个与当前块大小相同的预测块,GPM的预测块中某些像素位置100%使用第一个预测块对应位置的像素值,某些像素位置100%使用第二个预测块对应位置的像素值,而在交界区域或者称过渡区域,按一定比例使用这两个预测块对应位置的像素值。交界区域的权重也是逐渐过渡的。当然应对诸如屏幕内容编码地场景,也可以不使用过渡区域。具体这些权重如何分配,由GPM的“划分”模式决定。根据GPM的“划分”模式确定每个像素位置的权重。当然在某些情况下,比如说块尺寸很小的情况,可能某些GPM的模式下不能保证一定有某些像素位置100%使用第一个预测块对应位置的像素值,某些像素位置100%使用第二个预测块对应位置的像素值。也可以认为GPM使用两个与当前块大小不相同的预测块,即各取所需的一部分,将权重为0的部分剔除出来。
图10为VVC中的GPM模式在正方形的块上的64种模式的权重示意图。如图10所示,黑色表示第一个预测块对应位置的权重值为0%,白色表示第一个预测块对应位置的权重值为100%,灰色区域则按颜色深浅的不同表示第一个预测块对应位置的权重值为大于0%小于100%的某一个权重值。第二个参考块对应位置的权重值则为100%减去第一个参考块对应位置的权重值。
GPM可以说是一种预测模式或预测方法,因为它最终产生一个预测块。也可以说GPM是一种“划分”模式,它把预测块进行了模拟划分,它类似于实现了PU划分,但又没有实质地划分。上述GPM使用的第一个预测块和第二个预测块既可以是帧内预测产生的预测块,也可以是帧间的单向预测产生的预测块,还可以是帧间的双向预测产生的预测块。
还可以理解,一般消费类的视频码率是受限的,因而视频压缩通常要去寻求码流开销和失真的折衷。以块划分为例,对相同的内容,在一定范围内,划分地越细开销越大失真越少;划分越粗开销越少失真越大。以运动信息的编码为例,对相同的内容,在一定范围内,运动信息越精准开销越大失真越小;运动信息越粗放开销越小失真越大。一些解码端的方法在不占用开销情况下,利用解码端侧的信息进行处理与计算,达到改善运动信息,改善预测效果,减少失真的效果。不占用开销也就意味着没有编码器的根据原始图像做出的指示,它是根据可以得到的信息自动处理的。VVC中两个典型的解码端方法是解码端运动矢量改善(Decoder side Motion Vector Refinement,DMVR)和双向光流(Bi-Directional Optical Flow,BDOF),下面将对其分别进行详细介绍。
在一种可能的实现方式中,对于DMVR来说,VVC中的DMVR启动的一个条件是当前块的2个参考图像分别来自于当前图像的一前一后,而且2个参考图像与当前图像的距离相等。另一个启动条件是当前CU使用的是整块的merge模式(包括skip),所述整块的即不包含基于子块的merge如SbTMVP和affine merge,因为merge模式下运动矢量容易出现不够精确的情况。还有一些其他的条件这里不再赘述。VVC中的DMVR利用双边匹配(bilateral matching,BM)也就是对两边的参考块计算匹配代价,如绝对差之和(Sum of Absolute Difference,SAD)。DMVR搜索原始MV周边的MV的匹配代价,在移动时,2个参考图像的MV是按镜像移动的,也就是在各自原始MV的基础上一边移动MVdiff,另一 边移动-MVdiff,如图11所示。在图11中,2个参考图像包括参考图像L0(refPic in ListL0)和参考图像L1(refPic in ListL1)。搜索时也支持分像素的搜索,所以DMVR有可能找到比原有MV精度更高的MV。按一定的规则进行搜索,一般先搜索一定范围内的整像素MV,找到匹配代价最小的整像素MV,再在该整像素MV的基础上搜索分像素MV。如果找到了比原始MV匹配代价更小的MV,则用匹配代价更小的MV做运动补偿预测。DMVR改善后的MV理论上可以用于存储MV及周边块使用,比如在当前块构建merge候选列表时,如果周边块用DMVR改善了MV,使用改善后的MV用于构建merge候选列表能达到更好的压缩效果,但是出于硬件实现的考虑,VVC并没有这么做。
DMVR是可以基于子块处理的。实际上在VVC中,如果块的水平方向或竖直方向大于16像素,会以16像素的大小分割子块。这一方面是基于硬件实现复杂度的考虑,因为DMVR需要在解码端进行搜索,而限制子块的大小可以减少缓存的代价。另一方面,划分成子块处理提供了更好的灵活性,每个子块可以独立改善MV,从一定程度上达到了提高划分精度的效果,这也提升了压缩效率。
在另一种可能的实现方式中,对于BDOF来说,BDOF也是一个典型的解码端方法。正如它的名字,BDOF基于光流原理改善MV和预测。光流是空间运动物体在观察成像平面上的像素运动的瞬时速度。光流有一些基本的假设,如亮度恒定不变,即同一目标在不同图像之间运动时,其亮度不发生变化。时间连续或运动是小运动。即时间的变化不会引起目标位置的剧烈变化。
VVC中的BDOF启动的一个条件是当前块的2个参考图像分别来自于当前图像的一前一后,而且2个参考图像与当前图像的距离相等。VVC对每一个4×4子块,BDOF会推导出一个运动矢量偏差(vx,vy),这个偏差是通过最小化两个方向的预测值的差值计算得到的。这个运动矢量偏差也被用于调整对应子块里的预测值。其推导过程如下:
首先,计算2个预测块的水平方向和竖直方向的梯度and具体如下:

其中,I(k)(i,j)是参考图像列表k,k=0,1的坐标(i,j)的预测值,shift1根据亮度的比特深度bitDepth计算,shift1=max(6,bitDepth-6)。
其次,计算S1、S2、S3、S5和S6,具体如下:
S1=∑(i,j)∈ΩAbs(ψx(i,j))          (5)
S2=∑(i,j)∈Ωψx(i,j)·Sign(ψy(i,j))          (6)
S3=∑(i,j)∈Ωθ(i,j)·Sign(ψx(i,j))            (7)
S5=∑(i,j)∈ΩAbs(ψy(i,j))             (8)
S6=∑(i,j)∈Ωθ(i,j)·Sign(ψy(i,j))          (9)
其中,


θ(i,j)=(I(1)(i,j)>>nb)-(I(0)(i,j)>>nb)        (12)
其中,Ω是一个当前4×4子块周围的6×6的窗,na为min(1,bitDepth-11),nb为min(4,bitDepth-8)。
再次,运动矢量偏差(vx,vy)计算如下:

其中,th′BIO=2max(5,BD-7)是向下取整,BD是比特深度bitDepth。
再次,根据运动矢量偏差和梯度,该4×4子块内的每一个预测值调整如下:
最终BDOF的预测值计算如下:
predBDOF(x,y)=(I(0)(x,y)+I(1)(x,y)+b(x,y)+ooffset)>>shift      (16)
其中,ooffset和shift根据亮度的比特深度计算得到。na、nb和shift都是为了降低计算过程中的位宽做的处理。
这样,BDOF的运动矢量偏差可以做到很高的精度从而使预测更准确,而基于子块的处理也提高了灵活性,这两个方面和DMVR是类似的。
还可以理解,DMVR和BDOF都有改善运动矢量的效果。DMVR基于块匹配,BDOF基于光流原理。它们是可以组合使用的。示例性地,可以称之为多轮解码端运动矢量改善(Multi-pass Decoder-side Motion Vector Refinement,MDMVR)。
第一步,基于整块的双向匹配的运动矢量改善。第二步,基于子块的双向匹配的运动矢量改善。这一步的字块大小可以是16×16。第三步,基于子块的双向光流的运动矢量改善。这一步的子块大小可以是8×8。当前在此基础上还可以进一步丰富步骤,如再来一个第四步,基于4x4子块的双向光流的运动矢量改善。或者再来一个基于点的双向光流的运动矢量改善等。
还可以理解,模板匹配(Template Matching,TM)的方法最早用在帧间预测中,它利用相邻像素之间的相关性,把当前块周边的一些区域作为模板。在当前块进行编解码时,按照编码顺序其左侧及上侧已经编解码完成。当然在现有的硬件解码器实现时,不一定能保证当前块开始解码时,其左侧和上侧已经解码完成,当然这里说的是帧间块,比如在HEVC中帧间编码的块产生预测块时是不需要周边的重建像素的,因而帧间块的预测过程可以并行进行。但是帧内编码的块是一定需要左侧和上侧的重建像素作为参考像素的。理论上左侧和上侧是可得的,也就是说硬件设计做相应的调整是可以实现的。相对来说右侧和下侧在现在标准如VVC的编码顺序下是不可得的。
如图12所示,把当前块的左侧和上侧的矩形区域设为模板,左侧的模板部分的高度一般和当前块的高度相同,上侧的模板的部分的宽度一般和当前块的宽度相同,当然也可以不同。在参考图像L0中寻找模板的最佳匹配位置从而确定当前块的运动信息或者说运动矢量。这个过程大致可以描述为,在某一个参考图像中,从一个起始位置开始,在周边一定范围内进行搜索。可以预先设定好搜索的规则,如搜索范围搜索步长等。每移动一个到位置,计算该位置对应的模板和当前块周边的模板的匹配程度,所谓匹配程度可以用一些失真代价来衡量,比如说绝对差之和(Sum of Absolute Difference,SAD)、绝对变换差之和(Sum of Absolute Transformed Difference,SATD)、均方误差(Mean-Square Error,MSE)等,一般SATD使用的变换是哈达玛(Hadamard)变换,另外SAD、SATD、MSE等的值越小代表匹配程度越高。用该位置对应的模板的预测块和当前块周边的模板的重建块计算代价。除了整像素位置的搜索还可以进行分像素位置的搜索,根据搜索到的匹配程度最高的位置来确定当前块的运动信息。利用相邻像素之间的相关性,对模板合适的运动信息可能也是当前块合适的运动信息。当然模板匹配的方法可能并不一定对所有的块都适用,因而可以使用一些方法确定当前块是否使用上述模板匹配的方法,比如在当前块用一个控制开关表示是否使用模板匹配的方法。这种模板匹配的方法的一个名字叫解码端运动矢量推导(Decoder side Motion Vector Derivation,DMVD)。编码器和解码器都可以利用模板进行搜索从而导出运动信息或者在原有的运动信息的基础上找到更好的运动信息。而它不需要传输具体的运动矢量或运动矢量差,而是由编码器和解码器都进行同样规则的搜索从而保证编码和解码的一致。模板匹配的方法可以提高压缩性能,但是它需要在解码端也进行“搜索”,从而带来了一定的解码端复杂度。
(二)帧内预测。
图像内部相邻的部分或相邻像素之间存在着很强的空间相关性,帧内预测就是利用当前块周边已编解码的像素和当前块内部的像素的空间相关性的预测方法。示例性地,如图13所示,4×4的白色填充像素是当前块,当前块左侧一列和上侧一行的网格填充像素为当前块的参考像素,帧内预测使用这些参考像素对当前块进行预测。这些参考像素可能已经全部可得,即全部已经编解码。也可能有部分不可得,比如当前块是整帧的最左边,那么当前块的左侧的参考像素不可得。或者编解码当前块时,当前块左下方的部分还没有编解码,那么左下方的参考像素也不可得。对于参考像素不可得的情况,可以使用可得的参考像素或某些值或某些方法进行填充,或者不进行填充。
还需要说明的是,多参考行(Multiple reference line,MRL)的帧内预测方法可以使用更多的参考像素从而提高编码效率。如图14所示,这里为使用4个参考行/列的示意图。
帧内预测有多种预测模式,如图15所示,这里是H.264中对4×4的块进行帧内预测的9种模式。其中,模式0(垂直模式)是将当前块上面的像素按竖直方向复制到当前块作为预测值,模式1(水平模式)是将左侧的参考像素按水平方向复制到当前块作为预测值,模式2(DC模式)是将A~D和I~L这8个点的平均值作为所有点的预测值,模式3~8分别按某一个角度将参考像素复制到当前块的对应位置,因为当前块某些位置不能正好对应到参考像素,可能需要使用参考像素的加权平均值,或者说是插值的参考像素的分像素。
除此之外,还有PLANE,PLANAR等模式,而随着技术的发展以及块的扩大,角度预测模式也越 来越多。如HEVC使用的帧内预测模式有PLANAR、DC和33种角度模式共35种预测模式,详见图16。VVC使用的帧内模式有PLANAR、DC和65种角度模式共67种预测模式,详见图17。当然,除了上述67种模式,VVC对一些长和宽差距较大的长方形的块还提供了宽角度模式,如图中的虚线所指的模式即-14~-1和67~80两个区间,它们会替换掉一些常规的模式,详见图18。
还可以理解,对于帧内块复制(Intra Block Copy,IBC)来说,IBC能够明显提升屏幕内容编码(Screen Content Coding,SCC)的压缩效率,因而IBC从HEVC到VVC都被用于屏幕内容编码。屏幕内容区别于相机采集的内容(camera captured content),它是由计算机生成的,屏幕内容没有噪声,包含文字、计算机图形等,边界清晰。屏幕内容中存在大量重复的内容,如图19所示。
在本申请实施例中,可以认为IBC是把帧间预测的方法用到了帧内预测。其中,帧间预测把参考图像上的参考块用来生成当前块的预测块,参考图像不是当前图像。而IBC则是从当前图像中已编解码的部分或者叫已重建部分找参考块用来生成当前块的预测块。IBC也可称为帧内块补偿(intra picture block compensation)或当前图像参考(Current Picture Referencing,CPR)。
IBC可以用块矢量(block vector,BV)来表示当前块和参考块之间的位置差别,这和帧间预测的MV是类似的。编码器在搜索范围内通过块匹配的方法确定当前块的最佳的匹配块,并对BV进行编码,对BV的编码有多种方法,比如可以用merge模式,和帧间预测有类似之处,这里不再赘述。
IBC可以认为是一种帧内预测方法,也可以认为是独立于帧内预测和帧间预测的另一类预测方法。IBC对屏幕内容编码有很高的效率,在相机采集的自然序列中同样能提升压缩效率。
在ECM10中的帧内模板匹配预测(Intra Template Matching Prediction,IntraTMP)可以认为是一种特殊的IBC,IntraTMP也是要从当前图像中已编解码的部分中寻找参考块用来生成当前块的预测块。IntraTMP把当前块左侧和上侧一定范围内的重建像素作为当前块的模板,每搜索一个BV,该BV对应的与当前块相同大小的参考块的左侧和上侧一定范围内的重建像素参考块的模板,计算当前块的模板和参考块的模板的匹配代价,根据匹配代价确定参考块生成预测块。
还可以理解,对于解码端帧内预测模式导出(Decoder-side Intra Mode Derivation,DIMD)来说,DIMD利用当前块左侧和上侧的重建像素导出预测模式,但是它不是在模板上进行预测,而是分析重建像素的梯度。
如图20所示,DIMD分析黑色点的梯度,如水平梯度和竖直梯度,根据它的梯度适配一种帧内预测模式,对所有需要检查的点分析可以得到一个类似于下面的柱状图的结果。即每种帧内预测模式匹配的点的数量的统计。当然所谓柱状图只是帮助理解,具体实现时可以用多种简单的形式实现。现在的DIMD选出柱状图里最高的2个帧内预测模式,再加上PLANAR模式,共3个帧内预测模式的预测值进行加权,权重和分析的结果有关。示例性地,如图21所示,3个帧内预测模式包括M1模式、M2模式和PLANAR模式。对于这3个帧内预测模式所得到的预测值分别设置为Pred1、Pred2、Pred3,这3个帧内预测模式的权重值分别设置为w1、w2、w3,具体计算公式如下:


最终的预测块,可以如下述所示:
总结来说,DIMD利用重建像素的梯度分析来筛选帧内预测模式,而且可以将2个帧内预测模式再加上planar根据分析结果进行加权。DIMD的好处在于如果当前块选择了DIMD模式,那么它不需要再去指示具体使用了哪种帧内预测模式,而是由解码器自己通过上述流程导出,一定程度上节省了开销。
还可以理解,对于跨分量预测(Cross-Component Prediction,CCP)来说,由于同一空间的不同分量间具有很强的相关性,视频编解码技术可以利用这种相关性来提高压缩效率。有些情况下,同一空间的第一分量会先编解码,然后第二第三分量再编解码,这样第二三分量就可以利用第一分量的一些信息。比如在YUV格式中,U和V的像素可以用对应位置的Y的重建像素来预测。如果是YUV4:2:0格式的,U和V的像素位置和Y的位置不一一对应,可以通过降采样等方法找到对应的Y的重建像素来预测。
VVC中的CCP的一个典型的示例是跨分量线性模型(Cross-Component Linear Model,CCLM)。ECM中其他跨分量预测技术还有多模型CCLM(Multi-Model CCLM,MM-CCLM)、卷积跨分量模型(Convolutional Cross-Component Model,CCCM)、多模型CCCM(Multi-Model CCCM,MM-CCCM)、梯度线性模型(Gradient Linear Model,GLM)、inter-CCCM等,还有其他衍生技术不再一一列举,它们都是第二/三颜色分量利用第一颜色分量的一些信息,如重建值,进行预测的技术。跨分量预测技术可以用在帧内编码的块也可以用在帧间编码的块。例如inter-CCCM就是用在帧间编码的块。
(1)跨分量线性模型CCLM。
CCLM顾名思义是用一个第一颜色分量和第二/三颜色分量的线性模型进行预测的技术。具体地,如下所示:
predC(i,j)=α·recL′(i,j)+β        (21)
其中,predC(i,j)代表(i,j)位置的色度像素的预测值,代表recL′(i,j)位置的经过降采样的亮度像素的重建值。CCLM的模型参数(α和β)是根据当前块的相邻的经过降采样的亮度像素和色度像素导出的。示例性,如图22所示,这里示出了当前块的亮度分量相邻参考值和色度分量相邻参考值的采样示意图;其中,在(a)中,加粗的较大方框用于突出指示色度块21,而灰色实心圆圈用于指示色度块21的相邻参考值;在(b)中,加粗的较大方框用于突出指示亮度块22,而灰色实心圆圈用于指示亮度块22的相邻参考值。其中,色度块21为N×N大小,亮度块22为2N×2N大小。在这里,色度块21的相邻参考值与亮度块22的相邻参考值均是用于推导模型参数α和β。
基本的原理是利用当前块相邻的亮度和色度像素导出线性模型,再将这个线性模型用在当前块的上,根据亮度的重建值和这个线性模型确定色度的预测值。
(2)多模型CCLM。
MM-CCLM是CCLM的一个扩展,CCLM在当前块中只使用一个线性模型,MM-CCLM顾名思义使用多个线性模型,具体地在ECM-10中使用2个线性模型。为了导出2个线性模型,当前块用于导出线性模型的左侧和上侧相邻的亮度像素被分为2个组,分组的阈值是这些亮度像素值的中值。对当前块进行预测时,同样用该阈值把当前块的亮度像素分为2组,分别应用各自的模型进行预测。图23为一种MM-CCLM分组示意图,图24为一种MM-CCLM预测示意图。
(3)卷积跨分量模型CCCM。
和CCLM类似的是CCCM也是根据当前块左侧和上侧已重建的部分导出跨分量模型,但是CCCM使用的重建区域要更大一些,它可以导出一个非线性的模型。另一个不同的是CCLM是用一个降采样后的亮度值预测一个色度值,CCCM要用到色度像素对应的位置的亮度重建值以及其周边上下左右位置的亮度重建值。
具体地,CCCM用一个7抽头的卷积滤波器,该滤波器包括5个空域相邻的像素,C(center)是当前色度像素对应的亮度像素,N(north)是C上面的亮度像素,S(south)是C下面的亮度像素,W(west)是C左面的亮度像素,E是C右面的亮度像素。还有一个非线性项P,P=(C×C+midVal)>>bitDepth。其中,midVal即中值的意思,bitDepth是位宽。对10位的情况,P=(C×C+512)>>10。还有一个偏移项B,设为中值,对10位的情况是512。色度像素的预测值predChromaVal=C0C+C1N+C2S+C3E+C4W+C5P+C6B。
为了确定C0、C1、C2、C3、C4、C5、C6,CCCM会在如图25所示的参考区域中应用同样的模型对色度进行预测并且和重建的色度值比较,求解使均方误差最小的C0、C1、C2、C3、C4、C5、C6
(4)多模型卷积跨分量模型MM-CCCM。
和MM-CCLM类似,在当前块应用多个模型。其中,在ECM-10中使用的是2个,导出方法也是用一个阈值将已重建的亮度像素和当前块的亮度像素分成2组,分别导出CCCM模型,分别预测并组合成一个预测块。
(5)梯度线性模型GLM。
GLM是根据亮度的梯度来预测色度的方法。这里有2种GLM模式,一种模式是2参数GLM,一种模式是3参数GLM。其中:
2参数GLM的公式为predC(i,j)=α·gradL(i,j)+β;
3参数GLM的公式为predC(i,j)=α0·gradL(i,j)+α1·recL′(i,j)+β。
在这里,2参数GLM就是把CCLM中的下采样的亮度的重建像素值换成了亮度的梯度。3参数GLM就是在CCLM的基础上加上了亮度的梯度。亮度的梯度有如图26所示四种计算方法,滤波器方块对应的是亮度像素,圆圈对应的是色度像素,这是一组为YUV4:2:0格式设计的滤波器。
(6)帧间的CCCM。
帧内预测和帧间预测是不同的,帧内预测使用的是当前块周边已重建的像素来预测当前块内部,而帧间预测使用的是不同时刻的相同物体的图像来预测。对帧间预测来说最基本的是平移运动,也就是用一个运动矢量找到一个参考块,把参考块作为预测块。既然是从不同时刻找到的相同物体,参考图像中包含与当前图像相同的分量数,对YUV格式的序列来说,YUV三个分量都可以从参考块中得到预测值。上述跨分量模型如CCLM,CCCM都遵循类似帧内的方式,即用周边重建像素来导出模型,而inter-CCCM用原有帧间预测的预测块导出跨分量模型(滤波器系数),如图27所示。其中,resY、resCb、resCr分别表示亮度残差值、蓝色色度残差值和红色色度残差值;然后结合对应的预测值进行加法运算, 可以得到亮度重建值Y、蓝色色度重建值Cb和红色色度重建值Cr。也就是说,在亮度进行重建之后,再对亮度重建值应用导出的模型(滤波器系数)得到第二色度预测值,将原来的预测值和inter-CCCM得到的第二预测值进行加权作为新的预测值。inter-CCCM把包含亮度的残差的重建值经过模型转化给色度的预测,从而提升了压缩效率。
进一步地,下面针对变换技术进行相关介绍。
编码时,现在通用的混合编码框架会先进行预测,预测利用空间或者时间上的相关性能得到一个跟当前块相同或相似的图像。对一个块来说,预测块和当前块是完全相同的情况是有可能出现的,但是很难保证一个视频中的所有块都如此,特别是对自然视频,或者说相机拍摄的视频。视频中不规则的运动,扭曲形变,遮挡,亮度等的变化,很难被完全预测。所以混合编码框架会将当前块的原始图像减去预测图像得到残差图像,或者说当前块减去预测块得到残差块。残差块通常要比原始图像简单很多,因而预测可以显著提升压缩效率。对残差块也不是直接进行编码,而是通常先进行变换。变换是把残差图像从空间域变换到频率域,去除残差图像的相关性。残差图像变换到频率域以后,由于能量大多集中在低频区域,变换后的非零系数大多集中在左上角。接下来利用量化来进一步压缩。而且由于人眼对高频不敏感,高频区域可以使用更大的量化步长。
图28为一个DCT变换的示意图。如图28所示,原始图像经过DCT变换以后只有左上角区域存在非零系数。当然这个示例是对整幅图像做了DCT变换,而在视频编解码中,图像是分割成块来处理的,因而变换也是基于块来进行的。
变换在通常的视频的压缩中非常有用,但是也并非所有的块都必须要做变换,有些情况下变换反而不如不变换压缩效果好,因而在某些标准如VVC中,编码器可以选择当前块是否使用变换。其中,DCT2型(DCT-II)是视频压缩标准中最常用的变换,其变换的基图像如图29所示。
另外,VVC中还可以使用DCT8型(DCT-VIII)和DST7型(DST-VII)。这些变换的基本公式如表3所示,这里示出了N个点输入的DCT2,DCT8和DST7的基本变换公式。
表3
由于图像都是二维的,而直接进行二维的变换运算量和内存开销都是当时硬件条件所不能接受的,因而在标准中使用的上述DCT2、DCT8、DST7变换都是拆分成水平方向和竖直方向的一维变换分成两步进行的。如先进行水平方向的变换再进行竖直方向的变换,或者先进行竖直方向的变换再进行水平方向的变换。
(1)多变换选择MTS。
VVC支持DCT2、DCT8、DST7等变换核,对一个块,编码器可以选择合适的变换核并将索引传输到码流中,解码器根据索引确定反变换的变换核。水平方向和竖直方向可以选择不同的变换核,如水平方向用DCT8,竖直方向用DST7。这个技术一般称为MTS。
(2)低频不可分离的变换LFNST。
上述变换方法对水平方向和竖直方向的纹理比较有效,但是对斜向的纹理效果就会差一些。确实水平和竖直方向的纹理是最常见的,因而上述的变换方法对提升压缩效率是非常有用的。随着对压缩效率需求的不断提高,如果斜向的纹理能够更有效地处理,可以进一步提升压缩效率。
为了更有效地处理斜向纹理的残差,VVC中使用了LFNST变换。将上述变换诸如DCT2、DCT8、DST7称为基础变换(Primary Transform)。在VVC的编码端,LFNST用于DCT2变换之后量化之前。在VVC的解码端,LFNST用于反量化之后,反DCT2变换之前。因为是在DCT2(基础变换)的基础上再做变换,LFNST是一种二次变换。图30为无LFNST(二次变换)的编解码流程示意图,图31为 有LFNST(二次变换)的编解码流程示意图。当然编码端可以不通过熵解码而是直接对保存的量化系数进行反量化,因为熵编码是无损的。
图32为一种存在LFNST(二次变换)的详细编解码流程示意图。如图32所示,在编码端,首先是正向基础变换,然后LFNST对基础变换后的左上角的低频系数进行二次变换。示例性地,对于4×4的LFNST存在16个输入系数,对于8×8的LFNST存在64个输入系数;然后对LFNST变换后的系数进行量化处理,并将量化系数写入码流。在解码端,通过解码码流和反量化可以得到变换系数,然后在反LFNST变换中,对于4×4的反LFNST存在8个输入系数,对于8×8的反LFNST存在16个输入系数,最后反基础变换可以得到残差块。
也就是说,在编码端,LFNST对基础变换后的左上角的低频系数进行二次变换。基础变换通过对图像进行去相关性,把能量集中到左上角。而二次变换对基础变换的低频系数再去相关性,结果直观地来说如图32所示。在编码端,16个系数输入到4×4的LFNST,输出是8个系数;64个系数输入到8×8的LFNST,输出是16个系数。在解码端,8个系数输入到4×4的反LFNST,输出是16个系数;16个系数输入到8×8的反LFNST,输出是64个系数。
图33为VVC中LFNST的一些基图像。根据图33可以看出一些明显的斜向纹理。其中,LFNST除了有针对某些斜向纹理优化的变换核,也有针对平坦渐变纹理优化的变换核,如VVC中的LFNST的变换核组0。
LFNST只应用于帧内编码的块。角度预测按照指定的角度将参考像素平铺到当前块作为预测值,这意味着预测块会有明显的方向纹理,而当前块经过角度预测后的残差在统计上也会体现出明显的角度特性。因而LFNST所选用的变换核可以跟帧内预测模式进行绑定,即确定了帧内预测模式以后,LFNST只能使用帧内预测模式对应的一组(set)变换核。
具体地,VVC中的LFNST总共有4组变换核,每组可选2个变换核。表4给出了帧内预测模式和变换核组的对应关系。注意到色度帧内预测使用的跨分量预测模式为81到83,亮度帧内预测并没有这几种模式。LFNST的变换核可以通过转置来用一个变换核组对应处理更多的角度,示例性地,13到23和45到55的模式都对应变换核组2,但是13到23明显是接近于水平的模式而45到55明显是接近于竖直的模式。
表4
VVC的LFNST共有4组变换核,根据帧内预测模式指定LFNST使用哪一组。这样做利用了帧内预测模式和LFNST的变换核之间的相关性,从而减少了选择LFNST的变换核在码流中的传输。而当前块是否会使用LFNST,以及如果使用LFNST,是使用一个组中的第一个还是第二个,是需要通过码流和一些条件来确定的。
在后续的ECM技术演进中,LFNST进一步扩展。LFNST有更多的变换核组,在ECM中是35组,变换核组索引(LFNST set index)和帧内预测模式(Intra pred.mode)的对应关系如表5。每个变换核组对对应角度的纹理更高效。在这里,每个变换核组可以选择3个变换核。
表5
(3)不可分离的基础变换NSPT。
LFNST是水平竖直不可分离的变换,因为有二次变换,所以DCT2可以被称为基础变换。这样先经过DCT2,再进行LFNST,可以说是一种性能和复杂度折衷的方案,因为直接进行不可分离的基础变换效率更高,但是有更高的复杂度,比如说计算量和变换核的存储空间都更高。
在ECM10中,一些小块可以使用NSPT,而大块仍然使用DCT2+LFNST。小块的尺寸如4×4,4 ×8,8×4,8×8,4×16,16×4,8×16,16×8,8×32,32×8。在ECM10中,NSPT同样根据帧内预测模式匹配变换核组,匹配方法可以参照LFNST的方法,每个变换核组有3个变换核可选。示例性地,ECM10中的一个NSPT的8×8基图像如图34所示,图34是对应帧间角度预测模式7的,可见其处理对应角度的纹理更优。需要注意的是,NSPT只应用于帧内编码的块。
进一步地,对于划分技术来说,这里可以分为单树(Single tree)划分和双树(Dual tree)划分。其中,Single tree中亮度和色度一起划分,一个CU包含亮度块和相同位置的色度块。Dual tree中亮度和色度单独划分,一个CU只有亮度块或只有色度块。HEVC中只有Single tree。VVC中引入了Dual tree,但是VVC中的P和B slice还是只能用Single tree。VVC中的I slice可以用Dual tree。如图35所示,亮度和色度分别划分,可以看出亮度比色度有更精细的划分,因为亮度比色度具有更多的细节,而且一般亮度比色度要求更好的质量。
综上可知,LFNST和NSPT可以应用于帧内编码的块,或者也可以应用于帧间编码的块。对于相关技术而言,在VVC和ECM中,MTS/LFNST/NSPT不用于single tree的色度块的变换。如果当前块是帧内的dual tree的亮度编码单元或色度编码单元,那么MTS/LFNST/NSPT可以使用;如果当前块是single tree,即一个编码单元既有亮度块也有色度块,那么MTS/LFNST/NSPT只作用于亮度块的变换,不能作用于色度块的变换,当亮度块使用MTS/LFNST/NSPT时,色度块使用默认的DCT2变换;不利于提升色度分量的压缩效率。
基于此,本申请实施例提供了一种编码方法,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。本申请实施例还提供了一种解码方法,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
这样,无论是编码端还是解码端,都是首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,即视频编解码效率,同时还可以提升编解码性能。
下面将结合附图对本申请各实施例进行详细说明。
图36为本申请实施例提供的一种视频编解码的网络架构示意图。如图36所示,该网络架构包括一个或多个电子设备13至1N和通信网络01,其中,电子设备13至1N可以通过通信网络01进行视频交互。电子设备在实施的过程中可以为各种类型的具有视频编解码功能的设备,例如,所述电子设备可以包括手机、平板电脑、个人计算机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、服务器等,本申请实施例不作限定。
在本申请实施例中,这里提供了一种包含解码方法和编码方法的视频编解码系统的网络架构。其中,本申请实施例中的解码器或编码器就可以为上述电子设备。也就是说,本申请实施例中的电子设备具有视频编解码功能,一般包括视频编码器(即编码器)和视频解码器(即解码器)。
图37为本申请实施例提供的一种编码器的系统组成框图示意图。如图37所示,编码器100可以包括:分割单元101、预测单元102、第一加法器107、变换单元108、量化单元109、反量化单元110、反变换单元111、第二加法器112、滤波单元113、解码图片缓存(Decoded Picture Buffer,DPB)单元114和熵编码单元115。这里,编码器100的输入可以是由一系列图片或者一张静态图片组成的视频,编码器100的输出可以是用于表示输入视频的压缩版本的比特流(也可以称为“码流”)。
其中,分割单元101将输入视频中的图片分割成一个或多个编码树单元(Coding Tree Units,CTUs)。分割单元101将图片分成多个图块(或称为瓦片,tiles),还可以进一步将一个tile分成一个或多个砖块(bricks),这里,一个tile或者一个brick中可以包括一个或多个完整的和/或部分的CTUs。另外,分割单元101可以形成一个或多个切片(slices),其中一个slice可以包括图片中按照栅格顺序排列的一个或多个tiles,或者覆盖图片中矩形区域的一个或多个tiles。分割单元101还可形成一个或多个子图片,其中,一个子图片可以包括一个或多个slices、tiles或bricks。
在编码器100的编码过程中,分割单元101将CTU传送到预测单元102。通常,预测单元102可以由块分割单元103、运动估计(Motion Estimation,ME)单元104、运动补偿(Motion Compensation,MC)单元105和帧内预测单元106组成。具体地,块分割单元103迭代地使用四叉树分割、二叉树分割和三叉树分割而进一步将输入CTU划分成更小的编码单元(Coding Units,CUs)。预测单元102可 使用ME单元104和MC单元105获取CU的帧间预测块。帧内预测单元106可使用包括MIP模式的各种帧内预测模式获取CU的帧内预测块。在示例中,率失真优化的运动估计方式可被ME单元104和MC单元105调用以获取帧间预测块,以及率失真优化的模式确定方式可被帧内预测单元106调用以获取帧内预测块。
预测单元102输出CU的预测块,第一加法器107计算分割单元101的输出中的CU和CU的预测块之间的差值,即残差CU。变换单元108读取残差CU并对残差CU执行一个或多个变换操作以获取系数。量化单元109对系数进行量化并输出量化系数(即levels)。反量化单元110对量化系数执行缩放操作以输出重构系数。反变换单元111执行对应于变换单元108中的变换的一个或多个反变换并输出重构残差。第二加法器112通过使重构残差和来自预测单元102的CU的预测块相加而计算出重构CU。第二加法器112还将其输出发送到预测单元102以用作帧内预测参考。在图片或子图片中的所有CU被重构之后,滤波单元113对重构图片或子图片执行环路滤波。这里,滤波单元113包含一个或多个滤波器,例如去方块滤波器、采样自适应偏移(Sample Adaptive Offset,SAO)滤波器、自适应环路滤波器(Adaptive Loop Filter,ALF)、亮度映射和色度缩放(Luma Mapping with Chroma Scaling,LMCS)滤波器以及基于神经网络的滤波器等。或者,当滤波单元113确定CU不用作其它CU编码时的参考时,滤波单元113对CU中的一个或多个目标像素执行环路滤波。
滤波单元113的输出是解码图片或子图片,这些解码图片或子图片缓存至DPB单元114。DPB单元114根据时序和控制信息输出解码图片或子图片。这里,存储在DPB单元114中的图片还可用作预测单元102执行帧间预测或帧内预测的参考。最后熵编码单元115将来自编码器100中解码图片所必需的参数(比如控制参数和补充信息等)转换成二进制形式,并根据每个数据单元的语法结构将这样的二进制形式写入码流中,即编码器100最终输出码流。
进一步地,编码器100可以是具有第一处理器和记录计算机程序的第一存储器。当第一处理器读取并运行计算机程序时,编码器100读取输入视频并生成对应的码流。另外,编码器100还可以是具有一个或多个芯片的计算设备。在芯片上实现为集成电路的这些单元具有与图37中相应单元类似的连接和数据交换功能。
图38为本申请实施例提供的一种解码器的系统组成框图示意图。如图38所示,该解码器200可以包括:解析单元201、预测单元202、反量化单元205、反变换单元206、加法器207、滤波单元208和解码图片缓存单元209。这里,解码器200的输入是用于表示视频或者一张静态图片的压缩版本的比特流,解码器200的输出可以是由一系列图片组成的解码视频或者一张解码的静态图片。
其中,解码器200的输入码流可以是编码器100所生成的码流。解析单元201对输入码流进行解析并从输入码流获取语法元素的值。解析单元201将语法元素的二进制表示转换成数字值并将数字值发送到解码器200中的单元以获取一个或多个解码图片。解析单元201还可从输入码流解析一个或多个语法元素以显示解码图片。
在解码器200的解码过程中,解析单元201将语法元素的值以及根据语法元素的值设置或确定的、用于获取一个或多个解码图片的一个或多个变量发送到解码器200中的单元。
预测单元202确定当前解码块(例如CU)的预测块。这里,预测单元202可以包括运动补偿单元203和帧内预测单元204。具体地,当指示帧间解码模式用于对当前解码块进行解码时,预测单元202将来自解析单元201的相关参数传递到运动补偿单元203以获取帧间预测块;当指示帧内预测模式(包括基于MIP模式索引值指示的MIP模式)用于对当前解码块进行解码时,预测单元202将来自解析单元201的相关参数传送到帧内预测单元204以获取帧内预测块。
反量化单元205具有与编码器100中的反量化单元110相同的功能。反量化单元205对来自解析单元201的量化系数(即levels)执行缩放操作以获取重构系数。反变换单元206具有与编码器100中的反变换单元111相同的功能。反变换单元206执行一个或多个变换操作(即通过编码器100中的反变换单元111执行的一个或多个变换操作的反操作)以获取重构残差。加法器207对其输入(来自预测单元202的预测块和来自反变换单元206的重构残差)执行相加操作以获取当前解码块的重构块。重构块还发送到预测单元202以用作在帧内预测模式下编码的其它块的参考。
在图片或子图片中的所有CU被重构之后,滤波单元208对重构图片或子图片执行环路滤波。滤波单元208包含一个或多个滤波器,例如去方块滤波器、采样自适应补偿滤波器、自适应环路滤波器、亮度映射和色度缩放滤波器以及基于神经网络的滤波器等。或者,当滤波单元208确定重构块不用作对其它块解码时的参考时,滤波单元208对重构块中的一个或多个目标像素执行环路滤波。这里,滤波单元208的输出是解码图片或子图片,解码图片或子图片缓存至DPB单元209。DPB单元209根据时序和控制信息输出解码图片或子图片。存储在DPB单元209中的图片还可用作通过预测单元202执行帧间预测或帧内预测的参考。
进一步地,解码器200可以是具有第二处理器和记录计算机程序的第二存储器。当第一处理器读取并运行计算机程序时,解码器200读取输入码流并生成对应的解码视频。另外,解码器200还可以是具有一个或多个芯片的计算设备。在芯片上实现为集成电路的这些单元具有与图38中相应单元类似的连接和数据交换功能。
还需要说明的是,当本申请实施例应用于编码器100时,“当前块”具体是指视频图像中的当前待编码的块(也可以简称为“编码块”);当本申请实施例应用于解码器200时,“当前块”具体是指视频图像中的当前待解码的块(也可以简称为“解码块”)。
在本申请的一实施例中,参见图39,其示出了本申请实施例提供的一种解码方法的流程示意图。如图39所示,该方法可以包括:
S3901:确定当前块的色度分量的模式参数。
需要说明的是,在本申请实施例中,该方法应用于解码器。具体来说,基于图38所示解码器200的组成结构,本申请实施例的解码方法可以应用于帧内预测模式和/或帧间预测模式,这里主要是针对单树划分的色度分量所提出的MTS/LFNST/NSPT变换的优化方案,以提高压缩效率。
还需要说明的是,在本申请实施例中,当前块的预测模式可以包括:帧间预测模式和/或帧内预测模式。其中,帧内预测模式主要是根据当前块周边的已重建区域来预测当前块,帧间预测模式主要是根据当前块的参考图像来预测当前块。
还需要说明的是,在本申请实施例中,当前块的划分类型可以包括单树(single tree)划分和双树(dual tree)划分。其中,single tree中亮度分量和色度分量一起划分,此时一个CU包含亮度块和相同位置的色度块;dual tree中亮度和色度单独划分,此时一个CU只有亮度块或只有色度块。需要注意的是,当前块的亮度分量的块可以称为“亮度块”,当前块的色度分量的块可以称为“色度块”。
还需要说明的是,虽然在标准化阶段,LFNST原本可以用在single tree的色度分量,但是为了降低硬件的复杂度,LFNST不在色度分量上使用的效果更好,比如LFNST不在色度分量上使用相比于可以在色度分量上使用会使得流水线变短。基于此,在本申请实施例中,针对single tree的色度分量的使用添加了如下的限制条件。
S3902:在模式参数满足第一条件时,确定当前块的色度分量的第一变换核。
需要说明的是,在本申请实施例中,限制条件即为模式参数满足第一条件,这里可以包括:当前块的划分类型为单树划分且当前块的色度分量的预测模式为跨分量预测模式。其中,跨分量预测模式可以包括CCLM、CCCM、inter-CCCM等。
在本申请实施例中,如果当前块在单树划分下的色度分量使用跨分量预测模式,那么一种可能的实现方式是MTS/LFNST/NSPT不应用于当前块的色度分量。在这种情况下,可以将预设变换核确定为当前块的色度分量的第一变换核。其中,预设变换核即为默认的变换核。
示例性地,如果single tree的色度分量使用了跨分量预测模式,那么此时MTS/LFNST/NSPT不应用于当前块的色度分量,而是使用默认的变换核,如水平、竖直方向分别使用可分离的DCT2。
在本申请实施例中,如果当前块在单树划分下的色度分量使用跨分量预测模式,那么另一种可能的实现方式是MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核组。在这种情况下,可以基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组不同;根据第一变换核组,确定第一变换核。
需要说明的是,在本申请实施例中,第一变换模式至少包括下述其中一项:多变换选择模式(MTS)、低频不可分离变换模式(LFNST)和不可分离基础变换模式(NSPT)。
示例性地,如果single tree的色度分量使用了跨分量预测模式,那么此时MTS/LFNST/NSPT可以应用于当前块的色度分量,但是色度分量所使用的第一变换核组与亮度分量所使用的变换核组不同。
在本申请实施例中,如果当前块在单树划分下的色度分量使用跨分量预测模式,那么又一种可能的实现方式是MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核。在这种情况下,可以基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组相同;根据第一变换核组,确定第一变换核;其中,第一变换核与当前块的亮度分量的变换核不同。
需要说明的是,在本申请实施例中,MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核。其中,这里可以是两者的变换核组相同,但是使用的变换核不同;或者也可以是两者的变换核组不同,而且所使用的变换核也不同。
还需要说明的是,在本申请实施例中,第一变换模式至少包括下述其中一项:多变换选择模式(MTS)、低频不可分离变换模式(LFNST)和不可分离基础变换模式(NSPT)。
示例性地,如果single tree的色度分量使用了跨分量预测模式,那么此时MTS/LFNST/NSPT可以应用于当前块的色度分量,但是色度分量所使用的第一变换核与亮度分量所使用的变换核不同。
还需要说明的是,在基于第一变换模式确定当前块的色度分量的第一变换核组时,不同的变换模式可以对应不同的变换核组,比如多变换选择模式可以确定MTS变换核组,低频不可分离变换模式可以确定LFNST变换核组,不可分离基础变换模式可以确定NSPT变换核组。其中,每一个变换核组可以包括至少一个候选变换核,在确定出色度分量的第一变换核组之后,可以从中确定当前块的色度分量所使用的第一变换核。
也就是说,在本申请实施例中,MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核或变换核组。其中,在一些技术中的LFNST/NSPT都会以帧内预测模式确定一个变换核组,实际上这个帧内预测模式代表了一种纹理特征,比如说某一个角度的纹理,LFNST/NSPT可以根据这个纹理特征匹配对应的变换核组,每个变换核组中有多个变换核可选,例如3个变换核可选。类似地,帧内MTS也是根据帧内预测模式匹配变换核。对帧间预测,它本身是没有帧内预测模式的,上述的内容中用帧间预测块导出一个虚拟的帧内预测模式,这个虚拟的预测模式也可以称为纹理特征索引,用它来匹配LFNST/NSPT的变换核组,进而根据该变换核组来确定当前块的第一变换核。
可以理解地,对一个色度分量和亮度分量使用相同预测方法预测的single tree的CU,它们的残差可能也符合相同的纹理特征,比如说某一个角度的纹理。但是对一个色度分量和亮度分量使用不同预测方法预测的single tree的CU,它们的残差可能就符合不同的纹理特征了。在这里,一种具体的示例是跨分量预测。跨分量预测是使用亮度分量的重建块预测色度分量,亮度分量的重建块已经包含了亮度分量的残差,因而色度分量的预测块中包含亮度分量的残差转变来的信息。如果亮度分量和色度分量符合不同的纹理特征,那么可以给它们使用不同的变换核或变换核组。另一种具体的示例是对LFNST/NSPT,亮度分量使用它的帧内预测模式或虚拟的帧内预测模式匹配一个变换核组,色度分量如果使用了跨分量预测,那么对色度使用DC或PLANAR对应的变换核组,或者使用一个对跨分量预测专门优化的变换核组,这里不作具体限定。
还需要说明的是,以上描述的这些内容都是针对纹理特征而言的,对常用的YUV4:2:0格式来说,同一个CU里面亮度分量的像素数是一个色度分量的像素数的4倍,也就是说亮度块和色度块的尺寸是不一样的。示例性地,亮度块是16×16,那么对应的色度块是8×8,那么变换核或变换核组也需要是对应尺寸的。
在一些实施例中,根据第一变换核组,确定第一变换核,可以包括:解码码流,确定第一语法标识信息的取值;在第一语法标识信息指示当前块使用第一变换模式时,确定当前块的变换核索引;根据第一变换核组和变换核索引,确定第一变换核。
需要说明的是,在本申请实施例中,第一语法标识信息用于指示当前块是否使用第一变换模式,如当前块是否使用MTS/LFNST/NSPT。如果第一语法标识信息的取值等于第一值,那么可以确定当前块不使用MTS/LFNST/NSPT;如果第一语法标识信息的取值等于第二值,那么可以确定当前块使用MTS/LFNST/NSPT。其中,第一值可以设置为0,第二值可以设置为非0,例如1、2、3等。也就是说,在当前块使用第一变换模式时,第一语法标识信息还用于指示对应使用的哪种变换核。
还需要说明的是,在本申请实施例中,对于第一语法标识信息,也可以使用另外两个语法标识信息来替代。其中,一个语法标识信息用于指示当前块是否使用MTS/LFNST/NSPT,另一个语法标识信息用于指示在当前块使用MTS/LFNST/NSPT时对应的变换核索引。也就是说,在确定当前块的变换核索引时,可以是解码码流确定当前块的变换核索引。这样,在码流中需要传输两个语法元素,导致码流开销大。在这种情况下,针对码流中需要传输变换核索引的情况,如果所确定的第一变换核组中只有一个变换核,那么这时候也不需要传输变换核索引。具体地,在当前块使用MTS/LFNST/NSPT时,可以将第一变换核组中的唯一一个变换核直接作为当前块使用的第一变换核。
还需要说明的是,在本申请实施例中,对于第一语法标识信息,这里还可以使用另外三个语法标识信息来替代。其中,一个语法标识信息用于指示当前块是否使用NSPT以及对应使用的哪一个NSPT变换核,另一个语法标识信息用于指示当前块是否使用LFNST以及对应使用的哪一个LFNST变换核,又一个语法标识信息用于指示当前块是否使用MTS以及对应使用的哪一个MTS变换核;这里实质上是一样的,在此不作具体限定。
S3903:确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
需要说明的是,在本申请实施例中,可以是通过解码码流,确定当前块的色度分量的量化系数,然后对当前块的色度分量的量化系数进行反量化,确定当前块的色度分量的变换系数。
还需要说明的是,在本申请实施例中,该方法还包括:在模式参数不满足第一条件时,确定当前块 的色度分量的第二变换核;确定当前块的色度分量的变换系数,并根据第二变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
也就是说,在本申请实施例中,如果模式参数满足第一条件,此时可以确定当前块的色度分量的第一变换核,然后根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。如果模式参数不满足第一条件,此时可以确定当前块的色度分量的第二变换核,然后根据第二变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
在本申请实施例中,模式参数不满足第一条件,可以包括:当前块的划分类型为双树划分或者当前块的色度分量的预测模式为非跨分量预测模式。这时候,如果当前块为双树划分或者当前块的色度分量不使用跨分量预测模式,那么可以直接使用MTS/LFNST/NSPT。
在一些实施例中,确定当前块的色度分量的第二变换核,可以包括:基于第一变换模式,确定当前块的色度分量的第二变换核组;根据第二变换核组,确定第二变换核;其中,第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
需要说明的是,在本申请实施例中,根据第二变换核组,确定第二变换核,具体可以包括:解码码流,确定第一语法标识信息的取值;在第一语法标识信息指示当前块使用第一变换模式时,那么可以根据第二变换核组和第一语法标识信息的取值来确定第二变换核。
需要说明的是,在本申请实施例中,如果当前块使用多变换选择模式,那么可以根据当前块的帧内预测模式或者虚拟的帧内预测模式或者纹理特征索引来确定当前块的MTS变换核组,然后从中确定所使用的第二变换核。如果当前块使用低频不可分离变换模式,那么可以根据当前块的帧内预测模式或者虚拟的帧内预测模式或者纹理特征索引来确定当前块的LFNST变换核组,然后从中确定所使用的第二变换核。如果当前块使用不可分离基础变换模式,那么可以根据当前块的帧内预测模式或者虚拟的帧内预测模式或者纹理特征索引来确定当前块的NSPT变换核组,然后从中确定所使用的第二变换核。
还需要说明的是,在本申请实施例中,对于第一语法标识信息,如果使用两个语法标识信息来替代时,一个语法标识信息用于指示当前块是否使用MTS/LFNST/NSPT,另一个语法标识信息用于指示在当前块使用MTS/LFNST/NSPT时对应的变换核索引,那么在确定当前块的第二变换核时,也可以通过解码码流来确定当前块的第二变换核索引,然后根据第二变换核组和第二变换核索引确定第二变换核。这样,在码流中需要传输两个语法元素,导致码流开销大。在这种情况下,针对码流中需要传输变换核索引的情况,如果所确定的第二变换核组中只有一个变换核,那么也不需要传输变换核索引。具体地,在当前块使用MTS/LFNST/NSPT时,可以将第二变换核组中的唯一一个变换核直接作为第二变换核。
在一种可能的实现方式中,在模式参数满足第一条件时,根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块,可以包括:在第一语法标识信息指示当前块的色度分量使用NSPT时,根据第一变换核对当前块的色度分量的变换系数进行不可分离基础变换的反变换,确定当前块的色度分量的残差块;或者,在第一语法标识信息指示当前块的色度分量使用LFNST时,根据第一变换核对当前块的色度分量的变换系数进行低频不可分离变换的反变换,确定当前块的色度分量的变换块;以及对色度分量的变换块进行离散余弦变换的反变换,确定当前块的色度分量的残差块;或者,在第一语法标识信息指示当前块的色度分量使用MTS时,根据第一变换核对当前块的色度分量的变换系数进行多变换选择的反变换,确定当前块的色度分量的残差块。
在另一种可能的实现方式中,在模式参数不满足第一条件时,根据第二变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块,可以包括:在第一语法标识信息指示当前块的色度分量使用NSPT时,根据第二变换核对当前块的色度分量的变换系数进行不可分离基础变换的反变换,确定当前块的色度分量的残差块;或者,在第一语法标识信息指示当前块的色度分量使用LFNST时,根据第二变换核对当前块的色度分量的变换系数进行低频不可分离变换的反变换,确定当前块的色度分量的变换块;以及对色度分量的变换块进行离散余弦变换的反变换,确定当前块的色度分量的残差块;或者,在第一语法标识信息指示当前块的色度分量使用MTS时,根据第二变换核对当前块的色度分量的变换系数进行多变换选择的反变换,确定当前块的色度分量的残差块。
也就是说,在本申请实施例中,如果单树划分的CU中色度分量使用了跨分量预测模式,那么MTS/LFNST/NSPT不用于这种CU的色度分量。如果单树划分的CU中色度分量使用了跨分量预测模式,那么MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核或变换核组。
还需要说明的是,在本申请实施例中,解码端对变换系数的“反变换”,在标准文本中也可称为“变换”。本文中的“变换”和“反变换”对应的是两个相反的过程,如“变换”将空间域的数值转换到频率域的系数,那么“反变换”将频率域的系数转换到空间域的数值。“反”是相对于“正”而言,它们实质上都是变换。需要注意的是,标准如果只规定解码,那么标准文本中的“变换”是解码的部分,具体指的是本文中的“反变换”。
在一些实施例中,参见图40,在步骤S3903之后,该方法还可以包括:
S4001:对当前块的色度分量进行预测,确定当前块的色度分量的预测块。
S4002:根据当前块的色度分量的预测块和当前块的色度分量的残差块,确定当前块的色度分量的重建块。
需要说明的是,在本申请实施例中,对于步骤S4001来说,该步骤可以是与步骤S3901~S3902并行操作,也可以是在步骤S3901~3902之前执行,这里对步骤的先后顺序并不作具体限定。
还需要说明的是,在本申请实施例中,可以是对当前块的色度分量进行帧内预测,确定当前块的色度分量的预测块;或者,也可以是对当前块的色度分量进行帧间预测,确定当前块的色度分量的预测块。也就是说,将MTS/LFNST/NSPT用于单树划分的色度分量。可选地,可以用于帧内的单树划分和/或帧间的单树划分。
还需要说明的是,在本申请实施例中,在确定当前块的色度分量的预测块之后,可以对当前块的色度分量的预测块和当前块的色度分量的残差块进行加法运算,从而确定出当前块的色度分量的重建块。
在本申请实施例中,确定当前块的色度分量的变换系数,可以包括:解码码流,确定当前块的色度分量的量化系数;对当前块的色度分量的量化系数进行反量化,确定当前块的色度分量的变换系数。
在本申请实施例中,确定当前块的亮度分量的变换系数,可以包括:解码码流,确定当前块的亮度分量的量化系数;对当前块的亮度分量的量化系数进行反量化,确定当前块的亮度分量的变换系数。
还需要说明的是,在本申请实施例中,当前块的变换系数可以包括当前块的色度分量的变换系数和当前块的亮度分量的变换系数。对于第一语法标识信息来说,还可以是在当前块的最后一个非零系数位置符合一定条件下才进行解析的。参见图41,该方法可以包括:
S4101:解码码流,确定当前块的量化系数。
S4101:对当前块的量化系数进行反量化,确定当前块的变换系数。
S4103:在当前块的变换系数中的最后一个非零系数位置满足预设条件时,解码码流,确定当前块的第一语法标识信息的取值。
需要说明的是,在本申请实施例中,对于步骤S4103来说,解码码流,确定当前块的第一语法标识信息的取值,可以包括:根据至少一个上下文模型解码码流,确定第一语法标识信息的二元符号串;以及对第一语法标识信息的二元符号串进行反二值化处理,确定第一语法标识信息的取值。
还需要说明的是,在本申请实施例中,在第一语法标识信息指示当前块使用第一变换模式时,确定当前块使用的第一变换模式的变换核,并根据第一变换模式的变换核对当前块的变换系数进行反变换,确定当前块的残差块。在第一语法标识信息指示当前块不使用第一变换模式时,确定当前块使用的第二变换模式的变换核,并根据第二变换模式的变换核对当前块的变换系数进行反变换,确定当前块的残差块。示例性地,第一变换模式可以为MTS/LFNST/NSPT,第二变换模式可以为其他变换模式(或者直接使用默认的变换核),这里不作具体限定。
还需要说明的是,在本申请实施例中,第一语法标识信息可以用lfnst_nspt_idx表示。在相关技术中,lfnst_nspt_idx是在符合一定条件下才会解析的。其中一个条件是,最后一个非零系数位置为大于或等于1。量化系数的扫描是按分层对角线扫描方式(hierarchical diagonal scan)进行的。一个系数块可以分成4×4的子块,4×4的子块之间是按对角线扫描方式(diagonal scan)进行扫描的,4×4的子块内部也是按照diagonal scan进行扫描的。当前块左上角(0,0)的位置是扫描顺序的0,最后一个非零系数位置为大于或等于1,也就意味着当前块有(0,0)以外的系数。对DCT2变换来说,(0,0)就是DC系数。也就是说,如果当前块的系数只有(0,0)位置有非零系数或者没有非零系数,那么lfnst_nspt_idx这个语法元素不需要解析,默认为0。因为在这种情况下LFNST/NSPT能使用到的可能性很小,而通过这个限制可以明显减少lfnst_nspt_idx的不必要的开销。而且相关技术要求所有颜色分量的最后一个非零系数位置需要大于或等于1。比如说YUV格式下单树划分的块,Y、U、V三个颜色分量的最后一个非零系数位置都需要大于或等于1。
这样,针对帧间预测的块来说,本来残差就比帧内预测的块少,又考虑到一般色度分量的质量要求比亮度分量低得多,在帧间预测的块中会出现较多的亮度分量有一定系数而色度分量没有系数的情况。由于LFNST/NSPT的这个条件是为帧内预测设计的,而目前帧间预测也可以使用LFNST/NSPT,但它们的系数、残差规律并不相同,因而本申请实施例可以对这个限制条件进行修改。
在一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度分量的最后一个非零系数位置大于或等于第一阈值。
在另一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包 括:在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置大于或等于第一阈值。
需要说明的是,在本申请实施例中,第一阈值也可以称为最小阈值。其中,最一阈值可以设置为1,或者也可以更大的值,如2,3等,这里不作具体限定。
还需要说明的是,本申请实施例对于最后一个非零系数位置等于第一阈值的情况不作限定。也就是说,当前块的变换系数中的最后一个非零系数位置满足预设条件,也可以包括:在当前块的预测模式为帧内预测模式或双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于第一阈值;或者,在当前块的预测模式为帧间预测模式或单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置大于第一阈值。
示例性地,假定最小阈值等于1,那么对帧内预测的块,仍然使用相关技术。即所有颜色分量的最后一个非零系数位置需要大于或等于1的情况下才解析lfnst_nspt_idx;对帧间预测的块,在Y分量的最后一个非零系数位置大于或等于1的情况下才解析lfnst_nspt_idx,不再要求U、V分量。或者,对双树划分的块,在它所有颜色分量的最后一个非零系数位置大于或等于1的情况下才解析lfnst_nspt_idx;对单树划分的块,在Y分量的最后一个非零系数位置大于或等于1的情况下才解析lfnst_nspt_idx,不再要求U、V分量。
还可以理解地,在相关技术中,lfnst_nspt_idx是在符合一定条件下才会解析的。其中一个条件是,最后一个非零系数位置不能大于一个阈值,这个阈值是LFNST或NSPT最大可能的系数个数减一,这里可称之为最大阈值,最大阈值可以根据当前块的尺寸参数,即长度和宽度确定。示例性地,编码端LFNST对4×4的块进行二次变换时,LFNST的输入是4x4的DCT2变换后的系数,输出是8个系数,也就是对4×4的块LFNST输出最多可能只有8个系数,那么对解码器来说,如果一个4×4的块的最后一个非零系数位置超过7,即(8-1),那么它肯定不是LFNST输出的,这样解码器就可以知道当前块肯定没有使用LFNST,也就不需要再解析它的语法元素。通过这个限制可以明显减少lfnst_nspt_idx的不必要的开销。而且相关技术要求所有颜色分量的最后一个非零系数位置不能大于其最大阈值。比如说YUV格式下单树划分的块,Y、U、V三个颜色分量的最后一个非零系数位置都不能大于其最大阈值。
这样,考虑到LFNST/NSPT的这个条件是为帧内预测设计的,而目前帧间预测也可以使用LFNST/NSPT,但它们的系数、残差规律并不相同,因而可以对这个限制条件进行修改。
在又一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度分量的最后一个非零系数位置小于或等于第二阈值。
在又一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置小于或等于第二阈值。
需要说明的是,在本申请实施例中,第二阈值也可以称为最大阈值。一种具体的实施例中,可以根据当前块的尺寸参数,确定第二阈值。例如,最二阈值可以根据当前块的长度和宽度确定。另一种具体的实施例中,可以将第二阈值设置为当前块的变换系数中系数个数最大值与一的差值。例如,如果当前块LFNST输出最多可能只有8个系数,那么最二阈值可以设置为7。
还需要说明的是,本申请实施例对于最后一个非零系数位置等于第二阈值的情况也不作限定。也就是说,当前块的变换系数中的最后一个非零系数位置满足预设条件,还可以包括:在当前块的预测模式为帧内预测模式或双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于第二阈值;或者,在当前块的预测模式为帧间预测模式或单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置小于第二阈值。
示例性地,对帧内预测的块,仍然使用相关技术。即所有颜色分量的最后一个非零系数位置都不大于其最大阈值的情况下才解析lfnst_nspt_idx;对帧间预测的块,在Y分量的最后一个非零系数位置不大于其最大阈值的情况下才解析lfnst_nspt_idx,不再要求U、V分量。或者,对双树划分的块,在它所有分量的最后一个非零系数位置不大于最大阈值的情况下才解析lfnst_nspt_idx;对单树划分的块,在Y分量的最后一个非零系数位置不大于其最大阈值的情况下才解析lfnst_nspt_idx,不再要求U、V分量。
也就是说,在本申请实施例中,可以分情况在Y分量的最后一个非零系数位置大于或等于最小阈值的情况下才解析lfnst_nspt_idx,不再要求U、V分量。或者,也可以分情况在Y分量的最后一个非零系数位置不大于最大阈值的情况下才解析lfnst_nspt_idx,不再要求U、V分量。
本实施例提供了一种解码方法,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。这样,首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,而且还可以提升编解码性能。
在本申请的另一实施例中,参见图42,其示出了本申请实施例提供的一种编码方法的流程示意图。如图42所示,该方法可以包括:
S4201:确定当前块的色度分量的模式参数。
需要说明的是,在本申请实施例中,该方法应用于编码器。具体来说,基于图37所示编码器100的组成结构,本申请实施例的编码方法可以应用于帧内预测模式和/或帧间预测模式,这里主要是针对单树划分的色度分量所提出的MTS/LFNST/NSPT变换的优化方案,以提高压缩效率。
还需要说明的是,在本申请实施例中,当前块的预测模式可以包括:帧间预测模式和/或帧内预测模式。其中,帧内预测模式主要是根据当前块周边的已重建区域来预测当前块,帧间预测模式主要是根据当前块的参考图像来预测当前块。
还需要说明的是,在本申请实施例中,当前块的划分类型可以包括单树(single tree)划分和双树(dual tree)划分。其中,single tree中亮度分量和色度分量一起划分,此时一个CU包含亮度块和相同位置的色度块;dual tree中亮度和色度单独划分,此时一个CU只有亮度块或只有色度块。需要注意的是,当前块的亮度分量的块可以称为“亮度块”,当前块的色度分量的块可以称为“色度块”。
还需要说明的是,虽然在标准化阶段,LFNST原本可以用在single tree的色度分量,但是为了降低硬件的复杂度,LFNST不在色度分量上使用的效果更好,比如LFNST不在色度分量上使用相比于可以在色度分量上使用会使得流水线变短。基于此,在本申请实施例中,针对single tree的色度分量的使用添加了如下的限制条件。
S4202:在模式参数满足第一条件时,确定当前块的色度分量的第一变换核。
需要说明的是,在本申请实施例中,限制条件即为模式参数满足第一条件,这里可以包括:当前块的划分类型为单树划分且当前块的色度分量的预测模式为跨分量预测模式。其中,跨分量预测模式可以包括CCLM、CCCM、inter-CCCM等。
在本申请实施例中,如果当前块在单树划分下的色度分量使用跨分量预测模式,那么一种可能的实现方式是MTS/LFNST/NSPT不应用于当前块的色度分量。在这种情况下,可以将预设变换核确定为当前块的色度分量的第一变换核。其中,预设变换核即为默认的变换核。
示例性地,如果single tree的色度分量使用了跨分量预测模式,那么此时MTS/LFNST/NSPT不应用于当前块的色度分量,而是使用默认的变换核,如水平、竖直方向分别使用可分离的DCT2。
在本申请实施例中,如果当前块在单树划分下的色度分量使用跨分量预测模式,那么另一种可能的实现方式是MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核组。在这种情况下,可以基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组不同;根据第一变换核组,确定第一变换核。
需要说明的是,在本申请实施例中,第一变换模式至少包括下述其中一项:多变换选择模式(MTS)、低频不可分离变换模式(LFNST)和不可分离基础变换模式(NSPT)。
示例性地,如果single tree的色度分量使用了跨分量预测模式,那么此时MTS/LFNST/NSPT可以应用于当前块的色度分量,但是色度分量所使用的第一变换核组与亮度分量所使用的变换核组不同。
在本申请实施例中,如果当前块在单树划分下的色度分量使用跨分量预测模式,那么又一种可能的实现方式是MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核。在这种情况下,可以基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组相同;根据第一变换核组,确定第一变换核;其中,第一变换核与当前块的亮度分量的变换核不同。
需要说明的是,在本申请实施例中,MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核。其中,这里可以是两者的变换核组相同,但是使用的变换核不同;或者也可以是两者的变换核组不同,而且所使用的变换核也不同。
还需要说明的是,在本申请实施例中,第一变换模式至少包括下述其中一项:多变换选择模式(MTS)、低频不可分离变换模式(LFNST)和不可分离基础变换模式(NSPT)。
示例性地,如果single tree的色度分量使用了跨分量预测模式,那么此时MTS/LFNST/NSPT可以 应用于当前块的色度分量,但是色度分量所使用的第一变换核与亮度分量所使用的变换核不同。
还需要说明的是,在基于第一变换模式确定当前块的色度分量的第一变换核组时,不同的变换模式可以对应不同的变换核组,比如多变换选择模式可以确定MTS变换核组,低频不可分离变换模式可以确定LFNST变换核组,不可分离基础变换模式可以确定NSPT变换核组。其中,每一个变换核组可以包括至少一个候选变换核,在确定出色度分量的第一变换核组之后,可以从中确定当前块的色度分量所使用的第一变换核。
也就是说,在本申请实施例中,MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核或变换核组。其中,在一些技术中的LFNST/NSPT都会以帧内预测模式确定一个变换核组,实际上这个帧内预测模式代表了一种纹理特征,比如说某一个角度的纹理,LFNST/NSPT可以根据这个纹理特征匹配对应的变换核组,每个变换核组中有多个变换核可选,例如3个变换核可选。类似地,帧内MTS也是根据帧内预测模式匹配变换核。对帧间预测,它本身是没有帧内预测模式的,上述的内容中用帧间预测块导出一个虚拟的帧内预测模式,这个虚拟的预测模式也可以称为纹理特征索引,用它来匹配LFNST/NSPT的变换核组,进而根据该变换核组来确定当前块的第一变换核。
可以理解地,对一个色度分量和亮度分量使用相同预测方法预测的single tree的CU,它们的残差可能也符合相同的纹理特征,比如说某一个角度的纹理。但是对一个色度分量和亮度分量使用不同预测方法预测的single tree的CU,它们的残差可能就符合不同的纹理特征了。在这里,一种具体的示例是跨分量预测。跨分量预测是使用亮度分量的重建块预测色度分量,亮度分量的重建块已经包含了亮度分量的残差,因而色度分量的预测块中包含亮度分量的残差转变来的信息。如果亮度分量和色度分量符合不同的纹理特征,那么可以给它们使用不同的变换核或变换核组。另一种具体的示例是对LFNST/NSPT,亮度分量使用它的帧内预测模式或虚拟的帧内预测模式匹配一个变换核组,色度分量如果使用了跨分量预测,那么对色度使用DC或PLANAR对应的变换核组,或者使用一个对跨分量预测专门优化的变换核组,这里不作具体限定。
还需要说明的是,以上描述的这些内容都是针对纹理特征而言的,对常用的YUV4:2:0格式来说,同一个CU里面亮度分量的像素数是一个色度分量的像素数的4倍,也就是说亮度块和色度块的尺寸是不一样的。示例性地,亮度块是16×16,那么对应的色度块是8×8,那么变换核或变换核组也需要是对应尺寸的。
在一些实施例中,根据第一变换核组,确定第一变换核,可以包括:对第一变换核组中的至少一个候选变换核分别进行代价值计算,确定至少一个候选变换核各自的代价值;从至少一个候选变换核各自的代价值中确定最小代价值,将最小代价值对应的候选变换核作为第一变换核。
在一种可能的实现方式中,对第一变换核组中的至少一个候选变换核分别进行代价值计算,这里以第一候选变换核为例,该方法可以包括:基于第一候选变换核对当前块的色度分量的残差块进行变换与量化,确定当前块的色度分量的第一候选量化系数,并对第一候选量化系数进行熵编码处理,确定第一候选变换核的第一代价值;对第一候选量化系数进行反量化与反变换,确定当前块的色度分量的第一候选残差块,并根据第一候选残差块确定当前块的色度分量的第一候选预测块;根据第一候选预测块与当前块的色度分量的原始块进行代价计算,确定第一候选变换核的第二代价值;根据第一候选变换核的第一代价值和第二代价值,确定第一候选变换核的代价值。
需要说明的是,在本申请实施例中,第一候选变换核为至少一个候选变换核中的任意一个,如此可以确定这至少一个候选变换核各自的代价值。
还需要说明的是,在本申请实施例中,第一代价值可以表征第一候选变换核在码流中开销的代价,第二代价值表征第一候选变换核的失真的代价。在这里,根据第一候选变换核的第一代价值和第二代价值,确定第一候选变换核的代价值,可以包括:对第一候选变换核的第一代价值和第二代价值进行求和运算,将两者的和值作为第一候选变换核的代价值。
还需要说明的是,在本申请实施例中,这里的代价值计算,可以根据率失真优化(Rate Distortion Optimization,RDO)的代价结果进行确定,也可以根据绝对误差和(Sum of Absolute Difference,SAD)的代价结果进行确定,甚至也可以根据绝对变换差和(Sum of Absolute Transformed Difference,SATD)的代价结果进行确定,但不作具体限定。
还需要说明的是,在本申请实施例中,第一变换核组可以包括1个、2个、3个或者更多个候选变换核。如果第一变换核组仅包括1个候选变换核,那么可以直接将这1个候选变换核作为当前块的色度分量的第一变换核,无需进行代价值计算。
在一些实施例中,该方法还包括:确定第一语法标识信息的取值;其中,第一语法标识信息用于指示当前块是否使用第一变换模式以及对应使用的变换核索引;对第一语法标识信息的取值进行编码处理,将所得到的编码比特写入码流。
需要说明的是,在本申请实施例中,第一语法标识信息可以用于指示当前块是否使用第一变换模式,而且在当前块使用第一变换模式时,第一语法标识信息的取值还可以用于指示当前块使用的变换核索引。
还需要说明的是,在本申请实施例中,确定第一语法标识信息的取值,可以包括:在当前块不使用第一变换模式时,确定第一语法标识信息的取值为第一值;在当前块使用第一变换模式时,确定第一语法标识信息的取值为第二值;其中,第二值的取值与第一变换核的变换核索引具有关联关系。
在这里,第一值与第二值不同。在一种具体的实施例中,第一值可以设置为0,第二值可以设置为非0,例如1、2、3等。也就是说,在当前块使用第一变换模式时,第一语法标识信息还用于指示对应使用的哪种变换核。
还需要说明的是,在本申请实施例中,这里的变换核索引用于指示当前块的第一变换核在第一变换核组的编号。示例性地,如果当前块不使用第一变换模式,那么可以确定第一语法标识信息的取值为0;如果当前块使用第一变换模式,而且第一变换核为第一变换核组的第一个变换核(即变换核索引为0),那么可以确定第一语法标识信息的取值为1;如果当前块使用第一变换模式,而且第一变换核为第一变换核组的第二个变换核(即变换核索引为1),那么可以确定第一语法标识信息的取值为2;如果当前块使用第一变换模式,而且第一变换核为第一变换核组的第三个变换核(即变换核索引为2),那么可以确定第一语法标识信息的取值为3。
还需要说明的是,在本申请实施例中,对于第一语法标识信息,也可以使用另外两个语法标识信息来替代。其中,一个语法标识信息用于指示当前块是否使用MTS/LFNST/NSPT,另一个语法标识信息用于指示在当前块使用MTS/LFNST/NSPT时对应的变换核索引。也就是说,在确定当前块对应的第一变换核的变换核索引之后,还可以对该变换核索引进行编码处理,将所得到的编码比特写入码流。
这样,在码流中需要传输两个语法元素,导致码流开销大。在这种情况下,针对码流中需要传输变换核索引的情况,如果所确定的第一变换核组中只有一个变换核,那么这时候也不需要传输变换核索引。具体地,在当前块使用MTS/LFNST/NSPT时,可以将第一变换核组中的唯一一个变换核直接作为当前块使用的第一变换核。
还需要说明的是,在本申请实施例中,对于第一语法标识信息,这里还可以使用另外三个语法标识信息来替代。其中,一个语法标识信息用于指示当前块是否使用NSPT以及对应使用的哪一个NSPT变换核,另一个语法标识信息用于指示当前块是否使用LFNST以及对应使用的哪一个LFNST变换核,又一个语法标识信息用于指示当前块是否使用MTS以及对应使用的哪一个MTS变换核;这里实质上是一样的,在此不作具体限定。
S4203:确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数。
S4204:对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
需要说明的是,在本申请实施例中,确定当前块的色度分量的残差块,可以包括:确定当前块的色度分量的预测块;根据当前块的色度分量的原始块和所述当前块的色度分量的预测块,确定所述当前块的色度分量的残差块。
在本申请实施例中,可以是对当前块的色度分量进行帧内预测,确定当前块的色度分量的预测块;或者,也可以是对当前块的色度分量进行帧间预测,确定当前块的色度分量的预测块。也就是说,将MTS/LFNST/NSPT用于单树划分的色度分量。可选地,可以用于帧内的单树划分和/或帧间的单树划分。
还需要说明的是,在本申请实施例中,在确定当前块的色度分量的预测块之后,可以对当前块的色度分量的原始块和当前块的色度分量的预测块进行减法运算,从而确定出当前块的色度分量的残差块。
在一些实施例中,该方法还包括:在模式参数不满足第一条件时,确定当前块的色度分量的第二变换核;以及确定当前块的色度分量的残差块,并根据第二变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
也就是说,在本申请实施例中,如果模式参数满足第一条件,此时可以确定当前块的色度分量的第一变换核,然后根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数。如果模式参数不满足第一条件,此时可以确定当前块的色度分量的第二变换核,然后根据第二变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数,最终对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
在本申请实施例中,模式参数不满足第一条件,可以包括:当前块的划分类型为双树划分或者当前块的色度分量的预测模式为非跨分量预测模式。这时候,如果当前块为双树划分或者当前块的色度分量不使用跨分量预测模式,那么可以直接使用MTS/LFNST/NSPT。
在一些实施例中,确定当前块的色度分量的第二变换核,可以包括:基于第一变换模式,确定当前 块的色度分量的第二变换核组;根据第二变换核组,确定第二变换核;其中,第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
需要说明的是,在本申请实施例中,根据第二变换核组,确定第二变换核,具体可以包括:对第二变换核组中的至少一个候选变换核分别进行代价值计算,确定至少一个候选变换核各自的代价值;从至少一个候选变换核各自的代价值中确定最小代价值,将最小代价值对应的候选变换核作为第二变换核。
还需要说明的是,在本申请实施例中,这里的代价值计算,可以根据RDO的代价结果进行确定,也可以根据SAD的代价结果进行确定,甚至也可以根据SATD的代价结果进行确定,但不作具体限定。
还需要说明的是,在本申请实施例中,第二变换核组可以包括1个、2个、3个或者更多个候选变换核。如果第二变换核组仅包括1个候选变换核,那么可以直接将这1个候选变换核作为当前块的第二变换核,无需进行代价值计算。
可以理解地,在本申请实施例中,如果当前块使用多变换选择模式,那么可以根据当前块的帧内预测模式或者虚拟的帧内预测模式或者纹理特征索引来确定当前块的MTS变换核组,然后从中确定所使用的第二变换核。如果当前块使用低频不可分离变换模式,那么可以根据当前块的帧内预测模式或者虚拟的帧内预测模式或者纹理特征索引来确定当前块的LFNST变换核组,然后从中确定所使用的第二变换核。如果当前块使用不可分离基础变换模式,那么可以根据当前块的帧内预测模式或者虚拟的帧内预测模式或者纹理特征索引来确定当前块的NSPT变换核组,然后从中确定所使用的第二变换核。
还需要说明的是,在本申请实施例中,对于第一语法标识信息,如果使用两个语法标识信息来替代时,一个语法标识信息用于指示当前块是否使用MTS/LFNST/NSPT,另一个语法标识信息用于指示在当前块使用MTS/LFNST/NSPT时对应的变换核索引,那么在确定当前块的第二变换核时,也可以通过解码码流来确定当前块的第二变换核索引,然后根据第二变换核组和第二变换核索引确定第二变换核。但是由于码流中需要传输两个语法元素,导致码流开销大。在这种情况下,针对码流中需要传输变换核索引的情况,如果所确定的第二变换核组中只有一个变换核,那么也不需要传输变换核索引。具体地,在当前块使用MTS/LFNST/NSPT时,可以将第二变换核组中的唯一一个变换核直接作为第二变换核。
在一种可能的实现方式中,在模式参数满足第一条件时,根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数,可以包括:在第一语法标识信息指示当前块的色度分量使用NSPT时,根据第一变换核对当前块的色度分量的残差块进行不可分离基础变换,确定当前块的色度分量的变换系数;或者,在第一语法标识信息指示当前块的色度分量使用LFNST时,根据第一变换核对当前块的色度分量的残差块进行低频不可分离变换,确定当前块的色度分量的变换块;以及对色度分量的变换块进行离散余弦变换,确定当前块的色度分量的变换系数;或者,在第一语法标识信息指示当前块的色度分量使用MTS时,根据第一变换核对当前块的色度分量的残差块进行多变换选择变换,确定当前块的色度分量的变换系数。
在另一种可能的实现方式中,在模式参数不满足第一条件时,根据第二变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数,可以包括:在第一语法标识信息指示当前块的色度分量使用NSPT时,根据第二变换核对当前块的色度分量的残差块进行不可分离基础变换,确定当前块的色度分量的变换系数;或者,在第一语法标识信息指示当前块的色度分量使用LFNST时,根据第二变换核对当前块的色度分量的残差块进行低频不可分离变换,确定当前块的色度分量的变换块;以及对色度分量的变换块进行离散余弦变换,确定当前块的色度分量的变换系数;或者,在第一语法标识信息指示当前块的色度分量使用MTS时,根据第二变换核对当前块的色度分量的残差块进行多变换选择变换,确定当前块的色度分量的变换系数。
也就是说,在本申请实施例中,如果单树划分的CU中色度分量使用了跨分量预测模式,那么MTS/LFNST/NSPT不用于这种CU的色度分量。如果单树划分的CU中色度分量使用了跨分量预测模式,那么MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核或变换核组。
还需要说明的是,在本申请实施例中,编码端对残差块的“变换”,也可称为“正变换”,具体是指从空间域到频率域的变换,以去除残差的相关性。需要注意的是,标准如果只规定解码,那么标准文本中的“变换”是解码的部分,具体指的是本文中的“反变换”。
进一步地,在一些实施例中,参见图43,该方法还可以包括:
S4301:确定当前块的变换系数。
S4301:对当前块的变换系数进行量化,确定当前块的量化系数。
S4303:对当前块的量化系数进行编码处理,将所得到的编码比特写入码流。
在本申请实施例中,当前块的变换系数可以包括当前块的色度分量的变换系数和当前块的亮度分量的变换系数。在一种具体的实施例中,对于当前块的色度分量的变换系数来说,该方法还包括:对当前块的色度分量的变换系数进行量化,确定当前块的色度分量的量化系数;对所述当前块的色度分量的量 化系数进行编码处理,将所得到的编码比特写入码流。在另一种具体的实施例中,对于当前块的亮度分量的变换系数来说,该方法还包括:对当前块的亮度分量的变换系数进行量化,确定当前块的亮度分量的量化系数;对所述当前块的亮度分量的量化系数进行编码处理,将所得到的编码比特写入码流。
还可以理解地,在本申请实施例中,对于第一语法标识信息来说,还可以是在当前块的最后一个非零系数位置符合一定条件下才进行编码入码流的。在一些实施例中,参见图44,该方法还可以包括:
S4401:确定当前块的变换系数。
S4402:在当前块的变换系数中的最后一个非零系数位置满足预设条件时,对第一语法标识信息的取值进行编码处理,将所得到的编码比特写入码流。
需要说明的是,在本申请实施例中,对第一语法标识信息的取值进行编码处理,可以包括:对第一语法标识信息的取值进行二值化处理,确定当前块的二元符号串;以及根据至少一个上下文模型对二元符号串中的至少一个二元符号进行编码处理,并将所得到的编码比特写入码流。
还需要说明的是,在本申请实施例中,第一语法标识信息可以用lfnst_nspt_idx表示。在相关技术中,lfnst_nspt_idx是在符合一定条件下才会编码的。其中一个条件是,最后一个非零系数位置为大于或等于1。量化系数的扫描是按分层对角线扫描方式(hierarchical diagonal scan)进行的。一个系数块可以分成4×4的子块,4×4的子块之间是按对角线扫描方式(diagonal scan)进行扫描的,4×4的子块内部也是按照diagonal scan进行扫描的。当前块左上角(0,0)的位置是扫描顺序的0,最后一个非零系数位置为大于或等于1,也就意味着当前块有(0,0)以外的系数。对DCT2变换来说,(0,0)就是DC系数。也就是说,如果当前块的系数只有(0,0)位置有非零系数或者没有非零系数,那么lfnst_nspt_idx这个语法元素不需要编码,默认为0。因为在这种情况下LFNST/NSPT能使用到的可能性很小,而通过这个限制可以明显减少lfnst_nspt_idx的不必要的开销。而且相关技术要求所有颜色分量的最后一个非零系数位置需要大于或等于1。比如说YUV格式下单树划分的块,Y、U、V三个颜色分量的最后一个非零系数位置都需要大于或等于1。
这样,针对帧间预测的块来说,本来残差就比帧内预测的块少,又考虑到一般色度分量的质量要求比亮度分量低得多,在帧间预测的块中会出现较多的亮度分量有一定系数而色度分量没有系数的情况。由于LFNST/NSPT的这个条件是为帧内预测设计的,而目前帧间预测也可以使用LFNST/NSPT,但它们的系数、残差规律并不相同,因而本申请实施例可以对这个限制条件进行修改。
在一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度分量的最后一个非零系数位置大于或等于第一阈值。
在另一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置大于或等于第一阈值。
需要说明的是,在本申请实施例中,第一阈值也可以称为最小阈值。其中,最一阈值可以设置为1,或者也可以更大的值,如2,3等,这里不作具体限定。
还需要说明的是,本申请实施例对于最后一个非零系数位置等于第一阈值的情况不作限定。也就是说,当前块的变换系数中的最后一个非零系数位置满足预设条件,也可以包括:在当前块的预测模式为帧内预测模式或双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于第一阈值;或者,在当前块的预测模式为帧间预测模式或单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置大于第一阈值。
示例性地,假定最小阈值等于1,那么对帧内预测的块,仍然使用相关技术。即所有颜色分量的最后一个非零系数位置需要大于或等于1的情况下才编码lfnst_nspt_idx;对帧间预测的块,在Y分量的最后一个非零系数位置大于或等于1的情况下才编码lfnst_nspt_idx,不再要求U、V分量。或者,对双树划分的块,在它所有颜色分量的最后一个非零系数位置大于或等于1的情况下才编码lfnst_nspt_idx;对单树划分的块,在Y分量的最后一个非零系数位置大于或等于1的情况下才编码lfnst_nspt_idx,不再要求U、V分量。
还可以理解地,在相关技术中,lfnst_nspt_idx是在符合一定条件下才会编码的。其中一个条件是,最后一个非零系数位置不能大于一个阈值,这个阈值是LFNST或NSPT最大可能的系数个数减一,这里可称之为最大阈值,最大阈值可以根据当前块的尺寸参数,即长度和宽度确定。示例性地,编码端LFNST对4×4的块进行二次变换时,LFNST的输入是4x4的DCT2变换后的系数,输出是8个系数,也就是对4×4的块LFNST输出最多可能只有8个系数,那么对解码器来说,如果一个4×4的块的最后 一个非零系数位置超过7,即(8-1),那么它肯定不是LFNST输出的,这样解码器就可以知道当前块肯定没有使用LFNST,也就不需要再编码它的语法元素。通过这个限制可以明显减少lfnst_nspt_idx的不必要的开销。而且相关技术要求所有颜色分量的最后一个非零系数位置不能大于其最大阈值。比如说YUV格式下单树划分的块,Y、U、V三个颜色分量的最后一个非零系数位置都不能大于其最大阈值。
这样,考虑到LFNST/NSPT的这个条件是为帧内预测设计的,而目前帧间预测也可以使用LFNST/NSPT,但它们的系数、残差规律并不相同,因而可以对这个限制条件进行修改。
在又一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度分量的最后一个非零系数位置小于或等于第二阈值。
在又一种可能的实现方式中,当前块的变换系数中的最后一个非零系数位置满足预设条件,可以包括:在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置小于或等于第二阈值。
需要说明的是,在本申请实施例中,第二阈值也可以称为最大阈值。一种具体的实施例中,可以根据当前块的尺寸参数,确定第二阈值。例如,最二阈值可以根据当前块的长度和宽度确定。另一种具体的实施例中,可以将第二阈值设置为当前块的变换系数中系数个数最大值与一的差值。例如,如果当前块LFNST输出最多可能只有8个系数,那么最二阈值可以设置为7。
还需要说明的是,本申请实施例对于最后一个非零系数位置等于第二阈值的情况也不作限定。也就是说,当前块的变换系数中的最后一个非零系数位置满足预设条件,还可以包括:在当前块的预测模式为帧内预测模式或双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于第二阈值;或者,在当前块的预测模式为帧间预测模式或单树划分时,当前块的变换系数中亮度分量的最后一个非零系数位置小于第二阈值。
示例性地,对帧内预测的块,仍然使用相关技术。即所有颜色分量的最后一个非零系数位置都不大于其最大阈值的情况下才编码lfnst_nspt_idx;对帧间预测的块,在Y分量的最后一个非零系数位置不大于其最大阈值的情况下才编码lfnst_nspt_idx,不再要求U、V分量。或者,对双树划分的块,在它所有颜色分量的最后一个非零系数位置不大于最大阈值的情况下才编码lfnst_nspt_idx;对单树划分的块,在Y分量的最后一个非零系数位置不大于其最大阈值的情况下才编码lfnst_nspt_idx,不再要求U、V分量。
也就是说,在本申请实施例中,可以分情况在Y分量的最后一个非零系数位置大于或等于最小阈值的情况下才编码lfnst_nspt_idx,不再要求U、V分量。或者,也可以分情况在Y分量的最后一个非零系数位置不大于最大阈值的情况下才编码lfnst_nspt_idx,不再要求U、V分量。
在本申请的又一实施例中,本申请实施例提供了一种码流,码流是根据待编码信息进行比特编码生成的;其中,待编码信息包括下述至少一项:当前块的色度分量的量化系数和第一语法标识信息的取值;其中,第一语法标识信息用于指示当前块是否允许使用第一变换模式以及对应使用的变换核索引。
在本申请实施例中,第一变换模式可以为MTS/LFNST/NSPT。在模式参数满足第一条件时,例如若单树划分的CU中色度分量使用了跨分量预测模式,则MTS/LFNST/NSPT不用于这种CU的色度分量;若单树划分的CU中色度分量使用了跨分量预测模式,则MTS/LFNST/NSPT可以对色度分量使用和亮度分量不同的变换核或变换核组。
本实施例提供了一种编码方法,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。这样,首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,而且还可以提升编解码性能。
在本申请的又一实施例中,基于前述实施例所述的编解码方法,本申请实施例可以将MTS/LFNST/NSPT用于single tree的色度分量。可选地,可以用于帧内的single tree和/或帧间的single tree。但是考虑到硬件复杂度和流水线长度,这里需要满足如下的限制条件:
如果single tree的CU中色度分量使用了跨分量技术,例如CCLM、CCCM、inter-CCCM等,一种可能的实现方式是MTS/LFNST/NSPT不用于这种CU的色度分量,而是使用默认的变换核,例如水平 竖直方向分别使用可分离的DCT2。
另一种可能的实现方式是MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核或变换核组。具体地,在一些技术中的LFNST/NSPT都会以帧内预测模式确定一个变换核组,实际上这个帧内预测模式代表了一种纹理特征,比如说某一个角度的纹理,LFNST/NSPT根据这个特征匹配对应的变换核组,每个变换核组中有多个变换核可选,例如3个变换核可选。类似地,帧内MTS也是根据帧内预测模式匹配变换核。对帧间而言,它本身是没有帧内预测模式的,上述内容中可以用帧间预测块推导出一个虚拟的帧内预测模式,这个虚拟的预测模式也可以称为纹理特征索引,用它来匹配LFNST/NSPT的变换核组。
另外,对一个色度分量和亮度分量使用相同的预测方法预测的single tree的CU,它们的残差可能也符合相同的纹理特征,比如说某一个角度的纹理。但是对一个色度分量和亮度分量使用不同的预测方法预测的single tree的CU,它们的残差可能就符合不同的纹理特征了。一个典型的示例为跨分量预测。跨分量预测具体是用亮度分量的重建块预测色度分量,亮度分量的重建块已经包含了亮度分量的残差,因而色度分量的预测块中包含亮度分量的残差转变来的信息。如果亮度分量和色度分量符合不同的纹理特征,可以给它们使用不同的变换核或变换核组。一个示例是对LFNST/NSPT,亮度分量用它的帧内预测模式或虚拟的帧内预测模式匹配一个变换核组,色度分量如果使用了跨分量预测,那么可以对色度分量使用DC或PLANAR对应的变换核组,或者使用一个对跨分量预测专门优化的变换核组。
在本申请实施例中,这些都是针对纹理特征而言的,对常用的YUV4:2:0格式来说,同一个CU中面亮度分量的像素数是一个色度分量的像素数的4倍,也就是说亮度块和色度块的尺寸是不一样的。示例性地,如果亮度块是16×16,那么对应的色度块是8×8,那么变换核或变换核组也得是对应尺寸的。
也就是说,在本申请实施例中,将MTS/LFNST/NSPT用于single tree的色度分量。其中,如果single tree的CU中色度分量使用了跨分量技术,那么MTS/LFNST/NSPT不用于这种CU的色度分量;如果single tree的CU中色度分量使用了跨分量技术,那么MTS/LFNST/NSPT对色度分量使用和亮度分量不同的变换核或变换核组。
还可以理解地,在本申请实施例中,第一语法标识信息(例如lfnst_nspt_idx)是在符合一定条件下才会解析的。其中一个条件是,最后一个非零系数位置大于等于1。量化系数的扫描是按hierarchical diagonal scan进行的。一个系数块,会分成4×4的子块,4×4的子块之间是按diagonal scan进行扫描的,4×4的子块内部也是按照diagonal scan进行扫描的。当前块左上角(0,0)的位置是扫描顺序的0,最后一个非零系数位置大于等于1,也就意味着当前块有(0,0)以外的系数。对DCT2变换来说,(0,0)就是DC系数。也就是说如果当前块的系数只有(0,0)位置有非零系数或者没有非零系数,那么lfnst_nspt_idx这个语法元素不需要解析,默认为0。因为这种情况下LFNST/NSPT能用到的可能性很小,而通过这个限制可以明显减少lfnst_nspt_idx的不必要的开销。而且相关技术要求所有分量的最后一个非零系数位置大于等于1。比如说YUV格式下single tree划分的块,Y,U,V三个分量的最后一个非零系数位置都要大于等于1。
对帧间编码的块来说,本来残差就比帧内编码的块少,又考虑到一般色度的质量要求比亮度低得多,在帧间编码的块中会出现较多的亮度有一定系数而色度没有系数的情况。因为LFNST/NSPT的这个条件是为帧内编码设计的,而现在帧间编码也可以使用LFNST/NSPT,但它们的系数,残差规律并不相同,因而可以对这个限制条件进行修改。
一种可能的实现方式为:对帧内编码的块,仍然使用相关技术。即所有分量的最后一个非零系数位置大于等于1的情况下才解析lfnst_nspt_idx。对帧间编码的块,在Y分量的最后一个非零系数位置大于等于1的情况下才解析lfnst_nspt_idx。不再要求UV分量。
另一种可能的实现方式为:对dual tree划分的块,在它所有的分量的最后一个非零系数位置大于等于1的情况下才解析lfnst_nspt_idx。对single tree划分的块,在Y分量的最后一个非零系数位置大于等于1的情况下才解析lfnst_nspt_idx。不再要求UV分量。
更进一步地,相关技术中判断条件设为最后一个非零系数位置大于等于1,即这个最小可能的阈值是1,这里称它为最小阈值,最小阈值也可以设置更大的值,如2,3等。如最后一个非零系数位置大于等于2的情况下才解析lfnst_nspt_idx。
在相关技术中,lfnst_nspt_idx是在符合一定条件下才会解析的。其中一个条件是,最后一个非零系数位置不能大于一个阈值,这个阈值是LFNST或NSPT最大可能的系数个数减一,这里称之为最大阈值,最大阈值可以根据块的尺寸,即长和宽确定。示例性地,编码端LFNST对4×4的块进行二次变换时,LFNST的输入是4×4的DCT2变换后的系数,输出是8个系数,也就是对4x4的块LFNST输出最多可能只有8个系数,那么对解码器来说,如果一个4×4的块的最后一个非零系数位置超过7,即(8-1),那么它肯定不是LFNST输出的,这样解码器就知道当前块肯定没用LFNST,也就不需要解析它的语法 元素了。通过这个限制可以明显减少lfnst_nspt_idx的不必要的开销。
而且相关技术要求所有分量的最后一个非零系数位置不能大于其最大阈值。比如说YUV格式下single tree划分的块,Y,U,V三个分量的最后一个非零系数位置都不能大于其最大阈值。因为LFNST/NSPT的这个条件是为帧内编码设计的,而现在帧间编码也可以使用LFNST/NSPT,但它们的系数,残差规律并不相同,因而可以对这个限制条件进行修改。
一种可能的实现方式为:对帧内编码的块,仍然使用相关技术。即所有分量的最后一个非零系数位置都不大于其最大阈值的情况下才解析lfnst_nspt_idx。对帧间编码的块,在Y分量的最后一个非零系数位置不大于其最大阈值的情况下才解析lfnst_nspt_idx。不再要求UV分量。
另一种可能的实现方式为:对dual tree划分的块,在它所有的分量的最后一个非零系数位置不大于最大阈值的情况下才解析lfnst_nspt_idx。对single tree划分的块,在Y分量的最后一个非零系数位置不大于其最大阈值的情况下才解析lfnst_nspt_idx。不再要求UV分量。
也就是说,在本申请实施例中,可以分情况在Y分量的最后一个非零系数位置大于等于1的情况下才解析lfnst_nspt_idx,不再要求UV分量;以及分情况在Y分量的最后一个非零系数位置不大于最大阈值的情况下才解析lfnst_nspt_idx,不再要求UV分量。
在本申请实施例中,通过上述实施例对前述实施例的具体实现进行详细阐述,从中可以看出,根据前述实施例的技术方案,对色度分量使用MTS/LFNST/NSPT,可以提高压缩效率。其中,考虑色度分量编码的流水线长度,如果色度分量使用跨分量预测模式,也就是当亮度分量得到重建块以后,色度分量才能进行预测,而对于色度分量不使用跨分量预测模式,亮度分量和色度分量的预测可以并行进行,也就是说跨分量预测会使色度分量的流水线变长,LFNST是二次变换,也就意味着当前块如果使用LFNST,那么会先进行LFNST的反变换,再进行基础变换的反变换,这就会是的流水线变长,因而在色度使用跨分量预测时不使用LFNST,从而可以减少流水线长度,有利于控制硬件的复杂度,进而提高了编解码性能。
在本申请的又一实施例中,基于前述实施例相同的发明构思,参见图45,其示出了本申请实施例提供的一种编码器的组成结构示意图。如图45所示,该编码器450可以包括第一确定单元4501、变换单元4502和编码单元4503,其中:
第一确定单元4501,配置为确定当前块的色度分量的模式参数;以及在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;
变换单元4502,配置为确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;
编码单元4503,配置为对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,模式参数满足第一条件,包括:当前块的划分类型为单树划分且当前块的色度分量的预测模式为跨分量预测模式。
在一些实施例中,第一确定单元4501,还配置为将预设变换核确定为当前块的色度分量的第一变换核。
在一些实施例中,第一确定单元4501,还配置为基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组不同;根据第一变换核组,确定第一变换核。
在一些实施例中,第一确定单元4501,还配置为基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组相同;以及根据第一变换核组,确定第一变换核;其中,第一变换核与当前块的亮度分量的变换核不同。
在一些实施例中,第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
在一些实施例中,第一确定单元4501,还配置为对第一变换核组中的至少一个候选变换核分别进行代价值计算,确定至少一个候选变换核各自的代价值;以及从至少一个候选变换核各自的代价值中确定最小代价值,将最小代价值对应的候选变换核作为第一变换核。
在一些实施例中,第一确定单元4501,还配置为确定第一语法标识信息的取值;其中,第一语法标识信息用于指示当前块是否使用第一变换模式以及对应使用的变换核索引;编码单元4503,还配置为对第一语法标识信息的取值进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,第一确定单元4501,还配置为在当前块不使用第一变换模式时,确定第一语法标识信息的取值为第一值;在当前块使用第一变换模式时,确定第一语法标识信息的取值为第二值;其 中,第二值的取值与第一变换核的变换核索引具有关联关系。
在一些实施例中,第一确定单元4501,还配置为在模式参数不满足第一条件时,确定当前块的色度分量的第二变换核;变换单元4502,还配置为确定当前块的色度分量的残差块,并根据第二变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;编码单元4503,还配置为对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,模式参数不满足第一条件,包括:当前块的划分类型为双树划分或者当前块的色度分量的预测模式为非跨分量预测模式。
在一些实施例中,第一确定单元4501,还配置为基于第一变换模式,确定当前块的色度分量的第二变换核组;以及根据第二变换核组,确定第二变换核;其中,第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
在一些实施例中,参见图45,编码器450还可以包括量化单元4504,其中:
第一确定单元4501,还配置为确定当前块的变换系数;其中,当前块的变换系数包括当前块的色度分量的变换系数和当前块的亮度分量的变换系数;
量化单元4504,配置为对当前块的变换系数进行量化,确定当前块的量化系数;
编码单元4503,还配置为对当前块的量化系数进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,编码单元4503,还配置为在当前块的变换系数中的最后一个非零系数位置满足预设条件时,执行对第一语法标识信息的取值进行编码处理,将所得到的编码比特写入码流的步骤。
在一些实施例中,第一确定单元4501,还配置为在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
在一些实施例中,第一确定单元4501,还配置为在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
在一些实施例中,第一确定单元4501,还配置为在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
在一些实施例中,第一确定单元4501,还配置为在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
在一些实施例中,第一确定单元4501,还配置为根据当前块的尺寸参数,确定第二阈值。
在一些实施例中,第一确定单元4501,还配置为将第二阈值设置为当前块的变换系数中系数个数最大值与一的差值。
在一些实施例中,第一确定单元4501,还配置为确定当前块的色度分量的预测块;以及根据当前块的色度分量的原始块和当前块的色度分量的预测块,确定当前块的色度分量的残差块。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于编码器450,该计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现前述实施例中任一项所述的方法。
基于编码器450的组成以及计算机可读存储介质,参见图46,其示出了本申请实施例提供的编码器450的具体硬件结构示意图。如图46所示,编码器450可以包括:第一通信接口4601、第一存储器4602和第一处理器4603;各个组件通过第一总线系统4604耦合在一起。可理解,第一总线系统4604用于实现这些组件之间的连接通信。第一总线系统4604除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图46中将各种总线都标为第一总线系统4604。其中,
第一通信接口4601,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
第一存储器4602,用于存储能够在第一处理器4603上运行的计算机程序;
第一处理器4603,用于在运行所述计算机程序时,执行:
确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
可以理解,本申请实施例中的第一存储器4602可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(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,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的第一存储器4602旨在包括但不限于这些和任意其它适合类型的存储器。
而第一处理器4603可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过第一处理器4603中的硬件的集成逻辑电路或者软件形式的指令完成。上述的第一处理器4603可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于第一存储器4602,第一处理器4603读取第一存储器4602中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,第一处理器4603还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
本实施例提供了一种编码器,在该编码器中,首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,而且还可以提升编解码性能。
基于前述实施例相同的发明构思,参见图47,其示出了本申请实施例提供的一种解码器的组成结构示意图。如图47所示,该解码器470可以包括第二确定单元4701和反变换单元4702,其中:
第二确定单元4701,配置为确定当前块的色度分量的模式参数;以及在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;
反变换单元4702,配置为确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
在一些实施例中,模式参数满足第一条件,包括:当前块的划分类型为单树划分且当前块的色度分量的预测模式为跨分量预测模式。
在一些实施例中,第二确定单元4701,还配置为将预设变换核确定为当前块的色度分量的第一变换核。
在一些实施例中,第二确定单元4701,还配置为基于第一变换模式,确定当前块的色度分量的第 一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组不同;根据第一变换核组,确定第一变换核。
在一些实施例中,第二确定单元4701,还配置为基于第一变换模式,确定当前块的色度分量的第一变换核组;其中,第一变换核组与当前块的亮度分量的变换核组相同;以及根据第一变换核组,确定第一变换核;其中,第一变换核与当前块的亮度分量的变换核不同。
在一些实施例中,第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
在一些实施例中,参见图47,解码器470还可以包括解码单元4703,配置为解码码流,确定第一语法标识信息的取值;第二确定单元4701,还配置为在第一语法标识信息指示当前块使用第一变换模式时,确定当前块的变换核索引;以及根据第一变换核组和变换核索引,确定第一变换核。
在一些实施例中,第二确定单元4701,还配置为在模式参数不满足第一条件时,确定当前块的色度分量的第二变换核;反变换单元4702,还配置为确定当前块的色度分量的变换系数,并根据第二变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
在一些实施例中,模式参数不满足第一条件,包括:当前块的划分类型为双树划分或者当前块的色度分量的预测模式为非跨分量预测模式。
在一些实施例中,第二确定单元4701,还配置为基于第一变换模式,确定当前块的色度分量的第二变换核组;以及根据第二变换核组,确定第二变换核;其中,第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
在一些实施例中,参见图47,解码器470还可以包括反量化单元4704,其中:
解码单元4703,还配置为解码码流,确定当前块的色度分量的量化系数;反量化单元4704,配置为对当前块的色度分量的量化系数进行反量化,确定当前块的色度分量的变换系数。
在一些实施例中,当前块的变换系数包括当前块的色度分量的变换系数和当前块的亮度分量的变换系数;相应地,解码单元4703,还配置为解码码流,确定当前块的亮度分量的量化系数;反量化单元4704,还配置为对当前块的亮度分量的量化系数进行反量化,确定当前块的亮度分量的变换系数。
在一些实施例中,解码单元4703,还配置为在当前块的变换系数中的最后一个非零系数位置满足预设条件时,执行解码码流,确定第一语法标识信息的取值的步骤。
在一些实施例中,第二确定单元4701,还配置为在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
在一些实施例中,第二确定单元4701,还配置为在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
在一些实施例中,第二确定单元4701,还配置为在当前块的预测模式为帧内预测模式时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的预测模式为帧间预测模式时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
在一些实施例中,第二确定单元4701,还配置为在当前块的划分类型为双树划分时,当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,在当前块的划分类型为单树划分时,当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
在一些实施例中,第二确定单元4701,还配置为根据当前块的尺寸参数,确定第二阈值。
在一些实施例中,第二确定单元4701,还配置为将第二阈值设置为当前块的变换系数中系数个数最大值与一的差值。
在一些实施例中,第二确定单元4701,还配置为确定当前块的色度分量的预测块;以及根据当前块的色度分量的预测块和当前块的色度分量的残差块,确定当前块的色度分量的重建块。
可以理解地,在本实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本实施例提供了一种计算机可读存储介质,应用于解码器470,该计算机可读存储介质存储有计算机程序,所述计算机程序被第二处理器执行时实现前述实施例中任一项所述的方法。
基于解码器470的组成以及计算机可读存储介质,参见图48,其示出了本申请实施例提供的解码 器470的具体硬件结构示意图。如图48所示,解码器470可以包括:第二通信接口4801、第二存储器4802和第二处理器4803;各个组件通过第二总线系统4804耦合在一起。可理解,第二总线系统4804用于实现这些组件之间的连接通信。第二总线系统4804除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图48中将各种总线都标为第二总线系统4804。其中,
第二通信接口4801,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
第二存储器4802,用于存储能够在第二处理器4803上运行的计算机程序;
第二处理器4803,用于在运行所述计算机程序时,执行:
确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。
可选地,作为另一个实施例,第二处理器4803还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
可以理解,第二存储器4802与第一存储器4602的硬件功能类似,第二处理器4803与第一处理器4603的硬件功能类似;这里不再详述。
本实施例提供了一种解码器,在该解码器中,首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,而且还可以提升编解码性能。
在本申请的再一实施例中,参见图49,其示出了本申请实施例提供的一种编解码系统的组成结构示意图。如图49所示,编解码系统490可以包括编码器4901和解码器4902。
在本申请实施例中,编码器4901可以是前述实施例中任一项所述的编码器,解码器4902可以是前述实施例中任一项所述的解码器。
需要说明的是,在本申请中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。
本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
工业实用性
本申请实施例中,在编码端,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的残差块,并根据第一变换核对当前块的色度分量的残差块进行变换,确定当前块的色度分量的变换系数;对当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。在解码端,确定当前块的色度分量的模式参数;在模式参数满足第一条件时,确定当前块的色度分量的第一变换核;确定当前块的色度分量的变换系数,并根据第一变换核对当前块的色度分量的变换系数进行反变换,确定当前块的色度分量的残差块。这样,无论是编码端还是解码端,都是首先确定当前块的模式参数;在模式参数满足第一条件时,这时候确定当前块的色度分量的第一变换核,再根据第一变换核对当前块的色度分量的残差块进行变换。也就是说,第一变换核的确定与模式参数有关,能够实现将MTS/LFNST/NSPT变换应用于单树划分的色度分量,从而不仅可以提高压缩效率,而且还可以提升编解码性能。

Claims (47)

  1. 一种解码方法,应用于解码器,所述方法包括:
    确定当前块的色度分量的模式参数;
    在所述模式参数满足第一条件时,确定所述当前块的色度分量的第一变换核;
    确定所述当前块的色度分量的变换系数,并根据所述第一变换核对所述当前块的色度分量的变换系数进行反变换,确定所述当前块的色度分量的残差块。
  2. 根据权利要求1所述的方法,其中,所述模式参数满足第一条件,包括:所述当前块的划分类型为单树划分且所述当前块的色度分量的预测模式为跨分量预测模式。
  3. 根据权利要求2所述的方法,其中,所述确定所述当前块的色度分量的第一变换核,包括:将预设变换核确定为所述当前块的色度分量的第一变换核。
  4. 根据权利要求2所述的方法,其中,所述确定所述当前块的色度分量的第一变换核,包括:
    基于第一变换模式,确定所述当前块的色度分量的第一变换核组;其中,所述第一变换核组与所述当前块的亮度分量的变换核组不同;
    根据所述第一变换核组,确定所述第一变换核。
  5. 根据权利要求2所述的方法,其中,所述确定所述当前块的色度分量的第一变换核,包括:
    基于第一变换模式,确定所述当前块的色度分量的第一变换核组;其中,所述第一变换核组与所述当前块的亮度分量的变换核组相同;
    根据所述第一变换核组,确定所述第一变换核;其中,所述第一变换核与所述当前块的亮度分量的变换核不同。
  6. 根据权利要求4或5所述的方法,其中,所述第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
  7. 根据权利要求4或5所述的方法,其中,所述根据所述第一变换核组,确定所述第一变换核,包括:
    解码码流,确定第一语法标识信息的取值;
    在所述第一语法标识信息指示所述当前块使用第一变换模式时,确定所述当前块的变换核索引;
    根据所述第一变换核组和所述变换核索引,确定所述第一变换核。
  8. 根据权利要求1所述的方法,其中,所述方法还包括:
    在所述模式参数不满足第一条件时,确定所述当前块的色度分量的第二变换核;
    确定所述当前块的色度分量的变换系数,并根据所述第二变换核对所述当前块的色度分量的变换系数进行反变换,确定所述当前块的色度分量的残差块。
  9. 根据权利要求8所述的方法,其中,所述模式参数不满足第一条件,包括:所述当前块的划分类型为双树划分或者所述当前块的色度分量的预测模式为非跨分量预测模式。
  10. 根据权利要求8所述的方法,其中,所述确定所述当前块的色度分量的第二变换核,包括:
    基于第一变换模式,确定所述当前块的色度分量的第二变换核组;
    根据所述第二变换核组,确定所述第二变换核;其中,所述第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
  11. 根据权利要求1至10中任一项所述的方法,其中,所述确定所述当前块的色度分量的变换系数,包括:
    解码码流,确定所述当前块的色度分量的量化系数;
    对所述当前块的色度分量的量化系数进行反量化,确定所述当前块的色度分量的变换系数。
  12. 根据权利要求7所述的方法,其中,所述当前块的变换系数包括所述当前块的色度分量的变换系数和所述当前块的亮度分量的变换系数,所述方法还包括:
    解码码流,确定所述当前块的亮度分量的量化系数;
    对所述当前块的亮度分量的量化系数进行反量化,确定所述当前块的亮度分量的变换系数。
  13. 根据权利要求12所述的方法,其中,所述方法还包括:
    在所述当前块的变换系数中的最后一个非零系数位置满足预设条件时,执行解码码流,确定第一语法标识信息的取值的步骤。
  14. 根据权利要求13所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的预测模式为帧内预测模式时,所述当前块的变换系数中所有颜色分量的最后一个非 零系数位置大于或等于第一阈值;或者,
    在所述当前块的预测模式为帧间预测模式时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
  15. 根据权利要求13所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的划分类型为双树划分时,所述当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,
    在所述当前块的划分类型为单树划分时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
  16. 根据权利要求13所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的预测模式为帧内预测模式时,所述当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,
    在所述当前块的预测模式为帧间预测模式时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
  17. 根据权利要求13所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的划分类型为双树划分时,所述当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,
    在所述当前块的划分类型为单树划分时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
  18. 根据权利要求16或17所述的方法,其中,所述方法还包括:
    根据所述当前块的尺寸参数,确定所述第二阈值。
  19. 根据权利要求16或17所述的方法,其中,所述方法还包括:
    将所述第二阈值设置为所述当前块的变换系数中系数个数最大值与一的差值。
  20. 根据权利要求1至19中任一项所述的方法,其中,所述方法还包括:
    确定所述当前块的色度分量的预测块;
    根据所述当前块的色度分量的预测块和所述当前块的色度分量的残差块,确定所述当前块的色度分量的重建块。
  21. 一种编码方法,应用于编码器,所述方法包括:
    确定当前块的色度分量的模式参数;
    在所述模式参数满足第一条件时,确定所述当前块的色度分量的第一变换核;
    确定所述当前块的色度分量的残差块,并根据所述第一变换核对所述当前块的色度分量的残差块进行变换,确定所述当前块的色度分量的变换系数;
    对所述当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
  22. 根据权利要求21所述的方法,其中,所述模式参数满足第一条件,包括:所述当前块的划分类型为单树划分且所述当前块的色度分量的预测模式为跨分量预测模式。
  23. 根据权利要求22所述的方法,其中,所述确定所述当前块的色度分量的第一变换核,包括:将预设变换核确定为所述当前块的色度分量的第一变换核。
  24. 根据权利要求22所述的方法,其中,所述确定所述当前块的色度分量的第一变换核,包括:
    基于第一变换模式,确定所述当前块的色度分量的第一变换核组;其中,所述第一变换核组与所述当前块的亮度分量的变换核组不同;
    根据所述第一变换核组,确定所述第一变换核。
  25. 根据权利要求22所述的方法,其中,所述确定所述当前块的色度分量的第一变换核,包括:
    基于第一变换模式,确定所述当前块的色度分量的第一变换核组;其中,所述第一变换核组与所述当前块的亮度分量的变换核组相同;
    根据所述第一变换核组,确定所述第一变换核;其中,所述第一变换核与所述当前块的亮度分量的变换核不同。
  26. 根据权利要求24或25所述的方法,其中,所述第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
  27. 根据权利要求24或25所述的方法,其中,所述根据所述第一变换核组,确定所述第一变换核,包括:
    对所述第一变换核组中的至少一个候选变换核分别进行代价值计算,确定所述至少一个候选变换核各自的代价值;
    从所述至少一个候选变换核各自的代价值中确定最小代价值,将所述最小代价值对应的候选变换核作为所述第一变换核。
  28. 根据权利要求27所述的方法,其中,所述方法还包括:
    确定第一语法标识信息的取值;其中,所述第一语法标识信息用于指示所述当前块是否使用第一变换模式以及对应使用的变换核索引;
    对所述第一语法标识信息的取值进行编码处理,将所得到的编码比特写入码流。
  29. 根据权利要求28所述的方法,其中,所述确定第一语法标识信息的取值,包括:
    在所述当前块不使用第一变换模式时,确定所述第一语法标识信息的取值为第一值;
    在所述当前块使用第一变换模式时,确定所述第一语法标识信息的取值为第二值;其中,所述第二值的取值与所述第一变换核的变换核索引具有关联关系。
  30. 根据权利要求21所述的方法,其中,所述方法还包括:
    在所述模式参数不满足第一条件时,确定所述当前块的色度分量的第二变换核;
    确定所述当前块的色度分量的残差块,并根据所述第二变换核对所述当前块的色度分量的残差块进行变换,确定所述当前块的色度分量的变换系数;
    对所述当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
  31. 根据权利要求30所述的方法,其中,所述模式参数不满足第一条件,包括:所述当前块的划分类型为双树划分或者所述当前块的色度分量的预测模式为非跨分量预测模式。
  32. 根据权利要求30所述的方法,其中,所述确定所述当前块的色度分量的第二变换核,包括:
    基于第一变换模式,确定所述当前块的色度分量的第二变换核组;
    根据所述第二变换核组,确定所述第二变换核;其中,所述第一变换模式至少包括下述其中一项:多变换选择模式、低频不可分离变换模式和不可分离基础变换模式。
  33. 根据权利要求28所述的方法,其中,所述方法还包括:
    确定所述当前块的变换系数;其中,所述当前块的变换系数包括所述当前块的色度分量的变换系数和所述当前块的亮度分量的变换系数;
    对所述当前块的变换系数进行量化,确定所述当前块的量化系数;
    对所述当前块的量化系数进行编码处理,将所得到的编码比特写入码流。
  34. 根据权利要求33所述的方法,其中,所述方法还包括:
    在所述当前块的变换系数中的最后一个非零系数位置满足预设条件时,执行对所述第一语法标识信息的取值进行编码处理,将所得到的编码比特写入码流的步骤。
  35. 根据权利要求34所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的预测模式为帧内预测模式时,所述当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,
    在所述当前块的预测模式为帧间预测模式时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
  36. 根据权利要求34所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的划分类型为双树划分时,所述当前块的变换系数中所有颜色分量的最后一个非零系数位置大于或等于第一阈值;或者,
    在所述当前块的划分类型为单树划分时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置大于或等于第一阈值。
  37. 根据权利要求34所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的预测模式为帧内预测模式时,所述当前块的变换系数中所有颜色分量的最后一个非零系数位置小于或等于第二阈值;或者,
    在所述当前块的预测模式为帧间预测模式时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
  38. 根据权利要求34所述的方法,其中,所述当前块的变换系数中的最后一个非零系数位置满足预设条件,包括:
    在所述当前块的划分类型为双树划分时,所述当前块的变换系数中所有颜色分量的最后一个非零系 数位置小于或等于第二阈值;或者,
    在所述当前块的划分类型为单树划分时,所述当前块的变换系数中亮度颜色分量的最后一个非零系数位置小于或等于第二阈值。
  39. 根据权利要求37或38所述的方法,其中,所述方法还包括:
    根据所述当前块的尺寸参数,确定所述第二阈值。
  40. 根据权利要求37或38所述的方法,其中,所述方法还包括:
    将所述第二阈值设置为所述当前块的变换系数中系数个数最大值与一的差值。
  41. 根据权利要求21至40中任一项所述的方法,其中,所述确定所述当前块的色度分量的残差块,包括:
    确定所述当前块的色度分量的预测块;
    根据所述当前块的色度分量的原始块和所述当前块的色度分量的预测块,确定所述当前块的色度分量的残差块。
  42. 一种码流,其中,所述码流是根据待编码信息进行比特编码生成的;其中,待编码信息包括下述至少一项:
    当前块的色度分量的量化系数和第一语法标识信息的取值;其中,所述第一语法标识信息用于指示所述当前块是否允许使用第一变换模式以及对应使用的变换核索引。
  43. 一种编码器,所述编码器包括第一确定单元、变换单元和编码单元,其中:
    所述第一确定单元,配置为确定当前块的色度分量的模式参数;以及在所述模式参数满足第一条件时,确定所述当前块的色度分量的第一变换核;
    所述变换单元,配置为确定所述当前块的色度分量的残差块,并根据所述第一变换核对所述当前块的色度分量的残差块进行变换,确定所述当前块的色度分量的变换系数;
    所述编码单元,配置为对所述当前块的色度分量的变换系数进行编码处理,将所得到的编码比特写入码流。
  44. 一种编码器,所述编码器包括第一存储器和第一处理器,其中:
    所述第一存储器,用于存储能够在所述第一处理器上运行的计算机程序;
    所述第一处理器,用于在运行所述计算机程序时,执行如权利要求21至41中任一项所述的方法。
  45. 一种解码器,所述解码器包括第二确定单元和反变换单元,其中:
    所述第二确定单元,配置为确定当前块的色度分量的模式参数;以及在所述模式参数满足第一条件时,确定所述当前块的色度分量的第一变换核;
    所述反变换单元,配置为确定所述当前块的色度分量的变换系数,并根据所述第一变换核对所述当前块的色度分量的变换系数进行反变换,确定所述当前块的色度分量的残差块。
  46. 一种解码器,所述解码器包括第二存储器和第二处理器,其中:
    所述第二存储器,用于存储能够在所述第二处理器上运行的计算机程序;
    所述第二处理器,用于在运行所述计算机程序时,执行如权利要求1至20中任一项所述的方法。
  47. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被至少一个处理器执行时实现如权利要求1至20中任一项所述的方法、或者如权利要求21至41中任一项所述的方法。
PCT/CN2023/122981 2023-09-28 2023-09-28 编解码方法、码流、编码器、解码器以及存储介质 Pending WO2025065670A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2023/122981 WO2025065670A1 (zh) 2023-09-28 2023-09-28 编解码方法、码流、编码器、解码器以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2023/122981 WO2025065670A1 (zh) 2023-09-28 2023-09-28 编解码方法、码流、编码器、解码器以及存储介质

Publications (1)

Publication Number Publication Date
WO2025065670A1 true WO2025065670A1 (zh) 2025-04-03

Family

ID=95204598

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/122981 Pending WO2025065670A1 (zh) 2023-09-28 2023-09-28 编解码方法、码流、编码器、解码器以及存储介质

Country Status (1)

Country Link
WO (1) WO2025065670A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170324955A1 (en) * 2011-03-03 2017-11-09 Electronics And Telecommunications Research Institute Method for determining color difference component quantization parameter and device using the method
CN109922348A (zh) * 2017-12-13 2019-06-21 华为技术有限公司 图像编解码方法和装置
CN114258677A (zh) * 2019-08-22 2022-03-29 Lg 电子株式会社 编译色度量化参数偏移相关信息的图像解码方法和设备
CN114902678A (zh) * 2019-10-29 2022-08-12 Lg电子株式会社 基于变换的图像编码方法及其设备
CN115004706A (zh) * 2020-01-28 2022-09-02 北京达佳互联信息技术有限公司 关于变换和系数信令的方法和装置
CN116711304A (zh) * 2020-12-28 2023-09-05 Oppo广东移动通信有限公司 预测方法、编码器、解码器以及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170324955A1 (en) * 2011-03-03 2017-11-09 Electronics And Telecommunications Research Institute Method for determining color difference component quantization parameter and device using the method
CN109922348A (zh) * 2017-12-13 2019-06-21 华为技术有限公司 图像编解码方法和装置
CN114258677A (zh) * 2019-08-22 2022-03-29 Lg 电子株式会社 编译色度量化参数偏移相关信息的图像解码方法和设备
CN114902678A (zh) * 2019-10-29 2022-08-12 Lg电子株式会社 基于变换的图像编码方法及其设备
CN115004706A (zh) * 2020-01-28 2022-09-02 北京达佳互联信息技术有限公司 关于变换和系数信令的方法和装置
CN116711304A (zh) * 2020-12-28 2023-09-05 Oppo广东移动通信有限公司 预测方法、编码器、解码器以及存储介质

Similar Documents

Publication Publication Date Title
CN113853794B (zh) 视频解码方法与相关电子装置
CN113853791B (zh) 数字视频中的变换旁路编解码残差块
CN118044182A (zh) 用于视频处理的方法、设备和介质
CN118216145A (zh) 用于视频处理的方法、装置和介质
CN117857783A (zh) 使用量化残差差分脉冲码调制编解码的帧内编解码视频
CN117769836A (zh) 用于视频处理的方法、设备和介质
CN118945317A (zh) 对仿射译码块进行光流预测修正的方法及装置
KR20200055139A (ko) 비디오 코딩을 위한 인터 예측 장치 및 방법을 위한 보간 필터
CN117880498A (zh) 去块效应滤波自适应的编码器、解码器及对应方法
JP7384939B2 (ja) 双予測のオプティカルフロー計算および双予測補正におけるブロックレベル境界サンプル勾配計算のための整数グリッド参照サンプルの位置を計算するための方法
JPWO2020211807A5 (zh)
CN117501689A (zh) 视频处理的方法、设备和介质
CN118042136A (zh) 编解码方法和装置
WO2025065670A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025065658A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025065665A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
CN116800985A (zh) 编解码方法和装置
WO2025073278A1 (en) Method and apparatus for chroma coding
WO2025208348A1 (zh) 编解码方法、编解码器、码流以及存储介质
WO2025147924A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025065522A1 (zh) 编解码方法及装置、编解码器、码流、设备、存储介质
WO2025076670A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2024207136A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025199802A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025145288A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质

Legal Events

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

Ref document number: 23953814

Country of ref document: EP

Kind code of ref document: A1