WO2020000487A1 - 变换方法、反变换方法及装置 - Google Patents
变换方法、反变换方法及装置 Download PDFInfo
- Publication number
- WO2020000487A1 WO2020000487A1 PCT/CN2018/093923 CN2018093923W WO2020000487A1 WO 2020000487 A1 WO2020000487 A1 WO 2020000487A1 CN 2018093923 W CN2018093923 W CN 2018093923W WO 2020000487 A1 WO2020000487 A1 WO 2020000487A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transformation
- transformation check
- check
- target
- dst
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/18—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a set of transform coefficients
Definitions
- the present application relates to the technical field of video encoding and decoding, and more particularly, to a transform method, an inverse transform method, and a device.
- Digital video capabilities can be incorporated into a wide variety of devices, including digital television, digital live broadcast systems, wireless broadcast systems, personal digital assistants (PDAs), laptop or desktop computers, tablet computers, electronics Book readers, digital cameras, digital recording devices, digital media players, video game devices, video game consoles, cellular or satellite radio phones (so-called "smart phones"), video teleconferencing devices, video streaming devices And similar.
- Digital video devices implement video compression technology, for example, in standards defined by MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264 / MPEG-4 Part 10 Advanced Video Coding (AVC), Video coding standard H.265 / High Efficiency Video Coding (HEVC) standard and the video compression technology described in the extension of such standards.
- Video devices can implement such video compression techniques to more efficiently transmit, receive, encode, decode, and / or store digital video information.
- Video compression techniques perform spatial (intra-image) prediction and / or temporal (inter-image) prediction to reduce or remove redundancy inherent in video sequences.
- a video slice ie, a video frame or a portion of a video frame
- image blocks can also be referred to as tree blocks, coding units (CU), and / Or coding nodes.
- Spatial predictions about reference samples in neighboring blocks in the same image are used to encode image blocks in the to-be-encoded (I) slice of the image.
- the image blocks in the to-be-intercoded (P or B) slice of the image may use spatial prediction relative to reference samples in neighboring blocks in the same image or temporal prediction relative to reference samples in other reference images.
- An image may be referred to as a frame, and a reference image may be referred to as a reference frame.
- an inter prediction mode or an intra prediction mode is often used for prediction.
- an optimal transform check is selected from a variety of transform checks based on the rate distortion, and then the residual block is performed according to the optimal transform check. Transform to get the transform coefficient.
- the present application provides a transform method, an inverse transform method, and a device to implement an inverse transform on a residual coefficient.
- an inverse transform method includes: parsing a bitstream to obtain a residual coefficient of a current block, an intra prediction mode, and a target transform check to determine parameters; a first transform check, a second transform check, And a third transformation kernel determines a target transformation check corresponding to the target transformation check determination parameter; wherein the second transformation check is a first candidate transformation check or a second transformation candidate transformation check, the first candidate transformation check and the second transformation candidate
- the transformation check includes the transformation kernel DST-VII, the first candidate transformation check and the second transformation candidate check correspond to the intra prediction mode corresponding to the current block; according to the target transformation check, the residual coefficient is inversely transformed to obtain the residual block.
- parsing the bitstream to obtain the residual coefficient of the current block may specifically refer to firstly parsing the quantized coefficient from the bitstream and then dequantizing the quantized coefficient to obtain the residual coefficient, which can be used for inverse transformation .
- the target transformation check can be determined through the determined target transformation check determination parameters, and the inverse transformation of the residual coefficient can be realized according to the target transformation check.
- first candidate transformation check and the second transformation check both include a transformation kernel DST-VII, it is possible to increase the possibility of including the transformation kernel DST-VII in the final target transformation check, so that in the target transformation check, A better inverse transform effect may be obtained when inverse transforming the residual coefficients.
- the intra prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error tends to gradually increase from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. Using DST-VII for transformation and inverse transformation can achieve better results.
- the target transformation check determination parameter includes a first flag bit, or the target transformation check determination parameter includes a first flag bit and a transformation index value.
- determining the target transformation check corresponding to the determination parameter corresponding to the target transformation check determination from the first transformation check, the second transformation check, and the third transformation check includes: when the first flag bit is the first value, The target transformation check corresponding to the target transformation check determination parameter is determined to be the first transformation check; when the first flag bit is the second value and the transformation index value is the first transformation index value, the target corresponding to the target transformation check determination parameter is determined The transformation check is the second transformation check; when the first flag bit is the second value and the transformation index value is the second transformation index value, the target transformation check corresponding to the target transformation check determination parameter is determined to be the third transformation check.
- the total number of types of the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check is less than 5.
- the storage space occupied by storing the transformation kernel can be reduced.
- the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check include DCT-II, DCT-VIII, and DST-VII.
- the parameter value of the target transformation check determination parameter may also have a direct mapping relationship with the transformation check, so that the target transformation kernel may be directly determined according to the parameter value of the target transformation check determination parameter.
- determining a target transformation check corresponding to the target transformation check determination parameter from the first transformation check, the second transformation check, and the third transformation check includes: determining the parameter value of the parameter and the target transformation according to the target transformation check. The mapping relationship between the parameter value of the determined parameter and the transformation check is checked, and the target transformation check is determined.
- the first transformation check to the third transformation check are respectively corresponding. Then, when the decoding end resolves that the target transformation check determination parameter is the first parameter value, it can directly determine that the target transformation check is the first transformation check.
- the first flag bit is an explicit multi-core transform EMT flag bit.
- the above-mentioned EMT flag can also be called an EMT encoding flag.
- the first value is 0, and the second value is 1.
- the value of the EMT flag when the value of the EMT flag is 0, it means that a single-core inverse transformation is used when inversely transforming the residual coefficient (correspondingly, the single-core transformation is also used when the encoding end is transformed); when the EMT flag is set, A value of 1 indicates that a multi-core inverse transform is used when inverse transforming the residual coefficient (correspondingly, the multi-core transform is also used when the encoding end performs the transform).
- the first transformation check is a transformation check composed of the same transformation kernel.
- the first transformation check is (DCT-II, DCT-II).
- the first candidate transformation check is (DST-VII, DCT-VIII), and the second candidate transformation check is (DCT-VIII, DST-VII); within a frame corresponding to the current block
- the second transformation check is the first candidate transformation check; when the mode number of the intra prediction mode corresponding to the current block is greater than the preset threshold, the first transformation check is the second candidate. Transform check.
- the preset threshold is N.
- N 18.
- the third transformation check is (DST-VII, DST-VII).
- the first transformation check is (DCT-II, DTC-II).
- the first transformation index value is 0, the second transformation index value is 1, or the first transformation index value is 1 and the second transformation index value is 0.
- the lengths of the codewords corresponding to the first transformation index value and the second transformation index value are both 1.
- the lengths of the codewords corresponding to the transformation index value are all 1, which can reduce the number of occupied bits required to indicate the transformation index value.
- the codeword corresponding to the first transformation index value is 0, and the codeword corresponding to the second transformation index value is 1.
- the codeword corresponding to the first transformation index value is 1, and the codeword corresponding to the second transformation index value is 0.
- the above method before the target transformation check is determined, further includes: determining an intra prediction mode corresponding to the current block as a directional prediction mode.
- the above method before determining the target transformation check, further includes: determining that the width and height of the current block are both less than or equal to M.
- the value of M is 64.
- the above method further includes: when the intra prediction mode corresponding to the current block is a DC mode, determining transformation check (DCT-II, DTC-II) as a target transformation check.
- the above method further includes: when the intra prediction mode corresponding to the current block is a planar mode, determining a transformation check (DST-VII, DST-VII) as a target transformation check.
- a transformation check DST-VII, DST-VII
- the intra prediction mode is a DC mode or a planar mode
- the process of determining the target transformation kernel can be simplified and the time required for the inverse transformation can be reduced.
- a transformation check (DST-VII, DST-VII) is determined as the target transformation check.
- N can be 4, 8, and 16 and so on.
- an inverse transform method includes: parsing a bitstream to obtain a residual coefficient of a current block and a target transform check determination parameter; a first transform check, a second transform check, a third transform check, and A target transformation check corresponding to the target transformation check determination parameter is determined in the fourth transformation check; wherein the second transformation check, the third transformation check, and the fourth transformation check all include a transformation kernel DST-VII, so The second transformation check, at least one of the third transformation check and the fourth transformation check includes a transformation kernel DCT-VIII; according to the target transformation check, performing an inverse transformation on the residual coefficient to obtain a residual Bad block.
- parsing the bitstream to obtain the residual coefficient of the current block may specifically refer to firstly parsing the quantized coefficient from the bitstream, and then dequantizing the quantized coefficient to obtain the residual coefficient, which can be used for inverse transformation .
- the target transformation check can be determined through the determined target transformation check determination parameters, and the inverse transformation of the residual coefficient can be realized according to the target transformation check.
- first candidate transformation check and the second transformation check both include a transformation kernel DST-VII, it is possible to increase the possibility of including the transformation kernel DST-VII in the final target transformation check, so that in the target transformation check, A better inverse transform effect may be obtained when inverse transforming the residual coefficients.
- the intra prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error tends to gradually increase from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. Using DST-VII for transformation and inverse transformation can achieve better results.
- the target transformation check determination parameter includes a first flag bit, or the target transformation check determination parameter includes a first flag bit and a transformation index value.
- determining a target transformation check corresponding to the target transformation check determination parameter from the first transformation check, the second transformation check, the third transformation check, and the fourth transformation check includes: when the first flag bit is When it is the first value, it is determined that the target transformation check corresponding to the target transformation check determination parameter is the first transformation check; when the first flag bit is the second value and the transformation index value is the first transformation index value To determine a target transformation check corresponding to the target transformation check determination parameter as a second transformation check; when the first flag bit is a second value and the transformation index value is a second transformation index value, determine the target transformation
- the target transformation check corresponding to the transformation check determination parameter is a third transformation check; when the first flag bit has a second value and the transformation index value is a third transformation index value, determining a parameter corresponding to the target transformation check determination parameter
- the target transformation check is a fourth transformation check.
- the total number of types of transformation kernels included in the first transformation check, the second transformation check, the third transformation check, and the fourth transformation check is less than 5.
- the storage space occupied by storing the transformation kernel can be reduced.
- the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check include DCT-II, DCT-VIII, and DST-VII.
- determining, from the first transformation check, the second transformation check, the third transformation check, and the fourth transformation check, a target transformation check corresponding to the determined and target transformation check determination parameter includes: determining the parameter according to the target transformation check.
- the parameter value and the target transformation check determine the mapping relationship between the parameter value of the parameter and the transformation check to determine the target transformation check.
- the target transformation check determination parameters are respectively the first parameter value to the fourth parameter value, they correspond to the first transformation check to the fourth transformation check, respectively.
- the decoding end resolves that the target transformation check determination parameter is the first parameter value, it can directly determine that the target transformation check is the first transformation check.
- the first flag bit is an explicit multi-core transform EMT flag bit.
- the first value is 0, and the second value is 1.
- the value of the EMT flag when the value of the EMT flag is 0, it means that a single-core inverse transformation is used when the inverse transformation is performed on the residual coefficient (correspondingly, the single-core transformation is also used when the encoding end is transformed); A value of 1 indicates that a multi-core inverse transform is used when inverse transforming the residual coefficient (correspondingly, the multi-core transform is also used when the encoding end performs the transform).
- the first transformation check is a transformation check composed of the same transformation kernel.
- the length of the codeword corresponding to the first transformation index value is 1, and the length of the codeword corresponding to the second transformation index value and the third transformation index value are both 2.
- the first to third transformation index values are 0, 1, and 2, respectively.
- the codeword corresponding to the first transformation index value is 0, the codeword corresponding to the second transformation index value is 10, and the codeword corresponding to the third transformation index value is 11.
- the codewords corresponding to the second transformation index value and the third transformation index value are 10 and 01, respectively.
- the first transformation check is (DCT-II, DTC-II)
- the second transformation check is (DST-VII, DST-VII)
- the third transformation check is (DCT-VIII , DST-VII)
- the fourth transformation check is (DST-VII, DCT-VIII).
- the above method before determining the target transformation check, further includes: determining an intra prediction mode corresponding to the current block as a directional prediction mode.
- the above method before the target transformation check is determined, further includes: determining that a width and a height of the current block are both less than or equal to M.
- the value of M is 64.
- the above method further includes: when the intra prediction mode corresponding to the current block is a DC mode, determining a transformation check (DCT-II, DTC-II) as a target transformation check.
- a transformation check DCT-II, DTC-II
- the above method further includes: when the intra prediction mode corresponding to the current block is a planar mode, determining a transformation check (DST-VII, DST-VII) as a target transformation check.
- a transformation check DST-VII, DST-VII
- the inverse transformation can be simplified by directly using a preset transformation check, which can simplify the process of determining the target transformation kernel and reduce the time required for the inverse transformation.
- a transformation check (DST-VII, DST-VII) is determined as the target transformation check.
- N can be 4, 8, and 16 and so on.
- a transformation method includes: obtaining a residual block of an image block to be processed; obtaining a candidate transformation check of the residual block according to preset first mapping relationship information; and selecting from the candidate transformation check The transformation check with the lowest rate distortion is used as the target transformation check. According to the target transformation check, the residual block is transformed to obtain the transformation coefficient of the image block to be processed. The corresponding transformation index value of the target transformation check is written into the code stream.
- the first mapping relationship information includes a mapping relationship of a first flag bit, a first transformation index value and a second transformation index value, and a variety of transformation checks.
- first flag bit is the first value
- second transformation index value a mapping relationship of a first flag bit, a first transformation index value and a second transformation index value, and a variety of transformation checks.
- first flag bit is the first value
- Multi-core transformation is used when the flag is the second value
- the first flag bit when the first flag bit is the first value, it corresponds to the first transformation check.
- the first transformation index value corresponds to the second transformation check.
- the first transformation bit is checked.
- the second transformation index value corresponds to the third transformation check, and the second transformation check is selected from the first candidate transformation check and the second candidate transformation check according to the intra prediction mode corresponding to the residual block, where the first candidate transformation check and The second transformation candidate transformation check all includes DST-VII.
- the first mapping relationship information includes only three transformation checkups, the number of traversals can be reduced in the process of selecting a target transformation checkup, thereby reducing the time required for encoding.
- the first flag bit is an explicit multi-core transform EMT flag bit.
- the first value is 0, and the second value is 1.
- the first mapping relationship information includes an EMT flag bit.
- EMT flag bit When the value of the EMT flag bit is 0, it means that single-core transformation is used when transforming the residual block; when the value of the EMT flag bit is 1, it means that Multi-core transform is used to transform the residual block.
- the first transformation check is a transformation check composed of the same transformation kernel.
- the first transformation check is (DCT-II, DCT-II).
- the first transformation index value is 0, and the second transformation index value is 1.
- the first candidate transformation check is (DST-VII, DCT-VIII), and the second candidate transformation check is (DCT-VIII, DST-VII); when the frame corresponding to the residual block is When the mode number of the intra prediction mode is less than or equal to a preset threshold, the second transformation check is the first candidate transformation check; when the mode number of the intra prediction mode corresponding to the residual block is greater than the preset threshold, the first transformation check is the first Two candidate transformation checks.
- the preset threshold is N.
- the third transformation check is (DST-VII, DST-VII).
- the first transformation index value is 0, the second transformation index value is 1, or the first transformation index value is 1 and the second transformation index value is 0.
- the lengths of the codewords corresponding to the first transformation index value and the second transformation index value are both 1.
- the lengths of the codewords corresponding to the transformation index value are all 1, which can reduce the number of occupied bits required to indicate the transformation index value.
- the codeword corresponding to the first transformation index value is 0, and the codeword corresponding to the second transformation index value is 1.
- the codeword corresponding to the first transformation index value is 1, and the codeword corresponding to the second transformation index value is 0.
- the method before obtaining candidate transformation check of the residual block according to the preset first mapping relationship information, the method further includes: determining an intra prediction mode corresponding to the residual block as a directional prediction mode.
- the method before obtaining candidate transformation check of the residual block according to the preset first mapping relationship information, the method further includes: determining that the width and height of the residual block are both less than or equal to M.
- the value of M is 64.
- the target transformation check when the size of the residual block is large, (DCT-II, DTC-II) is directly used as the target transformation check to perform the transformation, and when the size of the residual block is small, the target transformation is finally determined according to the first mapping relationship information.
- the kernel can achieve better transformation of residual blocks of different sizes.
- the above method further includes: when the intra prediction mode corresponding to the residual block is a DC mode, determining transformation check (DCT-II, DTC-II) as a target transformation check.
- the above method further includes: when the intra prediction mode corresponding to the residual block is a planar mode, determining a transformation check (DST-VII, DST-VII) as a target transformation check.
- a transformation check DST-VII, DST-VII
- a preset transformation check can be directly used for quantization, which can save the traversal process and further reduce the time required for encoding.
- a transformation check (DST-VII, DST-VII) is determined as the target transformation check .
- N can be 4, 8, and 16 and so on.
- a transformation method includes: obtaining a residual block of an image block to be processed; obtaining a candidate transformation check of the residual block according to preset first mapping relationship information; and selecting from the candidate transformation check The transformation check with the lowest rate distortion is used as the target transformation check. According to the target transformation check, the residual block is transformed to obtain the transformation coefficient of the image block to be processed. The corresponding transformation index value of the target transformation check is written into the code stream.
- the first mapping relationship information includes a mapping relationship of a first flag bit, a first transformation index value, a second transformation index value, a third transformation index value, and four transformation checklists.
- the first flag bit is a first value and a first mapping bit. Single-core transformation and multi-core transformation are used when the two values are taken.
- the first flag bit corresponds to the first transformation check when the first value is the first value.
- the first flag bit is the second value
- the first transformation index value and the second transformation index value are used.
- the third transformation index value corresponds to the second transformation check, the third transformation check, and the fourth transformation check.
- Any one of the second transformation check to the fourth transformation check includes the transformation kernel DST-VII
- the second transformation check to At least one transformation check in the fourth transformation check includes a transformation kernel DCT-VIII.
- the first mapping relationship information includes only four transformation checkups, the number of traversals can be reduced in the process of selecting a target transformation checkup, thereby reducing the time required for encoding.
- the transformation kernel DST-VII is included in each transformation check corresponding to the first flag bit being the second value, and DST-VII has a higher usage rate in intra prediction transformation, therefore, according to the A mapping relationship information can select a transformation check with a higher usage rate for transformation, which can improve the transformation effect.
- the intra prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error tends to gradually increase from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. Using DST-VII for transformation and inverse transformation can achieve better results.
- the first flag bit is an explicit multiple core (EMT) flag.
- EMT explicit multiple core
- the first value is 0, and the second value is 1.
- the first mapping relationship information includes an EMT flag bit.
- EMT flag bit When the value of the EMT flag bit is 0, it means that single-core transformation is used when transforming the residual block; when the value of the EMT flag bit is 1, it means that Multi-core transform is used to transform the residual block.
- the first transformation check is a transformation check composed of the same transformation kernel.
- the length of the codeword corresponding to the first transformation index value is 1, and the length of the codeword corresponding to the second transformation index value and the third transformation index value are both 2.
- the first to third transformation index values are 0, 1, and 2, respectively.
- the codeword corresponding to the first transformation index value is 0, the codeword corresponding to the second transformation index value is 10, and the codeword corresponding to the third transformation index value is 11.
- the codewords corresponding to the second transformation index value and the third transformation index value are 10 and 01, respectively.
- the first transformation check is (DCT-II, DTC-II)
- the second transformation check is (DST-VII, DST-VII)
- the third transformation check is (DCT-VIII , DST-VII)
- the fourth transformation check is (DST-VII, DCT-VIII).
- the method before obtaining candidate transformation check of the residual block according to the preset first mapping relationship information, the method further includes: determining an intra prediction mode corresponding to the residual block as a directional prediction mode.
- the method before obtaining candidate transformation check of the residual block according to the preset first mapping relationship information, the method further includes: determining that the width and height of the residual block are both less than or equal to M.
- the value of M is 64.
- the target transformation check when the size of the residual block is large, (DCT-II, DTC-II) is directly used as the target transformation check to perform the transformation, and when the size of the residual block is small, the target transformation is finally determined according to the first mapping relationship information.
- the kernel can achieve better transformation of residual blocks of different sizes.
- the above method further includes: when the intra prediction mode corresponding to the residual block is a DC mode, determining a transform check (DCT-II, DTC-II) as a target transform check.
- DCT-II transform check
- DTC-II transform check
- the above method further includes: determining a transformation check (DST-VII, DST-VII) as a target transformation check when the intra prediction mode corresponding to the residual block is a plane mode.
- a preset transformation check can be directly used for quantization, which can save the traversal process and further reduce the time required for encoding.
- a transformation check (DST-VII, DST-VII) is determined as the target transformation check .
- N can be 4, 8, and 16 and so on.
- an inverse transform apparatus includes a module for performing a method in any one of the foregoing implementation manners of the first aspect or the second aspect.
- a transformation apparatus includes a module for executing a method in any one of the foregoing third or fourth aspects.
- a decoder including: a non-volatile memory and a processor coupled to each other, the processor calling program code stored in the memory to execute any of the first aspect or the second aspect Some or all steps of a method in one implementation.
- an encoder including: a non-volatile memory and a processor coupled to each other, the processor invoking program code stored in the memory to execute any of the third aspect or the fourth aspect Some or all steps of a method in one implementation.
- a computer-readable storage medium stores program code, where the program code includes a program for executing the first aspect, the second aspect, the third aspect, and the fourth aspect. An instruction in some or all of the steps of a method in any of the implementations.
- a computer program product is provided, and when the computer program product runs on a computer, the computer is caused to execute any one of the first aspect, the second aspect, the third aspect, and the fourth aspect. Instructions in some or all steps of the method.
- FIG. 1 is a schematic flowchart of an intra coding process
- FIG. 2 is a schematic flowchart of an intra decoding process
- 3 is a schematic diagram of various intra prediction modes
- FIG. 4 is a schematic flowchart of an inverse transform method according to an embodiment of the present application.
- FIG. 5 is a schematic flowchart of an inverse transform method according to an embodiment of the present application.
- FIG. 6 is a schematic flowchart of an inverse transform method according to an embodiment of the present application.
- FIG. 7 is a schematic flowchart of a conversion method according to an embodiment of the present application.
- FIG. 8 is a schematic flowchart of a conversion method according to an embodiment of the present application.
- FIG. 9 is a schematic flowchart of a conversion method according to an embodiment of the present application.
- FIG. 10 is a schematic block diagram of an inverse transform device according to an embodiment of the present application.
- FIG. 11 is a schematic block diagram of a video decoder according to an embodiment of the present application.
- FIG. 12 is a schematic block diagram of a video encoder according to an embodiment of the present application.
- intra-frame video coding here means that the prediction mode used in the process of encoding the video image is the intra prediction mode
- intra video decoding means that the prediction mode used in the process of decoding the video image is the frame Intra prediction mode.
- a prediction block of the image block to be processed can be obtained, and by making a difference between the image block to be processed and the prediction block (also called a prediction signal), a residual block can be obtained. (Can also be a residual signal) to remove redundancy between images.
- transform / quantize the residual block to obtain a quantized coefficient, and perform entropy coding on the quantized coefficient to obtain a code stream.
- the quantization coefficients need to be inverse quantized / inverse transformed to obtain the residual block.
- the residual block and the prediction block are added to obtain a reconstructed block (a loop can be performed before the reconstructed block is obtained Road filtering).
- intra-frame prediction can be performed from different directions using the encoded reconstruction block (reconstruction information) as reference information, and then the residual signal is transformed so that the energy of the residual signal is further concentrated, and then quantized Use a larger quantization step size for high-frequency signals and a smaller quantization step size for low-frequency signals to ensure that there is no loss of basic image information.
- encoding information such as quantization coefficients and coding modes is obtained by entropy decoding the code stream (binary code stream information), and the residual blocks are obtained after inverse quantization / inverse transformation of the quantized coefficients.
- the residual block is added to the intra prediction block and then loop filtered to obtain the final reconstruction speed.
- the generated reconstruction block will also be used in the subsequent intra prediction process of other image blocks.
- a direction diagram is shown for intra prediction using 67 intra-angle modes, as shown in FIG. 3. More dense angles can bring better prediction results.
- the number of angle modes for intra prediction has increased from 33 to 65 in HEVC.
- the mode number When the mode number is 0, it indicates a planar mode; when the mode number is 1, , Indicates the DC mode; the plane mode and the DC mode do not involve the prediction direction, and are called non-directional prediction modes; when the mode number is 2-66, it represents the angle prediction mode (also known as the directional prediction mode), and different mode numbers represent Different prediction angles are shown.
- the prediction angle corresponding to the prediction mode of the mode number 2-66 is indicated by a solid line or a dotted line.
- the denser angular directions can more effectively capture the texture boundaries in any direction in natural video, and can use more reference information for rate distortion cost selection, so that more suitable intra prediction modes can be found to more accurately predict the current encoding.
- Block which makes the predicted block closer to the original coded block, and fewer bits need to be transmitted to encode the current block, resulting in higher coding performance.
- these 67 intra-modes are used on coding blocks of all sizes, including luminance components and chrominance components.
- FIG. 4 is a schematic flowchart of an inverse transform method according to an embodiment of the present application.
- the method shown in FIG. 4 may be executed by a decoding device.
- the method shown in FIG. 4 includes steps 110 to 130.
- the steps 110 to 130 are described in detail below.
- operations such as entropy decoding on the code stream can be used to obtain the residual coefficient of the current block, the intra prediction mode, and the target transformation check and determination parameters.
- the above-mentioned target transformation check determination parameter is information used to determine the target transformation check of the residual coefficient of the current block.
- the target transformation check determination parameter can directly indicate only the target transformation check through a single message, or the target transformation check determination parameter can also The multiple parameters are used to collectively indicate the target transformation check.
- the above parsing the bitstream to obtain the residual coefficient of the current block may specifically refer to firstly parsing the quantized coefficient from the bitstream, and then dequantizing the quantized coefficient to obtain the residual coefficient, which can be used for inverse transformation.
- the second transformation check is the first candidate transformation check or the second change candidate transformation check.
- the first candidate transformation check and the second change candidate transformation check both include a transformation kernel DST-VII.
- the candidate transformation check corresponds to the intra prediction mode corresponding to the current block.
- the first candidate transformation check is (DST-VII, DCT-VIII), and the second candidate transformation check is (DCT-VIII, DST-VII); when the mode of the intra prediction mode corresponding to the residual block is When the number is less than or equal to a preset threshold, the second transformation check is a first candidate transformation check; when the mode number of the intra prediction mode corresponding to the residual block is greater than the preset threshold, the first transformation The collation is a second candidate transformation collation.
- the preset threshold is N.
- the target transformation check may be determined through a mapping relationship or a corresponding relationship between the parameter value of the target transformation check determination parameter and the transformation check.
- determining a target transformation check corresponding to the target transformation check determination parameter from the first transformation check, the second transformation check, and the third transformation check includes: determining the parameter value of the parameter and the target transformation according to the target transformation check. The mapping relationship between the parameter value of the determined parameter and the transformation check is checked, and the target transformation check is determined.
- the target transformation check determination parameters are respectively the first parameter value to the third parameter value, they correspond to the first transformation check to the third transformation check, respectively. Then, when the decoding end resolves that the target transformation check determination parameter is the first parameter value, it can directly determine that the target transformation check is the first transformation check.
- the corresponding relationship between the parameter values of the target transformation check determination parameters and the transformation check can be shown in Table 1.
- Table 1 after the decoder obtains the parameter values of the target transformation check determination parameters, it can directly map according to Table 1. Relationship determination target transformation check.
- the mapping relationship shown in Table 1 can be stored at the encoding end and the decoding end. After the encoding end determines the target transformation check, the parameter value of the target transformation check corresponding to the target transformation check can be written into the code stream. The decoding end can determine the target transformation check through the parsed target transformation check to determine the parameter values of the determined parameters and the mapping relationship shown in Table 1.
- the target transformation checks the parameter values of the determined parameters Target transformation check First parameter value First transformation check Second parameter value Second transformation check Third parameter value Third transformation check
- the correspondence between the parameter values of the target transformation check determination parameter and the transformation check can be shown in Table 2. As shown in Table 2, when the parameter values of the target transformation check determination parameter value are 0, 10 and 11, respectively, the corresponding target transformations are The checks are (DCT-II, DCT-II), (DST-VII, DCT-VIII), and (DST-VII, DST-VII).
- the target transformation checks the parameter values of the determined parameters Target transformation check 0 DCT-II, DCT-II 10 DST-VII, DCT-VIII 11 DST-VII, DST-VII
- Tables 1 and 2 are merely examples of a manifestation of the correspondence between the parameter values of the target transformation check determination parameters and the transformation check.
- the specific form is not limited, as long as there is a certain correspondence between the parameter values of the parameters determined by the target transformation check and the transformation check.
- the target transformation check determination parameter includes a first flag bit, or the target transformation check determination parameter includes a first flag bit and a transformation index value.
- determining, from the first transformation check, the second transformation check, and the third transformation check, the target transformation check corresponding to the determination parameter corresponding to the target transformation check specifically includes the following process:
- the first flag bit is an explicit multiple core transform (EMT) flag bit.
- EMT explicit multiple core transform
- the first value is 0, and the second value is 1.
- the value of the EMT flag when the value of the EMT flag is 0, it means that a single-core inverse transformation is used when the inverse transformation is performed on the residual coefficient (correspondingly, the single-core transformation is also used when the encoding end is transformed); A value of 1 indicates that a multi-core inverse transform is used when inverse transforming the residual coefficient (correspondingly, the multi-core transform is also used when the encoding end performs the transform).
- the first transformation check is a transformation check composed of the same transformation kernel.
- the types of the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check may be a part of the five transformation kernels defined in the JEM.
- the group of transform kernels are specifically DCT-II, DCT-V, DCT-VIII, DST-1 and DST-VII.
- the basic information of the five sets of transformation kernels is shown in Table 3.
- the total number of types of the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check is less than 5.
- the storage space occupied by storing the transformation kernel can be reduced.
- the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check include DCT-II, DCT-VIII, and DST-VII.
- mapping relationship between the first flag bit, the transformation index value, and the target transformation check
- specific form of the correspondence relationship may be a table
- the correspondence between the first flag bit, the transformation index value, and the target transformation check may be shown in Table 4.
- the first transformation index value is 0, and the second transformation index value is 1.
- first transformation index value and the second transformation index value may also be 1 and 0, respectively, and the first and second values may also be 1 and 0, respectively.
- the length of the codeword corresponding to the first transformation index value and the second transformation index value is both 1.
- the codeword corresponding to the first transformation index value is 0, and the codeword corresponding to the second transformation index value is 1.
- Table 6 is obtained by adding the codewords corresponding to the first transformation index value and the second transformation index value to Table 5.
- the lengths of the codewords corresponding to the transformation index value are all 1, which can reduce the number of occupied bits required to indicate the transformation index value.
- codewords corresponding to the first transformation index value and the second transformation index value may also be 1 and 0, respectively.
- the third transformation check is (DST-VII, DST-VII), and the first transformation check is (DCT-II, DTC-II).
- the second transformation check may be determined according to the intra prediction mode corresponding to the current block. Specifically, when the mode number of the intra prediction mode is less than or equal to 34, the second transformation check in Table 7 is (DST-VII, DCT-VIII); when the mode number of the intra prediction mode is greater than 34, Table 7 The second transformation check in (DST-VII, DCT-VIII).
- the second transformation check corresponding to each intra prediction mode can also be determined by looking up the table. For example, after the intra prediction mode corresponding to the current block is known, the foregoing second transformation check may be determined according to the correspondence between the prediction mode number of the intra prediction mode and the index number of the transformation check in Table 8 below.
- Table 8 contains a total of 35 intra prediction modes.
- the mode number of the intra prediction mode is 0-34.
- Table 7 contains three kinds of transformation checks. These three kinds of transformation checks are represented by the numbers 0-2, which are represented by 0-2. The transformation check is as follows:
- transform check 0 (DST-VII, DCT-VIII);
- transformation check 1 transformation check 1, ie (DCT-VIII, DST-VII);
- the former transformation kernel represents a horizontal transformation kernel
- the latter transformation kernel represents a vertical transformation kernel
- the former may represent a vertical transformation kernel
- the latter may represent a horizontal transformation kernel
- the second transformation check in Table 7 can be determined according to the relationship in Table 8.
- the first transformation check to the third transformation check use 4 kinds of transformation check (including DCT-II, DCT-II), but for each prediction mode, there are only 3 transformation check options available, and only 3 RDOs are required when encoding at the encoding end, thereby reducing encoding time Overhead.
- the mapping relationship between the transformation check and the prediction mode is more flexible (as can be seen from Table 7, for the angle prediction mode, 0 and 1 alternately appear), you can Achieve better performance with the same encoding time overhead.
- the mirror DST-VII can also be used to replace DCT-VIII in this scheme.
- the types of transformation kernels used have been reduced from three to two, namely DCT-II and DST-VII.
- the types of transform kernels are reduced, the memory occupied by the encoding kernel and the decoder to store the transform kernels can be reduced.
- the method shown in FIG. 4 further includes: determining an intra prediction mode corresponding to the residual block as a directional prediction mode.
- the candidate transformation check of the residual block is obtained according to step 120.
- the method shown in FIG. 4 further includes: determining that the width and height of the residual block are both less than or equal to M.
- M can be set according to the situation during the transformation, for example, M can be 64.
- the transformation effect can be improved.
- (DCT-II, DTC-II) is determined as the target transformation check.
- the method shown in FIG. 4 may be applicable to any intra prediction mode, that is, in the directional prediction mode or the non-directional prediction mode, the candidate transformation check of the residual block may be directly obtained according to step 120.
- the method of determining the candidate transformation check of the residual block in step 120 may only be applicable to the directional prediction mode, and for the non-directional prediction mode, a preset transformation check may be directly adopted as the target transformation check.
- the method shown in FIG. 4 further includes: when the intra prediction mode corresponding to the residual block is a DC mode, determining a transformation check (DCT-II, DTC-II) as a target transformation check.
- a transformation check DCT-II, DTC-II
- the method shown in FIG. 4 further includes: when the intra prediction mode corresponding to the residual block is a planar mode, determining a transformation check (DST-VII, DST-VII) as a target transformation check.
- a transformation check DST-VII, DST-VII
- the intra prediction mode is a DC mode or a planar mode
- the process of determining the target transformation kernel can be simplified and the time required for the inverse transformation can be reduced.
- a transformation check (DST-VII, DST-VII) is determined as the target transformation check.
- N can be 4, 8, and 16, etc. Further, the value of N can be a multiple of 4.
- the intra prediction mode is a planar mode
- other preset transformation checks can be used as the target transformation check, for example, the transformation check (DCT- II, DTC-II) is determined as the target transformation check.
- FIG. 5 is a schematic flowchart of an inverse transform method according to an embodiment of the present application.
- the method shown in FIG. 5 may be executed by a decoding device.
- the method shown in FIG. 5 includes steps 210 to 230.
- the steps 210 to 230 are described in detail below.
- information such as the residual coefficient of the current block and the target transformation check and determination parameters can be obtained by performing entropy decoding on the code stream.
- the above-mentioned target transformation check determination parameter is information used to determine the target transformation check of the residual coefficient of the current block.
- the target transformation check determination parameter can directly indicate only the target transformation check through a single message, or the target transformation check determination parameter can also The multiple parameters are used to collectively indicate the target transformation check.
- the above parsing the bitstream to obtain the residual coefficient of the current block may specifically refer to firstly parsing the quantized coefficient from the bitstream, and then dequantizing the quantized coefficient to obtain the residual coefficient, which can be used for inverse transformation.
- the second transformation check, the third transformation check, and the fourth transformation check each include a transformation kernel DST-VII, the second transformation check, the third transformation check, and the fourth transformation check.
- a transformation check includes the transformation kernel DCT-VIII.
- the target transformation check may be determined through a mapping relationship or a corresponding relationship between the parameter value of the target transformation check determination parameter and the transformation check.
- determining a target transformation check corresponding to the target transformation check determination parameter from the first transformation check, the second transformation check, the third transformation check, and the fourth transformation check includes: determining the parameter according to the target transformation check.
- the parameter value and the target transformation check determine the mapping relationship between the parameter value of the parameter and the transformation check to determine the target transformation check.
- the target transformation check determination parameters are respectively the first parameter value to the fourth parameter value, they correspond to the first transformation check to the fourth transformation check, respectively. Then, when the decoding end resolves that the target transformation check determination parameter is the second parameter value, it can directly determine that the target transformation check is the second transformation check.
- the corresponding relationship between the parameter values of the target transformation check determination parameters and the transformation check can be shown in Table 9.
- the mapping relationship shown in Table 9 can be stored at the encoding end and the decoding end. After the encoding end determines the target transformation check, the parameter value of the target transformation check corresponding to the target transformation check can be written into the code stream. The decoding end can determine the target transformation check through the parsed target transformation check to determine the parameter values of the determined parameters and the mapping relationship shown in Table 9.
- the target transformation checks the parameter values of the determined parameters Target transformation check First parameter value First transformation check Second parameter value Second transformation check Third parameter value Third transformation check Fourth parameter value Fourth transformation check
- the first transformation check is (DCT-II, DTC-II)
- the second transformation check is (DST-VII, DST-VII)
- the third transformation check is (DCT-VIII, DST-VII).
- the four transform checks are (DST-VII, DCT-VIII).
- the target transformation checks the parameter values of the determined parameters Target transformation check 0 DCT-II, DTC-II 01 DST-VII, DST-VII 10 DCT-VIII, DST-VII 11 DST-VII, DCT-VIII
- Tables 9 and 10 are merely examples of a manifestation of the correspondence between the parameter values of the target transformation check determination parameters and the transformation check.
- the specific form is not limited, as long as there is a certain correspondence between the parameter values of the parameters determined by the target transformation check and the transformation check.
- the target transformation check determination parameter When the target transformation check determination parameter collectively indicates the target transformation check through multiple parameters, the multiple parameters in the target transformation check determination parameter may be obtained first, and then the target transformation is determined according to the correspondence between the multiple parameters and the target transformation check. Check.
- the target transformation check determination parameter includes a first flag bit, or the target transformation check determination parameter includes a first flag bit and a transformation index value.
- determining a target transformation check corresponding to the target transformation check determination parameter from the first transformation check, the second transformation check, the third transformation check, and the fourth transformation check specifically includes the following process:
- the total number of types of transformation kernels included in the first transformation check, the second transformation check, the third transformation check, and the fourth transformation check is less than 5.
- the storage space occupied by storing the transformation kernel can be reduced.
- the transformation kernels included in the first transformation check, the first candidate transformation check, the second candidate transformation check, and the third transformation check include DCT-II, DCT-VIII, and DST-VII.
- mapping relationship between the first flag bit, the transformation index value, and the target transformation check
- specific form of the correspondence relationship may be a table
- the correspondence between the first flag bit, the transformation index value, and the target transformation check may be shown in Table 11.
- the target transformation check when the first flag bit is the first value, the target transformation check only has a corresponding relationship with the first flag bit, and the target transformation check is the first transformation check.
- the first flag bit is the second value, there is a corresponding relationship between the target transformation check and the first flag bit and the transformation index value.
- the first flag bit is the second value and the transformation index value is the first
- the target transformation check corresponding to the transformation index value, the second transformation index value, and the third transformation index value are respectively a second transformation check, a third transformation check, and a fourth transformation check.
- first value and the second value may also be 1 and 0, respectively, and the first transformation index value to the third transformation index value may also be other values.
- the first flag is an EMT flag.
- the value of the EMT flag when the value of the EMT flag is 0, it means that a single-core inverse transformation is used when the inverse transformation is performed on the residual coefficient (correspondingly, the single-core transformation is also used when the encoding end is transformed); A value of 1 indicates that a multi-core inverse transform is used when inverse transforming the residual coefficient (correspondingly, the multi-core transform is also used when the encoding end performs the transform).
- the first transformation check is a transformation check composed of the same transformation kernel.
- the length of the codeword corresponding to the first transformation index value is 1, and the length of the codeword corresponding to the second transformation index value and the third transformation index value are both 2.
- the codeword corresponding to the first transformation index value is 0, the codeword corresponding to the second transformation index value is 10, and the codeword corresponding to the third transformation index value is 11.
- the first flag bit is the EMT flag bit
- the first to third transformation index values are 0, 1, 2
- the codewords of the three index values are 0, 10, and 11, respectively
- the first flag bit is The correspondence between the transformation index value and the target transformation check.
- codewords corresponding to the second transformation index value and the third transformation index value may also be 10 and 01, respectively.
- the first transformation check is (DCT-II, DTC-II)
- the second transformation check is (DST-VII, DST-VII)
- the third transformation check is (DCT-VIII, DST-VII).
- the four transform checks are (DST-VII, DCT-VIII).
- Table 14 can be obtained by filling the first transformation check and the fourth transformation check into Table 13.
- the target transformation check can be determined through the determined target transformation check determination parameters, and the inverse transformation of the residual coefficient can be realized according to the target transformation check.
- first candidate transformation check and the second transformation check both include a transformation kernel DST-VII, it is possible to increase the possibility of including the transformation kernel DST-VII in the final target transformation check, so that in the target transformation check, A better inverse transform effect may be obtained when inverse transforming the residual coefficients.
- the intra prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error tends to gradually increase from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. Using DST-VII for transformation and inverse transformation can achieve better results.
- the method shown in FIG. 5 further includes: determining an intra prediction mode corresponding to the current block as a directional prediction mode.
- the method shown in FIG. 5 further includes: determining that the width and height of the residual block are both less than or equal to M.
- (DCT-II, DTC-II) is determined as the target transformation check.
- the value of M is 64.
- the method shown in FIG. 5 further includes: when the intra prediction mode corresponding to the current block is a DC mode, determining a transform check (DCT-II, DTC-II) as the target transform Check.
- DCT-II transform check
- DTC-II transform check
- the above method further includes: determining a transformation check (DST-VII, DST-VII) as the target transformation check if the intra prediction mode corresponding to the current fast mode is a plane mode.
- the inverse transformation can be simplified by directly using a preset transformation check, which can simplify the process of determining the target transformation kernel and reduce the time required for the inverse transformation.
- a transformation check (DST-VII, DST-VII) is determined as the target transformation Check.
- N can be 4, 8, and 16 and so on.
- the horizontal and vertical transformation kernels corresponding to the index values 0,1,2 both use at least one DST-VII transformation kernel, and the index value 3 indicates that neither the horizontal or vertical transformation kernels use DST-VII transformation kernels.
- the index value 0 corresponds to the (DST-VII, DST-VII) transform kernel, and its proportion is obviously higher than the index values 1,2,3. This is because intra prediction uses the top and left reference pixels to predict the current block. The prediction error tends to gradually increase from top to bottom from left to right.
- the DST-VII transform kernel is suitable for this type of residual signal. .
- this application provides a new mapping relationship.
- the candidate transformation kernel corresponding to the EMT flag of 0 is still a transformation check (DCT-II, DCT-II), and a new transformation check is added.
- the number of types is reduced to three, as shown in Table 17.
- Table 17 for the newly added transform kernels, at least one DST-VII transform kernel is used for the horizontal and vertical transform kernels according to the proportion of the transform kernels.
- the transformation index value is 0, the codeword is 0, and the index values of 1 and 2 correspond to the codewords of 10 and 11, respectively.
- the horizontal and vertical transformation kernels are both DST-VII transformation kernels; for an index value of 1, the horizontal transformation kernel is DST-VII, and the vertical transformation kernel is not a DST-VII transformation kernel; for an index value of 2, horizontal transformation The kernel is not a DST-VII transformation kernel, and the vertical transformation kernel is DST-VII; for a combination of transformation kernels with an index value of 3, the traversal process with an index value of 3 is skipped because it has the lowest ratio.
- the number of traversals can be reduced and the coding time can be reduced by using the table shown in Table 17.
- some transformation index values can correspond to one codeword, which can save the occupation of the transformation index value. Bits.
- the newly added transformation kernel in Table 17 above can be selected by querying the relationship between the residual block and the corresponding candidate transformation kernel.
- the above-mentioned newly added transform kernels can be selected according to Tables 18 and 19.
- Transform candidate set Candidate transformation kernel 0 DST-VII, DCT-VIII 1 DST-VII, DST-I 2 DST-VII, DCT-V
- transformation candidate set 0 contains candidate transformation kernels DST-VII, DCT-VIII
- transformation candidate set 2 contains candidate transformation kernels DST-VII, DCT-V.
- transformations can be selected from transformation candidate set 0
- a transformation kernel DCT-V is selected from the transformation candidate set 2 to form a new transformation kernel.
- transform kernels there may be three types of transform kernels, namely, DCT-II, DCT-VIII, and DST-VII.
- the use of the transform kernel can only depend on the transform index value, and has nothing to do with the intra prediction mode, as shown in Table 20.
- DCT-VIII in the above table 20 can also be replaced with other transformation kernels with similar characteristics, such as DCT-V, or a variant based on DST-VII, such as DST-VII after flipping. (This is because the characteristics of the DST-VII transformation kernel after mirror transformation are similar to those of DCT-VIII. It should be understood that the mirror transformation here can be used to do left-right mirroring or up-down mirroring.
- transformation kernels can also be reduced to two.
- the two transformation kernels are DCT-II and DST-VII, as shown in Table 21.
- FIG. 6 is a schematic flowchart of an inverse transform method according to an embodiment of the present application.
- the method shown in FIG. 6 can be executed by a decoding device.
- the method shown in FIG. 6 includes steps 1001 to 1010. Steps 1001 to 1010 are described in detail below.
- Step 1001 indicates that after the residual coefficients of the current block are obtained, the target transformation check corresponding to the residual coefficients is started, so as to perform inverse transformation on the residual coefficients according to the target transformation check.
- the residual coefficient of the current block can be obtained by analyzing the code stream.
- the value of N can be set to 64 or other values.
- step 1003 When at least one of W and H of the residual block is greater than N, step 1003 is performed, and when both of W and H of the residual block are less than or equal to N, step 1004 is performed.
- the intra prediction mode here is the intra prediction mode corresponding to the current block, and specifically refers to the intra prediction mode corresponding to the encoding end when performing intra prediction.
- Step 1005 is performed when the intra prediction mode is a directional prediction mode; step 1007 is performed when the intra prediction mode is a non-directional prediction mode.
- step 1003 is performed to determine (DCT-II, DCT-II) as the target conversion check; when the EMT flag is 1, step 1006 is performed.
- step 1006 the target transformation check may be specifically determined according to steps 120 and 220 in the method shown in FIG. 4 and FIG. 5, and the specific process is not described repeatedly.
- Step 1008 is performed when the intra prediction mode is a DC mode, and step 1009 is performed when the intra prediction mode is not a DC mode (the intra prediction mode is a planar mode at this time).
- the prediction value of the coded block is obtained by averaging the reference pixel values, the DC mode is suitable for a large area with a flat area, and the DCT-II transform kernel is suitable for such residual signals. Therefore, when the intra prediction mode is the DC mode , Determining (DCT-II, DTC-II) as the target transformation check can improve the transformation effect, and can reduce the number of bits required to indicate the target transformation check in the DC mode.
- the number of non-zero coefficients may also be comprehensively considered to determine the target transformation check.
- process shown in FIG. 6 may only be an example of a process of inverse transform performed by a decoder, and the process shown in FIG. 6 may include only a part of a process performed by an encoder.
- the inverse transform method of the embodiment of the present application is described in detail above with reference to FIGS. 4 to 6.
- the transform method of the embodiment of the present application is described below with reference to FIGS. 7 to 9. It should be understood that the The transformation method corresponds to the inverse transformation method shown in FIGS. 4 to 6.
- the transformation method according to the embodiment of the present application will be described in detail below with reference to FIGS. 7 to 9.
- FIG. 7 is a schematic flowchart of a conversion method according to an embodiment of the present application.
- the method shown in FIG. 7 may be executed by a coding end device.
- the method shown in FIG. 7 includes steps 310 to 350.
- the steps 310 to 350 are described in detail below.
- the above residual block may be obtained by making a difference between the current block (current image block) and the prediction block of the current block according to the process shown in FIG. 1.
- intra prediction is used. mode. Specifically, when the prediction block of the current block is obtained, and then the residual block of the current block is obtained, various intra prediction modes as shown in FIG. 3 may be adopted.
- the first mapping relationship information includes a mapping relationship of a first flag bit, a first transformation index value and a second transformation index value, and a variety of transformation checks.
- first flag bit is the first value
- second transformation index value a mapping relationship of a first flag bit, a first transformation index value and a second transformation index value, and a variety of transformation checks.
- first flag bit is the first value
- Multi-core transformation is used when the flag is the second value
- the first flag bit when the first flag bit is the first value, it corresponds to the first transformation check.
- the first transformation index value corresponds to the second transformation check.
- the first transformation bit is checked.
- the second transformation index value corresponds to the third transformation check, and the second transformation check is selected from the first candidate transformation check and the second candidate transformation check according to the intra prediction mode corresponding to the residual block, where the first candidate transformation check and The second transformation candidate transformation check all includes DST-VII.
- the transformation check in the first mapping relationship information may include at least a part of five sets of transformation kernels.
- the five sets of transformation kernels are DCT-II, DCT-V, DCT-VIII, and DST-1. And DST-VII.
- the first flag bit is an explicit multi-core transform EMT flag bit.
- the first value is 0, and the second value is 1.
- the first mapping relationship information includes an EMT flag bit.
- EMT flag bit When the value of the EMT flag bit is 0, it means that single-core transformation is used when transforming the residual block; when the value of the EMT flag bit is 1, it means that Multi-core transform is used to transform the residual block.
- the first transformation check is a transformation check composed of the same transformation kernel.
- the specific expression form of the first mapping relationship information is a table.
- the foregoing first mapping relationship information may be shown in Table 22.
- the first flag bit when the first flag bit is the first value, the first flag bit corresponds to the first transformation check, and when the first flag bit is the second value, the first flag bit corresponds to the two transformation check, and These two transformation checks correspond to the first transformation index value and the second transformation index value, respectively.
- the first transformation check may include only one kind of transformation kernel, for example, the first transformation check is (DCT-II, DCT-II).
- the third transformation check is (DST-VII, DST-VII).
- the first transformation index value is 0, the second transformation index value is 1, or the first transformation index value is 1 and the second transformation index value is 0.
- the length of the codeword corresponding to the first transformation index value and the second transformation index value is both 1.
- the lengths of the codewords corresponding to the transformation index value are all 1, which can reduce the number of occupied bits required to indicate the transformation index value.
- the codeword corresponding to the first transformation index value is 0, and the codeword corresponding to the second transformation index value is 1.
- the codeword corresponding to the first transformation index value is 1, and the codeword corresponding to the second transformation index value is 0.
- the foregoing first mapping relationship information may also be specifically shown in Table 23.
- the second transformation check in Table 2 is (DST-VII, DCT-VIII); when the mode number of the intra prediction mode is When it is greater than 34, the second transformation check in Table 2 is (DST-VII, DCT-VIII).
- the second transformation check needs to be selected according to the intra prediction mode corresponding to the residual block.
- the number of intra prediction modes is 35, including 2 non-directional prediction modes (that is, planar mode and DC mode) and 33 directional prediction modes.
- the number of intra prediction modes may be 67, including 2 non-directional prediction modes (planar mode and DC mode) and 65 directional prediction modes.
- the intra prediction modes can be divided into two or three groups, and each group of intra prediction modes corresponds to a different transformation check.
- Transform check 0 (DST-VII, DCT-VIII): when the intra prediction mode is less than or equal to N;
- Transform check 1 (DCT-VIII, DST-VII): When the intra prediction mode is greater than N.
- N is related to the number of intra prediction modes.
- transformation check 0 and transformation check 1 correspond to the first candidate transformation check and the second candidate transformation check respectively.
- the intra prediction mode may also be divided into three or more groups, each group corresponding to a kind of transformation check, and the number of the divided groups of the intra prediction mode in this application. And the correspondence relationship with the conversion check is not limited.
- each transformation kernel may be used to transform the residual block in turn and perform rate-distortion optimization (RDO) to obtain the rate distortion corresponding to each transformation check for transformation, and then check the transformation with the smallest rate distortion RDO Determined as the target transformation check.
- RDO rate-distortion optimization
- the flag information corresponding to the target transformation check may include a first flag bit and a transformation index value corresponding to the target transformation check.
- the flag information corresponding to the target transformation check includes only the first flag bit, and the value of the first flag bit is the first value; when the target transformation check is the second transformation check Or in the third transformation check, the corresponding flag information of the target transformation check includes only the first flag bit and the transformation index value.
- the target transformation check is the second transformation check
- the value of the first flag bit is the second value and the transformation is performed.
- the index value is the first transformation index value.
- the target transformation check is the third transformation check
- the value of the first flag bit is the second value and the transformation index value is the second transformation index value.
- the first mapping relationship information includes only three transformation checkups, the number of traversals can be reduced in the process of selecting a target transformation checkup, thereby reducing the time required for encoding.
- the method shown in FIG. 7 further includes: determining an intra prediction mode corresponding to the residual block as a directional prediction mode.
- the candidate transformation check of the residual block is obtained according to step 320.
- the method shown in FIG. 7 further includes: determining that the width and height of the residual block are both less than or equal to M.
- M can be set according to the situation during the transformation, for example, M can be 64.
- the transformation effect can be improved.
- (DCT-II, DTC-II) is determined as the target transformation check.
- the target transformation check when the size of the residual block is large, (DCT-II, DTC-II) is directly used as the target transformation check to perform the transformation, and when the size of the residual block is small, the target transformation is finally determined according to the first mapping relationship information.
- the kernel can achieve better transformation of residual blocks of different sizes.
- the method shown in FIG. 7 may be applicable to any intra prediction mode, that is, in the directional prediction mode or the non-directional prediction mode, the candidate transformation check of the residual block may be directly obtained according to step 320.
- the method for determining candidate transformation check of the residual block in step 320 may only be applicable to the directional prediction mode, and for the non-directional prediction mode, a preset transformation check may be directly adopted as the target transformation check.
- the method shown in FIG. 7 further includes: when the intra prediction mode corresponding to the residual block is a DC mode, determining a transformation check (DCT-II, DTC-II) as the target transformation check .
- a transformation check DCT-II, DTC-II
- the method shown in FIG. 7 further includes: when the intra prediction mode corresponding to the residual block is a planar mode, determining a transformation check (DST-VII, DST-VII) as the target transformation check .
- a transformation check DST-VII, DST-VII
- a preset transformation check can be directly used for quantization, which can save the traversal process and further reduce the time required for encoding.
- a transformation check (DST-VII, DST-VII) is determined as The target transformation check is described.
- N can be 4, 8, and 16 and so on.
- the intra prediction mode is a planar mode
- other preset transformation check may be used as the target transformation check.
- a DCT -II, DTC-II is determined as the target transformation check.
- FIG. 8 is a schematic flowchart of a conversion method according to an embodiment of the present application.
- the method shown in FIG. 8 may be executed by a coding-end device.
- the method shown in FIG. 8 includes steps 410 to 450. Steps 410 to 450 are described in detail below.
- the first mapping relationship information includes a mapping relationship of a first flag bit, a first transformation index value, a second transformation index value, a third transformation index value, and four transformation checklists.
- the first flag bit is a first value.
- Single-core transformation and multi-core transformation are respectively used for the second value and the second value.
- the first flag bit corresponds to the first transformation check when the first value is the first value, and the first transformation index value is the first flag bit when the second value is the second value.
- the second transformation index value and the third transformation index value correspond to the second transformation check, the third transformation check, and the fourth transformation check, respectively, and any one of the second to fourth transformation check includes a transformation Kernel DST-VII, at least one of the second to fourth transformation checkups includes a transformation kernel DCT-VIII.
- the first flag bit is an explicit multi-core transform EMT flag bit.
- the first value is 0, and the second value is 1.
- the first mapping relationship information includes an EMT flag bit.
- EMT flag bit When the value of the EMT flag bit is 0, it means that single-core transformation is used when transforming the residual block; when the value of the EMT flag bit is 1, it means that Multi-core transform is used to transform the residual block.
- the first transformation check is a transformation check composed of the same transformation kernel.
- the length of the codeword corresponding to the first transformation index value is 1, and the length of the codeword corresponding to the second transformation index value and the third transformation index value are both 2.
- the first to third transformation index values are 0, 1, and 2, respectively.
- the codeword corresponding to the first transformation index value is 0, the codeword corresponding to the second transformation index value is 10, and the codeword corresponding to the third transformation index value is 11.
- the codewords corresponding to the second transformation index value and the third transformation index value are 10 and 01, respectively.
- the flag information corresponding to the target transformation check may include a first flag bit and a transformation index value corresponding to the target transformation check.
- the flag information corresponding to the target transformation check includes only the first flag bit, and the value of the first flag bit is the first value; when the target transformation check is the second transformation check Or in the third transformation check, the corresponding flag information of the target transformation check includes only the first flag bit and the transformation index value.
- the target transformation check is the second transformation check
- the value of the first flag bit is the second value and the transformation is performed.
- the index value is the first transformation index value.
- the target transformation check is the third transformation check
- the value of the first flag bit is the second value and the transformation index value is the second transformation index value.
- the first mapping relationship information includes only four transformation checkups, the number of traversals can be reduced in the process of selecting a target transformation checkup, thereby reducing the time required for encoding.
- the transformation kernel DST-VII is included in each transformation check corresponding to the first flag bit being the second value, and DST-VII has a higher usage rate in intra prediction transformation, therefore, according to the A mapping relationship information can select a transformation check with a higher usage rate for transformation, which can improve the transformation effect.
- the intra-prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error gradually increases from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. The transformation using DST-VII can achieve better results.
- the first flag bit is an explicit multi-core transform EMT flag bit.
- the first value is 0, and the second value is 1.
- the first mapping relationship information includes an EMT flag bit.
- EMT flag bit When the value of the EMT flag bit is 0, it means that single-core transformation is used when transforming the residual block; when the value of the EMT flag bit is 1, it means that Multi-core transform is used to transform the residual block.
- the first transformation check is a transformation check composed of the same transformation kernel.
- the length of the codeword corresponding to the first transformation index value is 1, and the length of the codeword corresponding to the second transformation index value and the third transformation index value are both 2.
- the first to third transformation index values are 0, 1, and 2, respectively.
- the codeword corresponding to the first transformation index value is 0, the codeword corresponding to the second transformation index value is 10, and the codeword corresponding to the third transformation index value is 11.
- the codewords corresponding to the second transformation index value and the third transformation index value are 10 and 01, respectively.
- the first transformation check is (DCT-II, DTC-II)
- the second transformation check is (DST-VII, DST-VII)
- the third transformation check is (DCT-VIII, DST-VII)
- the fourth transformation check is (DST-VII, DCT-VIII).
- the method before obtaining the candidate transformation check of the residual block according to preset first mapping relationship information, the method further includes: determining an intra prediction mode corresponding to the residual block as Direction prediction mode.
- the method before obtaining candidate transformation check of the residual block according to preset first mapping relationship information, the method further includes: determining that the width and height of the residual block are both smaller than or Is equal to M.
- (DCT-II, DTC-II) is determined as the target transformation check.
- the value of M is 64.
- the target transformation check when the size of the residual block is large, (DCT-II, DTC-II) is directly used as the target transformation check to perform the transformation, and when the size of the residual block is small, the target transformation is finally determined according to the first mapping relationship information.
- the kernel can achieve better transformation of residual blocks of different sizes.
- the method further includes: in a case where an intra prediction mode corresponding to the residual block is a DC mode, determining a transform check (DCT-II, DTC-II) as the target transform Check.
- DCT-II transform check
- the above method further includes: determining a transformation check (DST-VII, DST-VII) as the target transformation when the intra prediction mode corresponding to the residual block is a planar mode. Check.
- a preset transformation check can be directly used for quantization, which can save the traversal process and further reduce the time required for encoding.
- a transformation check (DST-VII, DST-VII) is determined as The target transformation check is described.
- N can be 4, 8, and 16 and so on.
- FIG. 9 is a schematic flowchart of a conversion method according to an embodiment of the present application.
- the method shown in FIG. 9 can be executed by a coding end device.
- the method shown in FIG. 9 includes steps 2001 to 2009, and steps 2001 to 2009 are described in detail below.
- the transformation method in the embodiment of the present application is described in detail below with reference to FIG. 9.
- the method shown in FIG. 9 includes:
- Step 2001 represents the start of performing a transform operation on the residual block.
- a prediction block of the current block may be obtained through intra prediction, and then a residual block of the current block may be obtained according to the current block and the prediction block of the current block.
- the value of N can be set to 64 or other values.
- step 2003 When at least one of W and H of the residual block is greater than N, step 2003 is performed, and when both of W and H of the residual block are less than or equal to N, step 2004 is performed.
- DCT-II DCT-II
- DCT-II DCT-II
- the intra prediction mode corresponding to the residual block may be the intra prediction mode used in the process of obtaining the residual block. Specifically, the intra prediction mode corresponding to the residual block is to obtain the predicted block of the current block. The intra prediction mode used in the process.
- EMT flag can be determined before step 2004. If the EMT flag is 0, then (DCT-II, DCT-II) is directly determined as the target transformation check; when the EMT flag is 1, Go to step 2004.
- candidate transformation checks can be obtained according to the first mapping relationship information in the methods shown in FIG. 7 and FIG. 8, and then these candidate transformation checks are traversed in order to determine the transformation check with the lowest rate distortion as the target transformation Check.
- Step 2007 is performed when the intra prediction mode is the DC mode
- step 2008 is performed when the intra prediction mode is not the DC mode (the intra prediction mode is the planar mode at this time).
- the prediction value of the coded block is obtained by averaging the reference pixel values, the DC mode is suitable for a large area with a flat area, and the DCT-II transform kernel is suitable for such residual signals. Therefore, when the intra prediction mode is the DC mode , Determining (DCT-II, DTC-II) as the target transformation check can improve the transformation effect, and can reduce the number of bits required to indicate the target transformation check in the DC mode.
- the number of non-zero coefficients may be comprehensively considered to determine the target transformation check.
- process shown in FIG. 9 may only be an example of a process of transforming the encoding end, and the process shown in FIG. 9 may only include a part of the process of transforming the encoding end.
- the inverse transform method and transform method of the embodiment of the present application are described in detail above with reference to FIGS. 1 to 9.
- the inverse transform device of the embodiment of the present application is described below with reference to FIG. 10.
- the inverse transform device shown in FIG. For each step in the inverse transform method of the embodiment of the application, the limitation on the inverse transform method of the embodiment of the present application also applies to the inverse transform device shown in FIG. 10. In order to avoid unnecessary repetition, the following describes the The inverse conversion device will be described.
- FIG. 10 is a schematic block diagram of an inverse transform apparatus according to an embodiment of the present application.
- the inverse transforming apparatus 500 shown in FIG. 10 includes:
- An obtaining module 510 is configured to parse a code stream to obtain a residual coefficient, an intra prediction mode, and a target transformation check determination parameter of a current block, where the target transformation check determination parameter includes a first flag bit or the target transformation check Determining parameters include a first flag bit and a transformation index value;
- a determining module 520 is configured to:
- the transformation check is a first candidate transformation check or a second transformation candidate transformation check
- the first candidate transformation check and the second transformation candidate check include a transformation kernel DST-VII, and the first candidate transformation check and the A second change candidate transformation check corresponding to an intra prediction mode corresponding to the current block;
- An inverse transform module 530 is configured to perform inverse transform on the residual coefficient according to the target transform check to obtain a residual block.
- the target transformation check can be determined through the determined target transformation check determination parameters, and the inverse transformation of the residual coefficient can be realized according to the target transformation check.
- first candidate transformation check and the second transformation check both include a transformation kernel DST-VII, it is possible to increase the possibility of including the transformation kernel DST-VII in the final target transformation check, so that in the target transformation check, A better inverse transform effect may be obtained when inverse transforming the residual coefficients.
- the intra prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error tends to gradually increase from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. Using DST-VII for transformation and inverse transformation can achieve better results.
- the inverse transforming apparatus 500 may be configured to perform steps 110 to 130 in the method shown in FIG. 4.
- the inverse transforming apparatus 500 may also be used to execute steps 210 to 230 in the method shown in FIG. 5.
- the functions of the modules in the inverse transforming apparatus 500 are as follows:
- An obtaining module 510 is configured to parse a bitstream to obtain a residual coefficient of a current block and a target transformation check determination parameter, wherein the target transformation check determination parameter includes a first flag bit, or the target transformation check determination parameter includes a first flag Flag bit and transform index value;
- a determining module 520 is configured to:
- the second transformation check, the third transformation check, and the fourth transformation check each include a transformation kernel DST-VII, the second transformation check, the third transformation check, and the fourth transformation check.
- a transformation check includes the transformation kernel DCT-VIII;
- An inverse transform module 530 is configured to perform inverse transform on the residual coefficient according to the target transform check to obtain a residual block.
- the target transformation check can be determined through the determined target transformation check determination parameters, and the inverse transformation of the residual coefficient can be realized according to the target transformation check.
- first candidate transformation check and the second transformation check both include a transformation kernel DST-VII, it is possible to increase the possibility of including the transformation kernel DST-VII in the final target transformation check, so that in the target transformation check, A better inverse transform effect may be obtained when inverse transforming the residual coefficients.
- the intra prediction mode uses the top and right reference pixels of the current block to predict the current block, and the prediction error tends to gradually increase from top to bottom from left to right, the base of DST-VII The function is gradually increasing. Therefore, the DST-VII transformation kernel is suitable for this gradually increasing characteristic. Using DST-VII for transformation and inverse transformation can achieve better results.
- FIG. 11 is a schematic block diagram of a video decoder according to an embodiment of the present application.
- the video decoder 600 shown in FIG. 11 includes: an entropy decoding module 610, an inverse transform and inverse quantization module 620, a decoding end prediction module 630, a decoding reconstruction module 640, and a decoding end filtering module 650.
- the inverse transforming device 500 corresponds to the video decoder 600, and the inverse transforming device 500 may specifically be a decoder.
- the corresponding relationship between the inverse transforming device 500 and each module in the video decoder 600 is as follows:
- the obtaining module 510 is equivalent to the entropy decoding module 610, and is configured to obtain information such as a residual coefficient and a first flag bit;
- the determination module 520 and the inverse transform module 530 are equivalent to the inverse transform and inverse quantization module 620, and are configured to perform inverse transform on the residual coefficients to obtain residual blocks.
- FIG. 12 is a schematic block diagram of a video encoder according to an embodiment of the present application.
- the video encoder 700 shown in FIG. 12 includes an encoding end prediction module 710, a transform quantization module 720, an entropy encoding module 730, an encoding reconstruction module 740, and an encoding end filtering module 750.
- the video encoder shown in FIG. 12 can execute the transformation method in the embodiment of the present application.
- the disclosed systems, devices, and methods may be implemented in other ways.
- the device embodiments described above are only schematic.
- the division of the unit is only a logical function division.
- multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
- the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially a part that contributes to the existing technology or a 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 are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
- the aforementioned storage media include: U disks, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks, and other media that can store program codes .
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本申请提供了一种反变换方法和装置。该方法包括:解析码流以获取当前块的残差系数、帧内预测模式和目标变换核对确定参数,其中,目标变换核对确定参数包括第一标志位,或目标变换核对确定参数包括第一标志位和变换索引值;确定与目标变换核对确定参数对应的目标变换核对;根据目标变换核对,对残差系数进行反变换,得到残差块。本申请能够根据目标变换核对确定参数确定目标变换核对,进而实现对残差系数的反变换。
Description
本申请涉及视频编解码技术领域,并且更具体地,涉及一种变换方法、反变换方法及装置。
数字视频能力可并入到多种多样的装置中,包含数字电视、数字直播系统、无线广播系统、个人数字助理(personal digital assistant,PDA)、膝上型或桌上型计算机、平板计算机、电子图书阅读器、数码相机、数字记录装置、数字媒体播放器、视频游戏装置、视频游戏控制台、蜂窝式或卫星无线电电话(所谓的“智能电话”)、视频电话会议装置、视频流式传输装置及其类似者。数字视频装置实施视频压缩技术,例如,在由MPEG-2、MPEG-4、ITU-T H.263、ITU-T H.264/MPEG-4第10部分高级视频编码(AVC)定义的标准、视频编码标准H.265/高效视频编码(high efficiency video coding,HEVC)标准以及此类标准的扩展中所描述的视频压缩技术。视频装置可通过实施此类视频压缩技术来更有效率地发射、接收、编码、解码和/或存储数字视频信息。
视频压缩技术执行空间(图像内)预测和/或时间(图像间)预测以减少或去除视频序列中固有的冗余。对于基于块的视频编码,视频条带(即,视频帧或视频帧的一部分)可分割成若干图像块,所述图像块也可被称作树块、编码单元(coding unit,CU)和/或编码节点。使用关于同一图像中的相邻块中的参考样本的空间预测来编码图像的待帧内编码(I)条带中的图像块。图像的待帧间编码(P或B)条带中的图像块可使用相对于同一图像中的相邻块中的参考样本的空间预测或相对于其它参考图像中的参考样本的时间预测。图像可被称作帧,且参考图像可被称作参考帧。
在对图像块进行编码的过程中,需要对图像块进行预测、变换、量化以及熵编码,以得到编码码流。在对图像块进行预测的过程中常采用帧间预测模式或者帧内预测模式进行预测。当采用帧内预测模式进行预测时,在得到图像块的残差块之后,要根据率失真从多种变换核对中选择出最优变换核对,然后根据该最优变换核对,对残差块进行变换,得到变换系数。
因此,在对图像块进行编解码的过程中如何确定出目标变换核对,进而根据目标变换核对实现变换和反变换是一个需要解决的问题。
发明内容
本申请提供一种变换方法、反变换方法及装置,以实现对残差系数的反变换。
第一方面,提供了一种反变换方法,该方法包括:解析码流以获取当前块的残差系数、帧内预测模式和目标变换核对确定参数;从第一变换核对、第二变换核对、以及第三变换核中确定出与目标变换核对确定参数对应的目标变换核对;其中,第二变换核对为第一候 选变换核对或第二变候选变换核对,第一候选变换核对和第二变候选变换核对均包含变换核DST-VII,第一候选变换核对和第二变候选变换核对与当前块对应的帧内预测模式对应;根据目标变换核对,对残差系数进行反变换,得到残差块。
应理解,解析码流以获取当前块的残差系数具体可以是指先从码流中解析得到量化系数,然后再对量化系数进行反量化从而得到残差系数,该残差系数可以用于反变换。
本申请中,通过解析到的目标变换核对确定参数就可以确定目标变换核对,进而可以根据该目标变换核对实现对残差系数的反变换。
进一步的,由于第一候选变换核对和第二变换核对中均包含变换核DST-VII,可以使得最终确定的目标变换核对中包含变换核DST-VII的可能性增加,使得在根据目标变换核对,对残差系数进行反变换时可能会得到更好的反变换效果。
具体地,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换和反变换能够取得较好的效果。
可选地,目标变换核对确定参数包括第一标志位,或目标变换核对确定参数包括第一标志位和变换索引值。
可选地,从第一变换核对、第二变换核对以及第三变换核对中确定出与确定与目标变换核对确定参数对应的目标变换核对,包括:当第一标志位为第一取值时,确定与目标变换核对确定参数对应的目标变换核对为第一变换核对;当第一标志位为第二取值且变换索引值为第一变换索引值时,确定与目标变换核对确定参数对应的目标变换核对为第二变换核对;当第一标志位为第二取值且变换索引值为第二变换索引值时,确定与目标变换核对确定参数对应的目标变换核对为第三变换核对。
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核的种类的总数小于5。
本申请中,变换核的种类小于5时,能够减少由于存储变换核所占用的存储空间。
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核包括DCT-II,DCT-VIII和DST-VII。
可选地,目标变换核对确定参数的参数值也可以与变换核对之间有直接映射关系,这样就可以根据目标变换核对确定参数的参数值可以直接确定目标变换核。
可选地,从第一变换核对、第二变换核对以及第三变换核对中确定出与确定与目标变换核对确定参数对应的目标变换核对,包括:根据目标变换核对确定参数的参数值以及目标变换核对确定参数的参数值与变换核对之间的映射关系,确定目标变换核对。
具体地,根据目标变换核对确定参数分别为第一参数值至第三参数值时,分别对应第一变换核对至第三变换核对。那么当解码端解析到目标变换核对确定参数为第一参数值时,可以直接确定目标变换核对为第一变换核对。
可选地,上述第一标志位为显式多核变换EMT标志位。
上述EMT标志位也可以称为EMT编码标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,当EMT标志位的取值为0时表示在对残差系数进行反变换时要采用单核反 变换(相应的,编码端进行变换时采用的也是单核变换);当EMT标志位的取值为1时表示在对残差系数进行反变换时要采用多核反变换(相应的,编码端进行变换时采用的也是多核变换)。
可选地,第一变换核对为相同变换核组成的变换核对。
例如,第一变换核对为(DCT-II,DCT-II)。
在第一方面的某些实现方式中,第一候选变换核对为(DST-VII,DCT-VIII),第二候选变换核对为(DCT-VIII,DST-VII);在当前块对应的帧内预测模式的模式号小于或者等于预设阈值时,第二变换核对为第一候选变换核对;在当前块对应的帧内预测模式的模式号大于预设阈值时,第一变换核对为第二候选变换核对。
可选地,上述预设阈值为N,当采用H.265标准时,N=18,当采用是H.266标准时,N=34。
在第一方面的某些实现方式中,第三变换核对为(DST-VII,DST-VII)。
在第一方面的某些实现方式中,第一变换核对为(DCT-II,DTC-II)。
在第一方面的某些实现方式中,第一变换索引值为0,第二变换索引值为1,或者,第一变换索引值为1,第二变换索引值为0。
在第一方面的某些实现方式中,第一变换索引值和第二变换索引值对应的码字的长度均为1。
本申请中,变换索引值对应的码字的长度均为1,能够减少由于指示变换索引值所需要的占用的比特数。
可选地,第一变换索引值对应的码字为0,第二变换索引值对应的码字为1。
可选地,第一变换索引值对应的码字为1,第二变换索引值对应的码字为0。
在第一方面的某些实现方式中,在确定目标变换核对之前,上述方法还包括:确定当前块对应的帧内预测模式为方向预测模式。
在第一方面的某些实现方式中,在确定目标变换核对之前,上述方法还包括:确定当前块的宽和高均小于或者等于M。
在第一方面的某些实现方式中,在当前块的宽和高至少有一个大于M的情况下,确定(DCT-II,DTC-II)为目标变换核对。
可选地,上述M的数值为64。
本申请中,在当前块的尺寸较大的情况下直接采用(DCT-II,DTC-II)作为目标变换核对进行反变换,在当前块的尺寸较小时再根据目标变换核对确定参数最终确定目标变换核,能够灵活处理不同大小的图像块。
在第一方面的某些实现方式中,上述方法还包括:在当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为目标变换核对。
在第一方面的某些实现方式中,上述方法还包括:在当前块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
本申请中,当帧内预测模式为DC模式或者平面模式时,通过直接采用预设的变换核对进行反变换,能够简化确定目标变换核的过程,减少反变换所需要的时间。
可选地,在当前块对应的帧内预测模式为平面模式且当前块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
上述N的数值可以为4,8和16等。
由于平面模式下出现的残差呈现从左到右、从上到下依次增加的趋势,这类信号适合采用DST-VII,因此,在平面模式下采用(DST-VII,DST-VII)作为目标变换核对能够提高反变换的效果。
第二方面,提供了一种反变换方法,该方法包括:解析码流以获取当前块的残差系数和目标变换核对确定参数;从第一变换核对、第二变换核对、第三变换核对以及第四变换核对中确定出与所述目标变换核对确定参数对应的目标变换核对;其中,所述第二变换核对,所述第三变换核对和第四变换核对均包括变换核DST-VII,所述第二变换核对,所述第三变换核对和所述第四变换核对中至少一个变换核对包括变换核DCT-VIII;根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
应理解,解析码流以获取当前块的残差系数具体可以是指先从码流中解析得到量化系数,然后再对量化系数进行反量化从而得到残差系数,该残差系数可以用于反变换。
本申请中,通过解析到的目标变换核对确定参数就可以确定目标变换核对,进而可以根据该目标变换核对实现对残差系数的反变换。
进一步的,由于第一候选变换核对和第二变换核对中均包含变换核DST-VII,可以使得最终确定的目标变换核对中包含变换核DST-VII的可能性增加,使得在根据目标变换核对,对残差系数进行反变换时可能会得到更好的反变换效果。
具体地,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换和反变换能够取得较好的效果。
可选地,上述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值。
可选地,从第一变换核对、第二变换核对、第三变换核对以及第四变换核对中确定出与所述目标变换核对确定参数对应的目标变换核对,包括:当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;当第一标志位为第二取值并且所述变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对;当第一标志位为第二取值并且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;当第一标志位为第二取值并且所述变换索引值为第三变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第四变换核对。
可选地,上述第一变换核对、第二变换核对、第三变换核对以及第四变换核对中包含的变换核的种类的总数小于5。
本申请中,变换核的种类小于5时,能够减少由于存储变换核所占用的存储空间。
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核包括DCT-II,DCT-VIII和DST-VII。
可选地,从第一变换核对、第二变换核对、第三变换核对以及第四变换核对中确定出与确定与目标变换核对确定参数对应的目标变换核对,包括:根据目标变换核对确定参数的参数值以及目标变换核对确定参数的参数值与变换核对之间的映射关系,确定目标变换 核对。
具体地,目标变换核对确定参数分别为第一参数值至第四参数值时,分别对应第一变换核对至第四变换核对。这样,当解码端解析到目标变换核对确定参数为第一参数值时,可以直接确定目标变换核对为第一变换核对。
可选地,上述第一标志位为显式多核变换EMT标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,当EMT标志位的取值为0时表示在对残差系数进行反变换时要采用单核反变换(相应的,编码端进行变换时采用的也是单核变换);当EMT标志位的取值为1时表示在对残差系数进行反变换时要采用多核反变换(相应的,编码端进行变换时采用的也是多核变换)。
可选地,第一变换核对为相同变换核组成的变换核对。
采用第一变换核对进行反变换时进行的就是单核反变换。
在第二方面的某些实现方式中,第一变换索引值对应的码字的长度为1,第二变换索引值和第三变换索引值对应的码字的长度均为2。
通过将第一变换索引值的码字的长度设置为1,能够减少指示变换索引值时需要的比特位。
可选地,上述第一变换索引值至第三变换索引值分别为0,1,2。
可选地,上述第一变换索引值对应的码字为0,上述第二变换索引值对应的码字为10,上述第三变换索引值对应的码字为11。
可选地,上述第二变换索引值和第三变换索引值对应的码字分别为10和01。
在第二方面的某些实现方式中,第一变换核对为(DCT-II,DTC-II),第二变换核对为(DST-VII,DST-VII),第三变换核对为(DCT-VIII,DST-VII),第四变换核对为(DST-VII,DCT-VIII)。
本申请中,第一变换核对至第四变换核对中包含的变换核的种类为4种,小于现有JEM(H.266的参考软件模型)标准中的5种,可以减少存储变换核时占用的比特。
在第二方面的某些实现方式中,在确定所述目标变换核对之前,上述方法还包括:确定当前块对应的帧内预测模式为方向预测模式。
在第二方面的某些实现方式中在确定所述目标变换核对之前,上述方法还包括:确定当前块的宽和高均小于或者等于M。
在第二方面的某些实现方式中,在当前块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
可选地,上述M的数值为64。
在当前块的尺寸较大的情况下直接采用(DCT-II,DTC-II)作为目标变换核对进行变换,在当前块的尺寸较小时再根据目标变换核对确定参数最终确定目标变换核,能够灵活处理不同大小的图像块。
在第二方面的某些实现方式中,上述方法还包括:在当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为目标变换核对。
在第二方面的某些实现方式中,上述方法还包括:在当前块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
当帧内预测模式为DC模式或者平面模式对时,通过直接采用预设的变换核对进行反变换,能够简化确定目标变换核的过程,减少反变换所需要的时间。
可选地,在当前块对应的帧内预测模式为平面模式且当前块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
上述N的数值可以为4,8和16等。
在平面模式下出现的残差呈现从左到右、从上到下依次增加的趋势,这类信号适合采用DST-VII,因此,在平面模式下采用(DST-VII,DST-VII)作为目标变换核对能够提高反变换的效果。
第三方面,提供了一种变换方法,该方法包括:获取待处理图像块的残差块;根据预设的第一映射关系信息获取残差块的候选变换核对;从候选变换核对中选择出率失真最小的变换核对作为目标变换核对;根据目标变换核对,对残差块进行变换,得到待处理图像块的变换系数;将目标变换核对对应的变换索引值写入码流。
其中,第一映射关系信息包括第一标志位、第一变换索引值和第二变换索引值以及多种变换核对的映射关系,第一标志位为第一取值时采用单核变换,第一标志位为第二取值时采用多核变换;
此外,第一标志位为第一取值时对应第一变换核对,第一标志位为第二取值时第一变换索引值对应第二变换核对,第一标志位为第二取值时第二变换索引值对应第三变换核对,第二变换核对是根据残差块对应的帧内预测模式从第一候选变换核对和第二候选变换核对中选择得到的,其中,第一候选变换核对和第二变候选变换核对均包含DST-VII。
本申请中,由于第一映射关系信息中仅包含三个变换核对,因此,能够在选择目标变换核对的过程中减少遍历次数,从而可以减少编码所需要的时间。
可选地,上述第一标志位为显式多核变换EMT标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,第一映射关系信息包括EMT标志位,当EMT标志位的取值为0时表示在对残差块进行变换时要采用单核变换;当EMT标志位的取值为1时表示在对残差块进行变换时要采用多核变换。
可选地,第一变换核对为相同变换核组成的变换核对。
例如,第一变换核对为(DCT-II,DCT-II)。
可选地,上述第一变换索引值为0,第二变换索引值为1。
在第三方面的某些实现方式中,第一候选变换核对为(DST-VII,DCT-VIII),第二候选变换核对为(DCT-VIII,DST-VII);当残差块对应的帧内预测模式的模式号小于或者等于预设阈值时,第二变换核对为第一候选变换核对;当残差块对应的帧内预测模式的模式号大于预设阈值时,第一变换核对为第二候选变换核对。
可选地,上述预设阈值为N,当编码时采用的是H.265标准时,N=18,当编码时采用的是H.266标准时,N=34。
在第三方面的某些实现方式中,第三变换核对为(DST-VII,DST-VII)。
在第三方面的某些实现方式中,第一变换索引值为0,第二变换索引值为1,或者,第一变换索引值为1,第二变换索引值为0。
在第三方面的某些实现方式中,第一变换索引值和第二变换索引值对应的码字的长度 均为1。
本申请中,变换索引值对应的码字的长度均为1,能够减少由于指示变换索引值所需要的占用的比特数。
可选地,第一变换索引值对应的码字为0,第二变换索引值对应的码字为1。
可选地,第一变换索引值对应的码字为1,第二变换索引值对应的码字为0。
在第三方面的某些实现方式中,根据预设的第一映射关系信息获取残差块的候选变换核对之前,方法还包括:确定残差块对应的帧内预测模式为方向预测模式。
在第三方面的某些实现方式中,根据预设的第一映射关系信息获取残差块的候选变换核对之前,方法还包括:确定残差块的宽和高均小于或者等于M。
在第三方面的某些实现方式中,当残差块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
可选地,上述M的数值为64。
本申请中,当残差块的尺寸较大时直接采用(DCT-II,DTC-II)作为目标变换核对进行变换,当残差块的尺寸较小时再根据第一映射关系信息最终确定目标变换核,能够实现对不同大小的残差块进行更好的变换。
在第三方面的某些实现方式中,上述方法还包括:在残差块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为目标变换核对。
在第三方面的某些实现方式中,上述方法还包括:在残差块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
本申请中,当采用DC模式和平面模式对残差块进行量化时,可以直接采用预设的变换核对进行量化,能够节省遍历过程,进而减少编码所需要的时间。
可选地,在残差块对应的帧内预测模式为平面模式且残差块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
上述N的数值可以为4,8和16等。
第四方面,提供了一种变换方法,该方法包括:获取待处理图像块的残差块;根据预设的第一映射关系信息获取残差块的候选变换核对;从候选变换核对中选择出率失真最小的变换核对作为目标变换核对;根据目标变换核对,对残差块进行变换,得到待处理图像块的变换系数;将目标变换核对对应的变换索引值写入码流。
其中,第一映射关系信息包括第一标志位、第一变换索引值、第二变换索引值、第三变换索引值以及四种变换核对的映射关系,第一标志位为第一取值和第二取值时分别采用单核变换和多核变换,第一标志位为第一取值时对应第一变换核对,第一标志位为第二取值时第一变换索引值、第二变换索引值以及第三变换索引值分别对应第二变换核对、第三变换核对和第四变换核对,第二变换核对至第四变换核对中的任意一个变换核对包括变换核DST-VII,第二变换核对至第四变换核对中至少一个变换核对包括变换核DCT-VIII。
本申请中,由于第一映射关系信息中仅包含四个变换核对,因此,能够在选择目标变换核对的过程中减少遍历次数,从而可以减少编码所需要的时间。
进一步的,由于第一标志位为第二取值时对应的每个变换核对中都包含变换核DST-VII,而DST-VII的在帧内预测变换时的使用率较高,因此,根据第一映射关系信息能够选择使用率较高的变换核对进行变换,可以提高变换效果。
具体地,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换和反变换能够取得较好的效果。
可选地,上述第一标志位为显式多核变换(EMT:Explicit multiple core transform)标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,第一映射关系信息包括EMT标志位,当EMT标志位的取值为0时表示在对残差块进行变换时要采用单核变换;当EMT标志位的取值为1时表示在对残差块进行变换时要采用多核变换。
可选地,第一变换核对为相同变换核组成的变换核对。
在第四方面的某些实现方式中,第一变换索引值对应的码字的长度为1,第二变换索引值和第三变换索引值对应的码字的长度均为2。
可选地,上述第一变换索引值至第三变换索引值分别为0,1,2。
可选地,上述第一变换索引值对应的码字为0,上述第二变换索引值对应的码字为10,上述第三变换索引值对应的码字为11。
可选地,上述第二变换索引值和第三变换索引值对应的码字分别为10和01。
在第四方面的某些实现方式中,第一变换核对为(DCT-II,DTC-II),第二变换核对为(DST-VII,DST-VII),第三变换核对为(DCT-VIII,DST-VII),第四变换核对为(DST-VII,DCT-VIII)。
在第四方面的某些实现方式中,在根据预设的第一映射关系信息获取残差块的候选变换核对之前,方法还包括:确定残差块对应的帧内预测模式为方向预测模式。
在第四方面的某些实现方式中,在根据预设的第一映射关系信息获取残差块的候选变换核对之前,方法还包括:确定残差块的宽和高均小于或者等于M。
在第四方面的某些实现方式中,当残差块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
可选地,上述M的数值为64。
本申请中,当残差块的尺寸较大时直接采用(DCT-II,DTC-II)作为目标变换核对进行变换,当残差块的尺寸较小时再根据第一映射关系信息最终确定目标变换核,能够实现对不同大小的残差块进行更好的变换。
在第四方面的某些实现方式中,上述方法还包括:在残差块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为目标变换核对。
在第四方面的某些实现方式中,上述方法还包括:在残差块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
本申请中,当采用DC模式和平面模式对残差块进行量化时,可以直接采用预设的变换核对进行量化,能够节省遍历过程,进而减少编码所需要的时间。
可选地,在残差块对应的帧内预测模式为平面模式且残差块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
上述N的数值可以为4,8和16等。
第五方面,提供一种反变换装置,该装置包括用于执行上述第一方面或者第二方面中的任意一种实现方式中的方法的模块。
第六方面,提供一种变换装置,该装置包括用于执行上述第三方面或者第四方面中的任意一种实现方式中的方法的模块。
第七方面,提供一种解码器,包括:相互耦合的非易失性存储器和处理器,所述处理器调用存储在所述存储器中的程序代码以执行第一方面或者第二方面中的任意一种实现方式中的方法的部分或全部步骤。
第八方面,提供一种编码器,包括:相互耦合的非易失性存储器和处理器,所述处理器调用存储在所述存储器中的程序代码以执行第三方面或者第四方面中的任意一种实现方式中的方法的部分或全部步骤。
第九方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储了程序代码,其中,所述程序代码包括用于执行第一方面、第二方面、第三方面以及第四方面中的任意一种实现方式中的方法的部分或全部步骤的指令。
第十方面,提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行第一方面、第二方面、第三方面以及第四方面中的任意一种实现方式中的方法的部分或全部步骤的指令。
图1是帧内编码过程的示意性流程图;
图2是帧内解码过程的示意性流程图;
图3是各种帧内预测模式的示意图;
图4是本申请实施例的反变换方法的示意性流程图;
图5是本申请实施例的反变换方法的示意性流程图;
图6是本申请实施例的反变换方法的示意性流程图;
图7是本申请实施例的变换方法的示意性流程图;
图8是本申请实施例的变换方法的示意性流程图;
图9是本申请实施例的变换方法的示意性流程图;
图10是本申请实施例的反变换装置的示意性框图;
图11是本申请实施例的视频解码器的示意性框图;
图12是本申请实施例的视频编码器的示意性框图。
下面将结合附图,对本申请中的技术方案进行描述。
为了更好地理解本申请实施例,下面先结合图1和图2对帧内视频编码和帧内视频解码的主要过程进行简单的介绍。应理解,这里的帧内视频编码是指在对视频图像进行编码过程中采用的预测模式为帧内预测模式,帧内视频解码是指在对视频图像进行解码的过程中采用的预测模式为帧内预测模式。
如图1所示,通过对待处理图像快进行帧内预测可以得到待处理图像块的预测块,通过将待处理图像块与预测块(也可以称为预测信号)做差,可以得到残差块(也可以成为 残差信号),以去除图像之间的冗余。接下来,对残差块进行变换/量化得到量化系数,并对量化系数进行熵编码从而得到码流。同时在编码过程中还需要对量化系数进行反量化/反变换,以重新得到残差块,接下来,再对残差块和预测块相加从而得到重建块(在得到重建块之前可以进行环路滤波)。
在上述过程中,可以利用已编码的重建块(重建信息)作为参考信息从不同的方向进行帧内预测,然后对残差信号进行变换使得残差信号的能量进一步的集中,接下来再进行量化,对高频信号采用更大的量化步长,而对于低频信号使用更小的量化步长,保证图像基本信息没有损失。
如图2所示,在解码端,通过对码流(二进制码流信息)进行熵解码得到量化系数以及编码模式等编码信息,对量化系数进行反量化/反变换后得到残差块,并将残差块与帧内预测得到的预测块相加后再进行环路滤波就可以得到最终的重建快,同时生成的重建块还会用于接下来其他图像块的帧内预测过程。
在联合视频专家组(joint video experts team,JVET)正在制定的最新视频编码标准中,给出了利用67种帧内角度模式进行帧内预测时的方向示意图,如图3所示。更加密集的角度可以带来更好的预测效果,帧内预测的角度模式数量从HEVC的33种增加到65种,当模式号为0时,表示平面模式(planar);当模式号为1时,表示DC模式;平面模式和DC模式不涉及预测方向,称为非方向预测模式;当模式号为2-66时,表示角度预测模式(也可以称为方向预测模式),不同的模式号代表了不同的预测角度,如图3所示,模式号2-66的预测模式对应的预测角度用实线或者虚线表示。
更加密集的角度方向能够更加有效地捕捉到自然视频中任意方向的纹理边界,可以利用更多的参考信息进行率失真代价选择,从而可以找到更加适合的帧内预测模式来更加准确地预测当前编码块,使得预测块更加接近原始编码块,编码当前块所需要传输的比特更少,从而编码性能更高。在进行帧内编码时,这67种帧内模式运用在所有尺寸的编码块上,包括亮度分量和色度分量。
下面结合图4至图8对本申请实施例进行详细的介绍。
图4是本申请实施例的反变换方法的示意性流程图。图4所示的方法可以由解码端设备执行,图4所示的方法包括步骤110至步骤130,下面分别对步骤110至步骤130进行详细的介绍。
110、解析码流以获取当前块的残差系数、帧内预测模式和目标变换核对确定参数。
在获取到码流之后通过对码流进行熵解码等操作可以获取当前块的残差系数、帧内预测模式以及目标变换核对确定参数。
上述目标变换核对确定参数是用于确定当前块的残差系数的目标变换核对的信息,目标变换核对确定参数既可以通过单个信息来只直接指示目标变换核对,或者,目标变换核对确定参数也可以通过多个参数来共同指示目标变换核对。
上述解析码流以获取当前块的残差系数具体可以是指先从码流中解析得到量化系数,然后再对量化系数进行反量化从而得到残差系数,该残差系数可以用于反变换。
120、从第一变换核对、第二变换核对、以及第三变换核中确定出与目标变换核对确定参数对应的目标变换核对。
其中,上述第二变换核对为第一候选变换核对或第二变候选变换核对,第一候选变换 核对和第二变候选变换核对均包含变换核DST-VII,第一候选变换核对和第二变候选变换核对与当前块对应的帧内预测模式对应。
可选地,第一候选变换核对为(DST-VII,DCT-VIII),第二候选变换核对为(DCT-VIII,DST-VII);当所述残差块对应的帧内预测模式的模式号小于或者等于预设阈值时,所述第二变换核对为第一候选变换核对;当所述残差块对应的帧内预测模式的模式号大于所述预设阈值时,所述第一变换核对为第二候选变换核对。
可选地,上述预设阈值为N,当编码时采用的是H.265标准时,N=18,当编码时采用的是H.266标准时,N=34。
当上述目标变换核对确定参数通过单个信息来直接指示目标变换核对时,可以通过目标变换核对确定参数的参数值与变换核对的映射关系或者对应关系来确定目标变换核对。
可选地,从第一变换核对、第二变换核对以及第三变换核对中确定出与确定与目标变换核对确定参数对应的目标变换核对,包括:根据目标变换核对确定参数的参数值以及目标变换核对确定参数的参数值与变换核对之间的映射关系,确定目标变换核对。
具体地,目标变换核对确定参数分别为第一参数值至第三参数值时,分别对应第一变换核对至第三变换核对。那么,当解码端解析到目标变换核对确定参数为第一参数值时,可以直接确定目标变换核对为第一变换核对。
上述目标变换核对确定参数的参数值与变换核对的对应关系可以如表1所示,如表1所示,在解码端获取到了目标变换核对确定参数的参数值后,可以直接根据表1的映射关系确定目标变换核对。如表1所示的映射关系可以存储在编码端和解码端,编码端确定了目标变换核对之后,可以将该目标变换核对对应的目标变换核对确定参数的参数值写入到码流中,这样解码端通过解析到的目标变换核对确定参数的参数值以及表1所示的映射关系就可以确定目标变换核对了。
表1
目标变换核对确定参数的参数值 | 目标变换核对 |
第一参数值 | 第一变换核对 |
第二参数值 | 第二变换核对 |
第三参数值 | 第三变换核对 |
进一步地,目标变换核对确定参数的参数值与变换核对的对应关系可以如表2所示,如表2所示,目标变换核对确定参数的参数值为0,10和11时分别对应的目标变换核对为(DCT-II,DCT-II)、(DST-VII,DCT-VIII)和(DST-VII,DST-VII)。
表2
目标变换核对确定参数的参数值 | 目标变换核对 |
0 | DCT-II,DCT-II |
10 | DST-VII,DCT-VIII |
11 | DST-VII,DST-VII |
应理解,上述表1和表2只是目标变换核对确定参数的参数值与变换核对的对应关系的一种表现形式的举例,本申请对目标变换核对确定参数的参数值与变换核对的对应关系的具体形式不做限定,只要是目标变换核对确定参数的参数值与变换核对有一定的对应关系即可。
可选地,目标变换核对确定参数包括第一标志位,或目标变换核对确定参数包括第一标志位和变换索引值。
可选地,从第一变换核对、第二变换核对以及第三变换核对中确定出与确定与目标变换核对确定参数对应的目标变换核对,具体包括以下过程:
(1)当第一标志位为第一取值时,确定与目标变换核对确定参数对应的目标变换核对为第一变换核对;
(2)当第一标志位为第二取值且变换索引值为第一变换索引值时,确定与目标变换核对确定参数对应的目标变换核对为第二变换核对;
(3)当第一标志位为第二取值且变换索引值为第二变换索引值时,确定与目标变换核对确定参数对应的目标变换核对为第三变换核对。
可选地,上述第一标志位为显式多核变换(explicit multiple core transform,EMT)标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,当EMT标志位的取值为0时表示在对残差系数进行反变换时要采用单核反变换(相应的,编码端进行变换时采用的也是单核变换);当EMT标志位的取值为1时表示在对残差系数进行反变换时要采用多核反变换(相应的,编码端进行变换时采用的也是多核变换)。
可选地,第一变换核对为相同变换核组成的变换核对。
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核的种类可以JEM中定义的五组变换核中的一部分变换核,该五组变换核具体为DCT-II、DCT-V、DCT-VIII、DST-1和DST-VII。该五组变换核的基本信息如表3所示。
表3
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核的种类的总数小于5。
本申请中,变换核的种类小于5时,能够减少由于存储变换核所占用的存储空间。
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核包括DCT-II,DCT-VIII和DST-VII。
上述第一标志位、变换索引值和目标变换核对之间可以有一定的对应关系(映射关系),该对应关系的具体形式可以是表格。
例如,第一标志位、变换索引值和目标变换核对之间的对应关系可以如表4所示。
表4
由表4可知,当第一标志位为第一取值时,目标变换核对仅与第一标志位之间存在对应关系,并且,目标变换核对为第一变换核对。当第一标志位为第二取值时,目标变换核对与第一标志位以及变换索引值之间均存在对应关系,当第一标志位为第二取值时且变换索引值分别为第一变换索引值和第二变换索引值时分别对应的目标变换核对为第二变换核对和第三变换核对。
可选地,第一变换索引值为0,第二变换索引值为1。
当第一变换索引值和第二变换索引值分别为0和1,第一取值和第二取值分别为0和1时,第一标志位、变换索引值和目标变换核对之间的对应关系具体可以如表5所示。
表5
应理解,上述第一变换索引值和第二变换索引值也可以分别为1和0,第一取值和第二取值也可以分别为1和0。
可选地,所述第一变换索引值和所述第二变换索引值对应的码字的长度均为1。
可选地,第一变换索引值对应的码字为0,第二变换索引值对应的码字为1。
将第一变换索引值和第二变换索引值对应的码字加入到表5中,可以得到表6。
表6
第一标志位 | 目标变换核对 | 变换索引值 | 码字 |
0 | 第一变换核对 | N/A | N/A |
1 | 第二变换核对 | 0 | 0 |
第三变换核对 | 1 | 1 |
由表6可知,变换索引值对应的码字的长度均为1,能够减少由于指示变换索引值所需要的占用的比特数。
应理解,上述第一变换索引值和第二变换索引值对应的码字也可以分别为1和0。
可选地,第三变换核对为(DST-VII,DST-VII),第一变换核对为(DCT-II,DTC-II)。
将第一变换核对和第三变换核对所表示的具体变换核对填入到表6中,并对第二变换核对和第三变换核对的顺序做一下调整可以得到表7。
表7
如表7所示,第二变换核对可以依据当前块对应的帧内预测模式来确定。具体地,当帧内预测模式的模式号小于或者等于34时,表7中的第二变换核对为(DST-VII,DCT-VIII);当帧内预测模式的模式号大于34时,表7中的第二变换核对为(DST-VII,DCT-VIII)。
另外,还可以通过查表来确定相应的每种帧内预测模式对应的第二变换核对。例如,在获知了当前块对应的帧内预测模式后,可以根据如下的表8中帧内预测模式的预测模式号与变换核对的索引号的对应关系确定出上述第二变换核对。
表8
预测模式号 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
变换核对 | 2 | 2 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
预测模式号 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
变换核对 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
预测模式号 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | ||||
变换核对 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
表8中共包含35中帧内预测模式,帧内预测模式的模式号为0-34,表7中包含3种变换核对,这3种变换核对分别用数字0-2表示,0-2代表的变换核对具体如下:
0:变换核对0,即(DST-VII,DCT-VIII);
1:变换核对1,即(DCT-VIII,DST-VII);
2:变换核对2,即(DCT-VIII,DCT-VIII)。
在上述变换核对0至变换核对2中,前面的变换核表示水平变换核,后面的变换核表示垂直变换核。当然,也可以是前面的表示垂直变换核,后面的表示水平变换核。
假设,第一变换核对和第三变换核对如表7所示,表7中的第二变换核对可以根据表8中的关系来确定,那么,第一变换核对至第三变换核对虽然使用了4种变换核对(包括DCT-II,DCT-II),但对于每一种预测模式来讲最多只有3个变换核对可供选择,在编码端进行编码时只需要进行3次RDO,从而降低编码时间开销。这里由于更多的使用了4种变换核对,同时变换核对和预测模式之间的映射关系更加灵活(从表7中可看出,对于 角度预测模式,采用0、1交替出现的方式),可以实现在相同的编码时间开销下获得更好的性能。
此外,表8中具体变换核的选择,还可以利用镜像DST-VII来替换本方案中的DCT-VIII。这样从整个变换方案来讲,用到的变换核的种类从3种减少到了2种,即DCT-II和DST-VII。当变换核的种类减少时,能够减少编码端和解码端存储变换核所占用的内存。
130、根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
可选地,作为一个实施例,在步骤120之前,图4所示的方法还包括:确定所述残差块对应的帧内预测模式为方向预测模式。
也就是说,在图4所示的方法中,当残差块对应的帧内预测模式为方向预测模式的情况下才根据步骤120获取残差块的候选变换核对。
可选地,作为一个实施例,在步骤120之前,图4所示的方法还包括:确定所述残差块的宽和高均小于或者等于M。
M的取值可以根据变换时的情况来设置,例如,M可以为64。
通过在残差块小于一定尺寸时才根据第一映射关系信息来确定残差块的候选变换核对,能够提高变换效果。
可选地,当残差块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
本申请中,在当前块的尺寸较大的情况下直接采用(DCT-II,DTC-II)作为目标变换核对进行反变换,在当前块的尺寸较小时再根据目标变换核对确定参数最终确定目标变换核,能够灵活处理不同大小的图像块。
应理解,图4所示的方法可以适用于任何帧内预测模式,也就是说在方向预测模式或者非方向预测模式下都可以直接根据步骤120来获取残差块的候选变换核对。
或者,步骤120中确定残差块的候选变换核对的方式也可以只适用于方向预测模式,对于非方向预测模式可以直接采用预先设定的变换核对作为目标变换核对。
可选地,图4所示的方法还包括:在残差块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为目标变换核对。
可选地,图4所示的方法还包括:在残差块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
本申请中,当帧内预测模式为DC模式或者平面模式时,通过直接采用预设的变换核对进行反变换,能够简化确定目标变换核的过程,减少反变换所需要的时间。
可选地,在当前块对应的帧内预测模式为平面模式且当前块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为目标变换核对。
上述N的数值可以为4,8和16等,进一步的,N的数值可以是4的倍数。
也就是说,当帧内预测模式为平面模式时,如果当前块的宽和高至少有一个大于N时,可以采用其他预先设定的变换核对作为目标变换核对,例如,将变换核对(DCT-II,DTC-II)确定为目标变换核对。
由于平面模式下出现的残差呈现从左到右、从上到下依次增加的趋势,这类信号适合采用DST-VII,因此,在平面模式下采用(DST-VII,DST-VII)作为目标变换核对能够提高反变换的效果。
图5是本申请实施例的反变换方法的示意性流程图。图5所示的方法可以由解码端设备执行,图5所示的方法包括步骤210至步骤230,下面分别对步骤210至步骤230进行详细的介绍。
210、解析码流以获取当前块的残差系数和目标变换核对确定参数。
在获取到码流之后通过对码流进行熵解码等操作可以获取当前块的残差系数和目标变换核对确定参数等信息。
上述目标变换核对确定参数是用于确定当前块的残差系数的目标变换核对的信息,目标变换核对确定参数既可以通过单个信息来只直接指示目标变换核对,或者,目标变换核对确定参数也可以通过多个参数来共同指示目标变换核对。
上述解析码流以获取当前块的残差系数具体可以是指先从码流中解析得到量化系数,然后再对量化系数进行反量化从而得到残差系数,该残差系数可以用于反变换。
220、从第一变换核对、第二变换核对、第三变换核对以及第四变换核对中确定出与所述目标变换核对确定参数对应的目标变换核对。
其中,所述第二变换核对,所述第三变换核对和第四变换核对均包括变换核DST-VII,所述第二变换核对,所述第三变换核对和所述第四变换核对中至少一个变换核对包括变换核DCT-VIII。
当上述目标变换核对确定参数通过单个信息来直接指示目标变换核对时,可以通过目标变换核对确定参数的参数值与变换核对的映射关系或者对应关系来确定目标变换核对。
可选地,从第一变换核对、第二变换核对、第三变换核对以及第四变换核对中确定出与所述目标变换核对确定参数对应的目标变换核对,包括:根据目标变换核对确定参数的参数值以及目标变换核对确定参数的参数值与变换核对之间的映射关系,确定目标变换核对。
具体地,目标变换核对确定参数分别为第一参数值至第四参数值时,分别对应第一变换核对至第四变换核对。那么,当解码端解析到目标变换核对确定参数为第二参数值时,可以直接确定目标变换核对为第二变换核对。
上述目标变换核对确定参数的参数值与变换核对的对应关系可以如表9所示。如表9所示的映射关系可以存储在编码端和解码端,编码端确定了目标变换核对之后,可以将该目标变换核对对应的目标变换核对确定参数的参数值写入到码流中,这样解码端通过解析到的目标变换核对确定参数的参数值以及表9所示的映射关系就可以确定目标变换核对了。
表9
目标变换核对确定参数的参数值 | 目标变换核对 |
第一参数值 | 第一变换核对 |
第二参数值 | 第二变换核对 |
第三参数值 | 第三变换核对 |
第四参数值 | 第四变换核对 |
可选地,第一变换核对为(DCT-II,DTC-II),第二变换核对为(DST-VII,DST-VII),第三变换核对为(DCT-VIII,DST-VII),第四变换核对为(DST-VII,DCT-VIII)。
将第一变换核对至第四变换核对具体的变换核对添加到表9中可以得到表10,在表 10中第一参数值为0,01,10,11时分别对应的目标变换核对为(DCT-II,DTC-II),(DST-VII,DST-VII),(DCT-VIII,DST-VII),(DST-VII,DCT-VIII)。
表10
目标变换核对确定参数的参数值 | 目标变换核对 |
0 | DCT-II,DTC-II |
01 | DST-VII,DST-VII |
10 | DCT-VIII,DST-VII |
11 | DST-VII,DCT-VIII |
应理解,上述表9和表10只是目标变换核对确定参数的参数值与变换核对的对应关系的一种表现形式的举例,本申请对目标变换核对确定参数的参数值与变换核对的对应关系的具体形式不做限定,只要是目标变换核对确定参数的参数值与变换核对有一定的对应关系即可。
当目标变换核对确定参数通过多个参数来共同指示目标变换核对时,可以先获取目标变换核对确定参数中的多个参数,然后再根据该多个参数与目标变换核对的对应关系来确定目标变换核对。
可选地,目标变换核对确定参数包括第一标志位,或目标变换核对确定参数包括第一标志位和变换索引值。
可选地,从第一变换核对、第二变换核对、第三变换核对以及第四变换核对中确定出与所述目标变换核对确定参数对应的目标变换核对,具体包括以下过程:
(1)当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;
(2)当第一标志位为第二取值并且所述变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对;
(3)当第一标志位为第二取值并且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;
(4)当第一标志位为第二取值并且所述变换索引值为第三变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第四变换核对。
可选地,上述第一变换核对、第二变换核对、第三变换核对以及第四变换核对中包含的变换核的种类的总数小于5。
本申请中,变换核的种类小于5时,能够减少由于存储变换核所占用的存储空间。
可选地,上述第一变换核对、第一候选变换核对、第二候选变换核对以及第三变换核对中包含的变换核包括DCT-II,DCT-VIII和DST-VII。
上述第一标志位、变换索引值和目标变换核对之间可以有一定的对应关系(映射关系),该对应关系的具体形式可以是表格。
例如,第一标志位、变换索引值和目标变换核对之间的对应关系可以如表11所示。
表11
由表11可知,当第一标志位为第一取值时,目标变换核对仅与第一标志位之间存在对应关系,并且,目标变换核对为第一变换核对。当第一标志位为第二取值时,目标变换核对与第一标志位以及变换索引值之间均存在对应关系,当第一标志位为第二取值时且变换索引值分别为第一变换索引值、第二变换索引值时以及第三变换索引值时分别对应的目标变换核对为第二变换核对、第三变换核对和第四变换核对。
当第一变换索引值、第二变换索引值和第三变换索引值分别为0、1和2时,第一取值和第二取值分别为0和1时,第一标志位、变换索引值和目标变换核对之间的对应关系具体可以如表12所示。
表12
应理解,上述第一取值和第二取值也可以分别为1和0,上的第一变换索引值至第三变换索引值也可以是其他数值。
可选地,上述第一标志位为EMT标志位。
具体地,当EMT标志位的取值为0时表示在对残差系数进行反变换时要采用单核反变换(相应的,编码端进行变换时采用的也是单核变换);当EMT标志位的取值为1时表示在对残差系数进行反变换时要采用多核反变换(相应的,编码端进行变换时采用的也是多核变换)。
可选地,第一变换核对为相同变换核组成的变换核对。
采用第一变换核对进行反变换时进行的就是单核反变换。
可选地,第一变换索引值对应的码字的长度为1,第二变换索引值和第三变换索引值对应的码字的长度均为2。
通过将第一变换索引值的码字的长度设置为1,能够减少指示变换索引值时需要的比特位。
可选地,上述第一变换索引值对应的码字为0,上述第二变换索引值对应的码字为10,上述第三变换索引值对应的码字为11。
当第一标志位为EMT标志位,第一变换索引值至第三变换索引值分别为0,1,2,这三个索引值的码字分别为0,10,11时,第一标志位、变换索引值和目标变换核对之间的对应关系具体可以如表13所示。
表13
应理解,上述第二变换索引值和第三变换索引值对应的码字也可以分别为10和01。
可选地,第一变换核对为(DCT-II,DTC-II),第二变换核对为(DST-VII,DST-VII),第三变换核对为(DCT-VIII,DST-VII),第四变换核对为(DST-VII,DCT-VIII)。
本申请中,第一变换核对至第四变换核对中包含的变换核的种类为4种,小于现有JEM标准中的5种,可以减少存储变换核时占用的比特。
将第一变换核对和第四变换核对填入到表13中可以得到表14。
表14
230、根据目标变换核对,对所述残差系数进行反变换,得到残差块。
本申请中,通过解析到的目标变换核对确定参数就可以确定目标变换核对,进而可以根据该目标变换核对实现对残差系数的反变换。
进一步的,由于第一候选变换核对和第二变换核对中均包含变换核DST-VII,可以使得最终确定的目标变换核对中包含变换核DST-VII的可能性增加,使得在根据目标变换核对,对残差系数进行反变换时可能会得到更好的反变换效果。
具体地,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换和反变换能够取得较好的效果。
可选地,作为一个实施例,在确定所述目标变换核对之前,图5所示的方法还包括:确定当前块对应的帧内预测模式为方向预测模式。
可选地,作为一个实施例,在确定所述目标变换核对之前,图5所示的方法还包括:确定残差块的宽和高均小于或者等于M。
可选地,作为一个实施例,当残差块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
可选地,上述M的数值为64。
本申请中,在当前块的尺寸较大的情况下直接采用(DCT-II,DTC-II)作为目标变换核对进行变换,在当前块的尺寸较小时再根据目标变换核对确定参数最终确定目标变换核,能够灵活处理不同大小的图像块。
可选地,作为一个实施例,图5所示方法还包括:在当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
可选地,作为一个实施例,上述方法还包括:在当前快对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
本申请中,当帧内预测模式为DC模式或者平面模式对时,通过直接采用预设的变换核对进行反变换,能够简化确定目标变换核的过程,减少反变换所需要的时间。
可选地,在当前块对应的帧内预测模式为平面模式且残差块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
上述N的数值可以为4,8和16等。
在平面模式下出现的残差呈现从左到右、从上到下依次增加的趋势,这类信号适合采用DST-VII,因此,在平面模式下采用(DST-VII,DST-VII)作为目标变换核对能够提高反变换的效果。
现有的JEM标准中EMT标志位、候选变换核,变换索引值以及码字的对应情况如表15所示。
表15
由于现有方案中当EMT标志位为0核1时共对应五种变换核对,因此,在进行率失真优化的过程中需要进行五次遍历,这将可能导致最终的编码时间的增加。
通过对各种变换索引值对应的变换核对以及变换核对(DCT-II,DCT-II)的统计发现,不同的变换核对的占比情况相差较大,如表16所示,变换核对(DCT-II,DCT-II)的占比最高,达到了43.8%,索引值3的占比最小,只有7.2%。通过分析发现,在所有帧内预测模式在多核变换中,索引值0至索引值3对应的变换核对的占比依次占比呈下降趋势。
其中,索引值0,1,2对应的水平和垂直变换核都至少采用了一个DST-VII变换核,而索引值3表示的是水平和垂直变换核都没有采用DST-VII变换核。索引值0对应于(DST-VII,DST-VII)变换核,它的占比显然高于索引值1,2,3。这是因为帧内预测利用上边和左边的参考像素对当前块进行预测,预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII变换核适用于这类残差信号。
表16
变换核对 | DCT-II,DCT-II | 索引值0 | 索引值1 | 索引值2 | 索引值3 |
平均占比 | 43.8% | 23.2% | 12.8% | 13.0% | 7.2% |
因此,本申请提供了一种新的映射关系,在该映射关系中,EMT标志位为0时对应的候选变换核仍为变换核对(DCT-II,DCT-II),而新增的变换核对的种类减少至3种,具体如表17所示。在表17中,对于新增变换核,根据变换核的占比情况采用了水平和垂直变换核至少使用一个DST-VII变换核。另外,在表17中,变换索引值为0时对应码字0,索引值为1和2分别对应码字为10和11。
对于索引值为0,水平和垂直变换核都是DST-VII变换核;对于索引值为1,水平变换核是DST-VII,垂直变换核不是DST-VII变换核;对于索引值2,水平变换核不是DST-VII变换核,垂直变换核为DST-VII;对于索引值为3的变换核组合,由于占比最低,故跳过索引值为3的遍历过程。
因此,在编码端进行变换过程中通过采用表17所示的表格能够减少遍历次数,减少编码时间,另外,某些变换索引值可以对应1个码字,能够节省表示变换索引值时的占用的比特。
表17
上述表17中的新增变换核可以通过查询残差块与相应的候选变换核之间的关系来选择新增变换核。
例如,上述新增变换核可以根据表18和表19来选择。
表18
变换候选集 | 候选变换核 |
0 | DST-VII,DCT-VIII |
1 | DST-VII,DST-I |
2 | DST-VII,DCT-V |
表19
例如,当残差块对应的帧内预测模式的模式号为51时,根据表19确定水平方向对应的变换候选集为2,垂直方向上对应的变换候选集为0。如表18所示,变换候选集0包含候选变换核DST-VII,DCT-VIII,变换候选集2包含候选变换核DST-VII,DCT-V,那么,可以从变换候选集0中选择出变换核DST-VII,从变换候选集2中选择出变换核DCT-V组成新增变换核,这两种新增变换核有三种组合情况,这三种情况分别对应索引值0至索引值2。
在进行变换时,当变换核的种类较多时,存储这些变换核时需要占用一定的内存开销。为了减小内存开销,可以通过减少变换核种类来降低变换核的存贮开销以及变换实现复杂度。
可选地,变换核的种类可以有三种,分别为DCT-II,DCT-VIII和DST-VII。在这种情况下,变换核的使用可以仅仅取决于变换索引值,与帧内预测模式无关,具体如表20所示。
表20
需要说明的是,上述表20中的DCT-VIII也可以替换成其他类似特性的变换核,如DCT-V,或者,基于DST-VII的某种变形如镜像变换(flip)后的DST-VII(这是因为镜像变换后的DST-VII变换核的特性与DCT-VIII的相似,应理解,这里的镜像变换可以表示做左右镜像也可以是做上下镜像。
进一步的,也可以将变换核的种类减少到两种,这两种变换核为DCT-II和DST-VII,具体如表21所示。
表21
上文分别结合图4和图5对本申请实施例的反变换方法进行了详细的介绍,下面结合图6对解码端执行反变换的过程进行详细的介绍。
图6是本申请实施例的反变换方法的示意性流程图。图6所示的方法可以由解码端设备执行,图6所示的方法包括步骤1001至步骤1010,下面分别对步骤1001至步骤1010进行详细的介绍。
1001、开始。
步骤1001表示在获取到了当前块的残差系数之后,开始获取残差系数对应的目标变换核对,以便根据目标变换核对,对残差系数进行反变换。
应理解,当前块的残差系数可以通过解析码流获取。
1002、确定当前块的宽(W)和高(H)是否均小于或者等于N。
N的数值可以设置为64或者其它数值。
当残差块的W和H至少有一个大于N时,执行步骤1003,当残差块的W和H均小于或者等于N时,执行步骤1004。
1003、将(DCT-II,DCT-II)确定为目标变换核对。
1004、确定帧内预测模式是否为方向预测模式。
应理解,这里的帧内预测模式时当前块对应的帧内预测模式,具体地,是指编码端在进行帧内预测时对应的帧内预测模式。
当帧内预测模式为方向预测模式时执行步骤1005;当帧内预测模式为非方向预测模式时执行步骤1007。
1005、确定EMT标志位(或者也可以称为EMT编码标志位)是否为1。
当EMT标志位不为1时(例如,为0时),执行步骤1003,将(DCT-II,DCT-II)确定为目标变换核对;当EMT标志位为1时,执行步骤1006。
1006、获取变换索引值,将变换索引值对应的变换核对确定为目标变换核对。
应理解,在步骤1006中,具体可以根据图4和图5所示的方法中的步骤120和步骤220来确定目标变换核对,具体过程不再重复描述。
1007、确定帧内预测模式是否为DC模式。
当帧内预测模式为DC模式时执行步骤1008,当帧内预测模式不是DC模式时(此时帧内预测模式为平面模式)执行步骤1009。
1008、将(DCT-II,DTC-II)确定为目标变换核对。
1009、将(DST-VII,DST-VII)确定为目标变换核对。
由于编码块的预测值是由参考像素值平均得到,因此DC模式适合于大面积平坦的区域,而DCT-II变换核适合于这类残差信号,因此,当帧内预测模式为DC模式时,将(DCT-II,DTC-II)确定为目标变换核对能够提高变换效果,并且在DC模式下能够减少指示目标变换核对所需要的比特数。
1010、根据目标变换核对,对残差系数进行反变换,得到残差块。
应理解,在图6中确定目标变换核对的过程中,还可以综合考虑非零系数的个数来确定目标变换核对。
此外,图6所示的过程可以只是解码端进行反变换的流程的一种示例,图6所示的过程可以仅包含编码端进行变换的部分过程。
上文结合图4至图6对本申请实施例的反变换方法进行了详细的描述,下面结合图7至图9对本申请实施例的变换方法进行描述,应理解,图7至图9所示的变换方法与图4 至图6所示的反变换方法是对应的,下面结合图7至图9对本申请实施例的变换方法进行详细的描述。
图7是本申请实施例的变换方法的示意性流程图。图7所示的方法可以由编码端设备执行,图7所示的方法包括步骤310至步骤350,下面分别对步骤310至步骤350进行详细的介绍。
310、获取待处理图像块的残差块。
上述残差块可以是根据图1所示的过程通过对当前块(当前图像块)与当前块的预测块进行做差得到的,在得到该当前块的预测块的过程中采用是帧内预测模式。具体地,在得到当前块的预测块,进而得到当前块的残差块时,可以采用如图3所示的各种帧内预测模式。
320、根据预设的第一映射关系信息获取所述残差块的候选变换核对。
其中,第一映射关系信息包括第一标志位、第一变换索引值和第二变换索引值以及多种变换核对的映射关系,第一标志位为第一取值时采用单核变换,第一标志位为第二取值时采用多核变换;
此外,第一标志位为第一取值时对应第一变换核对,第一标志位为第二取值时第一变换索引值对应第二变换核对,第一标志位为第二取值时第二变换索引值对应第三变换核对,第二变换核对是根据残差块对应的帧内预测模式从第一候选变换核对和第二候选变换核对中选择得到的,其中,第一候选变换核对和第二变候选变换核对均包含DST-VII。
可选地,在上述第一映射关系信息中的变换核对中可以包含五组变换核中的至少一部分变换核,这五组变换核为DCT-II、DCT-V、DCT-VIII、DST-1和DST-VII。
可选地,上述第一标志位为显式多核变换EMT标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,第一映射关系信息包括EMT标志位,当EMT标志位的取值为0时表示在对残差块进行变换时要采用单核变换;当EMT标志位的取值为1时表示在对残差块进行变换时要采用多核变换。
可选地,第一变换核对为相同变换核组成的变换核对。
可选地,上述第一映射关系信息具体表现形式为表格。
例如,上述第一映射关系信息可以如表22所示。
表22
由表22可知,当第一标志位为第一取值时,第一标志位对应第一变换核对,当第一标志位为第二取值时,第一标志位对应两个变换核对,并且这两个变换核对分别对应第一变换索引值和第二变换索引值。
应理解,上述第一变换核对可以仅包含一种变换核,例如,上述第一变换核对为(DCT-II,DCT-II)。
可选地,上述第三变换核对为(DST-VII,DST-VII)。
可选地,第一变换索引值为0,第二变换索引值为1,或者,第一变换索引值为1,第二变换索引值为0。
可选地,所述第一变换索引值和所述第二变换索引值对应的码字的长度均为1。
本申请中,变换索引值对应的码字的长度均为1,能够减少由于指示变换索引值所需要的占用的比特数。
可选地,第一变换索引值对应的码字为0,第二变换索引值对应的码字为1。
可选地,第一变换索引值对应的码字为1,第二变换索引值对应的码字为0。
上述第一映射关系信息具体还可以如表23所示。
表23
以编码标准H.266为例,当帧内预测模式的模式号小于或者等于34时,表2中的第二变换核对为(DST-VII,DCT-VIII);当帧内预测模式的模式号大于34时,表2中的第二变换核对为(DST-VII,DCT-VIII)。
在图7所示的方法中,第二变换核对需要根据残差块对应的帧内预测模式来选择。
在H.265标准中,帧内预测模式的数量为35个,包含2个非方向预测模式(即平面模式和DC模式)和33个方向预测模式。
对于正在制定的H.266标准,帧内预测模式数量可能为67个,包含2个非方向预测模式(平面模式和DC模式)和65个方向预测模式。可以将帧内预测模式分成2组或者3组,每组帧内预测模式对应不同的变换核对。
例如,一种可能的方案如下:
变换核对0:(DST-VII,DCT-VIII):帧内预测模式小于等于N时;
变换核对1:(DCT-VIII,DST-VII):帧内预测模式大于N时。
N的取值与帧内预测模式的数量有关。对于H265标准,N可取2+(34-2)/2=18,对于正在制定中的H266标准,N可取2+(66-2)/2=34。
上述变换核对0和变换核对1分别相当于上文中的第一候选变换核对和第二候选变换核对。
应理解,在对帧内预测模式进行划分时,还可以将帧内预测模式划分成3组或者更多的组,每组对应一种变换核对,本申请对帧内预测模式的划分组的数目以及与变换核对的对应关系不做限定。
330、从所述候选变换核对中选择出率失真最小的变换核对作为目标变换核对。
应理解,可以依次采用各个变换核对残差块进行变换,并进行率失真优化(rate-distortion optimization,RDO),得到各个变换核对进行变换时对应的率失真,然后将率失真RDO最小的变换核对确定为目标变换核对。
340、根据所述目标变换核对,对所述残差块进行变换,得到所述待处理图像块的变 换系数。
350、将目标变换核对对应的标志信息写入码流。
应理解,目标变换核对对应的标志信息可以包括目标变换核对对应的第一标志位以及变换索引值。具体地,目标变换核对为第一变换核对时,目标变换核对对应的标志信息仅包含第一标志位,且第一标志位的取值为第一取值;当目标变换核对为第二变换核对或者第三变换核对时,目标变换核对对应的标志信息仅包含第一标志位和变换索引值,当目标变换核对为第二变换核对时,第一标志位的取值为第二取值且变换索引值为第一变换索引值,当目标变换核对为第三变换核对时,第一标志位的取值为第二取值且变换索引值为第二变换索引值。
本申请中,由于第一映射关系信息中仅包含三个变换核对,因此,能够在选择目标变换核对的过程中减少遍历次数,从而可以减少编码所需要的时间。
可选地,作为一个实施例,在步骤320之前,图7所示的方法还包括:确定所述残差块对应的帧内预测模式为方向预测模式。
也就是说,在图7所示的方法中,当残差块对应的帧内预测模式为方向预测模式的情况下才根据步骤320获取残差块的候选变换核对。
可选地,作为一个实施例,在步骤320之前,图7所示的方法还包括:确定所述残差块的宽和高均小于或者等于M。
M的取值可以根据变换时的情况来设置,例如,M可以为64。
通过在残差块小于一定尺寸时才根据第一映射关系信息来确定残差块的候选变换核对,能够提高变换效果。
可选地,当残差块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
本申请中,当残差块的尺寸较大时直接采用(DCT-II,DTC-II)作为目标变换核对进行变换,当残差块的尺寸较小时再根据第一映射关系信息最终确定目标变换核,能够实现对不同大小的残差块进行更好的变换。
应理解,图7所示的方法可以适用于任何帧内预测模式,也就是说在方向预测模式或者非方向预测模式下都可以直接根据步骤320来获取残差块的候选变换核对。
或者,步骤320中确定残差块的候选变换核对的方式也可以只适用于方向预测模式,对于非方向预测模式可以直接采用预先设定的变换核对作为目标变换核对。
可选地,图7所示的方法还包括:在所述残差块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
可选地,图7所示的方法还包括:在所述残差块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
本申请中,当采用DC模式和平面模式对残差块进行量化时,可以直接采用预设的变换核对进行量化,能够节省遍历过程,进而减少编码所需要的时间。
可选地,在所述残差块对应的帧内预测模式为平面模式且残差块的宽和高均小于或者等于N的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
上述N的数值可以为4,8和16等。
也就是说,当帧内预测模式为平面模式时,如果残差块的宽和高至少有一个大于N时, 可以采用其他预先设定的变换核对作为目标变换核对,例如,将变换核对(DCT-II,DTC-II)确定为目标变换核对。
图8是本申请实施例的变换方法的示意性流程图。图8所示的方法可以由编码端设备执行,图8所示的方法包括步骤410至步骤450,下面分别对步骤410至步骤450进行详细的介绍。
410、获取待处理图像块的残差块。
420、根据预设的第一映射关系信息获取所述残差块的候选变换核对。
其中,所述第一映射关系信息包括第一标志位、第一变换索引值、第二变换索引值、第三变换索引值以及四种变换核对的映射关系,第一标志位为第一取值和第二取值时分别采用单核变换和多核变换,所述第一标志位为第一取值时对应第一变换核对,所述第一标志位为第二取值时第一变换索引值、第二变换索引值以及第三变换索引值分别对应第二变换核对、第三变换核对和第四变换核对,所述第二变换核对至所述第四变换核对中的任意一个变换核对包括变换核DST-VII,所述第二变换核对至所述第四变换核对中至少一个变换核对包括变换核DCT-VIII。
可选地,上述第一标志位为显式多核变换EMT标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,第一映射关系信息包括EMT标志位,当EMT标志位的取值为0时表示在对残差块进行变换时要采用单核变换;当EMT标志位的取值为1时表示在对残差块进行变换时要采用多核变换。
可选地,第一变换核对为相同变换核组成的变换核对。
可选地,第一变换索引值对应的码字的长度为1,第二变换索引值和第三变换索引值对应的码字的长度均为2。
可选地,上述第一变换索引值至第三变换索引值分别为0,1,2。
可选地,上述第一变换索引值对应的码字为0,上述第二变换索引值对应的码字为10,上述第三变换索引值对应的码字为11。
可选地,上述第二变换索引值和第三变换索引值对应的码字分别为10和01。
430、从所述候选变换核对中选择出率失真最小的变换核对作为目标变换核对;
440、根据所述目标变换核对对所述残差块进行变换,得到所述待处理图像块的变换系数。
450、将目标变换核对对应的标志信息写入码流。
应理解,目标变换核对对应的标志信息可以包括目标变换核对对应的第一标志位以及变换索引值。具体地,目标变换核对为第一变换核对时,目标变换核对对应的标志信息仅包含第一标志位,且第一标志位的取值为第一取值;当目标变换核对为第二变换核对或者第三变换核对时,目标变换核对对应的标志信息仅包含第一标志位和变换索引值,当目标变换核对为第二变换核对时,第一标志位的取值为第二取值且变换索引值为第一变换索引值,当目标变换核对为第三变换核对时,第一标志位的取值为第二取值且变换索引值为第二变换索引值。
本申请中,由于第一映射关系信息中仅包含四个变换核对,因此,能够在选择目标变换核对的过程中减少遍历次数,从而可以减少编码所需要的时间。进一步的,由于第一标 志位为第二取值时对应的每个变换核对中都包含变换核DST-VII,而DST-VII的在帧内预测变换时的使用率较高,因此,根据第一映射关系信息能够选择使用率较高的变换核对进行变换,可以提高变换效果。
进一步的,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换能够取得较好的效果。
可选地,上述第一标志位为显式多核变换EMT标志位。
可选地,上述第一取值为0,第二取值为1。
具体地,第一映射关系信息包括EMT标志位,当EMT标志位的取值为0时表示在对残差块进行变换时要采用单核变换;当EMT标志位的取值为1时表示在对残差块进行变换时要采用多核变换。
可选地,第一变换核对为相同变换核组成的变换核对。
可选地,作为一个实施例,所述第一变换索引值对应的码字的长度为1,所述第二变换索引值和第三变换索引值对应的码字的长度均为2。
可选地,上述第一变换索引值至第三变换索引值分别为0,1,2。
可选地,上述第一变换索引值对应的码字为0,上述第二变换索引值对应的码字为10,上述第三变换索引值对应的码字为11。
可选地,上述第二变换索引值和第三变换索引值对应的码字分别为10和01。
可选地,所述第一变换核对为(DCT-II,DTC-II),所述第二变换核对为(DST-VII,DST-VII),所述第三变换核对为(DCT-VIII,DST-VII),所述第四变换核对为(DST-VII,DCT-VIII)。
可选地,作为一个实施例,在根据预设的第一映射关系信息获取所述残差块的候选变换核对之前,所述方法还包括:确定所述残差块对应的帧内预测模式为方向预测模式。
可选地,作为一个实施例,在根据预设的第一映射关系信息获取所述残差块的候选变换核对之前,所述方法还包括:确定所述残差块的宽和高均小于或者等于M。
可选地,作为一个实施例,当残差块的宽和高至少有一个大于M时,确定(DCT-II,DTC-II)为目标变换核对。
可选地,上述M的数值为64。
本申请中,当残差块的尺寸较大时直接采用(DCT-II,DTC-II)作为目标变换核对进行变换,当残差块的尺寸较小时再根据第一映射关系信息最终确定目标变换核,能够实现对不同大小的残差块进行更好的变换。
可选地,作为一个实施例,上述方法还包括:在所述残差块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
可选地,作为一个实施例,上述方法还包括:在所述残差块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
本申请中,当采用DC模式和平面模式对残差块进行量化时,可以直接采用预设的变换核对进行量化,能够节省遍历过程,进而减少编码所需要的时间。
可选地,在所述残差块对应的帧内预测模式为平面模式且残差块的宽和高均小于或者 等于N的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
上述N的数值可以为4,8和16等。
上文分别结合图7和图8对本申请实施例的变换方法进行了详细的介绍,下面结合图9对编码端执行变换的过程进行详细的介绍。
图9是本申请实施例的变换方法的示意性流程图。图9所示的方法可以由编码端设备执行,图9所示的方法包括步骤2001至步骤2009,下面分别对步骤2001至步骤2009进行详细的介绍。
下面结合图9对本申请实施例的变换方法进行详细的介绍。图9所示的方法包括:
2001、开始。
步骤2001表示开始对残差块执行变换操作。在进行变换操作之前可以是通过帧内预测得到当前块的预测块,然后再根据当前块以及当前块的预测块来得到当前块的残差块。2002、确定残差块的宽(W)和高(H)是否均小于或者等于N。
N的数值可以设置为64或者其它数值。
当残差块的W和H至少有一个大于N时,执行步骤2003,当残差块的W和H均小于或者等于N时,执行步骤2004。
2003、将(DCT-II,DCT-II)确定为目标变换核对。
当残差块的尺寸较大时,采用(DCT-II,DCT-II)对残差块进行变换能够取得较好的变换效果。
2004、确定残差块对应的帧内预测模式是否为方向预测模式。
应理解,残差块对应的帧内预测模式可以是在得到残差块的过程中所采用的帧内预测模式,具体地,残差块对应的帧内预测模式是在得到当前块的预测块的过程中采用的帧内预测模式。
应理解,在步骤2004之前还可以先确定EMT标志位,如果当EMT标志位为0,那么就直接将(DCT-II,DCT-II)确定为目标变换核对;当EMT标志位为1时,执行步骤2004。
2005、遍历多种变换核对,将率失真最小的变换核对确定为目标变换核对。
在步骤2005中,具体可以根据图7和图8所示的方法中的第一映射关系信息来获取候选变换核对,然后再依次遍历这些候选变换核对,将率失真最小的变换核对确定为目标变换核对。
2006、确定帧内预测模式是否为DC模式。
当帧内预测模式为DC模式时执行步骤2007,当帧内预测模式不是DC模式时(此时帧内预测模式为平面模式)执行步骤2008。
2007、将(DCT-II,DTC-II)确定为目标变换核对。
由于编码块的预测值是由参考像素值平均得到,因此DC模式适合于大面积平坦的区域,而DCT-II变换核适合于这类残差信号,因此,当帧内预测模式为DC模式时,将(DCT-II,DTC-II)确定为目标变换核对能够提高变换效果,并且在DC模式下能够减少指示目标变换核对所需要的比特数。
2008、将(DST-VII,DST-VII)确定为目标变换核对。
2009、根据目标变换核对,对残差块进行变换,得到变换系数。
应理解,在图9所示的过程中,在确定目标变换核对时还可以综合考虑非零系数的个数来确定目标变换核对。
应理解,图9所示的过程可以只是编码端进行变换的流程的一种示例,图9所示的过程可以仅包含编码端进行变换的部分过程。
上文结合图1至图9对本申请实施例的反变换方法和变换方法进行了详细介绍,下面结合图10对本申请实施例的反变换装置进行介绍,图10所示的反变换装置能够执行本申请实施例的反变换方法中的各个步骤,上文中对本申请实施例的反变换方法的限定同样也适用于图10所示的反变换装置,为了避免不必要的重复,下面对本申请实施例的反变换装置进行介绍。
图10是本申请实施例的反变换装置的示意性框图。图10所示的反变换装置500包括:
获取模块510,用于解析码流以获取当前块的残差系数、帧内预测模式和目标变换核对确定参数,其中,所述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值;
确定模块520,所述确定模块520用于:
当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;
当所述第一标志位为第二取值且变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对,其中,所述第二变换核对为第一候选变换核对或第二变候选变换核对,所述第一候选变换核对和所述第二变候选变换核对均包含变换核DST-VII,所述第一候选变换核对和所述第二变候选变换核对与所述当前块对应的帧内预测模式对应;
当所述第一标志位为第二取值且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;
反变换模块530,用于根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
本申请中,通过解析到的目标变换核对确定参数就可以确定目标变换核对,进而可以根据该目标变换核对实现对残差系数的反变换。
进一步的,由于第一候选变换核对和第二变换核对中均包含变换核DST-VII,可以使得最终确定的目标变换核对中包含变换核DST-VII的可能性增加,使得在根据目标变换核对,对残差系数进行反变换时可能会得到更好的反变换效果。
具体地,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换和反变换能够取得较好的效果。
也就是说,反变换装置500可以用于执行上述图4所示的方法中的步骤110至步骤130。
可选地,上述反变换装置500也可以用于执行上述图5所示的方法中的步骤210至步骤230。
具体地,当反变换装置500执行上述图5所示的方法中的步骤210至步骤230时,反 变换装置500中的各个模块的作用具体如下:
获取模块510,用于解析码流以获取当前块的残差系数和目标变换核对确定参数,其中,所述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值;
确定模块520,所述确定模块520用于:
当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;
当第一标志位为第二取值并且所述变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对;
当第一标志位为第二取值并且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;
当第一标志位为第二取值并且所述变换索引值为第三变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第四变换核对;
其中,所述第二变换核对,所述第三变换核对和第四变换核对均包括变换核DST-VII,所述第二变换核对,所述第三变换核对和所述第四变换核对中至少一个变换核对包括变换核DCT-VIII;
反变换模块530,用于根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
本申请中,通过解析到的目标变换核对确定参数就可以确定目标变换核对,进而可以根据该目标变换核对实现对残差系数的反变换。
进一步的,由于第一候选变换核对和第二变换核对中均包含变换核DST-VII,可以使得最终确定的目标变换核对中包含变换核DST-VII的可能性增加,使得在根据目标变换核对,对残差系数进行反变换时可能会得到更好的反变换效果。
具体地,由于帧内预测模式时利用当前块的上边和右边的参考像素对当前块进行预测,并且预测误差有从上到下从左到右依次逐渐增大的趋势,而DST-VII的基函数是逐渐增大的,因此,DST-VII变换核适合这种逐渐增大的特性,采用DST-VII进行变换和反变换能够取得较好的效果。
图11是本申请实施例的视频解码器的示意性框图。
图11所示的视频解码器600包括:熵解码模块610、反变换反量化模块620、解码端预测模块630、解码重建模块640和解码端滤波模块650。
可选的,上述反变换装置500与视频解码器600是对应的,反变换装置500具体可以是一个解码器。其中,反变换装置500与视频解码器600中的各个模块的对应关系如下:
获取模块510相当于熵解码模块610,用于获取残差系数和第一标志位等信息;
确定模块520和反变换模块530相当于反变换反量化模块620,用于实现对残差系数进行反变换,得到残差块。
图12是本申请实施例的视频编码器的示意性框图。
图12所示的视频编码器700包括:编码端预测模块710、变换量化模块720、熵编码模块730、编码重建模块740和编码端滤波模块750。图12所示的视频编码器能够执行本申请实施例的变换方法。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变换或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
Claims (28)
- 一种反变换方法,其特征在于,包括:解析码流以获取当前块的残差系数、帧内预测模式和目标变换核对确定参数,其中,所述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值;当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;当所述第一标志位为第二取值且变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对,其中,所述第二变换核对为第一候选变换核对或第二变候选变换核对,所述第一候选变换核对和所述第二变候选变换核对均包含变换核DST-VII,所述第一候选变换核对和所述第二变候选变换核对与所述当前块对应的帧内预测模式对应;当所述第一标志位为第二取值且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
- 如权利要求1所述的方法,其特征在于,所述第一候选变换核对为(DST-VII,DCT-VIII),第二候选变换核对为(DCT-VIII,DST-VII);当所述当前块对应的帧内预测模式的模式号小于或者等于预设阈值时,所述第二变换核对为所述第一候选变换核对;当所述当前块对应的帧内预测模式的模式号大于所述预设阈值时,所述第二变换核对为所述第二候选变换核对。
- 如权利要求1或2所述的方法,其特征在于,所述第三变换核对为(DST-VII,DST-VII)。
- 如权利要求1-3中任一项所述的方法,其特征在于,所述第一变换索引值和所述第二变换索引值对应的码字的长度均为1。
- 如权利要求1-4中任一项所述的方法,其特征在于,所述第一变换核对为(DCT-II,DTC-II)。
- 如权利要求1-5中任一项所述的方法,其特征在于,在确定所述目标变换核对之前,所述方法还包括:确定所述当前块对应的帧内预测模式为方向预测模式。
- 如权利要求1所述的方法,其特征在于,所述方法还包括:在所述当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
- 如权利要求如权利要求1所述的方法,其特征在于,所述方法还包括:在所述当前块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
- 一种反变换方法,其特征在于,包括:解析码流以获取当前块的残差系数和目标变换核对确定参数,其中,所述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值;当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;当第一标志位为第二取值并且所述变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对;当第一标志位为第二取值并且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;当第一标志位为第二取值并且所述变换索引值为第三变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第四变换核对;其中,所述第二变换核对,所述第三变换核对和第四变换核对均包括变换核DST-VII,所述第二变换核对,所述第三变换核对和所述第四变换核对中至少一个变换核对包括变换核DCT-VIII;根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
- 如权利要求9所述的方法,其特征在于,所述第一变换索引值对应的码字的长度为1,所述第二变换索引值和第三变换索引值对应的码字的长度均为2。
- 如权利要求9或10所述的方法,其特征在于,所述第一变换核对为(DCT-II,DTC-II),所述第二变换核对为(DST-VII,DST-VII),所述第三变换核对为(DCT-VIII,DST-VII),所述第四变换核对为(DST-VII,DCT-VIII)。
- 如权利要求9-11中任一项所述的方法,其特征在于,在确定所述目标变换核对之前,所述方法还包括:确定所述当前块对应的帧内预测模式为方向预测模式。
- 如权利要求9所述的方法,其特征在于,所述方法还包括:在所述当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
- 如权利要求9所述的方法,其特征在于,所述方法还包括:在所述当前块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
- 一种反变换装置,其特征在于,包括:获取模块,用于解析码流以获取当前块的残差系数、帧内预测模式和目标变换核对确定参数,其中,所述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值;确定模块,所述确定模块用于:当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;当所述第一标志位为第二取值且变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对,其中,所述第二变换核对为第一候选变换核对或第二变候选变换核对,所述第一候选变换核对和所述第二变候选变换核对均 包含变换核DST-VII,所述第一候选变换核对和所述第二变候选变换核对与所述当前块对应的帧内预测模式对应;当所述第一标志位为第二取值且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;反变换模块,用于根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
- 如权利要求15所述的装置,其特征在于,所述第一候选变换核对为(DST-VII,DCT-VIII),第二候选变换核对为(DCT-VIII,DST-VII);当所述当前块对应的帧内预测模式的模式号小于或者等于预设阈值时,所述第二变换核对为所述第一候选变换核对;当所述当前块对应的帧内预测模式的模式号大于所述预设阈值时,所述第二变换核对为所述第二候选变换核对。
- 如权利要求15或16所述的装置,其特征在于,所述第三变换核对为(DST-VII,DST-VII)。
- 如权利要求15-17中任一项所述的装置,其特征在于,所述第一变换索引值和所述第二变换索引值对应的码字的长度均为1。
- 如权利要求15-18中任一项所述的装置,其特征在于,所述第一变换核对为(DCT-II,DTC-II)。
- 如权利要求15-19中任一项所述的装置,其特征在于,在确定所述目标变换核对之前,所述确定模块还用于:确定所述当前块对应的帧内预测模式为方向预测模式。
- 如权利要求15所述的装置,其特征在于,所述确定模块还用于:在所述当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
- 如权利要求如权利要求15所述的装置,其特征在于,所述确定模块还用于:在所述当前块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
- 一种反变换装置,其特征在于,包括:获取模块,用于解析码流以获取当前块的残差系数和目标变换核对确定参数,其中,所述目标变换核对确定参数包括第一标志位,或所述目标变换核对确定参数包括第一标志位和变换索引值;确定模块,所述确定模块用于:当所述第一标志位为第一取值时,确定与所述目标变换核对确定参数对应的目标变换核对为第一变换核对;当第一标志位为第二取值并且所述变换索引值为第一变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第二变换核对;当第一标志位为第二取值并且所述变换索引值为第二变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第三变换核对;当第一标志位为第二取值并且所述变换索引值为第三变换索引值时,确定与所述目标变换核对确定参数对应的目标变换核对为第四变换核对;其中,所述第二变换核对,所述第三变换核对和第四变换核对均包括变换核DST-VII,所述第二变换核对,所述第三变换核对和所述第四变换核对中至少一个变换核对包括变换核DCT-VIII;反变换模块,用于根据所述目标变换核对,对所述残差系数进行反变换,得到残差块。
- 如权利要求23所述的装置,其特征在于,所述第一变换索引值对应的码字的长度为1,所述第二变换索引值和第三变换索引值对应的码字的长度均为2。
- 如权利要求22或23所述的装置,其特征在于,所述第一变换核对为(DCT-II,DTC-II),所述第二变换核对为(DST-VII,DST-VII),所述第三变换核对为(DCT-VIII,DST-VII),所述第四变换核对为(DST-VII,DCT-VIII)。
- 如权利要求23-25中任一项所述的装置,其特征在于,在确定所述目标变换核对之前,所述确定模块还用于:确定所述当前块对应的帧内预测模式为方向预测模式。
- 如权利要求23所述的装置,其特征在于,所述确定模块还用于:在所述当前块对应的帧内预测模式为DC模式的情况下,确定变换核对(DCT-II,DTC-II)为所述目标变换核对。
- 如权利要求23所述的装置,其特征在于,所述确定模块还用于:在所述当前块对应的帧内预测模式为平面模式的情况下,确定变换核对(DST-VII,DST-VII)为所述目标变换核对。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2018/093923 WO2020000487A1 (zh) | 2018-06-30 | 2018-06-30 | 变换方法、反变换方法及装置 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2018/093923 WO2020000487A1 (zh) | 2018-06-30 | 2018-06-30 | 变换方法、反变换方法及装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020000487A1 true WO2020000487A1 (zh) | 2020-01-02 |
Family
ID=68985695
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/093923 WO2020000487A1 (zh) | 2018-06-30 | 2018-06-30 | 变换方法、反变换方法及装置 |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2020000487A1 (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130003828A1 (en) * | 2011-07-01 | 2013-01-03 | Cohen Robert A | Method for Selecting Transform Types From Mapping Table for Prediction Modes |
CN104469488A (zh) * | 2014-12-29 | 2015-03-25 | 北京奇艺世纪科技有限公司 | 视频解码方法及系统 |
CN107241599A (zh) * | 2011-10-19 | 2017-10-10 | 株式会社Kt | 解码视频信号的方法 |
US20180020218A1 (en) * | 2016-07-15 | 2018-01-18 | Qualcomm Incorporated | Look-up table for enhanced multiple transform |
-
2018
- 2018-06-30 WO PCT/CN2018/093923 patent/WO2020000487A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130003828A1 (en) * | 2011-07-01 | 2013-01-03 | Cohen Robert A | Method for Selecting Transform Types From Mapping Table for Prediction Modes |
CN107241599A (zh) * | 2011-10-19 | 2017-10-10 | 株式会社Kt | 解码视频信号的方法 |
CN104469488A (zh) * | 2014-12-29 | 2015-03-25 | 北京奇艺世纪科技有限公司 | 视频解码方法及系统 |
US20180020218A1 (en) * | 2016-07-15 | 2018-01-18 | Qualcomm Incorporated | Look-up table for enhanced multiple transform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102292592B1 (ko) | 영상 복호화 방법 및 장치 | |
CN111819852B (zh) | 用于变换域中残差符号预测的方法及装置 | |
TWI755376B (zh) | 用於視訊寫碼之濾波器之幾何轉換 | |
KR102271143B1 (ko) | 스킵 모드를 이용한 영상 복호화 방법 및 이러한 방법을 사용하는 장치 | |
CN111819854B (zh) | 用于协调多符号位隐藏和残差符号预测的方法和装置 | |
KR102393179B1 (ko) | 복원 블록을 생성하는 방법 및 장치 | |
US20150063452A1 (en) | High efficiency video coding (hevc) intra prediction encoding apparatus and method | |
GB2488830A (en) | Encoding and decoding image data | |
US20230087855A1 (en) | Picture coding method, picture decoding method, and related apparatuses | |
CN111801941B (zh) | 用于利用自适应乘数系数进行图像滤波的方法及装置 | |
WO2021185257A1 (zh) | 图像编码方法、图像解码方法及相关装置 | |
JP7384974B2 (ja) | 適応乗算係数を用いた画像フィルタリングのための方法および装置 | |
WO2021244197A1 (zh) | 图像编码方法、图像解码方法及相关装置 | |
CN113597757A (zh) | 具有区域数自适应的几何划分的形状自适应离散余弦变换 | |
JP2023107803A (ja) | 符号化方法、復号化方法、デコーダ、エンコーダー及び記憶媒体 | |
CN114071161B (zh) | 图像编码方法、图像解码方法及相关装置 | |
WO2022022622A1 (zh) | 图像编码方法、图像解码方法及相关装置 | |
WO2020000487A1 (zh) | 变换方法、反变换方法及装置 | |
WO2023154359A1 (en) | Methods and devices for multi-hypothesis-based prediction | |
KR101307469B1 (ko) | 비디오 인코더, 비디오 디코더, 비디오 인코딩 방법 및 비디오 디코딩 방법 | |
CN117581547A (zh) | 用于视频编解码的侧窗双边滤波 | |
KR20200050111A (ko) | 칼라 좌표축 변환을 이용한 영상 부호화/복호화 방법 및 장치 |
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: 18924297 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18924297 Country of ref document: EP Kind code of ref document: A1 |