Coding mode prediction method and device, equipment, medium and product
By calculating the additional cost in video encoding and determining the target cost, the image color block problem caused by poor chroma component encoding in the prior art is solved, the encoding effect is improved and the distortion of chroma component is reduced, and better Image quality.
Patent Information
- Application Number
- CN202411545689.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-31
AI Technical Summary
In the existing video encoding technology, the encoding mode prediction method based on the cost of rate distortion can easily lead to poor chroma component encoding, resulting in color block problems in the image.
By obtaining the chromaticity distortion information of the current block, if the preset conditions are met, an additional cost is calculated and the target cost is determined based on the additional cost, thereby determining the target encoding mode in multiple candidate encoding modes to improve the encoding effect and reduce the chroma component distortion.
At the same encoding bit rate, the image color block problem is significantly improved, the encoding mode prediction effect is improved, and the obvious distortion of the chromaticity component is reduced.
Smart Images

Figure CN119316593A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as cloud storage, cloud computing, and video coding, and in particular to a coding mode prediction method, device, equipment, medium, and product. Background Art
[0002] Coding mode prediction for video coding refers to predicting the coding mode of the current block to encode the video at the lowest possible bit rate while maintaining a certain level of video quality.
[0003] In the related art, coding mode prediction is usually performed based on rate distortion cost (RdCost). Summary of the invention
[0004] The present disclosure provides a coding mode prediction method, apparatus, device, medium and product.
[0005] According to one aspect of the present disclosure, a coding mode prediction method is provided, comprising: for various candidate coding modes among multiple candidate coding modes, obtaining chrominance distortion information of a current block corresponding to the various candidate coding modes; if the chrominance distortion information satisfies a preset condition, determining additional costs of the various candidate coding modes, and determining target costs of the various candidate coding modes based on the additional costs; and determining a target coding mode among the multiple candidate coding modes based on the target cost.
[0006] According to another aspect of the present disclosure, a coding mode prediction device is provided, including: an acquisition module, used to acquire, for various candidate coding modes among multiple candidate coding modes, chrominance distortion information of a current block corresponding to the various candidate coding modes; a determination module, used to determine the additional costs of the various candidate coding modes if the chrominance distortion information meets a preset condition, and determine the target costs of the various candidate coding modes based on the additional costs; and a prediction module, used to determine the target coding mode among the multiple candidate coding modes based on the target cost.
[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method as described in any of the above aspects.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to any one of the above aspects.
[0009] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the methods described in any one of the above aspects.
[0010] According to the embodiments of the present disclosure, the encoding effect can be improved and the color block problem of the image can be improved.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0013] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0014] Figure 2 is a schematic diagram of an application scenario for implementing an embodiment of the present disclosure;
[0015] Figure 3 is a schematic diagram of a target cost calculation process provided according to an embodiment of the present disclosure;
[0016] Figure 4 is a schematic diagram according to a second embodiment of the present disclosure;
[0017] Figure 5 is a schematic diagram according to a third embodiment of the present disclosure;
[0018] Figure 6 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0019] Figure 7 It is a schematic diagram of an electronic device used to implement the coding mode prediction method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0021] YUV is a video data format, mainly used in television systems, including analog and digital television. In YUV, Y refers to luminance (Luminance or Luma), and U and V refer to chrominance (Chrominance or Chroma). Common YUV formats mainly include the following:
[0022] YUV444: The sampling rates of the three components Y, U, and V are all 1, that is, each pixel has independent Y, U, and V values. This is the highest quality YUV format, but the data volume is also the largest.
[0023] YUV422: U and V samples are taken once for every two pixels. Compared with YUV444, the chroma resolution is reduced by half.
[0024] YUV420: U and V samples are taken once for every four pixels. Compared with YUV444, the chroma resolution is reduced by three quarters. This is the most commonly used YUV format because it greatly reduces the amount of data while maintaining good video quality.
[0025] YUV411: U and V samples are taken once for every four pixels, but the horizontal resolution of chroma is lower than that of YUV420.
[0026] YUV410: U and V are sampled once every nine pixels, and the horizontal and vertical resolutions of chroma are low.
[0027] YUV400: only has Y component, no U and V components, that is, black and white video.
[0028] When predicting the coding mode, the cumulative coding cost (sum_RdCost) of the three components Y, U, and V is usually used as a criterion, and the mode with the smaller sum_RdCost is selected as the optimal coding mode. Where sum_RdCost = Y_RdCost + U_RdCost + V_RdCost.
[0029] The above cost is usually the rate-distortion cost, which is used to measure the pros and cons of different coding modes in video coding. It comprehensively considers the bit rate and distortion degree after coding. It can be expressed as:
[0030] Rd_Cost=D+λR
[0031] Among them, Rd_Cost is the rate distortion cost;
[0032] D is the distortion;
[0033] R is the encoding bit rate;
[0034] λ is the preset weight adjustment parameter.
[0035] Most of the current video encodings are done by encoding videos in YUV420 data format.
[0036] When calculating sum_RdCost for each coding mode, since the Y component accounts for a larger proportion of data and the U and V components account for a lower proportion of data, even if there are obvious abnormalities in the U and V components, the sum_RdCost is smaller, resulting in the optimal coding mode being a mode with poor chrominance component encoding, resulting in image color block problems.
[0037] In order to improve the image color block problem, the present disclosure provides the following embodiments.
[0038] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. This embodiment provides a coding mode prediction method, such as Figure 1 As shown, the method includes:
[0039] 101. For each candidate coding mode among a plurality of candidate coding modes, obtain chrominance distortion information of a current block corresponding to the various candidate coding modes.
[0040] 102. If the chrominance distortion information satisfies a preset condition, determine additional costs of the various candidate coding modes, and determine target costs of the various candidate coding modes based on the additional costs.
[0041] 103. Determine a target coding mode from among the multiple candidate coding modes based on the target cost.
[0042] In the video encoding scenario, the current block refers to the pixel block currently being encoded in the video.
[0043] Chroma distortion information refers to distortion-related information on the chroma component.
[0044] Assuming that the video format is the YUV format, the chrominance component includes a U component and a Y component.
[0045] The distortion-related information may include: distortion degree and / or distortion variance.
[0046] Distortion is used to characterize the degree of distortion.
[0047] Commonly used distortion measurement methods include mean square error (MSE), peak signal-to-noise ratio (PSNR), etc. The mean square error is the average of the square difference between the original pixel block and the reconstructed pixel block; PSNR is based on the mean square error, for example, the maximum pixel value is divided by the mean square error and then the logarithm is taken. It can be expressed as:
[0048]
[0049] Among them, MSE is the mean square error;
[0050] x i is the pixel value of the i-th pixel in the original pixel block;
[0051] y i is the pixel value of the i-th pixel in the reconstructed pixel block;
[0052] n is the total number of pixels.
[0053]
[0054] Among them, PSNR is the peak signal-to-noise ratio;
[0055] MSE is the mean square error;
[0056] MAX I is the maximum pixel value. For example, for an 8-bit grayscale image, MAX I =255.
[0057] Taking the YUV format as an example, the distortion in the chrominance distortion information is specifically the chrominance distortion, including the U component distortion and the V component distortion, which are represented by dist_U and dist_V respectively. Taking the distortion as MSE as an example, the MSE of the U component is taken as dist_U, and the MSE of the V component is taken as dist_V.
[0058] The distortion variance refers to the variance between the distortions of the sub-blocks of the current block.
[0059] Assuming that the sub-block size is 4*4, the current block can be divided into multiple 4*4 sub-blocks, and the distortion of each sub-block is calculated, for example, the mean square error of each sub-block, and then the variance between the sub-blocks is calculated based on the distortion of each sub-block. For example, the distortion mean is first calculated based on the distortion of each sub-block, and then the square sum of the distortion of each sub-block and the distortion mean is calculated as the variance.
[0060] The variance is expressed as:
[0061]
[0062] Among them, var represents variance;
[0063] m is the total number of sub-blocks;
[0064] d i is the distortion of the ith sub-block;
[0065] d avg is the mean value of the sub-block distortion.
[0066] Taking the YUV format as an example, the distortion variance in the chrominance distortion information is specifically the chrominance distortion variance, including the U component distortion variance and the V component distortion variance, which are represented by var_dist_U and var_dist_V respectively. Taking var_dist_U as an example, var_dist_U is the variance calculated according to the distortion of the 4*4 sub-block corresponding to the U component.
[0067] After obtaining the chroma distortion information of the current block, such as the chroma distortion degree (dist_U and dist_V) and / or the chroma distortion variance (var_dist_U and var_dist_V) mentioned above, it is determined whether the obtained chroma distortion information meets the preset conditions. When the preset conditions are met, the additional cost is calculated, and then the target cost is calculated based on the additional cost.
[0068] Specifically, the preset conditions may include: the target chromaticity distortion is greater than a preset multiple of the luminance distortion; and / or the target chromaticity distortion variance is greater than a preset variance threshold.
[0069] Among them, the target chromaticity distortion is the maximum value of the chromaticity distortion, expressed as:
[0070] max(dist_U,dist_V);
[0071] The target chroma distortion variance is the maximum value among the chroma distortion variances, expressed as:
[0072] max(var_dist_U,var_dist_V).
[0073] Luminance distortion is the distortion calculated based on the luminance component. In the YUV format, it is the distortion calculated based on the Y component, such as the MSE of the Y component, represented by dist_Y.
[0074] Based on this, if max(dist_U,dist_V)>dist_Y*k1, and / or,
[0075] If max(var_dist_U,var_dist_V)>k2, then calculate the additional cost.
[0076] Among them, k1 is a preset multiple, and k2 is a preset variance threshold.
[0077] After obtaining the additional cost, the target cost is calculated based on the additional cost.
[0078] The target cost is a parameter of the final calculation, and specifically may be a rate-distortion cost.
[0079] The additional cost refers to an additional parameter introduced outside the usual cost function. For example, the target cost is the rate-distortion cost, and the usual cost is calculated based on the distortion D and the coding bit rate R. In this embodiment, an additional parameter is introduced, which is called the additional cost and is represented by R. extra express.
[0080] The calculation formula can be:
[0081] sum_Rd_Cost=D+λ(R+R extra );
[0082] Among them, sum_Rd_Cost is the target cost;
[0083] R extra It is an extra cost;
[0084] D, R, and λ are parameters usually involved in the cost function, as described above, which are distortion, coding bit rate, and weight adjustment parameter, respectively.
[0085] After the target cost of each candidate coding mode is determined, the target coding mode is determined based on the target cost. For example, the candidate coding mode with the smallest target cost is used as the target coding mode.
[0086] In this embodiment, when the chrominance distortion information meets the preset conditions, the additional cost of each candidate coding mode is determined, the target cost is determined based on the additional cost, and the target coding mode is determined based on the target cost. In this way, the additional cost can be introduced when calculating the target cost, thereby improving the coding mode prediction effect, thereby reducing the obvious distortion of the chrominance component on the basis of the same coding bit rate, thereby significantly improving the image color block problem.
[0087] In order to better understand the present disclosure, the application scenarios involved in the present disclosure are described as follows:
[0088] Figure 2 It is a schematic diagram of an application scenario for implementing the embodiment of the present disclosure.
[0089] In this embodiment, coding mode prediction in video coding is taken as an example.
[0090] In a video coding scenario, for a current block in a current frame, a target coding mode may be determined from a plurality of candidate coding modes through a coding mode prediction process, and then the current block may be encoded using the target coding mode.
[0091] Generally speaking, the more complex the coding mode is, the more coding bits are required and the smaller the distortion is. When predicting the coding mode, it is necessary to balance the coding bits and the distortion. To this end, the rate-distortion cost (Rd_Cost) can be used to measure the pros and cons of different coding modes, which comprehensively considers the bit rate and distortion after encoding.
[0092] For data in YUV format, the target cost is usually the sum of the costs of each component, represented by sum_Rd_Cost.
[0093] After obtaining the target cost of each candidate coding mode, the candidate coding mode with the smallest target cost may be used as the target coding mode.
[0094] Specifically, Figure 2 As shown, assuming that there are N candidate coding modes, represented by the first coding mode, the second coding mode, ... the Nth coding mode, the target cost (such as sum_Rd_Cost) of each candidate coding mode can be calculated, represented by sum_Rd_cost1~sum_Rd_costN respectively, and the candidate coding mode corresponding to the minimum cost is taken as the target coding mode.
[0095] For each candidate coding mode, when no additional cost is introduced, its target cost can be expressed as:
[0096] sum_Rd_Cost=D+λR
[0097] =D Y +D U +D V +λ(R Y +R U +R V )
[0098] Where sum_Rd_Cost is the target cost; D Y ,D U ,D V are the distortion of Y, U, and V components respectively; R Y ,R U ,R V are the encoding bit rates of the Y, U, and V components respectively; λ is a preset weight adjustment parameter.
[0099] Since the Y component accounts for a high proportion in sum_Rd_Cost, the chrominance distortion may be high for a candidate coding mode (such as D U and D VTherefore, when determining the target coding mode based on sum_Rd_Cost, the candidate coding mode with larger chrominance distortion may be used as the target coding mode, which may cause color block problems.
[0100] To this end, if the chrominance distortion of the current block is large, in the embodiment of the present disclosure, an additional cost will be introduced, and the target cost will be calculated based on the additional cost. After that, the candidate coding mode with the smallest target cost can be used as the target coding mode.
[0101] Based on this, for each candidate coding mode, when introducing additional cost, its target cost can be expressed as:
[0102] sum_Rd_Cost=D+λ(R+R extra )
[0103] =D Y +D U +D V +λ(R Y +R U +R V +R extra )
[0104] Where sum_Rd_Cost is the target cost; D Y ,D U ,D V are the distortion of Y, U, and V components respectively; R Y ,R U ,R V are the encoding bit rates of the Y, U, and V components respectively; λ is the preset weight adjustment parameter; R extra It’s an extra cost.
[0105] Figure 3 It is a schematic diagram of the target cost calculation process provided according to an embodiment of the present disclosure.
[0106] like Figure 3 As shown, for each candidate coding mode, it can be determined whether the chrominance distortion information of the current block meets the preset conditions. If so, the additional cost is calculated, and the target cost is calculated based on the additional cost. If not, the target cost is calculated based on the usual method.
[0107] Specifically, when the additional cost is introduced, the calculation formula can be:
[0108] sum_Rd_Cost=D+λ(R+R extra )
[0109] =D Y +D U +DV +λ(R Y +R U +R V +R extra )
[0110] When no additional cost is introduced, the calculation formula can be:
[0111] sum_Rd_Cost=D+λR
[0112] =D Y +D U +D V +λ(R Y +R U +R V )
[0113] In the above formula, sum_Rd_Cost is the target cost; D Y ,D U ,D V are the distortion of Y, U, and V components respectively; R Y ,R U ,R V are the encoding bit rates of the Y, U, and V components respectively; λ is the preset weight adjustment parameter; R extra It’s an extra cost.
[0114] In combination with the above application scenarios, the present disclosure also provides the following embodiments.
[0115] Figure 4 is a schematic diagram according to a second embodiment of the present disclosure. This embodiment provides a coding mode prediction method, the method comprising:
[0116] 401. For each candidate coding mode among a plurality of candidate coding modes, obtain chrominance distortion information of a current block corresponding to the various candidate coding modes.
[0117] 402. Determine whether the chromaticity distortion information meets a preset condition. If so, execute 403; otherwise, execute 404.
[0118] Specifically, it may include: if the chroma distortion information includes a target chroma distortion, and the target chroma distortion is greater than a preset multiple of the luminance distortion of the current block, determining that the chroma distortion information meets a preset condition; and / or,
[0119] If the chromaticity distortion information includes a target chromaticity distortion variance, and the target chromaticity distortion is greater than a preset variance threshold, it is determined that the chromaticity distortion information meets a preset condition.
[0120] If the current block includes multiple chrominance components, the target chrominance distortion is the maximum value among the multiple chrominance distortions. Similarly, the target chrominance distortion variance is the maximum value among the multiple chrominance distortion variances.
[0121] Taking the YUV format as an example, the target chroma distortion is the maximum value of the U component distortion and the V component distortion, and the target chroma distortion variance is the maximum value of the U component distortion variance and the V component distortion variance.
[0122] The formula is:
[0123] Based on this, if max(dist_U, dist_V)>dist_Y*k1, the preset condition is met; and / or,
[0124] If max(var_dist_U,var_dist_V)>k2, the preset condition is met.
[0125] Among them, k1 is the preset multiple, k2 is the preset variance threshold;
[0126] dist_U, dist_V are the distortion of U component and V component respectively;
[0127] dist_Y is the distortion of the Y component (brightness component);
[0128] var_dist_U, var_dist_V are the distortion variance of the U component and the V component respectively;
[0129] max() is the maximum value operation.
[0130] In this embodiment, by judging whether the preset conditions are met based on the chromaticity distortion degree and / or the chromaticity distortion variance, the current block with obvious chromaticity distortion can be accurately and comprehensively predicted, and then for the current block with obvious chromaticity distortion, a target encoding mode that can reduce the chromaticity distortion can be selected to improve the image color block problem.
[0131] 403. Determine additional costs of the various candidate coding modes, and determine target costs of the various candidate coding modes based on the additional costs.
[0132] The additional cost may be determined based on the current optimal mode chrominance distortion and the current chrominance distortion corresponding to the current block.
[0133] Taking the YUV format as an example, the current optimal mode chromaticity distortion is represented by dist_U_best, dist_V_best, and the current chromaticity distortion is represented by dist_U, dist_V. The additional cost R extra The calculation formula can be:
[0134]
[0135] Among them, R extra is the additional cost;
[0136] qp is a preset quantization parameter; it is used to control the bitrate and encoding distortion. The larger qp is, the greater the distortion and the lower the bitrate;
[0137] dist diff is the distortion error;
[0138] dist_U, dist_V are the current chrominance distortion degrees;
[0139] dist_U_best, dist_V_best are the current optimal mode chrominance distortion degrees.
[0140] Among them, the current chrominance distortion degree is the chrominance distortion degree corresponding to the current coding mode, the current optimal mode chrominance distortion degree is the chrominance distortion degree corresponding to the current optimal coding mode, and the current optimal coding mode is the optimal coding mode among all the candidate coding modes that have been processed currently.
[0141] Specifically, each candidate coding mode can be traversed in turn to calculate the target cost of each candidate coding mode. The currently traversed candidate coding mode is the current coding mode. Assuming that the current coding mode is the second coding mode, then the current chrominance distortion degree is the chrominance distortion degree corresponding to the second coding mode. Assuming that the first coding mode has been traversed before, then the current optimal mode chrominance distortion degree is the chrominance distortion degree corresponding to the optimal coding mode among the first coding mode and the second coding mode. For example, if the target cost corresponding to the first coding mode is sum1 and the target cost corresponding to the second coding mode is sum2, and sum2 < sum1, then the current optimal mode is the second coding mode, and the current optimal mode chrominance distortion degree is the chrominance distortion degree corresponding to the second coding mode. Another example is that after traversing the second coding mode, the current traverses the third coding mode. Then the current optimal mode is the optimal coding mode among the first coding mode, the second coding mode, and the third coding mode, and the current optimal mode chrominance distortion degree is the chrominance distortion degree corresponding to the current optimal mode.
[0142] In this embodiment, determining the additional cost based on the current optimal mode chrominance distortion degree and the current chrominance distortion degree can accurately and efficiently obtain the additional cost, improving the processing accuracy and efficiency.
[0143] After calculating the additional cost, calculate the target cost based on the additional cost. Specifically, the original distortion degrees and original coding bitrates corresponding to the various candidate coding modes can be obtained; the target coding bitrate can be obtained based on the additional cost and the original coding bitrate; the target cost can be determined based on the original distortion degree and the target coding bitrate.
[0144] The calculation formula can be:
[0145] sum_Rd_Cost=D+λ(R+R extra );
[0146] Among them, sum_Rd_Cost is the target cost;
[0147] D and R are the original distortion and original coding bit rate respectively;
[0148] R extra It is an extra cost;
[0149] R+R extra is the target encoding bit rate;
[0150] λ is the preset weight adjustment parameter.
[0151] In this embodiment, the target coding bit rate is obtained based on the additional cost and the original coding bit rate, and the target cost is determined based on the original distortion and the target coding bit rate. In this way, the additional cost is introduced into the coding bit rate part, which improves the accuracy of the target cost, thereby avoiding the occurrence of coding blocks with abnormal chroma and improving the accuracy of the target coding mode.
[0152] 404. Determine the target cost based on the original distortion and the original encoding bit rate corresponding to the various candidate encoding modes.
[0153] The calculation formula can be:
[0154] sum_Rd_Cost=D+λR;
[0155] Among them, sum_Rd_Cost is the target cost;
[0156] D and R are the original distortion and original coding bit rate respectively;
[0157] λ is the preset weight adjustment parameter.
[0158] In this embodiment, when the chrominance distortion information does not meet the preset condition, the target cost is determined based on the original distortion and the original encoding bit rate, which can simplify the calculation and improve the processing efficiency.
[0159] 405. Determine a target coding mode from among the multiple candidate coding modes based on the target cost.
[0160] Specifically, the candidate coding mode with the smallest target cost may be used as the target coding mode.
[0161] In this way, the target encoding mode can be obtained simply and efficiently.
[0162] Figure 5is a schematic diagram according to a third embodiment of the present disclosure. This embodiment provides a coding mode prediction method, the method comprising:
[0163] 501. Get the current block in the video.
[0164] The current block is an image block currently being encoded in the video. Specifically, for each frame of an image in the video, the image can be divided into multiple image blocks, and each image block is used as a current block, and then the current block can be encoded.
[0165] 502. For each candidate coding mode among the plurality of candidate coding modes, obtain a target chroma distortion and a target chroma distortion variance of a current block corresponding to the various candidate coding modes.
[0166] Among them, a plurality of candidate coding modes are preset, and for each coding mode, a target chroma distortion and a target chroma distortion variance of the current block are calculated respectively.
[0167] The target distortion can be represented by max(dist_U, dist_V), and the target chrominance distortion variance can be represented by max(var_dist_U, var_dist_V). The specific calculation process can refer to the relevant description of the above embodiment.
[0168] 503. Determine whether any of the following is satisfied:
[0169] max(dist_U,dist_V)>dist_Y*k1;
[0170] max(var_dist_U,var_dist_V)>k2;
[0171] Wherein, dist_Y is the brightness distortion, and the calculation process can refer to the relevant description of the above embodiment, k1 is a preset multiple, and k2 is a preset variance threshold.
[0172] If yes, execute 504; otherwise, execute 505.
[0173] 504 . Determine the additional costs of the various candidate coding modes, and determine the target costs of the various candidate coding modes based on the additional costs. Then, execute 506 .
[0174] For example, the calculation formula for the target cost at this time is:
[0175] sum_Rd_Cost=D+λ(R+R extra );
[0176] Among them, sum_Rd_Cost is the target cost;
[0177] D and R are the original distortion and original coding bit rate respectively;
[0178] R extra It is an extra cost;
[0179] R+R extra is the target encoding bit rate;
[0180] λ is the preset weight adjustment parameter.
[0181] Additional cost R extra For the specific calculation process of , please refer to the relevant description of the above embodiment.
[0182] 505. Determine additional costs of the various candidate coding modes, and determine target costs of the various candidate coding modes based on the additional costs.
[0183] For example, the calculation formula for the target cost at this time is:
[0184] sum_Rd_Cost=D+λR;
[0185] Among them, sum_Rd_Cost is the target cost;
[0186] D and R are the original distortion and original coding bit rate respectively;
[0187] λ is the preset weight adjustment parameter.
[0188] 506. Use the candidate coding mode corresponding to the minimum target cost as the target coding mode of the current block.
[0189] 507. Use the target coding mode to encode the current block.
[0190] For example, assuming that the candidate encoding modes include: a first encoding mode, a second encoding mode and a third encoding mode, and after calculation, the target cost corresponding to the first encoding mode is the smallest, the first encoding mode is adopted to encode the current block.
[0191] Afterwards, 501 and subsequent steps may be repeatedly executed until all blocks are encoded.
[0192] Figure 6 It is a schematic diagram according to the fourth embodiment of the present disclosure. This embodiment provides a coding mode prediction device. The device 600 includes: an acquisition module 601, a determination module 602 and a prediction module 603.
[0193] The acquisition module 601 is used to obtain the chrominance distortion information of the current block corresponding to various candidate coding modes among multiple candidate coding modes; the determination module 602 is used to determine the additional costs of the various candidate coding modes if the chrominance distortion information meets a preset condition, and determine the target costs of the various candidate coding modes based on the additional costs; the prediction module 603 is used to determine the target coding mode among the multiple candidate coding modes based on the target cost.
[0194] In this embodiment, when the chromaticity distortion information meets the preset conditions, the additional cost of each candidate coding mode is determined, the target cost is determined based on the additional cost, and the target coding mode is determined based on the target cost. In this way, the additional cost can be introduced when calculating the target cost, thereby improving the coding mode prediction effect, thereby reducing chromaticity distortion and improving image color block problems on the basis of the same coding bit rate.
[0195] In some embodiments, the determining module 602 is further configured to:
[0196] If the chroma distortion information includes a target chroma distortion, and the target chroma distortion is greater than a preset multiple of the luminance distortion of the current block, it is determined that the chroma distortion information meets a preset condition; and / or,
[0197] If the chromaticity distortion information includes a target chromaticity distortion variance, and the target chromaticity distortion is greater than a preset variance threshold, it is determined that the chromaticity distortion information meets a preset condition.
[0198] In this embodiment, by judging whether the preset conditions are met based on the chromaticity distortion degree and / or the chromaticity distortion variance, the current block with obvious chromaticity distortion can be accurately and comprehensively predicted, and then for the current block with obvious chromaticity distortion, a target encoding mode that can reduce the chromaticity distortion can be selected to improve the image color block problem.
[0199] In some embodiments, the determining module 602 is further configured to:
[0200] The additional cost is determined based on the current optimal mode chrominance distortion and the current chrominance distortion corresponding to the current block.
[0201] In this embodiment, the additional cost is determined based on the current optimal mode chromaticity distortion and the current chromaticity distortion, so that the additional cost can be obtained accurately and efficiently, thereby improving processing accuracy and efficiency.
[0202] In some embodiments, the determining module 602 is further configured to:
[0203] Obtaining original distortion and original encoding bit rate corresponding to the various candidate encoding modes;
[0204] Obtaining a target encoding bit rate based on the additional cost and the original encoding bit rate;
[0205] The target cost is determined based on the original distortion and the target encoding bit rate.
[0206] In this embodiment, the target coding bit rate is obtained based on the additional cost and the original coding bit rate, and the target cost is determined based on the original distortion and the target coding bit rate. In this way, the additional cost is introduced into the coding bit rate part, which improves the accuracy of the target cost and thus improves the accuracy of the target coding mode.
[0207] In some embodiments, the determining module 602 is further configured to:
[0208] If the chrominance distortion information does not meet the preset condition, the target cost is determined based on the original distortion and the original encoding bit rate corresponding to the various candidate encoding modes.
[0209] In this embodiment, when the chrominance distortion information does not meet the preset condition, the target cost is determined based on the original distortion and the original encoding bit rate, which can simplify the calculation and improve the processing efficiency.
[0210] It can be understood that in the embodiments of the present disclosure, the same or similar contents in different embodiments can be referenced to each other.
[0211] It can be understood that the “first”, “second”, etc. in the embodiments of the present disclosure are only used for distinction and do not indicate the degree of importance, time sequence, etc.
[0212] It is understandable that unless there is any special limitation on the sequence of steps in the process, it means that the timing relationship between these steps is not limited.
[0213] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0214] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0215] Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device 700 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0216] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0217] Multiple components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0218] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as the coding mode prediction method. For example, in some embodiments, the coding mode prediction method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the coding mode prediction method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the coding mode prediction method in any other appropriate manner (e.g., by means of firmware).
[0219] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0220] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable task processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0221] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0222] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0223] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0224] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0225] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0226] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A coding mode prediction method, comprising: For each candidate coding mode among the plurality of candidate coding modes, obtaining chrominance distortion information of a current block corresponding to the various candidate coding modes; If the chroma distortion information satisfies a preset condition, determining additional costs of the various candidate coding modes, and determining target costs of the various candidate coding modes based on the additional costs; Based on the target cost, a target coding mode is determined among the multiple candidate coding modes.
2. The method according to claim 1, further comprising: If the chroma distortion information includes a target chroma distortion, and the target chroma distortion is greater than a preset multiple of the luminance distortion of the current block, determining that the chroma distortion information meets a preset condition; and / or, If the chromaticity distortion information includes a target chromaticity distortion variance, and the target chromaticity distortion is greater than a preset variance threshold, it is determined that the chromaticity distortion information meets a preset condition.
3. The method according to claim 1, wherein: The additional cost of determining the various candidate coding modes includes: The additional cost is determined based on the current optimal mode chrominance distortion and the current chrominance distortion corresponding to the current block.
4. The method according to claim 3, wherein: The determining the target costs of the various candidate coding modes based on the additional cost includes: Obtaining original distortion and original encoding bit rate corresponding to the various candidate encoding modes; Obtaining a target encoding bit rate based on the additional cost and the original encoding bit rate; The target cost is determined based on the original distortion and the target encoding bit rate.
5. The method according to claim 1, further comprising: If the chrominance distortion information does not meet the preset condition, the target cost is determined based on the original distortion and the original encoding bit rate corresponding to the various candidate encoding modes.
6. A coding mode prediction device, comprising: An acquisition module, configured to acquire, for each candidate coding mode among a plurality of candidate coding modes, chrominance distortion information of a current block corresponding to each candidate coding mode; A determination module, configured to determine additional costs of the various candidate coding modes if the chroma distortion information satisfies a preset condition, and determine target costs of the various candidate coding modes based on the additional costs; A prediction module is used to determine a target coding mode among the multiple candidate coding modes based on the target cost.
7. The device according to claim 6, wherein: The determining module is also used for: If the chroma distortion information includes a target chroma distortion, and the target chroma distortion is greater than a preset multiple of the luminance distortion of the current block, determining that the chroma distortion information meets a preset condition; and / or, If the chromaticity distortion information includes a target chromaticity distortion variance, and the target chromaticity distortion is greater than a preset variance threshold, it is determined that the chromaticity distortion information meets a preset condition.
8. The device according to claim 6, wherein: The determination module is further used for: The additional cost is determined based on the current optimal mode chrominance distortion and the current chrominance distortion corresponding to the current block.
9. The device according to claim 8, wherein: The determination module is further used for: Obtaining original distortion and original encoding bit rate corresponding to the various candidate encoding modes; Obtaining a target encoding bit rate based on the additional cost and the original encoding bit rate; The target cost is determined based on the original distortion and the target encoding bit rate.
10. The device according to claim 6, wherein: The determining module is also used for: If the chrominance distortion information does not meet the preset condition, the target cost is determined based on the original distortion and the original encoding bit rate corresponding to the various candidate encoding modes.
11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
13. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Coding method and device
CN112118444A
Method and apparatus for performing rate distortion analysis for palette mode
CN114208172A
Method and device for selecting chroma coding mode and computer equipment
CN115278225A
Method and device for determining coding mode, electronic equipment and storage medium
CN116347088A
Video image compression coding distortion control method and device, equipment and medium
CN117834897A