WO2020253728A1 - 编码方法及装置 - Google Patents

编码方法及装置 Download PDF

Info

Publication number
WO2020253728A1
WO2020253728A1 PCT/CN2020/096591 CN2020096591W WO2020253728A1 WO 2020253728 A1 WO2020253728 A1 WO 2020253728A1 CN 2020096591 W CN2020096591 W CN 2020096591W WO 2020253728 A1 WO2020253728 A1 WO 2020253728A1
Authority
WO
WIPO (PCT)
Prior art keywords
mode
candidate sub
selected candidate
sub
modes
Prior art date
Application number
PCT/CN2020/096591
Other languages
English (en)
French (fr)
Inventor
陈方栋
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2020253728A1 publication Critical patent/WO2020253728A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/11Selection of coding mode or of prediction mode among a plurality of spatial predictive coding modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • H04N19/147Data rate or code amount at the encoder output according to rate distortion criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods 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 colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/567Motion estimation based on rate distortion criteria

Definitions

  • This application relates to video coding and decoding technology, and in particular to a coding method and device.
  • each mode there are multiple sub-modes. For example, there are two sub-blocks in the triangular prediction mode, and the two sub-blocks have 5 and 4 motion information candidates respectively. After the combination, there are up to 20 motion information combinations, and the two sub-blocks can be divided into 45 degrees and 135 degrees. Division method, so there are up to 40 sub-patterns.
  • each coding block it is necessary to first determine the optimal sub-mode in each mode, and then select a sub-mode from the optimal sub-modes of all modes as the optimal mode of the coding block. If complex decision-making methods are used for screening in all processes, the coding complexity will be very high.
  • this application provides an encoding method and device.
  • an encoding method including:
  • the rate-distortion cost of each rough-selected candidate sub-mode is estimated based on the predicted value of the luminance component of each rough-selected candidate sub-mode, and the fine-selected candidate sub-mode is roughly selected based on the rate-distortion cost of each rough-selected candidate sub-mode. Selecting candidate sub-modes; wherein the selected candidate sub-mode is a sub-mode of the current mode for selection;
  • the optimal sub-mode of the current mode is determined.
  • an encoding device including a processor and a machine-readable storage medium, the machine-readable storage medium stores machine-readable instructions that can be executed by the processor, and The processor is prompted by the machine-readable instructions:
  • the rate-distortion cost of each rough-selected candidate sub-mode is estimated based on the predicted value of the luminance component of each rough-selected candidate sub-mode, and the fine-selected candidate sub-mode is roughly selected based on the rate-distortion cost of each rough-selected candidate sub-mode. Selecting candidate sub-modes; wherein the selected candidate sub-mode is a sub-mode of the current mode for selection;
  • the optimal sub-mode of the current mode is determined.
  • the encoding method of the embodiment of the present application determines and stores the prediction value of the brightness component of each rough selection candidate sub-mode by determining the rough selection candidate sub-mode of the current mode of the current image block, based on the brightness component of each rough selection candidate sub-mode
  • the predicted value estimates the rate-distortion cost of each rough selection candidate sub-mode, and based on the rate-distortion cost of each rough selection candidate sub-mode, the selected candidate sub-mode is roughly selected from the rough selection candidate sub-modes; further, from the stored Obtain the predicted value of the brightness component of each selected candidate sub-mode from the predicted value of the brightness component of each selected candidate sub-mode, and determine the accuracy of each selected candidate sub-mode based on the predicted value of the brightness component of each selected candidate sub-mode Rate-distortion cost, and based on the precise rate-distortion cost of each selected candidate sub-mode, determine the optimal sub-mode of the current mode, and reuse the predicted value of the brightness component calculated in the sub-mode rough selection process in the sub
  • Fig. 1 is a schematic flowchart of an encoding method shown in an exemplary embodiment of the present application
  • FIG. 2 is a schematic flowchart of a rough selection of sub-modes according to an exemplary embodiment of the present application
  • FIG. 3 is a schematic flowchart of a sub-mode selection shown in an exemplary embodiment of the present application
  • FIG. 4 is a schematic flowchart of a sub-mode selection shown in another exemplary embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a sub-mode selection shown in another exemplary embodiment of the present application.
  • Fig. 6 is a schematic diagram of the hardware structure of an encoding device according to an exemplary embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of an encoding device shown in an exemplary embodiment of the present application.
  • Fig. 8 is a schematic structural diagram of an encoding device shown in another exemplary embodiment of the present application.
  • Fig. 9 is a schematic structural diagram of an encoding device shown in another exemplary embodiment of the present application.
  • Intra prediction refers to using the reconstructed pixel values of the spatial neighboring blocks of the current image block (in the same frame of image as the current image block) for predictive coding.
  • Inter Prediction refers to the use of reconstructed pixel values of temporal neighboring blocks of the current image block (different from the current image block) for predictive coding.
  • Motion Vector In inter prediction, MV is used to represent the relative displacement between the current image block and the best matching block in the reference image. Each divided block has a corresponding motion vector that needs to be transmitted to the decoding device. If the MV of each image block is independently encoded and transmitted, especially if it is divided into small-sized blocks, it needs to consume a lot of bits. In order to reduce the number of bits used to encode MV, the spatial correlation between adjacent image blocks is used in video encoding to predict the MV of the current image block based on the MV of the adjacent encoded block, and then encode the prediction difference. This effectively reduces the number of bits representing MV.
  • the MV of the adjacent encoded block is generally used to predict the MV of the current image block, and then the MV prediction value (Motion Vector Prediction, referred to as MVP) and the true estimation of the MV are used.
  • the difference between the values (Motion Vector Difference, MVD for short) is encoded, thereby effectively reducing the number of MV encoding bits.
  • Motion Information Since MV represents the position offset between the current image block and a certain image block of a certain reference image, in order to accurately obtain the information pointing to the image block, in addition to the MV information, the index information of the reference image is also required to identify Reference image.
  • a reference image list is usually established based on certain principles, and the reference image index information is used to identify which reference image in the reference image list is used by the current image block.
  • many coding technologies also support multiple reference image lists, so an index value is also required to identify the reference image list, and this index value may be called a reference direction.
  • coding information related to motion such as MV, reference frame index, and reference direction, is collectively called motion information.
  • Rate-Distortion Optimized (Rate-Distortion Optimized, referred to as RDO):
  • the index to evaluate coding efficiency includes: code rate and peak signal to noise ratio (Peak Signal to Noise Ratio, referred to as PSNR).
  • PSNR Peak Signal to Noise Ratio
  • the discriminant formula is essentially a comprehensive evaluation of the two.
  • D distortion
  • SSE Standard of Mean Squared Difference index
  • the Lagrangian multiplier
  • R The actual number of bits required for image block encoding in this mode, including the sum of the number of bits required for encoding mode information, motion information, residuals, etc.
  • the mode selection if the RDO principle is used to make a comparison decision on the coding mode, the best coding performance can usually be guaranteed.
  • Accurate rate-distortion calculation method and fast rate-distortion calculation method In order to obtain the rate-distortion cost of a certain mode, it is necessary to obtain the distortion and bit number overhead of the mode. The acquisition of distortion and bit number overhead requires coding of all relevant information of the mode, especially the entropy coding of the residual, which is very time-consuming. Therefore, at the encoding end, two rate-distortion calculation methods are usually included: accurate rate-distortion calculation method (precise RDO) and fast rate-distortion calculation method (fast RDO).
  • the accurate rate-distortion calculation method is to obtain the final distortion and bit number overhead after a complete encoding of all relevant information of the mode; while the fast rate-distortion calculation method skips the residual coding process of the mode and is only based on the prediction of the mode.
  • the difference between the original value and the original value, as well as some simple mode information rate overhead estimation, to estimate the rate distortion cost of the mode its accuracy is not as good as the accurate rate distortion calculation, but the complexity is very low, which is beneficial to software and hardware implementation.
  • Mode refers to the activation of a specific method or tool, such as triangular prediction mode, Regular Merge mode, Affine Merge mode, etc.
  • some candidates are involved, which can be called candidate submodes or submodes.
  • the Regular Merge mode refers to the method of directly multiplexing the surrounding motion information as the motion information of the current image block without additional coding of the motion information difference, and the surrounding motion information may have N candidates, and one of the candidates is used.
  • a sub-mode that is, a mode is a collection of all sub-modes that use the mode method.
  • Triangle Prediction Mode Divide an image block into two triangle sub-blocks (there are 45 degree angle division mode and 135 degree angle division mode), these two triangle sub-blocks have different unidirectional motion information , The one-way motion information can be obtained from the candidate motion information list. This mode is only used in Merge/Skip mode, and only used in the prediction process, and does not affect the subsequent transformation and quantization process.
  • Regular Merge mode the traditional Merge mode, select one motion information from the candidate motion information list, and generate the prediction value of the current image block based on the motion information.
  • the candidate motion information list includes: spatial neighboring block candidate motion information, temporal neighboring block candidate motion information, spatial non-neighboring block candidate motion information, motion information obtained by combining existing motion information, and default motion information (such as zero movement information) and so on.
  • MMVD Merge mode with MVD, motion vector residual merging
  • This mode selects a certain motion information in the candidate motion information list of the Regular Merge mode as the reference motion information, and then obtains the motion information difference through a table lookup method.
  • the final motion information is acquired based on the difference between the reference motion information and the motion information, and the predicted value of the current image block is generated based on the final motion information.
  • Affine Merge mode This mode selects a piece of motion information from the candidate motion information list, and generates a prediction value of the current image block based on the motion information.
  • the motion information in the candidate motion information list of the Regular merge mode is a 2-parameter translation motion vector
  • the motion information in the candidate motion information list of the Affine Merge mode is a 4-parameter or 6-parameter affine Sports information.
  • IBC Merge (intra-frame block copy merge) mode This mode selects a block vector from the candidate block vector list, and generates the prediction value of the current image block based on the block vector.
  • the block vector refers to the offset vector of the reference block and the current image block in the current frame.
  • Merge mode refers to a type of prediction mode that directly selects a motion information from the candidate motion information list to generate the prediction value of the current image block, such as triangular prediction mode, Affine Merge mode, IBC Merge mode, regular merge mode or MMVD mode. These modes do not require a motion search process at the encoding end (that is, the encoding end selects motion information from the candidate motion information list, and does not need to search for other existing motion information to determine whether there is better motion information), except for the MMVD mode, Other modes do not need to encode the motion information difference, that is, directly multiplex a certain motion information in the candidate motion information list.
  • FIG. 1 is a schematic flowchart of an encoding method provided by an embodiment of this application.
  • the encoding method may be applied to an encoding terminal device. As shown in FIG. 1, the encoding method may include the following steps:
  • Step S100 Determine a rough selection candidate sub-mode of the current mode of the current image block.
  • the optimal sub-mode of the mode may be determined by a rough selection first and then a fine selection.
  • the current mode For the coding mode (referred to herein as the current mode) that the current image block (coding block) is currently trying to use, in order to determine the optimal sub-mode of the current mode, you can first select the sub-modes of the current mode A sub-mode for rough selection (referred to as a rough selection candidate sub-mode herein).
  • all sub-modes of the mode can be used as the candidate sub-modes for rough selection.
  • the triangular prediction mode for the triangular prediction mode, it includes an angle division mode of 45 degrees and an angle division mode of 135 degrees.
  • the number of candidate motion vectors can be called CandNum
  • CandNum the number of sub-modes of the triangle prediction mode is 2*CandNum*(CandNum-1).
  • CandNum is 5 by default, and the number of sub-patterns of the triangle sub-pattern is 40, and all the 40 sub-patterns can be used as the candidate sub-patterns for rough selection.
  • the foregoing determination of the coarse selection candidate sub-modes of the current mode may include:
  • the first number of sub-modes are selected from the sub-modes of the current mode of the current image block, and the first number of sub-modes are determined as the rough selection candidate sub-modes.
  • the probability that each sub-mode of that mode is selected as the optimal sub-mode is related to the size of the current image block, therefore, when determining the rough selection candidate sub-mode, the current The size of the image block, remove some sub-modes from the sub-modes of the current mode (the sub-modes with lower probability of being selected as the optimal sub-mode), so as to reduce the number of candidate sub-modes for rough selection and improve the efficiency of rough selection of sub-modes .
  • the sub-modes of the current mode can be filtered according to the aspect ratio of the current image block.
  • each sub-mode of the current mode being selected as the optimal sub-mode is closer, otherwise, each sub-mode of the current mode is selected as the optimal sub-mode
  • the probability of each sub-mode of the current mode is closer, otherwise, each sub-mode of the current mode is selected as the optimal sub-mode
  • the greater the probability of the mode is, therefore, when the candidate sub-modes are roughly selected, the sub-modes of the current mode can be screened according to the aspect ratio of the current image block.
  • the number of sub-modes excluded from the sub-modes of the current mode may be positively correlated with the aspect ratio of the current image block, that is, the larger the aspect ratio of the current image block is, the sub-mode is determined as a rough selection candidate sub-mode The smaller the number (which can be referred to as the first number in this article).
  • Step S110 Determine and store the predicted value of the luminance component of each roughly selected candidate sub-mode.
  • Step S120 Estimate the rate-distortion cost of each rough-selected candidate sub-mode based on the predicted value of the luminance component of each rough-selected candidate sub-mode, and roughly select from the rough-selected candidate sub-modes based on the rate-distortion cost of each rough-selected candidate sub-mode Featured candidate sub-modes.
  • the prediction value of the luminance component of each rough selection candidate sub-mode of the current mode may be determined.
  • the triangular sub-block division method of the rough selection candidate sub-mode and the motion information of each triangle sub-block can be used through motion compensation. Determine the predicted value of the luminance component of the roughly selected candidate sub-mode.
  • the encoding end device determines the predicted value of the brightness component of each rough selection candidate sub-mode, on the one hand, it can estimate the rate distortion cost of each rough selection candidate sub-mode based on the predicted value of the brightness component of each rough selection candidate sub-mode, and based on each The rate-distortion cost of the rough selection of candidate sub-modes is to roughly select a sub-mode for selection from the rough selection of candidate sub-modes (referred to as the selected candidate sub-mode in this article).
  • the encoding end device determines each rough selection When predicting the brightness component of the candidate sub-mode, the predicted value of the brightness component of each candidate sub-mode can be stored, so that the predicted value of the brightness component can be directly reused in the subsequent selection process to improve the efficiency of sub-mode selection .
  • the encoding end device may estimate the rough selection candidate sub-mode based on the predicted value of the brightness component of the rough selection candidate sub-mode and the original value of the brightness component of the current image block. Distortion.
  • the transformed pixel of the current image block After the Hadamard transform of the difference between the predicted value of the brightness component of the coarsely selected candidate sub-mode and the original value of the brightness component of the current image block, the transformed pixel of the current image block The sum of the values obtains the distortion of the roughly selected candidate sub-pattern.
  • the encoding end device can estimate the number of bits required to encode the sub-mode information of the roughly selected candidate sub-mode (that is, the number of bits required to encode other sub-mode information except the residual).
  • the encoding end device may determine the rough selection candidate based on the distortion of the rough selection candidate sub-mode and the number of bits required for encoding sub-mode information The rate-distortion cost of the mode.
  • the encoding end device when the encoding end device determines the rate-distortion cost of each rough selection candidate sub-mode, it may roughly select the selected candidate sub-mode from the rough selection candidate sub-modes based on the rate-distortion cost of each rough selection candidate sub-mode .
  • the encoding end device may select a preset number (which can be set according to requirements) of sub-modes as the selected candidate sub-modes in the descending order of the rate-distortion cost of each roughly selected candidate sub-mode.
  • the foregoing rough selection of the selected candidate sub-modes from the rough selection of candidate sub-modes based on the rate-distortion cost of each rough selection of the candidate sub-modes may include:
  • the top second number of rough selection candidate sub-modes are selected from the rough selection candidate sub-modes and determined as the candidate selection candidates Sub mode
  • the selected candidate sub-mode is removed, and the remaining selected candidate sub-modes are selected Determined as a selected candidate sub-mode.
  • the encoding end device can compare the rate-distortion cost of each candidate selection candidate sub-mode with the minimum rate-distortion cost, and the difference between the rate-distortion cost and the minimum rate-distortion cost is greater than a preset threshold
  • the selected candidate sub-modes (which can be set according to the actual scene) are eliminated, and the remaining selected candidate sub-modes are determined as the selected candidate sub-modes.
  • the aforementioned minimum rate-distortion cost may include the minimum rate-distortion cost of each coarse-selected candidate sub-mode of the current mode; or, the rate-distortion cost of each coarse-selected candidate sub-mode of other modes that the current image block has tried Minimum value.
  • the number of selected candidate sub-patterns described above may be set according to the size of the current image block.
  • the second number can be set according to the aspect ratio of the current image block.
  • the foregoing second number may be positively correlated with the aspect ratio of the current image block, that is, the greater the aspect ratio of the current image block, the greater the foregoing second number.
  • Step S130 Obtain the predicted value of the brightness component of each selected candidate sub-mode from the stored predicted value of the brightness component of each rough candidate sub-mode, and determine each based on the predicted value of the brightness component of each selected candidate sub-mode. Accurate rate-distortion cost of selected candidate sub-modes.
  • step S110 the prediction of the brightness component of the rough-selected candidate sub-mode stored in step S110 may be reused. Therefore, the efficiency of sub-mode selection can be improved.
  • the encoding end device may obtain the predicted value of the brightness component of each selected candidate sub-mode from the stored predicted value of the brightness component of each rough-selected candidate sub-mode, and based The predicted value of the luminance component of each selected candidate sub-mode determines the accuracy rate distortion cost of each selected candidate sub-mode.
  • the coarse selection candidate sub-modes include sub-modes 1 to 30 (that is, the predicted values of the luminance components of sub-modes 1 to 30 are stored in step S110), and the selected candidate sub-modes include sub-modes 1 to 5, then it can be multiplexed
  • the stored prediction values of the luminance components of sub-modes 1 to 5 do not need to be recalculated.
  • the above-mentioned obtains the predicted value of the brightness component of each selected candidate sub-mode from the stored predicted values of the brightness components of each rough-selected candidate sub-mode, and obtains the predicted value of each selected candidate sub-mode based on the brightness of each selected candidate sub-mode.
  • the predicted value of the component determines the accurate rate-distortion cost of each selected candidate sub-mode, which may include:
  • any selected candidate sub-mode obtain the predicted value of the brightness component of the selected candidate sub-mode from the stored prediction values of the brightness components of each rough-selected candidate sub-mode, and calculate the chrominance component of the sub-mode Predictive value;
  • the first accurate rate-distortion cost of the selected candidate sub-mode is determined.
  • the stored prediction value of the brightness component of each rough-selected candidate sub-mode can be obtained.
  • the predicted value of the luminance component; on the other hand, the predicted value of the chrominance component of the selected candidate sub-mode can be calculated, and the selected candidate can be determined based on the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode.
  • the residual coding information of the sub-mode and the distortion of the selected candidate sub-mode can be obtained.
  • determining the residual coding information of the selected candidate sub-mode based on the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode may include:
  • the original residuals of the luminance and chrominance components of the selected candidate sub-mode are determined respectively.
  • the foregoing target operation includes one or more of the following operations: transformation, quantization, and entropy coding.
  • the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode when the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode are determined, it may be based on the predicted values of the luminance component and the current Determine the original residual value of the luminance component of the selected candidate sub-mode based on the original value of the luminance component of the image block; and, based on the predicted value of the chrominance component of the selected candidate sub-mode and the chrominance component of the current image block
  • the original value determines the original residual value of the chrominance component of the selected candidate sub-mode, and further, the original residual values of the luminance component and the chrominance component of the selected candidate sub-mode can be transformed, quantized, and entropy coded
  • One or more operations (referred to as the target operation in this document) among other operations to determine the number of bits required for residual encoding of the selected candidate sub-pattern (referred to as the first bit number in this document).
  • determining the distortion of the selected candidate sub-mode based on the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode may include:
  • the distortion of the selected candidate sub-mode is determined.
  • the inverse operation of the target operation (such as inverse transformation, inverse quantization, etc.) can be used to determine the Select the reconstruction values of the luminance and chrominance components of the selected candidate sub-mode, and based on the reconstruction values of the luminance and chrominance components of the selected candidate sub-mode, and the original values of the luminance and chrominance components of the current image block, Determine the distortion of the selected candidate sub-mode.
  • the SSE of the reconstructed values of the luminance component and the chrominance component and the original values of the luminance component and the chrominance component of the selected candidate sub-mode may be determined as the distortion of the selected candidate sub-mode.
  • SSE can be obtained by the following formula:
  • L 1 represents a reconstruction value of the luminance component of the sub-mode selection candidate
  • L 1original represents the original value of the luminance component of the sub-mode selection candidate
  • L 2 represents a chrominance component of the sub-mode selection candidate
  • L 2original represents the original value of the chrominance component of the selected candidate sub-mode
  • w1 and w2 respectively represent the weight coefficients.
  • the values of w1 and w2 may be different.
  • determining the final number of bits of the selected candidate sub-mode based on the mode coding information of the selected candidate sub-mode and the residual coding information of the selected candidate sub-mode may include:
  • the final bit number of the selected candidate sub-mode is determined.
  • the final number of bits of the selected candidate sub-pattern may be determined according to the number of bits required for residual coding (that is, the above-mentioned first number of bits) and the mode coding information (that is, the coding information for coding the sub-mode information).
  • the selected candidate when the distortion of the selected candidate sub-mode and the final number of bits are determined, the selected candidate may be determined based on the distortion of the selected candidate sub-mode and the final number of bits
  • the accuracy rate-distortion cost of the sub-mode (referred to herein as the first accuracy rate-distortion cost).
  • the above-mentioned target operation is performed respectively on the original residual values of the luminance component and the chrominance component of the selected candidate sub-mode, and after the first number of bits required for residual coding is determined, the method may further include:
  • the target operation includes a quantization operation, and the original residual values of the luminance component and the chrominance component of the selected candidate sub-mode are quantized, the reconstruction residual values of the luminance component and the chrominance component are all 0, then the refined The candidate sub-mode is determined as the optimal sub-mode of the current mode.
  • the selected candidate sub-mode when the original residual values of the luminance component and the chrominance component of the selected candidate sub-mode are quantized, the reconstructed residual values of the luminance component and the chrominance component are both 0, that is, when there is no reconstruction residual in both the luminance component and the chrominance component, the selected candidate sub-mode can be determined as the optimal sub-mode of the current mode, and no other sub-modes of the current mode will be tried (ie It is not necessary to calculate the accuracy rate distortion cost of other sub-modes of the current mode in the above manner).
  • the above-mentioned obtains the predicted value of the brightness component of each selected candidate sub-mode from the stored predicted values of the brightness components of each rough-selected candidate sub-mode, and obtains the predicted value of each selected candidate sub-mode based on the brightness of each selected candidate sub-mode.
  • the predicted value of the component determines the accurate rate-distortion cost of each selected candidate sub-mode, which may include:
  • For any selected candidate sub-mode obtain the predicted value of the brightness component of the selected candidate sub-mode from the stored prediction values of the brightness components of each rough-selected candidate sub-mode, and calculate the color of the selected candidate sub-mode.
  • the predicted value of the degree component is the predicted value of the degree component
  • the second accurate rate-distortion cost of the selected candidate sub-mode is determined.
  • the stored luminance components of each rough-selected candidate sub-mode can be Obtain the predicted value of the luminance component of the selected candidate sub-mode from the predicted value, and calculate the predicted value of the chrominance component of the selected candidate sub-mode.
  • the predicted values of the luminance component and the chrominance component can be used as the reconstructed values of the luminance component and the chrominance component, and further, it can be based on the luminance component and the chrominance component of the selected candidate sub-mode.
  • the predicted value of the degree component and the original values of the luminance component and chrominance component of the current image block determine the distortion of the selected candidate sub-mode.
  • the SSE of the predicted values of the luma and chroma components of the selected candidate sub-mode (reconstruction values in this example) and the original values of the luma and chroma components can be determined as the selected candidate sub-mode. distortion.
  • the final bit number of the selected candidate sub-mode can be determined by the mode encoding information. Therefore, the selected candidate sub-mode can be determined by encoding the sub-mode information of the selected candidate sub-mode
  • the mode coding information of the selected candidate sub-mode (the final number of bits in this example), and further, based on the distortion of the selected candidate sub-mode and the mode coding information, the accurate rate-distortion cost of the selected candidate sub-mode (referred to as the first 2. Rate distortion cost).
  • the implementations that do not require coding residuals reduce the time consumption and bit consumption caused by residual coding, but the distortion is usually greater (for the reconstruction of luminance and chrominance components)
  • the residual values are not all 0
  • the above-mentioned obtains the predicted value of the brightness component of each selected candidate sub-mode from the stored predicted values of the brightness components of each rough-selected candidate sub-mode, and the prediction is based on the brightness component of each selected candidate sub-mode
  • the value determines the accurate rate-distortion cost of each selected candidate sub-mode, and can also include:
  • the target operation includes a quantization operation, and the original residual values of the luminance and chrominance components of the selected candidate sub-mode are quantized, the reconstruction of the luminance and chrominance components is obtained If the residual value is not all 0, then compare the first rate-distortion cost and the second rate-distortion cost of the selected candidate sub-modes, and the first rate-distortion cost and the second rate-distortion cost are The smaller value is determined as the accurate rate-distortion cost of the selected candidate sub-mode.
  • the accuracy rate-distortion cost of the selected candidate sub-mode (that is, the above-mentioned first accuracy rate-distortion cost) can be determined according to the way that the residuals need to be encoded, and according to the need for encoding
  • the residual method determines the accurate rate-distortion cost of the selected candidate sub-mode (that is, the above-mentioned second accurate rate-distortion cost).
  • the first precision rate-distortion cost and the second precision rate-distortion cost of the selected candidate sub-mode can be compared, and the first precision rate-distortion cost and the second precision rate-distortion cost can be compared.
  • the smaller of the two precision rate-distortion costs is determined as the precision rate-distortion cost of the selected candidate sub-mode.
  • Step S140 Determine the optimal sub-mode of the current mode based on the accurate rate-distortion cost of the selected candidate sub-modes.
  • the precision rate-distortion cost of the selected candidate sub-modes is determined, such as the aforementioned first precision rate-distortion cost, or the aforementioned second precision-rate-distortion cost, or the aforementioned first precision-rate-distortion cost and the second precision
  • the smaller value of the rate-distortion cost can determine the optimal sub-mode of the current mode based on the accurate rate-distortion cost of the selected candidate sub-modes.
  • the encoding end device can determine the mode used by the current image block (referred to as the target mode herein) based on the accuracy rate distortion cost of the optimal sub-mode of each mode of the current image block, and compare the current image block based on the target mode.
  • the image block is encoded.
  • the encoding end device may compare the accuracy rate-distortion costs of the optimal sub-modes of each mode, and determine the optimal sub-mode with the smallest accuracy rate-distortion cost as the target mode used by the current image block.
  • each rough selection candidate sub-mode before estimating the rate-distortion cost of each rough selection candidate sub-mode based on the predicted value of the luminance component of each rough selection candidate sub-mode, it may further include:
  • the value of the preset flag bit is the first value, it is determined to execute the step of estimating the rate distortion cost of each rough selection candidate sub-mode based on the predicted value of the luminance component of each rough selection candidate sub-mode;
  • each rough selection candidate sub-mode is determined to be a selected candidate sub-mode; based on the stored prediction values of the brightness components of each rough selection candidate sub-mode, each selected candidate sub-mode is determined.
  • the accurate rate-distortion cost of the candidate sub-modes; based on the accurate rate-distortion cost of each selected candidate sub-mode, the optimal sub-mode of the current mode is determined.
  • a flag bit for identifying whether to skip rough selection (referred to as a preset flag bit in this article) can be preset, and based on the value of the flag bit, it can be determined Whether to skip the rough selection, that is, do not perform the rough selection of the sub-mode.
  • the value of the preset flag bit is the first value, it indicates that rough selection is not skipped; if the value of the preset flag bit is the second value, it indicates that rough selection is skipped.
  • the value of the preset flag bit may be read first.
  • the value of the preset flag bit is the first value, it is determined not to skip the rough selection, and further, the rough selection of the sub-modes can be performed first, and then the selection of the sub-modes can be performed according to the method described in the foregoing embodiment.
  • each rough selection candidate sub-pattern may be determined as the selected candidate sub-pattern, based on the stored brightness of each rough selection candidate sub-pattern
  • the predicted value of the component determines the accurate rate-distortion cost of each selected candidate sub-mode, and determines the optimal sub-mode of the current mode based on the accurate rate-distortion cost of each selected candidate sub-mode.
  • the above method may further include:
  • the value of the preset flag bit is determined.
  • the main difference between the rate-distortion cost calculated in the sub-mode rough selection and the sub-mode selection process is whether to consider the number of bits required for residual coding, therefore, whether the coding residual affects the sub-mode
  • the necessity of rough selection, and the reconstruction residual value of the sub-mode can be used as a reference for whether the coding residual is required. Therefore, it can be based on other attempts that the current image block has tried.
  • the reconstruction residual information of the mode information determines the value of the aforementioned preset flag bit.
  • the foregoing determination of the value of the preset flag bit based on the reconstruction residual information of other modes that the current image block has tried may include:
  • the reconstruction residual value of the sub-mode is 0 (that is, the reconstruction residual value of the luminance component and the chrominance component are both 0)
  • the reconstruction residual value of the optimal mode among other tried modes of the current image block can be obtained;
  • the reconstruction residual value of the optimal mode among the other tried modes of the image block is 0 (that is, the reconstruction residual value of the luminance component and the chrominance component are both 0), then it can be determined that the optimal mode of the current image block has a high probability of not being Residual coding is required.
  • skipping the coarse selection can improve the efficiency of sub-mode optimization; if the reconstruction residual value of the optimal mode in the other modes of the current image block has been tried is not 0 (that is, the brightness component or/and If the reconstruction residual value of the chrominance component is not 0), it can be determined that the optimal mode of the current image block has a high probability of requiring residual coding. In this case, rough selection can improve the efficiency of sub-mode optimization.
  • the above method may further include:
  • the current mode is a specific mode, it is determined that the value of the preset flag bit is the first value.
  • the specific mode includes any mode that reuses surrounding motion information, such as triangular prediction mode, Affine Merge (affine merge) mode, IBC Merge (intra block copy merge) mode, regular merge (normal merge) mode Or MMVD (Merge mode with MVD, motion vector residual merge) mode, etc.
  • the following takes the current mode as the triangular prediction mode as an example to describe the preferred sub-mode solutions provided in the embodiments of the present application.
  • the triangular prediction mode includes an angle division mode of 45 degrees and an angle division mode of 135 degrees.
  • the total number of sub-modes of the triangular prediction mode is 2*CandNum*(CandNum-1).
  • CandNum is 5 by default, so the total number of sub-modes of the triangle prediction mode is 40.
  • the sub-modes of the triangular prediction mode may be determined as the coarse selection candidate sub-modes, or the sub-modes may be filtered based on the size of the current image block, and the remaining sub-modes may be determined as the coarse selection candidate sub-modes.
  • N_rough the number of candidate sub-patterns for rough selection.
  • N_accurate The number of selected candidate sub-modes of the triangular prediction mode.
  • the number of selected candidate sub-modes may be set to a fixed value (such as 3), or set according to the size of the current image block.
  • N_accurate selected candidate sub-patterns are roughly selected from N_rough rough-selected candidate sub-patterns.
  • the implementation process may be as shown in Figure 2 and may include the following steps:
  • Step S200 For any rough selection candidate sub-mode, based on the triangle sub-block division mode of the rough selection candidate sub-mode and the motion information of each triangle sub-block, determine the prediction value of the brightness component of the rough selection candidate sub-mode, and store The predicted value of the luminance component of the roughly selected candidate sub-mode.
  • the prediction value of the luminance component of the roughly selected candidate sub-mode may be determined by means of motion compensation.
  • Step S210 Determine the distortion of the rough selection candidate sub-mode based on the predicted value of the brightness component of the rough selection candidate sub-mode and the original value of the brightness component of the current image block.
  • the distortion of the rough selection candidate submode (hereinafter referred to as D_rough(i)) can be calculated by calculating the difference between the predicted value of the brightness component of the rough selection candidate submode and the original value of the brightness component of the current image block. After the Hadamard transformation, sum up all the transformed values.
  • Step S220 Estimate the number of bits required for encoding the sub-mode information of the roughly selected candidate sub-mode.
  • the number of bits required for coding of sub-mode information can be estimated, regardless of the number of bits required for residual coding, that is, the sub-mode information other than the residual coding of the candidate sub-mode for coarse selection can be estimated
  • the number of bits required for encoding hereinafter referred to as R_mode(i)).
  • Step S230 Determine the rate-distortion cost of the roughly selected candidate sub-mode based on D_rough(i) and R_mode(i) (hereinafter referred to as J_rough(i)).
  • Step S240 Based on the rate-distortion cost of each rough selection candidate sub-mode, a selected candidate sub-mode is roughly selected from the rough selection candidate sub-mode.
  • N_accurate selected candidate sub-modes may be selected from N_rough rough selection candidate sub-modes according to the order of rate-distortion cost from small to large.
  • the rate-distortion cost and the minimum rate-distortion cost of the N_accurate selected candidate sub-modes can be compared, and the minimum rate-distortion cost is compared with the minimum
  • the selected candidate sub-modes whose rate-distortion cost difference is greater than the preset threshold are removed from the N_accurate selected candidate sub-modes (the removed selected candidate sub-modes no longer participate in the sub-mode selection).
  • the minimum rate-distortion cost is the minimum rate-distortion cost of each rough selection candidate sub-mode of the current mode, or the minimum rate-distortion cost of each rough selection candidate sub-mode of other modes that the current image block has tried value.
  • the difference between the rate-distortion cost of the selected candidate sub-mode and the minimum rate-distortion cost greater than the preset threshold may be: J_mode(i)>TH1*J_mode_min, that is, J_mode(i)-J_mode_min>(TH1-1) J_mode_min;
  • TH1 can be set according to actual needs, such as 1.25.
  • N_accurate the number of selected candidate sub-patterns.
  • Step S300 For any selected candidate sub-mode, obtain the predicted value of the brightness component of the selected candidate sub-mode from the stored predicted value of the brightness component of the rough-selected candidate sub-mode.
  • the predicted value of the brightness component calculated in the rough selection process can be reused, without the need to perform motion compensation again to obtain the predicted value of the brightness component, so as to improve the selection of the sub-mode. effectiveness.
  • Step S310 Based on the predicted values of the luminance and chrominance components of the selected candidate sub-mode and the original values of the luminance and chrominance components of the current image block, determine the luminance and chrominance components of the selected candidate sub-mode, respectively The original residual value of.
  • Step S320 Perform target operations on the original residual values of the luminance component and the chrominance component of the selected candidate sub-modes respectively, and determine the number of bits required for residual coding (hereinafter referred to as R1).
  • the target operation may include one or more of operations such as transformation, quantization, and entropy encoding.
  • Step S330 using the reverse operation of the target operation to determine the reconstruction values of the luminance component and the chrominance component of the selected candidate sub-mode respectively, and based on the reconstruction values of the luminance component and the chrominance component of the selected candidate sub-mode, and The original values of the luminance component and the chrominance component of the current image block determine the distortion of the selected candidate sub-mode.
  • the SSE of the reconstructed value and the original value may be determined as the distortion of the selected candidate sub-mode (hereinafter referred to as D).
  • Step S340 Encode the information of the selected candidate sub-mode, and determine the mode coding information of the selected candidate sub-mode (hereinafter referred to as R2).
  • Step S350 Determine the final bit number of the selected candidate sub-pattern (hereinafter referred to as R) based on R1 and R2.
  • Step S360 based on the distortion D of the selected candidate sub-mode and the final number of bits R, determine the accurate rate-distortion cost of the selected candidate sub-mode (hereinafter referred to as J).
  • Step S370 Compare the precision rate-distortion cost with other selected candidate sub-modes that have been tried by the triangular prediction mode, and store the precision rate-distortion cost of the selected candidate sub-mode with the smallest precision rate-distortion cost.
  • the selected candidate sub-mode with the smallest accuracy rate distortion cost may be determined as the optimal sub-mode of the triangular prediction mode.
  • the accuracy rate-distortion cost of the optimal sub-mode can be stored, so as to compare the accuracy rate-distortion cost of the optimal sub-modes of different modes to determine the difference in the current image
  • the optimal mode used for encoding the block can be stored, so as to compare the accuracy rate-distortion cost of the optimal sub-modes of different modes to determine the difference in the current image The optimal mode used for encoding the block.
  • the triangular prediction mode includes an angle division mode of 45 degrees and an angle division mode of 135 degrees.
  • the total number of sub-modes of the triangular prediction mode is 2*CandNum*(CandNum-1).
  • CandNum is 5 by default, so the total number of sub-modes of the triangle prediction mode is 40.
  • the sub-modes of the triangular prediction mode may be determined as the rough selection candidate sub-modes, or the sub-modes may be filtered based on the size of the current image block, and the remaining sub-modes may be determined as the rough selection candidate sub-modes.
  • N_rough the number of candidate sub-patterns for rough selection.
  • N_accurate The number of selected candidate sub-modes of the triangular prediction mode.
  • the number of selected candidate sub-modes may be set to a fixed value (such as 3), or set according to the size of the current image block.
  • N_accurate selected candidate sub-patterns are roughly selected from the N_rough rough-selected candidate sub-patterns.
  • the implementation process may be as shown in FIG. 2 and this embodiment will not be repeated.
  • the rate-distortion cost and the minimum rate-distortion cost of the N_accurate selected candidate sub-modes can be compared, and the minimum rate-distortion cost is compared with the minimum
  • the selected candidate sub-modes whose rate-distortion cost difference is greater than the preset threshold are removed from the N_accurate selected candidate sub-modes (the removed selected candidate sub-modes no longer participate in the sub-mode selection).
  • the minimum rate-distortion cost is the minimum rate-distortion cost of each rough selection candidate sub-mode of the current mode, or the minimum rate-distortion cost of each rough selection candidate sub-mode of other modes that the current image block has tried value.
  • the difference between the rate-distortion cost of the selected candidate sub-mode and the minimum rate-distortion cost greater than the preset threshold may be: J_mode(i)>TH1*J_mode_min, that is, J_mode(i)-J_mode_min>(TH1-1) J_mode_min;
  • TH1 can be set according to actual needs, such as 1.25.
  • N_accurate the number of selected candidate sub-patterns.
  • Step S361 Determine whether the reconstruction residual values of the luminance component and the chrominance component of the selected candidate sub-mode are both 0. If yes, go to step S380; otherwise, go to step S370.
  • Step S380 Determine the selected candidate sub-mode as the optimal sub-mode of the triangular prediction mode, and store the precision rate-distortion cost of the selected candidate sub-mode.
  • quantizing the original residual values of the luminance component and the chrominance component of the selected candidate sub-mode can obtain the reconstructed residual values of the luminance component and the chrominance component of the selected candidate sub-mode.
  • the selected candidate sub-mode may not be subjected to residual coding.
  • the selected candidate sub-mode can be determined for triangular prediction The optimal sub-mode of the mode, without the need to try selected candidate sub-modes of other triangulation prediction modes that have not been tried.
  • the accuracy rate distortion cost of the selected candidate sub-mode may be stored, so as to compare the accuracy rates of the optimal sub-modes of different modes Distortion cost to determine the optimal mode for encoding the current image block.
  • the triangular prediction mode includes an angle division mode of 45 degrees and an angle division mode of 135 degrees.
  • the total number of sub-modes of the triangular prediction mode is 2*CandNum*(CandNum-1).
  • CandNum is 5 by default, so the total number of sub-modes of the triangle prediction mode is 40.
  • the sub-modes of the triangular prediction mode may be determined as the rough selection candidate sub-modes, or the sub-modes may be filtered based on the size of the current image block, and the remaining sub-modes may be determined as the rough selection candidate sub-modes.
  • N_rough the number of candidate sub-patterns for rough selection.
  • N_accurate The number of selected candidate sub-modes of the triangular prediction mode.
  • the number of selected candidate sub-modes may be set to a fixed value (such as 3), or set according to the size of the current image block.
  • N_accurate selected candidate sub-patterns are roughly selected from the N_rough rough-selected candidate sub-patterns.
  • the implementation process may be as shown in FIG. 2 and this embodiment will not be repeated.
  • the rate-distortion cost and the minimum rate-distortion cost of the N_accurate selected candidate sub-modes can be compared, and the minimum rate-distortion cost is compared with the minimum
  • the selected candidate sub-modes whose rate-distortion cost difference is greater than the preset threshold are removed from the N_accurate selected candidate sub-modes (the removed selected candidate sub-modes no longer participate in the sub-mode selection).
  • the minimum rate-distortion cost is the minimum rate-distortion cost of each rough selection candidate sub-mode of the current mode, or the minimum rate-distortion cost of each rough selection candidate sub-mode of other modes that the current image block has tried value.
  • the difference between the rate-distortion cost of the selected candidate sub-mode and the minimum rate-distortion cost greater than the preset threshold may be: J_mode(i)>TH1*J_mode_min, that is, J_mode(i)-J_mode_min>(TH1-1) J_mode_min;
  • TH1 can be set according to actual needs, such as 1.25.
  • N_accurate the number of selected candidate sub-patterns.
  • Step S500 For any selected candidate sub-mode, obtain the predicted value of the brightness component of the selected candidate sub-mode from the stored predicted value of the brightness component of the rough-selected candidate sub-mode.
  • Step S510 Determine the distortion of the selected candidate sub-mode based on the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode, and the original values of the luminance component and the chrominance component of the current image block.
  • the reconstructed values of the luminance component and the chrominance component of the selected candidate sub-mode are respectively equal to the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode.
  • the SSE of the predicted value and the original value or the SSE with different weights may be determined as the distortion of the selected candidate sub-mode (hereinafter referred to as D).
  • Step S520 Encode the information of the selected candidate sub-mode, and determine the mode coding information of the selected candidate sub-mode.
  • Step S530 Determine the accurate rate-distortion cost of the selected candidate sub-mode based on the distortion of the selected candidate sub-mode and the mode coding information.
  • Step S540 Compare the precision rate-distortion cost with other selected candidate sub-modes that the triangle prediction mode has tried, and store the precision rate-distortion cost of the selected candidate sub-mode with the smallest precision rate-distortion cost.
  • the triangular prediction mode includes an angle division mode of 45 degrees and an angle division mode of 135 degrees.
  • the total number of sub-modes of the triangular prediction mode is 2*CandNum*(CandNum-1).
  • CandNum is 5 by default, so the total number of sub-modes of the triangle prediction mode is 40.
  • the sub-modes of the triangular prediction mode may be determined as the rough selection candidate sub-modes, or the sub-modes may be filtered based on the size of the current image block, and the remaining sub-modes may be determined as the rough selection candidate sub-modes.
  • N_rough the number of candidate sub-patterns for rough selection.
  • N_accurate The number of selected candidate sub-modes of the triangular prediction mode.
  • the number of selected candidate sub-modes may be set to a fixed value (such as 3), or set according to the size of the current image block.
  • N_accurate selected candidate sub-patterns are roughly selected from the N_rough rough-selected candidate sub-patterns.
  • the implementation process may be as shown in FIG. 2 and this embodiment will not be repeated.
  • the rate-distortion cost and the minimum rate-distortion cost of the N_accurate selected candidate sub-modes can be compared, and the minimum rate-distortion cost is compared with the minimum
  • the selected candidate sub-modes whose rate-distortion cost difference is greater than the preset threshold are removed from the N_accurate selected candidate sub-modes (the removed selected candidate sub-modes no longer participate in the sub-mode selection).
  • the minimum rate-distortion cost is the minimum rate-distortion cost of each rough selection candidate sub-mode of the current mode, or the minimum rate-distortion cost of each rough selection candidate sub-mode of other modes that the current image block has tried value.
  • the difference between the rate-distortion cost of the selected candidate sub-mode and the minimum rate-distortion cost greater than the preset threshold may be: J_mode(i)>TH1*J_mode_min, that is, J_mode(i)-J_mode_min>(TH1-1) J_mode_min;
  • TH1 can be set according to actual needs, such as 1.25.
  • N_accurate the number of selected candidate sub-patterns.
  • the accurate rate-distortion cost of the selected candidate sub-mode (hereinafter referred to as accurate rate-distortion cost 1) can be calculated according to the method flow shown in FIG. 3 (step S300 to step S360). ), and calculate the precision rate-distortion cost of the selected candidate sub-mode (hereinafter referred to as precision rate-distortion cost 2) according to the method flow shown in FIG. 5 (steps S500 to step S530), and compare the precision rate-distortion cost 1 and precision Rate-distortion cost 2, the smaller of the two is determined as the accurate rate-distortion cost of the selected candidate sub-mode.
  • the sub-mode with the smallest rate-distortion cost is determined more accurately as the optimal sub-mode, and the sub-mode preferred effect.
  • step S300 to step S360 the method described in step S300 to step S360 is used to determine the selected candidate sub-mode in the case of residual coding. After the precision rate distortion cost, it can be judged whether the reconstruction residual values of the luminance component and the chrominance component of the selected candidate sub-mode are both 0; if so, the selected candidate sub-mode is determined as the optimal sub-mode of the triangular prediction mode.
  • step S500 to step S530 the method described in step S500 to step S530 is no longer determined for the precision rate-distortion cost of the selected candidate sub-mode without residual coding, and the other unattended selected candidates of the triangular prediction mode are no longer determined Try the sub-mode; otherwise, determine the precision rate-distortion cost of the selected candidate sub-mode without residual coding in the manner described in steps S500 to S530, and perform the precision in the manner described in the fourth embodiment. Determination of the accurate rate-distortion cost for selecting candidate sub-modes.
  • a flag bit for identifying whether to skip the rough selection can be preset, that is, the preset flag bit (hereinafter referred to as bestisSkip); if bestisSkip is 0, the flag does not skip the rough selection; if bestisSkip is 1, the flag skips rough selection.
  • the value of bestisSkip may be determined based on the reconstruction residual information of other modes that the current image block has tried.
  • the value of bestisSkip is determined to be 1; otherwise, the value of bestisSkip is determined to be 0.
  • the value of bestisSkip can be determined based on the current mode.
  • the sub-mode selection (including rough selection and selection) can be performed in the manner described in any one of Embodiment 1, Embodiment 2, and Embodiment 3.
  • step 3 since the rough selection is skipped, in the sub-mode selection process, if the predicted value of the brightness component of each rough selection candidate sub-mode is not stored, it is necessary to calculate each selection The predicted value of the luminance component of the candidate sub-mode. If the predicted value of the brightness component of each rough selection candidate sub-mode is stored, the predicted value of the brightness component of each rough selection candidate sub-mode can be multiplexed.
  • the first to sixth embodiments illustrate the implementation of sub-mode optimization by taking the current mode as the triangular prediction mode as an example, but the current mode is not limited to the triangular prediction mode, and the sub-mode optimization methods of the first to sixth embodiments can also be applied.
  • a mode that multiplexes the motion information of surrounding blocks in Affine Merge mode, IBC Merge mode, regular merge mode and MMVD mode.
  • the difference lies in the motion information type of the candidate sub-mode There is a difference between and the number (as shown in Table 1).
  • the prediction value of the brightness component of each rough selection candidate sub-mode is determined and stored, based on the prediction value of the brightness component of each rough selection candidate sub-mode Estimate the rate-distortion cost of each rough selection candidate sub-mode, and roughly select the selected candidate sub-mode from the rough selection candidate sub-modes based on the rate-distortion cost of each rough selection candidate sub-mode; further, from the stored rough selection Obtain the predicted value of the brightness component of each selected candidate sub-mode from the predicted value of the brightness component of the selected candidate sub-mode, and determine the accuracy rate distortion of each selected candidate sub-mode based on the predicted value of the brightness component of each selected candidate sub-mode The cost, and based on the precision rate-distortion cost of the selected candidate sub-modes, determines the optimal sub-mode of the current mode.
  • FIG. 6 is a schematic diagram of the hardware structure of an encoding device provided by an embodiment of this application.
  • the encoding device may include a processor 601 and a machine-readable storage medium 602 storing machine-executable instructions.
  • the processor 601 and the machine-readable storage medium 602 may communicate via a system bus 603. Furthermore, by reading and executing the machine executable instructions corresponding to the encoding control logic in the machine-readable storage medium 602, the processor 601 can execute the encoding method described above.
  • the machine-readable storage medium 602 mentioned herein may be any electronic, magnetic, optical, or other physical storage device, and may contain or store information, such as executable instructions, data, and so on.
  • the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard drive), solid state hard drive, any type of storage disk (Such as CD, DVD, etc.), or similar storage media, or a combination of them.
  • the coding control logic described above may include a first determination unit 710, a second determination unit 720, a storage unit 730, a rough selection unit 740, a selection unit 750, and a third determination unit 760 in terms of functions. :
  • the first determining unit 710 is configured to determine a rough selection candidate sub-mode of the current mode of the current image block; wherein the rough selection candidate sub-mode is a sub-mode of the current mode for performing rough selection;
  • the second determining unit 720 is configured to determine the predicted value of the luminance component of each roughly selected candidate sub-mode
  • the storage unit 730 is configured to store the predicted value of the luminance component of each candidate sub-mode for rough selection
  • the rough selection unit 740 is configured to estimate the rate-distortion cost of each rough-selected candidate sub-mode based on the predicted value of the luminance component of each rough-selected candidate sub-mode, and calculate the rate distortion cost of each rough-selected candidate sub-mode from the rough
  • the selected candidate sub-mode is roughly selected from the selected candidate sub-modes; wherein the selected candidate sub-mode is a sub-mode of the current mode used for selection;
  • the selection unit 750 is configured to obtain the predicted value of the brightness component of each selected candidate sub-mode from the stored prediction values of the brightness components of each rough selection candidate sub-mode, and based on the brightness of each selected candidate sub-mode The predicted value of the component determines the precision rate-distortion cost of each selected candidate sub-mode;
  • the third determining unit 760 is configured to determine the optimal sub-mode of the current mode based on the precision rate-distortion cost of the selected candidate sub-mode.
  • the first determining unit 710 is configured to select a first number of sub-modes from the sub-modes of the current mode of the current image block according to the size of the current image block, and The first number of sub-patterns are determined as the rough selection candidate sub-patterns.
  • the rough selection unit 740 is configured to select from the rough selection candidate sub-patterns according to the rate-distortion cost of each rough selection candidate sub-pattern in descending order of the rate-distortion cost.
  • the top-ranked second number of rough selection candidate sub-patterns are determined to be the candidate selection candidate sub-patterns; if there is a candidate selection candidate sub-pattern whose difference with the minimum rate-distortion cost is greater than the preset threshold In the sub-mode, the candidate selected candidate sub-mode is removed, and the remaining candidate selected candidate sub-modes are determined as the selected candidate sub-mode.
  • the minimum rate-distortion cost is the minimum rate-distortion cost of each rough selection candidate sub-mode of the current mode, or each rough selection of other modes that the current image block has tried The minimum rate-distortion cost of the candidate sub-mode.
  • the second number is set according to the size of the current image block.
  • the selection unit 750 is configured to, for any selected candidate sub-mode, obtain the selected candidate sub-mode from the stored prediction values of the brightness components of each rough-selected candidate sub-mode The predicted value of the luminance component of and calculate the predicted value of the chrominance component of the selected candidate sub-mode;
  • the first accurate rate-distortion cost of the selected candidate sub-mode is determined.
  • the selection unit 750 is configured to be based on the predicted values of the luminance component and the chrominance component of the selected candidate sub-mode and the original values of the luminance component and the chrominance component of the current image block , Respectively determine the original residual values of the luminance component and the chrominance component of the selected candidate sub-mode;
  • Target operations on the original residual values of the luminance component and the chrominance component of the selected candidate sub-modes to determine the first number of bits required for residual coding; wherein the target operation includes one or more of the following operations : Transformation, quantization and entropy coding.
  • the selection unit 750 is configured to use the reverse operation of the target operation to respectively determine the reconstruction values of the luminance component and the chrominance component of the selected candidate sub-mode;
  • the distortion of the selected candidate sub-mode is determined.
  • the selection unit 750 is configured to encode the sub-mode information of the selected candidate sub-mode, and determine the mode coding information of the selected candidate sub-mode;
  • the final bit number of the selected candidate sub-mode is determined.
  • the selection unit 750 is configured to obtain the result obtained by quantizing the original residual values of the luminance component and the chrominance component of the selected candidate submode if the target operation includes a quantization operation
  • the reconstruction residual values of the luminance component and the chrominance component are both 0, and the selected candidate sub-mode is determined as the optimal sub-mode of the current mode.
  • the selection unit 750 is configured to, for any selected candidate sub-mode, obtain the selected candidate sub-mode from the stored prediction values of the brightness components of each rough-selected candidate sub-mode The predicted value of the luminance component of and calculate the predicted value of the chrominance component of the selected candidate sub-mode;
  • the second accurate rate-distortion cost of the selected candidate sub-mode is determined.
  • the selection unit 750 is configured to, for any selected candidate sub-mode, if the target operation includes a quantization operation, and the brightness and chroma components of the selected candidate sub-mode The reconstruction residual values of the luminance component and the chrominance component obtained after the quantization of the original residual value are not both 0, then the first precision rate distortion cost and the second precision rate distortion cost of the selected candidate sub-mode are compared, and the The smaller value of the first accurate rate-distortion cost and the second accurate rate-distortion cost is determined as the accurate rate-distortion cost of the selected candidate sub-mode.
  • the foregoing encoding control logic may further include: a reading unit 770;
  • the reading unit 770 is configured to read the value of a preset flag bit; wherein, the preset flag bit is used to identify whether to skip rough selection;
  • the rough selection unit 740 is configured to estimate the rate distortion cost of each rough selection candidate sub-mode based on the predicted value of the brightness component of each rough selection candidate sub-mode if the value of the preset flag bit is the first value;
  • the selection unit 750 is further configured to, if the value of the preset flag bit is the second value, determine each of the rough selection candidate sub-modes as the selected candidate sub-mode; based on the stored rough selection candidates
  • the predicted value of the luminance component of the sub-mode determines the precision rate-distortion cost of each selected candidate sub-mode; based on the precision rate-distortion cost of each selected candidate sub-mode, the optimal sub-mode of the current mode is determined.
  • the foregoing encoding control logic may further include: a fourth determining unit 780;
  • the fourth determining unit 780 is configured to determine the value of the preset flag bit based on the reconstruction residual information of other modes that the current image block has tried.
  • the fourth determining unit 780 is configured to determine the preset flag bit if the reconstruction residual value of the optimal mode among the tried other modes of the current image block is 0 The value of is the second value;
  • the fourth determining unit 780 is further configured to determine that the value of the preset flag bit is the first value if the current mode is a specific mode;
  • the specific mode includes any mode that multiplexes surrounding motion information.
  • the rough selection unit 740 is configured to determine the rough selection candidate sub-mode based on the predicted value of the brightness component of the rough selection candidate sub-mode and the original value of the brightness component of the current image block Distortion
  • the selected candidate sub-pattern is roughly selected from the rough-selected candidate sub-pattern based on the rate-distortion cost of each rough-selected candidate sub-pattern.
  • the rough selection unit 750 is configured to select, for any selected candidate sub-mode, from the stored brightness components of each rough selection candidate sub-mode Obtain the predicted value of the luminance component of the selected candidate sub-mode from the predicted value of, and calculate the predicted value of the chrominance component of the selected candidate sub-mode;
  • the values of the luminance and chrominance components of the selected candidate sub-mode are determined respectively.
  • Original residual value
  • target operations on the original residual values of the luminance components and chrominance components of the selected candidate sub-modes to determine the number of bits required for residual coding; wherein the target operations include one or more of the following operations: transform , Quantization and entropy coding;
  • the accurate rate-distortion cost of the selected candidate sub-mode is determined.
  • the embodiments of the present application also provide a machine-readable storage medium, which may store machine-executable instructions, which when executed by a processor, implement the code described in any embodiment of the present disclosure method.

Landscapes

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

Abstract

本申请提供一种编码方法及装置,该编码方法包括:确定当前图像块的当前模式的粗选候选子模式;确定并存储各粗选候选子模式的亮度分量的预测值;基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价;基于各所述精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。该方法可以提高子模式优选的效率。

Description

编码方法及装置 技术领域
本申请涉及视频编解码技术,尤其涉及一种编码方法及装置。
背景技术
目前,复用周围运动信息的模式存在多种,如三角预测模式、仿射(Affine)预测模式、帧内块复制技术(Intra Block Copy,简称IBC)合并(Merge)模式和普通预测模式。而每个模式下,又存在多种子模式。如三角预测模式存在两个子块,两个子块分别有5种和4种运动信息候选,组合后则最多有20种运动信息组合,而两个子块的划分方法又存在45度和135度两种划分方法,因此最多有40种子模式。
对于每个编码块,需要先确定每种模式下的最优的子模式,再从所有模式的最优子模式中选择一种子模式,作为该编码块的最优模式。若所有过程均采用复杂的决策方法进行筛选,编码的复杂度将非常高。
发明内容
有鉴于此,本申请提供一种编码方法及装置。
具体地,本申请是通过如下技术方案实现的:
根据本申请实施例的第一方面,提供一种编码方法,包括:
确定当前图像块的当前模式的粗选候选子模式;其中,所述粗选候选子模式为所述当前模式的用于进行粗选的子模式;
确定并存储各粗选候选子模式的亮度分量的预测值;
基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;其中,所述精选候选子模式为所述当前模式的用于进行精选的子模式;
从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价;
基于各所述精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。
根据本申请实施例的第二方面,提供一种编码装置,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可读指令,所述处理器被所述机器可读指令促使:
确定当前图像块的当前模式的粗选候选子模式;其中,所述粗选候选子模式为所述当前模式的用于进行粗选的子模式;
确定并存储各粗选候选子模式的亮度分量的预测值;
基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;其中,所述精选候选子模式为所述当前模式的用于进行精选的子模式;
从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价;
基于各所述精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。
本申请实施例的编码方法,通过确定当前图像块的当前模式的粗选候选子模式,确定并存储各粗选候选子模式的亮度分量的预测值,基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;进而,从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,并基于各精选候选子模式的精确率失真代价,确定当前模式的最优子模式,通过在子模式精选过程中复用子模式粗选过程中计算的亮度分量的预测值,提高了子模式精选的效率,进而,提高了子模式优选的效率。
附图说明
图1是本申请一示例性实施例示出的一种编码方法的流程示意图;
图2是本申请一示例性实施例示出的一种子模式粗选的流程示意图;
图3是本申请一示例性实施例示出的一种子模式精选的流程示意图;
图4是本申请又一示例性实施例示出的一种子模式精选的流程示意图;
图5是本申请又一示例性实施例示出的一种子模式精选的流程示意图;
图6是本申请一示例性实施例示出的一种编码装置的硬件结构示意图;
图7是本申请一示例性实施例示出的一种编码装置的结构示意图;
图8是本申请又一示例性实施例示出的一种编码装置的结构示意图;
图9是本申请又一示例性实施例示出的一种编码装置的结构示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
为了使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面先对本申请实施例中涉及的部分技术术语进行解释说明。
帧内预测(Intra Prediction):指利用当前图像块的空域相邻块(与当前图像块处于同一帧图像)的重建像素值进行预测编码。
帧间预测(Inter Prediction):指利用当前图像块的时域相邻块(与当前图像块处于不同图像)的重建像素值进行预测编码。
运动矢量(Motion Vector,简称MV):在帧间预测中,用MV表示当前图像块与其参考图像中的最佳匹配块之间的相对位移。每个划分的块都有相应的运动矢量需要传送到解码端设备。若对每个图像块的MV进行独立编码和传输,特别是划分成小尺寸的块,需要消耗相当多的比特。为了降低用于编码MV的比特数,视频编码中会利用相邻图像块之间的空间相关性,根据相邻已编码块的MV对当前图像块的MV进行预测,然后对预测差进行编码,从而有效降低表示MV的比特数。基于此,在对当前图像块的MV编码过程中,一般先使用相邻已编码块的MV预测当前图像块的MV,然后对MV的预测值(Motion Vector Prediction,简称MVP)与MV的真正估值之间的差值(MotionVector Difference,简称MVD)进行编码,从而有效降低MV的编码比特数。
运动信息(Motion Information):由于MV表示当前图像块与某个参考图像的某个图像块的位置偏移,为了准确获取指向图像块的信息,除了MV信息,还需要参考图像的索引信息来标识参考图像。视频编码技术中,对于当前图像,通常会基于一定的原则,建立一个参考图像列表,参考图像索引信息用于标识当前图像块采用了参考图像列表中的第几个参考图像。此外,很多编码技术还支持多个参考图像列表,因此还需要一个索引值标识参考图像列表,该索引值可以称为参考方向。视频编码中,将MV、参考帧索引、参考方向等与运动相关的编码信息统称为运动信息。
率失真原则(Rate-Distortion Optimized,简称RDO):评价编码效率的指标包括:码率和峰值信噪比(Peak Signal to Noise Ratio,简称PSNR)。码率越小,则压缩率越大;PSNR越大,重建图像质量越好。在模式选择的时候,判别公式实质上也就是对二者的综合评价。
模式对应的代价:J(mode)=D+λ*R。其中,D表示失真(Distortion),通常使用SSE(差值均方和)指标来衡量,SSE是指重建块与源图像块的差值均方和;λ是拉格朗日乘子;R就是该模式下图像块编码所需的实际比特数,包括编码模式信息、运动信息、残差等所需的比特数总和。
在模式选择时,若使用RDO原则去对编码模式做比较决策,通常可以保证编码性能最佳。
精确率失真计算方法与快速率失真计算方法:为了获得某一模式的率失真代价,需获得该模式的失真和比特数开销。而失真和比特数开销的获取,均需要进行该模式所有相关信息的编码,尤其是残差的熵编码,该过程非常耗时。因而,在编码端,通常包括两种率失真计算方法:精确率失真计算方法(精确RDO)和快速率失真计算方法(快速RDO)。精确率失真计算方法是经过完整的该模式所有相关信息的编码来获取最终的失真和比特数开销;而快速率失真计算方法,跳过了该模式的残差编码过程,只基于该模式的预测值与原始值之间的差,以及一些简单的模式信息码率开销估算,来估计该模式的率失真代价,其准确性不如精确率失真计算,但复杂度非常低,有利于软硬件实现。
模式(Mode)与子模式(submode):模式是指启用了某一特定方法或工具,如三角预测模式、Regular Merge(普通合并)模式、Affine Merge(仿射合并)模式等。在某一模式中,会涉及一些候选项,可以称为候选子模式(candidate submode)或子模式(submode)。例如,Regular Merge模式是指直接复用周围运动信息作为当前图像块的运动信息,而不额外编码运动信息差的方法,而周围运动信息可能有N个候选项,采用其中某一个候选项的方法则称为子模式,即模式是采用了该模式方法的所有子模式的集合。
三角预测模式(Triangle Prediction mode):将一个图像块划分为两个三角子块(存在45度的角度划分模式和135度的角度划分模式),这两个三角子块拥有不同的单向运动信息,该单向运动信息可以从候选运动信息列表中获取。该模式仅用于Merge/Skip模式,且仅用于预测过程,不影响后续的变换、量化过程。
Regular Merge(普通合并)模式:即传统Merge模式,从候选运动信息列表中选择一个运动信息,基于该运动信息生成当前图像块的预测值。该候选运动信息列表包括:空域相邻块候选运动信息、时域相邻块候选运动信息、空域非相邻块候选运动信息、基于已有运动信息进行组合获取的运动信息,以及默认运动信息(如零运动信息)等。
MMVD(Merge mode with MVD,运动矢量残差合并)模式:该模式选择Regular Merge模式的候选运动信息列表中的某一个运动信息作为基准运动信息,再通过查表方法获取运动信息差。基于基准运动信息和运动信息差获取最终的运动信息,基于该最终的运动信息生成当前图像块的预测值。
Affine Merge(仿射合并)模式:该模式是从候选运动信息列表中选择一个运动信息,基于该运动信息生成当前图像块的预测值。与Regular Merge模式相比,Regular merge模式的候选运动信息列表中的运动信息都是2参数的平移运动矢量,而Affine Merge模式的候选运动信息列表中的运动信息为4参数或6参数的仿射运动信息。
IBC Merge(帧内块复制合并)模式:该模式从候选块矢量列表中选择一个块矢量,基于该块矢量生成当前图像块的预测值。该块矢量是指参考块在当前帧中与当前图像块的偏移矢量。
融合模式(Merge mode,也可以称为合并模式):指一类直接从候选运动信息列表中选择一个运动信息,生成当前图像块的预测值的预测模式,如三角预测模式、Affine Merge模式、IBC Merge模式、regular merge模式或MMVD模式。这些模式在编码端不需要进行运动搜索过程(即编码端从候选运动信息列表中选择运动信息,而不需要搜索其他已有运动信息来确定是否存在更优的运动信息),除了MMVD模式外,其他模式都不需要编码运动信息差,即直接复用候选运动信息列表中的某个运动信息。
下面结合附图对本申请实施例中技术方案作进一步详细的说明。
请参见图1,为本申请实施例提供的一种编码方法的流程示意图,该编码方法可以应用于编码端设备,如图1所示,该编码方法可以包括以下步骤:
步骤S100、确定当前图像块的当前模式的粗选候选子模式。
本申请实施例中,为了提高确定最优模式的效率,对于任一模式,可以通过先粗选,后精选的方式,确定该模式的最优子模式。
示例性的,对于当前图像块(编码块)当前尝试使用的编码模式(本文中称为当前模式),为了确定该当前模式的最优子模式,可以先从该当前模式的子模式中选择出用于进行粗选的子模式(本文中称为粗选候选子模式)。
例如,对于任一模式,可以将该模式的全部子模式均作为粗选候选子模式。
以当前模式为三角预测模式为例,对于三角预测模式,其包括45度的角度划分模式和135度的角度划分模式。基于候选运动矢量的个数(可以称为CandNum),可以确定三角预测模式的子模式的数量为2*CandNum*(CandNum-1)。CandNum默认为5,则三角子模式的子模式的数量40个,该40个子模式均可以作为粗选候选子模式。
在一个示例中,上述确定当前模式的粗选候选子模式,可以包括:
根据当前图像块的尺寸,从当前图像块的当前模式的子模式中选择第一数量的子模式,并将第一数量的子模式确定为粗选候选子模式。
示例性的,考虑到对于任一模式,该模式的各子模式被选中为最优子模式的概率与当前图像块的尺寸存在相关性,因而,在确定粗选候选子模式时,可以根据当前图像块的尺寸,从当前模式的子模式中剔除部分子模式(被选中为最优子模式的概率较低的子模式),以精简粗选候选子模式的数量,提高子模式粗选的效率。
在一个示例中,可以根据当前图像块的长宽比,对当前模式的子模式进行筛选。
示例性的,考虑到若当前图像块的长宽比越接近1,当前模式的各子模式被选中为最优子模式的概率越接近,反之,当前模式的各子模式被选中为最优子模式的概率差别越大,因而,在确定粗选候选子模式时,可以根据当前图像块的长宽比,对当前模式的子模式进行筛选。
示例性的,从当前模式的子模式中剔除的子模式的数量可以与当前图像块的长宽比正相关,即当前图像块的长宽比越大,确定为粗选候选子模式的子模式的数量(本文中可以称为第一数量)越少。
步骤S110、确定并存储各粗选候选子模式的亮度分量的预测值。
步骤S120、基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从粗选候选子模式中粗选出精选候选子模式。
本申请实施例中,为了实现当前模式的子模式的粗选,可以确定当前模式的各粗选候选子模式的亮度分量的预测值。
例如,仍以当前模式为三角预测模式为例,对于任一粗选候选子模式,可以基于该粗选候选子模式的三角子块划分方法和各三角子块的运动信息,通过运动补偿的方式确定该粗选候选子模式的亮度分量的预测值。
编码端设备确定各粗选候选子模式的亮度分量的预测值时,一方面,可以基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从粗选候选子模式中粗选出用于进行精选的子模式(本文中称为精选候选子模式)。
另一方面,考虑到子模式的精选过程中也需要使用子模式的亮度分量的预测值,为了避免精选过程中重新计算子模式的亮度分量的预测值,编码端设备确定了各粗选候选子模式的亮度分量的预测值时,可以存储各粗选候选子模式的亮度分量的预测值,以便后续精选过程中可以直接复用该亮度分量的预测值,提高子模式精选的效率。
示例性的,对于任一粗选候选子模式,编码端设备一方面可以基于该粗选候选子模式的亮度分量的预测值和当前图像块的亮度分量的原始值,估算该粗选候选子模式的失真。
在一个示例中,可以通过计算该粗选候选子模式的亮度分量的预测值和当前图像块的亮度分量的原始值的差值的哈达玛变换之后,将当前图像块各像素点的变换后的值求和得到该粗选候选子模式的失真。
另一方面,编码端设备可以估算该粗选候选子模式的子模式信息编码所需比特数(即编码除残差之外的其他子模式信息所需的比特数)。
编码端设备确定了该粗选候选子模式的失真以及子模式信息编码所需比特数时,可以基于该粗选候选子模式的失真以及子模式信息编码所需比特数,确定该粗选候选子模式的率失真代价。
本申请实施例中,编码端设备确定了各粗选候选子模式的率失真代价时,可以基于各粗选候选子模式的率失真代价从粗选候选子模式中粗选出精选候选子模式。
例如,编码端设备可以按照各粗选候选子模式的率失真代价从小到大的顺序,选择预设数量(可以根据需求设定)的子模式作为精选候选子模式。
作为一种可能的实施方式,上述基于各粗选候选子模式的率失真代价从粗选候选子模式中粗选出精选候选子模式,可以包括:
基于各粗选候选子模式的率失真代价,按照率失真代价从小到大的顺序,从粗选候选子模式中选择出排名靠前的第二数量的粗选候选子模式确定为候选精选候选子模式;
若候选精选候选子模式中存在与最小率失真代价的差值大于预设阈值的候选精选候选子模式时,移除该候选精选候选子模式,并将剩余的候选精选候选子模式确定为精选候选子模式。
示例性的,为了精简精选候选子模式的数量,提高子模式精选的效率,对于基于粗选候选子模式的率失真代价粗选出的精选候选子模式(该实施方式中可以称为候选精选候选子模式),编码端设备可以分别将各候选精选候选子模式的率失真代价与最小率失真代价进行比较,并将率失真代价与最小率失真代价的差值大于预设阈值(可以根据实际场景设定)的候选精选候选子模式剔除,将剩余的候选精选候选子模式确定为精选候选子模式。
示例性的,上述最小率失真代价可以包括当前模式的各粗选候选子模式的率失真代价的最小值;或者,当前图像块已尝试的其他模式的各粗选候选子模式的率失真代价的最小值。
在一个示例中,上述候选精选候选子模式的数量(本文中称为第二数量)可以根据当前图像块的尺寸设置。
例如,可以根据当前图像块的长宽比,设置上述第二数量。
示例性的,上述第二数量可以与当前图像块的长宽比正相关,即当前图像块的长宽比越大,上述第二数量越多。
步骤S130、从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价。
本申请实施例中,在子模式精选过程中,不需要再次计算精选候选子模式的亮度分量的预测值,而是可以复用步骤S110中存储的粗选候选子模式的亮度分量的预测值,从而,可以提高子模式精选的效率。
示例性的,编码端设备确定了精选候选子模式时,可以从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价。
例如,假设粗选候选子模式包括子模式1~30(即步骤S110中存储了子模式1~30的亮度分量的预测值),精选候选子模式包括子模式1~5,则可以复用所存储的子模式1~5的亮度分量的预测值,而不需要再重新计算。
作为一种可能的实现方式,上述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,可以包括:
对于任一精选候选子模式,从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该子模式的色度分量的预测值;
基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的残差编码信息以及该精选候选子模式的失真;
基于该精选候选子模式的模式编码信息,以及该精选候选子模式的残差编码信息,确定该精选候选子模式的最 终比特数;
基于该精选候选子模式的失真以及最终比特数,确定该精选候选子模式的第一精确率失真代价。
示例性的,在子模式精选过程中,对于任一精选候选子模式,一方面,可以从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值;另一方面,可以计算该精选候选子模式的色度分量的预测值,并基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的残差编码信息以及该精选候选子模式的失真。
在一个示例中,上述基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的残差编码信息,可以包括:
基于该精选候选子模式的亮度分量和色度分量的预测值以及当前图像块的亮度分量和色度分量的原始值,分别确定该精选候选子模式的亮度分量和色度分量的原始残差值;
分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的第一比特数。
示例性的,上述目标操作包括以下操作之一或多个:变换、量化以及熵编码。
示例性的,对于任一精选候选子模式,在确定了该精选候选子模式的亮度分量和色度分量的预测值时,可以分别基于精选候选子模式的亮度分量的预测值和当前图像块的亮度分量的原始值,确定该精选候选子模式的亮度分量的原始残差值;以及,基于该精选候选子模式的色度分量的预测值和当前图像块的色度分量的原始值,确定该精选候选子模式的色度分量的原始残差值,进而,可以分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行变换、量化以及熵编码等操作中的一个或多个操作(本文中称为目标操作),以确定对该精选候选子模式进行残差编码所需的比特数(本文中称为第一比特数)。
在一个示例中,上述基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的失真,可以包括:
利用上述目标操作的反向操作,分别确定该精选候选子模式的亮度分量和色度分量的重建值;
基于该精选候选子模式的亮度分量和色度分量的重建值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
示例性的,按照上述方式确定了该精选候选子模式的色度分量和亮度分量的原始残差值时,可以利用目标操作的反向操作(如反变换、反量化等),分别确定该精选候选子模式的亮度分量和色度分量的重建值,并基于该精选候选子模式的亮度分量和色度分量的重建值,以及当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
例如,可以将该精选候选子模式的亮度分量和色度分量的重建值与亮度分量和色度分量的原始值的SSE确定为该精选候选子模式的失真。SSE可以通过下式得到:
SSE=w1(L 1-L 1original) 2+w2(L 2-L 2original) 2
在上式中,L 1表示该精选候选子模式的亮度分量的重建值,L 1original表示该精选候选子模式的亮度分量的原始值,L 2表示该精选候选子模式的色度分量的重建值,L 2original表示该精选候选子模式的色度分量的原始值,w1、w2分别表示权重系数。在一些实施例中,w1=w2=1。在一些实施例中,w1、w2的取值可不同。
在一个示例中,上述基于该精选候选子模式的模式编码信息,以及该精选候选子模式的残差编码信息,确定该精选候选子模式的最终比特数,可以包括:
对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
基于第一比特数以及该精选候选子模式的模式编码信息,确定该精选候选子模式的最终比特数。
示例性的,精选候选子模式的最终比特数可以根据残差编码所需的比特数(即上述第一比特数)以及模式编码信息(即对子模式信息进行编码的编码信息)确定。
示例性的对于任一精选候选子模式,当确定了该精选候选子模式的失真,以及最终比特数时,可以基于该精选候选子模式的失真以及最终比特数,确定该精选候选子模式的精确率失真代价(本文中称为第一精确率失真代价)。
在一个示例中,上述分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的第一比特数之后,还可以包括:
若目标操作包括量化操作,且该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值均为0,则将该精选候选子模式确定为当前模式的最优子模式。
示例性的,对于任一精选候选子模式,当对该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值均为0,即亮度分量和色度分量均不存在重建残差时,可以将该精选候选子模式确定为当前模式的最优子模式,而不再对当前模式的其他子模式进行尝试(即不需要按照上述方式再计算当前模式的其他子模式的精确率失真代价)。
作为一种可能的实现方式,上述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,可以包括:
对于任一精选候选子模式,从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
基于该精选候选子模式的亮度分量和色度分量的预测值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真;
对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
基于该精选候选子模式的失真以及模式编码信息,确定该精选候选子模式的第二精确率失真代价。
示例性的,在子模式精选过程中,对于任一精选候选子模式,若该精选候选子模式不需要编码残差,则可以从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,并计算该精选候选子模式的色度分量的预测值。
示例性的,由于不需要编码残差,因此,可以将亮度分量和色度分量的预测值作为亮度分量和色度分量的重建值,进而,可以基于该精选候选子模式的亮度分量和色度分量的预测值,以及当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
例如,可以将该精选候选子模式的亮度分量和色度分量的预测值(该示例中即为重建值)与亮度分量和色度分量的原始值的SSE确定为该精选候选子模式的失真。
示例性的,由于不需要编码残差,精选候选子模式最终比特数可以由模式编码信息确定,因此,可以通过对精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息(该示例中即为最终比特数),进而,可以基于该精选候选子模式的失真以及模式编码信息,确定该精选候选子模式的精确率失真代价(本文中称为第二精确率失真代价)。
与上述需要编码残差的实现方式相比,不需要编码残差的实现方式减少了残差编码带来的时间消耗和比特消耗,但是失真通常会更大(对于亮度分量和色度分量的重建残差值不均为0的情况),在实际应用中,可以根据需求选择按照需要编码残差的方式进行子模式精选,或按照不需要编码残差的方式进行子模式精选。
在一个示例中,上述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,还可以包括:
对于任一精选候选子模式,若所述目标操作包括量化操作,且该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值不均为0,则比较该精选候选子模式的第一精确率失真代价和第二精确率失真代价,将该第一精确率失真代价和第二精确率失真代价二者中的较小值确定为该精选候选子模式的精确率失真代价。
示例性的,对于任一精选候选子模式,可以分别按照需要编码残差的方式确定该精选候选子模式的精确率失真代价(即上述第一精确率失真代价),以及按照不需要编码残差的方式确定该精选候选子模式的精确率失真代价(即上述第二精确率失真代价)。
若在按照需要编码残差的方式确定该精选候选子模式的精确率失真代价的过程中,确定该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值不均为0,则可以比较该精选候选子模式的第一精确率失真代价和第二精确率失真代价,并将该第一精确率失真代价和第二精确率失真代价二者中的较小值确定为该精选候选子模式的精确率失真代价。
步骤S140、基于精选候选子模式的精确率失真代价,确定当前模式的最优子模式。
本申请实施例中,确定了精选候选子模式的精确率失真代价时,如上述第一精确率失真代价,或上述第二精确率失真代价,或上述第一精确率失真代价和第二精确率失真代价中的较小值,可以基于精选候选子模式的精确率失真代价,确定当前模式的最优子模式。
本申请实施例中,编码端设备可以基于当前图像块的各模式的最优子模式的精确率失真代价,确定当前图像块使用的模式(本文中称为目标模式),并基于目标模式对当前图像块进行编码。
例如,编码端设备可以比较各模式的最优子模式的精确率失真代价,并将精确率失真代价最小的最优子模式确定为当前图像块使用的目标模式。
作为一种可能的实现方式,上述基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价之前,还可以包括:
读取预设标志位的值;
若该预设标志位的值为第一值,则确定执行上述基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价的步骤;
若该预设标志位的值为第二值,则将各粗选候选子模式确定为精选候选子模式;基于所存储的各粗选候选子模 式的亮度分量的预测值,确定各精选候选子模式的精确率失真代价;基于各精选候选子模式的精确率失真代价,确定当前模式的最优子模式。
示例性的,为了提高子模式确定的可控性,可以预先设定一个用于标识是否跳过粗选的标志位(本文中称为预设标志位),基于该标志位的值,可以确定是否跳过粗选,即不进行子模式的粗选。
在一个示例中,该预设标志位的值为第一值,则标识不跳过粗选;该预设标志位的值为第二值,则标识跳过粗选。
示例性的,当需要确定对当前图像块进行编码使用的模式时,可以先读取该预设标志位的值。
若该预设标志位的值为第一值,则确定不跳过粗选,进而,可以按照上述实施例中描述的方式先进行子模式的粗选,然后再进行子模式的精选。
若该预设标志位的值为第二值,则确定跳过粗选,进而,可以将各粗选候选子模式确定为精选候选子模式,基于所存储的各粗选候选子模式的亮度分量的预测值,确定各精选候选子模式的精确率失真代价,并基于各精选候选子模式的精确率失真代价,确定当前模式的最优子模式。
在一个示例中,上述方法还可以包括:
基于当前图像块已尝试的其他模式的重建残差信息,确定预设标志位的值。
示例性的,考虑到子模式粗选和子模式精选过程中计算出的率失真代价的主要区别在于是否考虑残差编码所需的比特数,因此,是否需要进行编码残差影响了进行子模式粗选的必要性,而子模式的重建残差值(包括亮度分量和色度分量的重建残差值)可以作为是否需要进行编码残差的参考,因而,可以基于当前图像块已尝试的其他模式信息的重建残差信息,确定上述预设标志位的值。
在一个示例中,上述基于当前图像块已尝试的其他模式的重建残差信息,确定所述预设标志位的值,可以包括:
若当前图像块的已尝试的其他模式中最优模式的重建残差值为0,则确定预设标志位的值为第二值;
否则,确定预设标志位的值为第一值。
示例性的,考虑到当子模式的重建残差值为0(即亮度分量和色度分量的重建残差值均为0)时,不进行残差编码的相关操作可以节省模式确定的时间,且并不会带来更大的失真,因此,在对当前图像块的当前模式进行子模式优选时,可以获取当前图像块的已尝试的其他模式中最优模式的重建残差值;若当前图像块的已尝试的其他模式中最优模式的重建残差值为0(即亮度分量和色度分量的重建残差值均为0),则可以确定当前图像块的最优模式大概率不需要进行残差编码,此时,跳过粗选可以提高子模式优选的效率;若当前图像块的已尝试的其他模式中最优模式的重建残差值不为0(即亮度分量或/和色度分量的重建残差值不为0),则可以确定当前图像块的最优模式大概率需要进行残差编码,此时,进行粗选可以提高子模式优选的效率。
在一个示例中,上述方法还可以包括:
若当前模式为特定模式,则确定预设标志位的值为第一值。
示例性的,该特定模式包括任一复用周围运动信息的模式,如三角预测模式、Affine Merge(仿射合并)模式、IBC Merge(帧内块复制合并)模式、regular merge(普通合并)模式或MMVD(Merge mode with MVD,运动矢量残差合并)模式等。
为了使本领域技术人员更好地理解本申请实施例提供的技术方案,下面以当前模式为三角预测模式为例对本申请实施例提供的子模式优选方案进行说明。
实施例一
1、确定三角预测模式的粗选候选子模式。
示例性的,对于三角预测模式,其包括45度的角度划分模式和135度的角度划分模式。基于候选运动矢量的个数CandNum,三角预测模式的子模式的总数为2*CandNum*(CandNum-1)。CandNum默认为5,因此,三角预测模式的子模式的总数为40个。
示例性的,可以将三角预测模式的子模式均确定为粗选候选子模式,也可以基于的当前图像块的尺寸对子模式 进行筛选,并将剩余的子模式确定为粗选候选子模式。
假设粗选候选子模式的数量为N_rough。
2、确定三角预测模式的精选候选子模式的数量(下文中称为N_accurate)。
示例性的,精选候选子模式的数量可以设定为固定值(如3),或者,根据当前图像块的尺寸进行设定。
3、从N_rough个粗选候选子模式中粗选出N_accurate个精选候选子模式,其实现流程可以如图2所示,可以包括以下步骤:
步骤S200、对于任一粗选候选子模式,基于该粗选候选子模式的三角子块划分模式和各三角子块的运动信息,确定该粗选候选子模式的亮度分量的预测值,并存储该粗选候选子模式的亮度分量的预测值。
示例性的,可以通过运动补偿的方式确定粗选候选子模式的亮度分量的预测值。
步骤S210、基于该粗选候选子模式的亮度分量的预测值以及当前图像块的亮度分量的原始值,确定该粗选候选子模式的失真。
示例性的,粗选候选子模式的失真(下文中称为D_rough(i)),可以通过计算该粗选候选子模式的亮度分量的预测值和当前图像块的亮度分量的原始值差值的哈达玛变换之后,将全部变换后的值求和得到。
步骤S220、估算该粗选候选子模式的子模式信息编码所需比特数。
示例性的,在粗选过程中,可以估算子模式信息编码所需比特数,不考虑残差编码所需的比特数,即估算该粗选候选子模式的除残差编码外的子模式信息编码所需的比特数(下文中称为R_mode(i))。
步骤S230、基于D_rough(i)和R_mode(i)确定该粗选候选子模式的率失真代价(下文中称为J_rough(i))。
步骤S240、基于各粗选候选子模式的率失真代价从粗选候选子模式中粗选出精选候选子模式。
示例性的,可以按照率失真代价从小到大的顺序,从N_rough个粗选候选子模式中选择N_accurate个精选候选子模式。
在一个示例中,按照图2所示方法流程粗选了N_accurate个精选候选子模式之后,还可以比较该N_accurate个精选候选子模式的率失真代价与最小率失真代价,并将与该最小率失真代价的差值大于预设阈值的精选候选子模式从该N_accurate个精选候选子模式中移除(被移除的精选候选子模式不再参与子模式精选)。
示例性的,该最小率失真代价为当前模式的各粗选候选子模式的率失真代价的最小值,或者,当前图像块已尝试的其他模式的各粗选候选子模式的率失真代价的最小值。
示例性的,精选候选子模式的率失真代价与最小率失真代价的差值大于预设阈值可以为:J_mode(i)>TH1*J_mode_min,即J_mode(i)-J_mode_min>(TH1-1)J_mode_min;TH1的值可以根据实际需求设定,如设定为1.25。
下文中仍以精选候选子模式的数量为N_accurate为例进行说明。
4、计算各精选候选子模式的色度分量的预测值。
5、计算各精选候选子模式的精确率失真代价,选择精确率失真代价最小的精选候选子模式作为三角预测模式的最优子模式,其实现流程可以如图3所示,可以包括以下步骤:
步骤S300、对于任一精选候选子模式,从所存储的粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值。
示例性的,在子模式的精选过程中,可以复用粗选过程中计算得到的亮度分量的预测值,而不需要再次进行运动补偿获取亮度分量的预测值,以提高子模式精选的效率。
步骤S310、基于该精选候选子模式的亮度分量和色度分量的预测值以及当前图像块的亮度分量和色度分量的原始值,分别确定该精选候选子模式的亮度分量和色度分量的原始残差值。
步骤S320、分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的比特数(下文中称为R1)。
示例性的,目标操作可以包括变换、量化以及熵编码等操作中的一种或多种。
步骤S330、利用目标操作的反向操作,分别确定该精选候选子模式的亮度分量和色度分量的重建值,并基于该精选候选子模式的亮度分量和色度分量的重建值,以及当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
示例性的,可以将上述重建值与原始值的SSE确定为该精选候选子模式的失真(下文中称为D)。
步骤S340、对该精选候选子模式的信息进行编码,确定该精选候选子模式的模式编码信息(下文中称为R2)。
步骤S350、基于R1和R2确定该精选候选子模式的最终比特数(下文中称为R)。
步骤S360、基于该精选候选子模式的失真D和最终比特数R,确定该精选候选子模式的精确率失真代价(下文中称为J)。
步骤S370、与三角预测模式已尝试的其他精选候选子模式比较精确率失真代价,存储精确率失真代价最小的精选候选子模式的精确率失真代价。
示例性的,可以将精确率失真代价最小的精选候选子模式确定为三角预测模式的最优子模式。
示例性的,确定了三角预测模式的最优子模式时,可以存储该最优子模式的精确率失真代价,以便比较各不同模式的最优子模式的精确率失真代价,以确定对当前图像块进行编码使用的最优模式。
实施例二
1、确定三角预测模式的粗选候选子模式。
示例性的,对于三角预测模式,其包括45度的角度划分模式和135度的角度划分模式。基于候选运动矢量的个数CandNum,三角预测模式的子模式的总数为2*CandNum*(CandNum-1)。CandNum默认为5,因此,三角预测模式的子模式的总数为40个。
示例性的,可以将三角预测模式的子模式均确定为粗选候选子模式,也可以基于的当前图像块的尺寸对子模式进行筛选,并将剩余的子模式确定为粗选候选子模式。
假设粗选候选子模式的数量为N_rough。
2、确定三角预测模式的精选候选子模式的数量(下文中称为N_accurate)。
示例性的,精选候选子模式的数量可以设定为固定值(如3),或者,根据当前图像块的尺寸进行设定。
3、从N_rough个粗选候选子模式中粗选出N_accurate个精选候选子模式,其实现流程可以如图2所示,该实施例不做赘述。
在一个示例中,按照图2所示方法流程粗选了N_accurate个精选候选子模式之后,还可以比较该N_accurate个精选候选子模式的率失真代价与最小率失真代价,并将与该最小率失真代价的差值大于预设阈值的精选候选子模式从该N_accurate个精选候选子模式中移除(被移除的精选候选子模式不再参与子模式精选)。
示例性的,该最小率失真代价为当前模式的各粗选候选子模式的率失真代价的最小值,或者,当前图像块已尝试的其他模式的各粗选候选子模式的率失真代价的最小值。
示例性的,精选候选子模式的率失真代价与最小率失真代价的差值大于预设阈值可以为:J_mode(i)>TH1*J_mode_min,即J_mode(i)-J_mode_min>(TH1-1)J_mode_min;TH1的值可以根据实际需求设定,如设定为1.25。
下文中仍以精选候选子模式的数量为N_accurate为例进行说明。
4、计算各精选候选子模式的色度分量的预测值。
5、计算各精选候选子模式的精确率失真代价,选择精确率失真代价最小的精选候选子模式作为三角预测模式的最优子模式,其实现流程可以如图4所示,该流程除了可以包括图3所示步骤S300~步骤S370之外,还可以包括以下步骤:
步骤S361、判断该精选候选子模式的亮度分量和色度分量的重建残差值是否均为0。若是,则转至步骤S380;否则,转至步骤S370。
步骤S380、将该精选候选子模式确定为三角预测模式的最优子模式,并存储该精选候选子模式的精确率失真代价。
示例性的,对精选候选子模式的亮度分量和色度分量的原始残差值进行量化可以得到该精选候选子模式的亮度分量和色度分量的重建残差值。
若精选候选子模式的亮度分量和色度分量的重建残差值均为0,则该精选候选子模式可以不进行残差编码,此时,可以将该精选候选子模式确定三角预测模式的最优子模式,而不需要再对其他未尝试的三角预测模式的精选候选子模式进行尝试。
示例性的,当确定该精选候选子模式为三角预测模式的最优子模式时,可以存储该精选候选子模式的精确率失真代价,以便比较各不同模式的最优子模式的精确率失真代价,以确定对当前图像块进行编码使用的最优模式。
实施例三
以三角预测模式各子模式均不进行残差编码为例。
1、确定三角预测模式的粗选候选子模式。
示例性的,对于三角预测模式,其包括45度的角度划分模式和135度的角度划分模式。基于候选运动矢量的个数CandNum,三角预测模式的子模式的总数为2*CandNum*(CandNum-1)。CandNum默认为5,因此,三角预测模式的子模式的总数为40个。
示例性的,可以将三角预测模式的子模式均确定为粗选候选子模式,也可以基于的当前图像块的尺寸对子模式进行筛选,并将剩余的子模式确定为粗选候选子模式。
假设粗选候选子模式的数量为N_rough。
2、确定三角预测模式的精选候选子模式的数量(下文中称为N_accurate)。
示例性的,精选候选子模式的数量可以设定为固定值(如3),或者,根据当前图像块的尺寸进行设定。
3、从N_rough个粗选候选子模式中粗选出N_accurate个精选候选子模式,其实现流程可以如图2所示,该实施例不做赘述。
在一个示例中,按照图2所示方法流程粗选了N_accurate个精选候选子模式之后,还可以比较该N_accurate个 精选候选子模式的率失真代价与最小率失真代价,并将与该最小率失真代价的差值大于预设阈值的精选候选子模式从该N_accurate个精选候选子模式中移除(被移除的精选候选子模式不再参与子模式精选)。
示例性的,该最小率失真代价为当前模式的各粗选候选子模式的率失真代价的最小值,或者,当前图像块已尝试的其他模式的各粗选候选子模式的率失真代价的最小值。
示例性的,精选候选子模式的率失真代价与最小率失真代价的差值大于预设阈值可以为:J_mode(i)>TH1*J_mode_min,即J_mode(i)-J_mode_min>(TH1-1)J_mode_min;TH1的值可以根据实际需求设定,如设定为1.25。
下文中仍以精选候选子模式的数量为N_accurate为例进行说明。
4、计算各精选候选子模式的色度分量的预测值。
5、计算各精选候选子模式的精确率失真代价,选择精确率失真代价最小的精选候选子模式作为三角预测模式的最优子模式,其实现流程可以如图5所示,其可以包括以下步骤:
步骤S500、对于任一精选候选子模式,从所存储的粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值。
步骤S510、基于该精选候选子模式的亮度分量和色度分量的预测值,以及当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
示例性的,当不进行残差编码时,精选候选子模式的亮度分量和色度分量的重建值分别等于该精选候选子模式的亮度分量和色度分量的预测值。
示例性的,可以将上述预测值与原始值的SSE或带不同权重的SSE确定为该精选候选子模式的失真(下文中称为D)。
步骤S520、对该精选候选子模式的信息进行编码,确定该精选候选子模式的模式编码信息。
步骤S530、基于该精选候选子模式的失真以及模式编码信息,确定该精选候选子模式的精确率失真代价。
步骤S540、与三角预测模式已尝试的其他精选候选子模式比较精确率失真代价,存储精确率失真代价最小的精选候选子模式的精确率失真代价。
实施例四
1、确定三角预测模式的粗选候选子模式。
示例性的,对于三角预测模式,其包括45度的角度划分模式和135度的角度划分模式。基于候选运动矢量的个数CandNum,三角预测模式的子模式的总数为2*CandNum*(CandNum-1)。CandNum默认为5,因此,三角预测模式的子模式的总数为40个。
示例性的,可以将三角预测模式的子模式均确定为粗选候选子模式,也可以基于的当前图像块的尺寸对子模式进行筛选,并将剩余的子模式确定为粗选候选子模式。
假设粗选候选子模式的数量为N_rough。
2、确定三角预测模式的精选候选子模式的数量(下文中称为N_accurate)。
示例性的,精选候选子模式的数量可以设定为固定值(如3),或者,根据当前图像块的尺寸进行设定。
3、从N_rough个粗选候选子模式中粗选出N_accurate个精选候选子模式,其实现流程可以如图2所示,该实施例不做赘述。
在一个示例中,按照图2所示方法流程粗选了N_accurate个精选候选子模式之后,还可以比较该N_accurate个精选候选子模式的率失真代价与最小率失真代价,并将与该最小率失真代价的差值大于预设阈值的精选候选子模式从该N_accurate个精选候选子模式中移除(被移除的精选候选子模式不再参与子模式精选)。
示例性的,该最小率失真代价为当前模式的各粗选候选子模式的率失真代价的最小值,或者,当前图像块已尝试的其他模式的各粗选候选子模式的率失真代价的最小值。
示例性的,精选候选子模式的率失真代价与最小率失真代价的差值大于预设阈值可以为:J_mode(i)>TH1*J_mode_min,即J_mode(i)-J_mode_min>(TH1-1)J_mode_min;TH1的值可以根据实际需求设定,如设定为1.25。
下文中仍以精选候选子模式的数量为N_accurate为例进行说明。
4、计算各精选候选子模式的色度分量的预测值。
5、计算各精选候选子模式的精确率失真代价,选择精确率失真代价最小的精选候选子模式作为三角预测模式的最优子模式。
示例性,对于任一精选候选子模式,可以分别按照图3所示方法流程(步骤S300~步骤S360)计算该精选候选子模式的精确率失真代价(下文中称为精确率失真代价1),以及按照图5所示方法流程(步骤S500~步骤S530)计算该精选候选子模式的精确率失真代价(下文中称为精确率失真代价2),并比较精确率失真代价1和精确率失真代价2,将二者中的较小者确定为该精选候选子模式的精确率失真代价。
可见,通过分别计算进行残差编码的精确率失真代价和不进行残差编码的精确率失真代价,更准确地确定出率失真代价最小的子模式作为最优子模式,优化了子模式优选的效果。
实施例五
在实施例四所示子模式优选方案的基础上,对于任一精选候选子模式,在按照步骤S300~步骤S360描述的方式确定了该精选候选子模式在进行残差编码的情况下的精确率失真代价之后,可以判断该精选候选子模式的亮度分量和色度分量的重建残差值是否均为0;若是,则将该精选候选子模式确定为三角预测模式的最优子模式,不再按照步骤S500~步骤S530描述的方式确定该精选候选子模式在不进行残差编码的情况下的精确率失真代价,也不再对三角预测模式的其他未尝试的精选候选子模式进行尝试;否则,按照步骤S500~步骤S530描述的方式确定该精选候选子模式在不进行残差编码的情况下的精确率失真代价,并按照实施例四中描述的方式进行该精选候选子模式的精确率失真代价的确定。
实施例六
1、读取预设标志位的值。
示例性的,可以预先设定一个用于标识是否跳过粗选的标志位,即预设标志位(下文中称为bestisSkip);若bestisSkip为0,则标识不跳过粗选;若bestisSkip为1,则标识跳过粗选。
在一个示例中,可以基于当前图像块已尝试的其他模式的重建残差信息,确定bestisSkip的值。
例如,若当前图像块的已尝试的其他模式中最优模式的重建残差值为0,则确定bestisSkip的值为1;否则,确定bestisSkip的值为0。
在另一个示例中,可以基于当前模式,确定bestisSkip的值。
例如,若当前模式为特定模式,则确定bestisSkip的值为0。
2、若bestisSkip的值为0,则可以按照实施例一、实施例二以及实施例三中任一实施例中描述的方式进行子模 式的优选(包括粗选和精选)。
3、若bestisSkip的值为1,则可以直接将N_accurate设置为N_rough(即全部粗选候选子模式均作为精选候选子模式,进行子模式精选),并按照实施例一、实施例二以及实施例三中任一实施例中描述的方式进行子模式的精选(跳过粗选),即可以按照图3、图4或图5所示的方式进行子模式的精选。
需要说明的是,在步骤3中,由于跳过了粗选,因此,在子模式的精选过程中,如果未存储各粗选候选子模式的亮度分量的预测值,则需要计算各精选候选子模式的亮度分量的预测值。如果存储有各粗选候选子模式的亮度分量的预测值,可复用各粗选候选子模式的亮度分量的预测值。
实施例七
实施例一至实施例六是以当前模式为三角预测模式为例进行了子模式优选的实现的说明,但当前模式并不限于三角预测模式,实施例一至实施例六的子模式优选方法也可以适用于Affine Merge模式、IBC Merge模式、regular merge模式和MMVD模式等复用周围块运动信息的模式。
示例性的,与应用于三角预测模式相比,当上述实施例描述的子模式优选方式应用于Affine Merge模式、IBC Merge模式、regular merge模式或MMVD模式时,区别在于候选子模式的运动信息类型和数量存在差异(如表1所示)。
表1
Figure PCTCN2020096591-appb-000001
本申请实施例中,通过确定当前图像块的当前模式的粗选候选子模式,确定并存储各粗选候选子模式的亮度分量的预测值,基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;进而,从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,并基于精选候选子模式的精确率失真代价,确定当前模式的最优子模式,通过在子模式精选过程中复用子模式粗选过程中计算的亮度分量的预测值,提高了子模式精选的效率,进而,提高了子模式优选的效率。
以上对本申请提供的方法进行了描述。下面对本申请提供的装置进行描述:
请参见图6,为本申请实施例提供的一种编码装置的硬件结构示意图。该编码装置可包括处理器601、存储有机器可执行指令的机器可读存储介质602。处理器601与机器可读存储介质602可经由系统总线603通信。并且,通过读取并执行机器可读存储介质602中与编码控制逻辑对应的机器可执行指令,处理器601可执行上文描述的编码方法。
本文中提到的机器可读存储介质602可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、 易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。
如图7所示,从功能上划分,上述编码控制逻辑可以包括第一确定单元710、第二确定单元720、存储单元730、粗选单元740、精选单元750以及第三确定单元760;其中:
所述第一确定单元710,用于确定当前图像块的当前模式的粗选候选子模式;其中,所述粗选候选子模式为所述当前模式的用于进行粗选的子模式;
所述第二确定单元720,用于确定各粗选候选子模式的亮度分量的预测值;
所述存储单元730,用于存储各粗选候选子模式的亮度分量的预测值;
所述粗选单元740,用于基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;其中,所述精选候选子模式为所述当前模式的用于进行精选的子模式;
所述精选单元750,用于从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价;
所述第三确定单元760,用于基于所述精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。
作为一种可能的实施方式,所述第一确定单元710,用于根据所述当前图像块的尺寸,从所述当前图像块的当前模式的子模式中选择第一数量的子模式,并将第一数量的子模式确定为所述粗选候选子模式。
作为一种可能的实施方式,所述粗选单元740,用于基于各粗选候选子模式的率失真代价,按照率失真代价从小到大的顺序,从所述粗选候选子模式中选择出排名靠前的第二数量的粗选候选子模式确定为候选精选候选子模式;若所述候选精选候选子模式中存在与最小率失真代价的差值大于预设阈值的候选精选候选子模式时,移除该候选精选候选子模式,并将剩余的候选精选候选子模式确定为精选候选子模式。
作为一种可能的实施方式,所述最小率失真代价为所述当前模式的各粗选候选子模式的率失真代价的最小值,或者,所述当前图像块已尝试的其他模式的各粗选候选子模式的率失真代价的最小值。
作为一种可能的实施方式,所述第二数量根据所述当前图像块的尺寸设置。
作为一种可能的实施方式,所述精选单元750,用于对于任一精选候选子模式,从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的残差编码信息以及该精选候选子模式的失真;
基于该精选候选子模式的模式编码信息,以及该精选候选子模式的残差编码信息,确定该精选候选子模式的最终比特数;
基于该精选候选子模式的失真以及最终比特数,确定该精选候选子模式的第一精确率失真代价。
作为一种可能的实施方式,所述精选单元750,用于基于该精选候选子模式的亮度分量和色度分量的预测值以及所述当前图像块的亮度分量和色度分量的原始值,分别确定该精选候选子模式的亮度分量和色度分量的原始残差值;
分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的第一比特数;其中,所述目标操作包括以下操作之一或多个:变换、量化以及熵编码。
作为一种可能的实施方式,所述精选单元750,用于利用所述目标操作的反向操作,分别确定该精选候选子模式的亮度分量和色度分量的重建值;
基于该精选候选子模式的亮度分量和色度分量的重建值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
作为一种可能的实施方式,所述精选单元750,用于对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
基于所述第一比特数以及该精选候选子模式的模式编码信息,确定该精选候选子模式的最终比特数。
作为一种可能的实施方式,所述精选单元750,用于若所述目标操作包括量化操作,且该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值均为0,则将该精选候选子模式确定为所述当前模式的最优子模式。
作为一种可能的实施方式,所述精选单元750,用于对于任一精选候选子模式,从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
基于该精选候选子模式的亮度分量和色度分量的预测值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真;
对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
基于该精选候选子模式的失真以及模式编码信息,确定该精选候选子模式的第二精确率失真代价。
作为一种可能的实施方式,所述精选单元750,用于对于任一精选候选子模式,若所述目标操作包括量化操作,且该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值不均为0,则比较该精选候选子模式的第一精确率失真代价和第二精确率失真代价,将该第一精确率失真代价和第二精确率失真代价二者中的较小值确定为该精选候选子模式的精确率失真代价。
作为一种可能的实施方式,如图8所示,上述编码控制逻辑还可以包括:读取单元770;
所述读取单元770,用于读取预设标志位的值;其中,所述预设标志位用于标识是否跳过粗选;
所述粗选单元740,用于若所述预设标志位的值为第一值,则基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价;
所述精选单元750,还用于若所述预设标志位的值为第二值,则将各所述粗选候选子模式确定为精选候选子模式;基于所存储的各粗选候选子模式的亮度分量的预测值,确定各精选候选子模式的精确率失真代价;基于所述各精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。
作为一种可能的实施方式,如图9所示,上述编码控制逻辑还可以包括:第四确定单元780;
所述第四确定单元780,用于基于所述当前图像块已尝试的其他模式的重建残差信息,确定所述预设标志位的值。
作为一种可能的实施方式,所述第四确定单元780,用于若所述当前图像块的已尝试的其他模式中最优模式的重建残差值为0,则确定所述预设标志位的值为所述第二值;
否则,确定所述预设标志位的值为所述第一值。
作为一种可能的实施方式,所述第四确定单元780,还用于若所述当前模式为特定模式,则确定所述预设标志 位的值为所述第一值;
其中,所述特定模式包括任一复用周围运动信息的模式。
作为一种可能的实施方式,所述粗选单元740,用于基于该粗选候选子模式的亮度分量的预测值以及所述当前图像块的亮度分量的原始值,确定该粗选候选子模式的失真;
估算该粗选候选子模式的子模式信息编码所需比特数;
基于该粗选候选子模式的失真,以及子模式信息编码所需比特数,确定该粗选候选子模式的率失真代价;
基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式。
作为一种可能的实施方式,当所述当前模式为三角预测模式时,所述粗选单元750,用于对于任一精选候选子模式,从所存储的各粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
基于该精选候选子模式的亮度分量和色度分量的预测值以及所述当前图像块的亮度分量和色度分量的原始值,分别确定该精选候选子模式的亮度分量和色度分量的原始残差值;
分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的比特数;其中,所述目标操作包括以下操作之一或多个:变换、量化以及熵编码;
利用所述目标操作的反向操作,分别确定该精选候选子模式的亮度分量和色度分量的重建值;
基于该精选候选子模式的亮度分量和色度分量的重建值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真;
对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
基于该精选候选子模式残差编码所需的比特数以及模式编码信息,确定该精选候选子模式的最终比特数;
基于该精选候选子模式的失真以及最终比特数,确定该精选候选子模式的精确率失真代价。
本申请实施例还提供一种机器可读存储介质,该机器可读存储介质上可以存储有机器可执行指令,所述机器可执行指令被处理器执行时实现本公开任一实施例描述的编码方法。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。

Claims (20)

  1. 一种编码方法,应用于编码端设备,所述方法包括:
    确定当前图像块的当前模式的粗选候选子模式;其中,所述粗选候选子模式为所述当前模式的用于进行粗选的子模式;
    确定并存储各所述粗选候选子模式的亮度分量的预测值;
    基于各所述粗选候选子模式的亮度分量的预测值估算各所述粗选候选子模式的率失真代价;
    基于各所述粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式;其中,所述精选候选子模式为所述当前模式的用于进行精选的子模式;
    从所存储的各所述粗选候选子模式的亮度分量的预测值中获取各所述精选候选子模式的亮度分量的预测值;
    基于各所述精选候选子模式的亮度分量的预测值确定各所述精选候选子模式的精确率失真代价;
    基于各所述精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。
  2. 根据权利要求1所述的方法,其特征在于,所述确定当前模式的粗选候选子模式,包括:
    根据所述当前图像块的尺寸,从所述当前图像块的当前模式的子模式中选择第一数量的子模式,并
    将所述第一数量的子模式确定为所述粗选候选子模式。
  3. 根据权利要求1或2所述的方法,其特征在于,所述基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式,包括:
    基于各所述粗选候选子模式的率失真代价,按照率失真代价从小到大的顺序,从所述粗选候选子模式中选择出排名靠前的第二数量的粗选候选子模式确定为候选精选候选子模式;
    若所述候选精选候选子模式中存在与最小率失真代价的差值大于预设阈值的候选精选候选子模式时,移除该候选精选候选子模式,并将剩余的候选精选候选子模式确定为所述精选候选子模式。
  4. 根据权利要求3所述的方法,其特征在于,所述最小率失真代价为所述当前模式的各所述粗选候选子模式的率失真代价的最小值,或者,所述当前图像块已尝试的其他模式的各所述粗选候选子模式的率失真代价的最小值。
  5. 根据权利要求3或4所述的方法,其特征在于,所述第二数量根据所述当前图像块的尺寸设置。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,包括:
    对于任一所述精选候选子模式,从所存储的各所述粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
    基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的残差编码信息以及该精选子候选模式的失真;
    基于该精选候选子模式的模式编码信息,以及该精选候选子模式的残差编码信息,确定该精选候选子模式的最终比特数;
    基于该精选候选子模式的失真以及最终比特数,确定该精选候选子模式的第一精确率失真代价。
  7. 根据权利要求6所述的方法,其特征在于,所述基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的残差编码信息,包括:
    基于该精选候选子模式的亮度分量和色度分量的预测值以及所述当前图像块的亮度分量和色度分量的原始值,分别确定该精选候选子模式的亮度分量和色度分量的原始残差值;
    分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的第一比特数;其中,所述目标操作包括以下操作之一或多个:变换、量化以及熵编码。
  8. 根据权利要求7所述的方法,其特征在于,所述基于该精选候选子模式的亮度分量和色度分量的预测值,确定该精选候选子模式的失真,包括:
    利用所述目标操作的反向操作,分别确定该精选候选子模式的亮度分量和色度分量的重建值;
    基于该精选候选子模式的亮度分量和色度分量的重建值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真。
  9. 根据权利要求7所述的方法,其特征在于,所述基于该精选候选子模式的模式编码信息,以及该精选候选子模式的残差编码信息,确定该精选候选子模式的最终比特数,包括:
    对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
    基于所述第一比特数以及该精选候选子模式的模式编码信息,确定该精选候选子模式的最终比特数。
  10. 根据权利要求7-9任一项所述的方法,其特征在于,所述分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的第一比特数之后,还包括:
    若所述目标操作包括量化操作,且该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值均为0,则将该精选候选子模式确定为所述当前模式的最优子模式。
  11. 根据权利要求1-10任一项所述的方法,其特征在于,所述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,包括:
    对于任一所述精选候选子模式,从所存储的各所述粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
    基于该精选候选子模式的亮度分量和色度分量的预测值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真;
    对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
    基于该精选候选子模式的失真以及模式编码信息,确定该精选候选子模式的第二精确率失真代价。
  12. 根据权利要求11所述的方法,其特征在于,所述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,还包括:
    对于任一所述精选候选子模式,若所述目标操作包括量化操作,且该精选候选子模式的亮度分量和色度分量的原始残差值进行量化后得到的亮度分量和色度分量的重建残差值不均为0,则比较该精选候选子模式的第一精确率失真代价和第二精确率失真代价,将该第一精确率失真代价和第二精确率失真代价二者中的较小值确定为该精选候选子模式的精确率失真代价。
  13. 根据权利要求1-12任一项所述的方法,其特征在于,所述基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价之前,还包括:
    读取预设标志位的值;其中,所述预设标志位用于标识是否跳过粗选;
    若所述预设标志位的值为第一值,则基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价;
    若所述预设标志位的值为第二值,则
    将各所述粗选候选子模式确定为精选候选子模式;
    基于所存储的各所述粗选候选子模式的亮度分量的预测值,确定各所述精选候选子模式的精确率失真代价;
    基于所述各精选候选子模式的精确率失真代价,确定所述当前模式的最优子模式。
  14. 根据权利要求13所述的方法,其特征在于,所述方法还包括:
    基于所述当前图像块已尝试的其他模式的重建残差信息,确定所述预设标志位的值。
  15. 根据权利要求14所述的方法,其特征在于,所述基于所述当前图像块已尝试的其他模式的重建残差信息,确定所述预设标志位的值,包括:
    若所述当前图像块的已尝试的其他模式中最优模式的重建残差值为0,则确定所述预设标志位的值为所述第二值;
    若所述当前图像块的已尝试的其他模式中最优模式的重建残差值不为0,则确定所述预设标志位的值为所述第一值。
  16. 根据权利要求13-15任一项所述的方法,其特征在于,所述方法还包括:
    若所述当前模式为特定模式,则确定所述预设标志位的值为所述第一值;
    其中,所述特定模式包括任一复用周围运动信息的模式。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述基于各粗选候选子模式的亮度分量的预测值估算各粗选候选子模式的率失真代价,并基于各粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式,包括:
    基于该粗选候选子模式的亮度分量的预测值以及所述当前图像块的亮度分量的原始值,确定该粗选候选子模式的失真;
    估算该粗选候选子模式的子模式信息编码所需比特数;
    基于该粗选候选子模式的失真,以及子模式信息编码所需比特数,确定该粗选候选子模式的率失真代价;
    基于各所述粗选候选子模式的率失真代价从所述粗选候选子模式中粗选出精选候选子模式。
  18. 根据权利要求1-17任一项所述的方法,其特征在于,当所述当前模式为三角预测模式时,所述从所存储的各粗选候选子模式的亮度分量的预测值中获取各精选候选子模式的亮度分量的预测值,并基于各精选候选子模式的亮度分量的预测值确定各精选候选子模式的精确率失真代价,包括:
    对于任一所述精选候选子模式,从所存储的各所述粗选候选子模式的亮度分量的预测值中获取该精选候选子模式的亮度分量的预测值,以及计算该精选候选子模式的色度分量的预测值;
    基于该精选候选子模式的亮度分量和色度分量的预测值以及所述当前图像块的亮度分量和色度分量的原始值,分别确定该精选候选子模式的亮度分量和色度分量的原始残差值;
    分别对该精选候选子模式的亮度分量和色度分量的原始残差值进行目标操作,确定残差编码所需的比特数;其中,所述目标操作包括以下操作之一或多个:变换、量化以及熵编码;
    利用所述目标操作的反向操作,分别确定该精选候选子模式的亮度分量和色度分量的重建值;
    基于该精选候选子模式的亮度分量和色度分量的重建值,以及所述当前图像块的亮度分量和色度分量的原始值,确定该精选候选子模式的失真;
    对该精选候选子模式的子模式信息进行编码,确定该精选候选子模式的模式编码信息;
    基于该精选候选子模式残差编码所需的比特数以及模式编码信息,确定该精选候选子模式的最终比特数;
    基于该精选候选子模式的失真以及最终比特数,确定该精选候选子模式的精确率失真代价。
  19. 一种编码装置,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可读指令,所述处理器被所述机器可读指令促使执行权利要求1-18任一所述的方法。
  20. 一种机器可读存储介质,所述机器可读存储介质上存储有机器可执行指令,所述机器可执行指令被处理器执行时实现权利要求1-18任一所述的方法。
PCT/CN2020/096591 2019-06-20 2020-06-17 编码方法及装置 WO2020253728A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910539426.7 2019-06-20
CN201910539426.7A CN112118444B (zh) 2019-06-20 2019-06-20 编码方法及装置

Publications (1)

Publication Number Publication Date
WO2020253728A1 true WO2020253728A1 (zh) 2020-12-24

Family

ID=73796152

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/096591 WO2020253728A1 (zh) 2019-06-20 2020-06-17 编码方法及装置

Country Status (2)

Country Link
CN (1) CN112118444B (zh)
WO (1) WO2020253728A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114710666B (zh) * 2022-06-01 2022-09-02 深圳比特微电子科技有限公司 一种编码模式的选择方法、装置

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101207810A (zh) * 2006-12-21 2008-06-25 联想(北京)有限公司 一种h264视频编码快速模式选择方法和装置
CN103929652A (zh) * 2014-04-30 2014-07-16 西安电子科技大学 视频标准中基于自回归模型的帧内预测快速模式选择方法
CN103997646A (zh) * 2014-05-13 2014-08-20 北京航空航天大学 一种高清视频编码中快速帧内预测模式选择方法
CN104052994A (zh) * 2014-04-14 2014-09-17 嘉兴职业技术学院 分级自适应的hevc帧内预测模式快速决策方法
CN104602019A (zh) * 2014-12-31 2015-05-06 乐视网信息技术(北京)股份有限公司 一种视频编码方法及装置
US20150245068A1 (en) * 2014-02-21 2015-08-27 Industry-Academic Cooperation Foundation, Yonsei University Tsm rate-distortion optimizing method, encoding method and device using the same, and apparatus for processing picture
CN106231302A (zh) * 2016-07-28 2016-12-14 同观科技(深圳)有限公司 一种最优帧内预测模式的确定方法和系统
CN106454349A (zh) * 2016-10-18 2017-02-22 哈尔滨工业大学 一种基于h.265视频编码的运动估计块匹配方法

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1206864C (zh) * 2002-07-22 2005-06-15 中国科学院计算技术研究所 结合率失真优化的码率控制的方法及其装置
CN100455021C (zh) * 2004-09-30 2009-01-21 华为技术有限公司 帧内预测模式的选择方法
EP2343901B1 (en) * 2010-01-08 2017-11-29 BlackBerry Limited Method and device for video encoding using predicted residuals
CN104954787B (zh) * 2014-03-27 2018-03-23 浙江大华技术股份有限公司 Hevc帧间预测模式选择方法及装置
CN103905818B (zh) * 2014-04-13 2017-02-15 浙江师范大学 基于霍夫变换的hevc标准中帧内预测模式快速确定方法
US10142626B2 (en) * 2014-10-31 2018-11-27 Ecole De Technologie Superieure Method and system for fast mode decision for high efficiency video coding
CN104320657B (zh) * 2014-10-31 2017-11-03 中国科学技术大学 Hevc无损视频编码的预测模式选择方法及相应的编码方法
CN104581152A (zh) * 2014-12-25 2015-04-29 同济大学 一种hevc帧内预测模式选择加速方法
CN104639940B (zh) * 2015-03-06 2017-10-10 宁波大学 一种快速hevc帧内预测模式选择方法
US9807423B1 (en) * 2015-11-24 2017-10-31 Google Inc. Hybrid transform scheme for video coding
CN105657420B (zh) * 2015-12-30 2018-03-20 邦彦技术股份有限公司 一种面向hevc的快速帧内预测模式判决方法和装置
CN106131547B (zh) * 2016-07-12 2018-07-03 北京大学深圳研究生院 视频编码中帧内预测模式的快速决策方法
JP2018078545A (ja) * 2016-10-07 2018-05-17 財團法人工業技術研究院Industrial Technology Research Institute 画面内予測の予測モードを選択する方法、ビデオ符号化デバイス及び画像処理装置
US20180103251A1 (en) * 2016-10-07 2018-04-12 Industrial Technology Research Institute Method for selecting prediction mode of intra prediction, video encoding device and image processing apparatus

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101207810A (zh) * 2006-12-21 2008-06-25 联想(北京)有限公司 一种h264视频编码快速模式选择方法和装置
US20150245068A1 (en) * 2014-02-21 2015-08-27 Industry-Academic Cooperation Foundation, Yonsei University Tsm rate-distortion optimizing method, encoding method and device using the same, and apparatus for processing picture
CN104052994A (zh) * 2014-04-14 2014-09-17 嘉兴职业技术学院 分级自适应的hevc帧内预测模式快速决策方法
CN103929652A (zh) * 2014-04-30 2014-07-16 西安电子科技大学 视频标准中基于自回归模型的帧内预测快速模式选择方法
CN103997646A (zh) * 2014-05-13 2014-08-20 北京航空航天大学 一种高清视频编码中快速帧内预测模式选择方法
CN104602019A (zh) * 2014-12-31 2015-05-06 乐视网信息技术(北京)股份有限公司 一种视频编码方法及装置
CN106231302A (zh) * 2016-07-28 2016-12-14 同观科技(深圳)有限公司 一种最优帧内预测模式的确定方法和系统
CN106454349A (zh) * 2016-10-18 2017-02-22 哈尔滨工业大学 一种基于h.265视频编码的运动估计块匹配方法

Also Published As

Publication number Publication date
CN112118444B (zh) 2022-11-25
CN112118444A (zh) 2020-12-22

Similar Documents

Publication Publication Date Title
CN112584173B (zh) 一种编解码方法及其设备
CN107277546B (zh) 编码装置和方法、解码装置和方法以及存储介质
WO2017005146A1 (zh) 视频编码和解码方法、视频编码和解码装置
US20060039476A1 (en) Methods for efficient implementation of skip/direct modes in digital video compression algorithms
CN110933426B (zh) 一种解码、编码方法及其设备
US8228985B2 (en) Method and apparatus for encoding and decoding based on intra prediction
WO2022194103A1 (zh) 解码方法、编码方法、装置、设备及存储介质
WO2020253728A1 (zh) 编码方法及装置
WO2020001591A1 (zh) 一种解码、编码方法及其设备
CN110662074B (zh) 一种运动矢量确定方法和设备
WO2018184411A1 (zh) 一种预测模式的判决方法、装置及存储介质
CN112449180A (zh) 一种编解码方法、装置及其设备
JP4281667B2 (ja) 画像符号化装置
CN110691247B (zh) 一种解码、编码方法和设备
CN117242479A (zh) 用于视频处理的方法、装置和介质
KR20130105402A (ko) 추가의 비트 레이트 오버헤드 없이 참조 블록의 로컬 조명 및 콘트라스트 보상에 기초한 멀티 뷰 비디오 코딩 및 디코딩 방법
Po et al. Compensated sum of absolute difference for fast H. 264 inter mode selection
WO2012114561A1 (ja) 動画像符号化装置及び動画像符号化方法

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

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

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20827060

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 16/09/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20827060

Country of ref document: EP

Kind code of ref document: A1