WO2020107288A1 - 视频编码优化方法、装置及计算机存储介质 - Google Patents
视频编码优化方法、装置及计算机存储介质 Download PDFInfo
- Publication number
- WO2020107288A1 WO2020107288A1 PCT/CN2018/118012 CN2018118012W WO2020107288A1 WO 2020107288 A1 WO2020107288 A1 WO 2020107288A1 CN 2018118012 W CN2018118012 W CN 2018118012W WO 2020107288 A1 WO2020107288 A1 WO 2020107288A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- level
- block
- encoded
- image frame
- pixel
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/189—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
- H04N19/19—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding using optimisation based on Lagrange multipliers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/189—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
- H04N19/196—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters
Definitions
- the embodiments of the present application relate to the technical field of video encoding and decoding, and in particular, to a video encoding optimization method, device, and computer storage medium.
- the video image acquired by a relatively stationary camera position has a scene with a fixed background and a foreground person or object moving.
- Most video encoders can maintain the quality of the background part relatively well, presenting the characteristics of high visual quality; and for the foreground part of the motion, due to the widespread introduction of Rate-Distortion Optimization (RDO) technology, the encoder
- RDO Rate-Distortion Optimization
- the mode with poor recovery quality is often selected for encoding, which results in the block phenomenon of the reconstructed video image in the motion area, and even low quality situations such as blur smear.
- the embodiments of the present application are expected to provide a video encoding optimization method, device, and computer storage medium, which can effectively improve the encoding quality of the image motion area, objectively reduce the quality error of the foreground content and background content, and achieve overall subjectivity The purpose of quality improvement and improvement.
- the block-level optimization factor is used to characterize the improvement of the block-level coding quality Parameter adjustment degree
- block-level coding optimization processing is performed on the image frame to be coded.
- the method further includes:
- the obtaining the block-level optimization factor of the image frame to be encoded according to the pixel distortion value and the block-level division of the image frame to be encoded includes:
- the block-level optimization factor of the image frame to be encoded is obtained according to the degree of deviation of the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function.
- the obtaining the block-level optimization factor of the image frame to be encoded according to the pixel distortion value and the block-level division of the image frame to be encoded includes:
- a first distortion set is obtained; wherein, the first distortion set is used to characterize the pixel distortion value set corresponding to the pixel distortion value greater than the preset distortion threshold;
- the block level division of the image frame to be encoded and the block level optimization factor of the image frame to be encoded are determined.
- the block-level coding optimization processing for the image frame to be coded based on the block-level optimization factor includes:
- the optimized block-level quantization parameter is obtained according to the optimized and adjusted block-level Lagrange multiplier
- block-level encoding processing is performed on the image frame to be encoded.
- the acquiring the pixel distortion value corresponding to at least one pixel in the image frame to be encoded includes:
- a pixel distortion value corresponding to each pixel in the image frame to be encoded is obtained.
- the calculating the frame-level dispersion probability distribution function of the image frame to be encoded according to the dispersion value includes:
- the probability values corresponding to different absolute values of dispersion are counted;
- the frame-level dispersion probability distribution function of the image frame to be encoded is calculated according to the obtained absolute value of the dispersion and the probability values corresponding to the respective dispersion values.
- the obtaining the block-level optimization factor of the image frame to be encoded according to the deviation degree of the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function includes:
- the optimization of the block-level Lagrange multiplier according to the block-level optimization factor includes:
- the image frame to be encoded is a P frame, record the block-level optimization factor, and use the block-level optimization factor as the reference value of the block-level optimization factor of the B frame;
- the block-level Lagrange multiplier is optimized and adjusted according to the block-level optimization factor reference value; wherein, the block-level optimization factor reference value is based on the corresponding position of the P frame The block-level optimization factor is obtained.
- the method further includes:
- the image frame to be encoded is not a tail frame, continue to perform the process of the video encoding optimization method of the next frame image;
- the process of the video encoding optimization method ends.
- an embodiment of the present application provides a video encoding optimization apparatus, the video encoding optimization apparatus includes: an acquisition unit and an encoding unit,
- the acquiring unit is configured to acquire a pixel distortion value corresponding to at least one pixel in the image frame to be encoded; wherein the pixel distortion value is used to characterize the quality of the encoding quality of the image frame to be encoded;
- the acquiring unit is further configured to acquire the block-level optimization factor of the image frame to be encoded according to the pixel distortion value and the block-level division of the image frame to be encoded; wherein, the block-level optimization factor is used to Characterize the degree of adjustment of parameters required for the improvement of block-level coding quality;
- the coding unit is configured to perform block-level coding optimization processing on the image frame to be coded based on the block-level optimization factor.
- the video encoding optimization apparatus further includes a calculation unit configured to average the pixel distortion values corresponding to all pixels in the image frame to be encoded to obtain the first pixel corresponding to the image frame to be encoded An average value of distortion; and based on the pixel distortion value corresponding to each pixel in the image frame to be encoded and the average value of the first pixel distortion, a dispersion value of at least one pixel in the image frame to be encoded is obtained.
- the calculation unit is further configured to calculate a frame-level dispersion probability distribution function of the image frame to be encoded based on the dispersion value; and based on the block level division of the image frame to be encoded, Calculating the block-level dispersion probability distribution function of the image frame to be encoded;
- the acquiring unit is configured to acquire the block-level optimization factor of the image frame to be encoded according to the degree of deviation of the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function.
- the acquiring unit is further configured to compare the pixel distortion value with a preset distortion threshold; and when the pixel distortion value is greater than the preset distortion threshold, a first distortion set is obtained; wherein, The first distortion set is used to characterize a pixel distortion value set corresponding to a pixel distortion value greater than a preset distortion threshold;
- the calculation unit is further configured to perform an average calculation on the pixel distortion values in the first distortion set to obtain a second pixel distortion average value corresponding to the image frame to be encoded;
- the acquiring unit is further configured to determine the block level division of the image frame to be encoded and the block level of the image frame to be encoded based on the pixel distortion value in the first distortion set and the second pixel distortion mean Optimization factor.
- the video encoding optimization apparatus further includes an adjustment unit configured to optimize and adjust the block-level Lagrangian multiplier according to the block-level optimization factor; and based on the Lagrangian multiplier and the quantization parameter Correspondence between them, according to the optimized and adjusted block-level Lagrangian multiplier, the optimized and adjusted block-level quantization parameters are obtained;
- the encoding unit is configured to perform block-level encoding processing on the image frame to be encoded based on the optimized block-level Lagrange multiplier and the optimized adjusted block-level quantization parameter.
- the acquiring unit is further configured to acquire the reconstructed pixel value and the original pixel value corresponding to at least one pixel in the image frame to be encoded; and by reconstructing the reconstructed pixel value and the original pixel The value is calculated to obtain a pixel distortion value corresponding to at least one pixel in the image frame to be encoded.
- the calculation unit is further configured to perform absolute value processing on the dispersion value to obtain an absolute value of dispersion corresponding to at least one pixel in the image frame to be encoded; and according to the obtained absolute value of dispersion Values, statistics of probability values corresponding to different absolute deviations of the dispersion; and calculating the frame-level dispersion probability distribution function of the image frame to be encoded according to the obtained absolute deviations of the dispersion and the probability values corresponding to the respective dispersion values.
- the calculation unit is further configured to perform difference integration on the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function to obtain the block-level and The value of the degree of deviation between frame levels is determined as the block-level optimization factor.
- the video encoding optimization apparatus further includes a comparison unit configured to record the block-level optimization factor if the image frame to be encoded is a P-frame, and use the block-level optimization factor as the B-frame A block-level optimization factor reference value; and if the image frame to be encoded is a B-frame, the block-level Lagrange multiplier is optimally adjusted according to the block-level optimization factor reference value; wherein, the block-level optimization factor The reference value is obtained according to the block-level optimization factor at the corresponding position of the P frame.
- the comparison unit is further configured to determine whether the image frame to be encoded is a tail frame; and if the image frame to be encoded is not a tail frame, continue to perform the video encoding optimization method of the next frame image Process; and if the image frame to be encoded is a tail frame, then the process of the video encoding optimization method ends.
- an embodiment of the present application provides a video encoding optimization device, where the video encoding optimization device includes: a memory and a processor;
- the memory is used to store a computer program that can run on the processor
- the processor is configured to execute the steps of the method according to any one of the first aspects when running the computer program.
- an embodiment of the present application provides a computer storage medium that stores a video encoding optimization program that is implemented as any one of the first aspects when executed by at least one processor Steps of the method
- Embodiments of the present application provide a video encoding optimization method, device, and computer storage medium, by obtaining a pixel distortion value corresponding to at least one pixel in an image frame to be encoded, and then according to the pixel distortion value and the image to be encoded Block-level division of the frame to obtain the block-level optimization factor of the image frame to be coded; because the pixel distortion value is used to characterize the quality of the image frame to be coded, the block-level coding quality can be obtained Improve the block-level optimization factor of the required parameter adjustment; finally, based on the block-level optimization factor, perform block-level coding optimization on the image frame to be coded; in this way, perform block-level coding optimization on the image frame to be coded through the block-level optimization factor Processing can improve the quality of the foreground motion area in the image frame to be encoded, so that the quality of the foreground motion area is close to the quality of the background static area, thereby reducing the quality error of the foreground content and the background content, which has
- FIG. 1 is a schematic flowchart of a video encoding optimization method provided by an embodiment of this application;
- FIG. 2 is a schematic diagram of a histogram of a dispersion probability density function provided by an embodiment of this application;
- FIG. 3 is a schematic diagram of another histogram of dispersion probability density functions provided by embodiments of the present application.
- FIG. 4 is a schematic structural diagram of a dispersion probability distribution curve provided by an embodiment of this application.
- FIG. 5 is a schematic structural diagram of a block-level dispersion probability distribution curve and a frame-level dispersion probability distribution curve provided by an embodiment of this application;
- FIG. 6 is a detailed flowchart of a video encoding optimization method provided by an embodiment of the present application.
- FIG. 7 is a detailed flowchart of a block-level coding optimization process provided by an embodiment of this application.
- FIG. 8 is a schematic structural diagram of a video encoding optimization device provided by an embodiment of the present application.
- FIG. 9 is a schematic structural diagram of another video encoding optimization device provided by an embodiment of the present application.
- FIG. 10 is a schematic structural diagram of yet another video encoding optimization device provided by an embodiment of this application.
- FIG. 11 is a schematic structural diagram of yet another video encoding optimization device provided by an embodiment of the present application.
- FIG. 12 is a schematic diagram of a specific hardware structure of a video encoding optimization device provided by an embodiment of the present application.
- each coding unit (Coding Unit, CU) it divides generally uses the same parameter for encoding, which can be Including quantization parameters (QuantizationParameter, QP) and Lagrange multipliers (Lambda, ⁇ ).
- QP quantization parameters
- Lambda Lagrange multipliers
- the image quality selected by the encoder will show a difference in one frame of image Very big feature.
- the efficiency of video encoding has been improved from the perspective of the average statistics of distortion, from the perspective of the visual quality of the image, the image quality has not met expectations. Therefore, how to effectively control the worst quality of a frame of images is more meaningful than raising its mean value.
- the current mainstream video coding optimization techniques are all focused on how to save the code rate and how to reduce the average distortion of pixels, without taking into account the quality of the worst part of the video coding, that is, the quality control of the most distorted part.
- the quality evaluation is not based on the average value of Peak Signal to Noise (PSNR), but on the visual effect of the human eye; The human eye usually focuses on moving objects and content in the image, often ignoring the quality of the background.
- PSNR Peak Signal to Noise
- the main feature of the current mainstream encoder optimization tools is to provide codewords to the background content in exchange for quality improvement, saving codewords that encode moving objects, and achieving the objective of improving the average quality; but it causes image motion areas, That is, the quality of the foreground part is degraded.
- an embodiment of the present application provides a video encoding optimization method by obtaining a pixel distortion value corresponding to at least one pixel in an image frame to be encoded; and then according to the pixel distortion value and the block of the image frame to be encoded To obtain the block-level optimization factor of the image frame to be encoded; finally, based on the block-level optimization factor, the block-level encoding optimization process is performed on the image frame to be encoded; in this way, the image frame to be encoded is processed by the block-level optimization factor
- the quality of the foreground motion area in the image frame to be coded can be improved, so that the quality of the foreground motion area is close to the quality of the background still area, thereby reducing the quality error of the foreground content and the
- the method may include:
- S101 Obtain a pixel distortion value corresponding to at least one pixel in an image frame to be coded; wherein the pixel distortion value is used to characterize the coding quality of the image frame to be coded;
- S102 Obtain the block-level optimization factor of the image frame to be encoded according to the pixel distortion value and the block-level division of the image frame to be encoded; wherein the block-level optimization factor is used to characterize the improvement of block-level encoding quality The degree of adjustment of the required parameters;
- S103 Perform block-level coding optimization processing on the image frame to be coded based on the block-level optimization factor.
- the parameters required for the improvement of block-level coding quality include at least the block-level Lagrangian multiplier ⁇ CU and the block-level quantization parameter QP CU .
- the image frame to be encoded is divided into blocks, multiple CUs can be obtained, and then encoded in units of CUs.
- ⁇ CU and QP CU are optimized and adjusted according to the obtained block-level optimization factors, which can better achieve the purpose of controlling block-level coding quality.
- the acquiring the pixel distortion value corresponding to at least one pixel in the image frame to be encoded includes:
- a pixel distortion value corresponding to at least one pixel in the image frame to be encoded is obtained.
- the pixel value of the image frame to be encoded is a digitized image signal.
- the reconstructed pixel value represents the reconstruction value of each pixel in the reconstructed image frame corresponding to the image frame to be encoded after encoding
- the original pixel value represents the pixel value of each pixel in the original image frame corresponding to the image to be encoded before encoding Original value; in this way, the pixel difference between the reconstructed pixel value and the original pixel value is used to characterize the degree of information loss of the image frame to be encoded before and after encoding, which is usually called distortion.
- YUV represents a color space
- YUV-based color encoding is a common encoding method for streaming media
- Y represents Luminance (Y)
- U represents Chrominance (U)
- V means concentration (Chroma, V).
- the pixel distortion value can be calculated according to equation (1); according to equation (1), it can be seen that the pixel distortion value is the absolute value of the pixel difference between the reconstructed pixel value and the original pixel value Value.
- p and q represent the position of the pixel in row p and column q of the image frame to be encoded
- C rec ( p,q) represents the reconstructed pixel value corresponding to the pth row and qth column in the reconstructed image frame corresponding to the image frame to be encoded
- C src (p,q) represents the original corresponding to the image frame to be encoded before encoding
- D(p,q) represents the pixel distortion value corresponding to the pth row and qth column in the image frame to be encoded.
- the pixel difference value represents the difference between the reconstructed pixel value and the original pixel value, and the positive and negative meanings are the same; therefore, the absolute value of the pixel difference value is used to indicate the degree of distortion before and after encoding the image frame to be encoded, that is
- the pixel distortion value can be expressed as the absolute value of the pixel difference.
- other feature values can also be used for the determination, which is not specifically limited in the embodiments of the present application.
- the dispersion value corresponding to each pixel of the image frame to be encoded may be further obtained; therefore, based on the technical solution shown in FIG. 1,
- the method further includes:
- the dispersion value of at least one pixel in the image frame to be encoded is obtained.
- the average value of these pixel distortion values is obtained to obtain the average pixel distortion value corresponding to the image frame to be encoded. Specifically, according to the following The formula (2) is calculated,
- W represents the width of all pixels of the image frame to be encoded
- H represents the height of all pixels of the image frame to be encoded
- p 1, 2, ..., W
- q 1, 2, ..., H.
- Dev(p,q) represents the dispersion value corresponding to the pixel point of the pth row and the qth column in the image frame to be encoded.
- the size of the dispersion value characterizes the gap between the pixel distortion value and the average value, and at the same time reflects the degree of dispersion of the data.
- the change range of the pixel value is specifically set according to the actual situation, such as an integer between 0 and 1023, which is not specifically limited in the embodiment of the present application.
- the obtaining the block-level optimization factor of the image frame to be encoded according to the pixel distortion value and the block-level division of the image frame to be encoded includes:
- the block-level optimization factor of the image frame to be encoded is obtained according to the degree of deviation of the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function.
- the calculating the frame-level dispersion probability distribution function of the image frame to be encoded according to the dispersion value includes:
- the probability values corresponding to different absolute values of dispersion are counted;
- the frame-level dispersion probability distribution function of the image frame to be encoded is calculated according to the obtained absolute value of the dispersion and the probability values corresponding to the respective dispersion values.
- the probability density function is used to describe the probability that the value of a random variable is around a certain value.
- the probability density function can vividly describe the probability distribution of Dev(p,q); where, Dev(p,q) represents discrete Type random variables, the following formula (4) represents the distribution law of Dev(p,q), and p k is calculated according to formula (5).
- Dev k represents the number of pixels with a dispersion value of k
- p k represents the probability value corresponding to the dispersion value of k.
- the purpose of the embodiments of the present application is to reduce tailing, that is, reduce the probability when the dispersion value is large, and try to make the probability when the dispersion value is large tend to 0, so as to improve the quality of the foreground motion area to approach Background still area quality.
- FIG. 3 it shows another schematic diagram of the histogram of the dispersion probability density function provided by the embodiment of the present application; the histogram shown in FIG. 3 is obtained by performing an absolute value operation according to the histogram shown in FIG. 2, As can be seen from the histogram shown in Figure 3, the area with a dispersion value of ⁇ 8 reflects the probability value of the area with a small dispersion value.
- the probability of this area is large and relatively concentrated; while the dispersion value is 10
- the area within the range of ⁇ 35 reflects the probability value of the area with a large dispersion value.
- the probability of this area is low and there is a long tail; it can be seen that the histogram shown in FIG. 3 further shows that the embodiment of the present application The purpose is to reduce tailing, that is, reduce the probability when the dispersion value is large, and try to make the probability when the dispersion value is large tend to zero.
- block-level distortion dispersion statistics and frame-level distortion dispersion statistics can be regarded as the relationship between samples and the population; still taking the histogram shown in FIG. 3 as an example, the block-level dispersion probability distribution curve can be calculated separately And the frame-level dispersion probability distribution curve, as shown in FIG.
- the block-level optimization factor of the image frame to be encoded is obtained according to the degree of deviation of the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function, include:
- F frame (x) represents the frame-level dispersion probability distribution function
- F CU (x) represents the block-level dispersion probability distribution function
- S represents the degree of deviation between the two, specifically the area enclosed by the two, such as the figure
- S can be regarded as the degree of deviation between the block-level dispersion probability distribution of the divided blocks in the frame and the frame-level dispersion probability distribution.
- S is as small as possible, so that the sample and the population Tend to be consistent.
- S when S is a positive value, it indicates that the image quality of the current CU block is poor. That is, the block-level sample quality is lower than the frame-level overall quality; when S is a negative value, it indicates that the current CU block image quality is better, that is, the block-level sample quality is higher than the frame-level overall quality.
- the block level division of the image frame to be encoded and the block level optimization factor of the image frame to be encoded are determined.
- the preset distortion threshold value is used to measure whether the pixel distortion value in the image frame to be encoded is a judgment value of a statistical sample; in practical applications, the preset distortion threshold value is set according to specific conditions, and this application is implemented Examples are not specifically limited.
- this part of the pixel distortion values greater than the preset distortion threshold can be used as a statistical sample, that is, the first distortion set; then by calculating the average value of the pixel distortion values in the first distortion set, The second pixel distortion mean value can be obtained; finally, the block level division of the image frame to be encoded is performed according to the pixel distortion value in the first distortion set and the second pixel distortion average value, and the block level optimization factor of the image frame to be encoded is determined.
- performing block-level coding optimization processing on the image frame to be coded based on the block-level optimization factor includes:
- the optimized block-level quantization parameter is obtained according to the optimized and adjusted block-level Lagrange multiplier
- block-level encoding processing is performed on the image frame to be encoded.
- ⁇ CU indicates that the block-level Lagrangian multiplier is assigned
- ⁇ sys indicates the default Lagrangian multiplier of the encoder system
- ⁇ indicates a constant parameter.
- a frame of image can be divided into multiple blocks, for each CU, it has its own assigned ⁇ CU and QP CU ; different CU, its corresponding ⁇ CU and QP CU can also be different.
- the corresponding relationship between the ⁇ CU and the QP CU can be obtained according to equation (10), Directly find the optimized QP CU .
- a and b are constant parameters; after a large number of sample training, the value of a is generally 4.2005, and the value of b is generally 13.7122.
- a and b can also be adaptively selected, which is not limited in the embodiments of the present application.
- the embodiments of the present application can optimize the block level In addition to adjusting the factors ( ⁇ CU and QP CU ), the embodiments of the present application can also use the pixel distortion mean or energy value (that is, the product of the pixel distortion value and the square of the image motion distance) to optimize the block-level optimization factor ( ⁇ CU and QP CU ) to adjust; it is even possible to first determine the block-level division of the image frame to be encoded by the degree of deviation between the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function, and then for the divided blocks Level optimization factors ( ⁇ CU and QP CU ) are adjusted; this embodiment of the present application does not specifically limit this.
- the optimization of the block-level Lagrange multiplier according to the block-level optimization factor includes:
- the image frame to be encoded may include an I frame, a P frame and a B frame; wherein, the I frame represents an intra prediction frame, the P frame represents a unidirectional prediction frame (also called a forward prediction frame), and the B frame Represents a bidirectionally predicted frame; in terms of number, the number of B frames is much more than P frames, and the number of P frames is much more than I frames.
- the block-level optimization factor in the foregoing technical solution is performed according to the P frame, but the calculated block-level optimization factor is applied to the block-level coding optimization process for the B frame; and for the I frame
- the embodiments of the present application do not interfere with the encoding process.
- the embodiment of the present application performs block-level coding optimization processing on the B frame through the block-level optimization factor, which can effectively improve the coding quality of the image motion area.
- the method further includes:
- the image frame to be encoded is not a tail frame, continue to perform the process of the video encoding optimization method of the next frame image;
- the process of the video encoding optimization method ends.
- FIG. 6 shows a detailed flowchart of a video encoding optimization method provided by an embodiment of the present application.
- the detailed process may include:
- S601 Read the original image frame and the reconstructed image frame corresponding to the current frame image, and obtain the original pixel value and the reconstructed pixel value corresponding to each pixel respectively;
- S602 Calculate the pixel distortion value corresponding to each pixel by calculating the reconstructed pixel value and the original pixel value; and calculate based on the average value of the pixel distortion value to obtain at least one pixel in the current frame image Point deviation value;
- S603 Fit the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function according to the dispersion value
- S605 Determine whether the current frame image is a tail frame
- step S605 if the current frame image is not a tail frame, step S606 is performed; if the current frame image is a tail frame, step S607 is performed.
- step S604 refer to FIG. 7, which shows a detailed flowchart of a block-level encoding optimization process provided by an embodiment of the present application.
- the detailed process may include:
- Table 1 shows a schematic table of BD-Rate performance in a random access (Random Access, RA) mode provided by an embodiment of the present application; in the RA mode, there are B frames in addition to I frames and P frames,
- the sequence to be tested takes the part of a 10-bit 4K sequence developed by the Joint Video Research Team (JVET) as an example.
- QE disable means that the technical solution of this application is not used
- QE enable means that the application of this application
- PSNR (1%) represents the PSNR of the region with a statistical quality of 1%
- PSNR (2%) represents the PSNR of the region with a statistical quality of 2%, and so on.
- the technical solution of the present application can achieve better gains in the image motion area part, that is, people's attention to content.
- the BD can be obtained by using the technical solution of the present application -Rate value is -3.23%, which means that the technical solution of this application can save the code rate by 3.23%.
- the video encoding optimization apparatus 80 may include: an obtaining unit 801 and an encoding unit 802 ,among them,
- the calculation unit 803 is further configured to calculate the frame-level dispersion probability distribution function of the image frame to be encoded according to the dispersion value; and based on the block-level division of the image frame to be encoded , Calculate the block-level dispersion probability distribution function of the image frame to be encoded;
- the acquiring unit 801 is configured to acquire the block-level optimization factor of the image frame to be encoded according to the degree of deviation of the frame-level dispersion probability distribution function and the block-level dispersion probability distribution function.
- the obtaining unit 801 is further configured to compare the pixel distortion value with a preset distortion threshold; and when the pixel distortion value is greater than the preset distortion threshold, obtain a first distortion set; wherein, The first distortion set is used to characterize a pixel distortion value set corresponding to a pixel distortion value greater than a preset distortion threshold;
- the video encoding optimization device 80 further includes an adjustment unit 804 configured to optimize and adjust the block-level Lagrangian multiplier according to the block-level optimization factor; and based on the Lagrangian
- the corresponding relationship between the daily multiplier and the quantization parameter is the optimized and adjusted block-level quantization parameter according to the optimized and adjusted block-level Lagrangian multiplier;
- the obtaining unit 801 is further configured to obtain the reconstructed pixel value and the original pixel value corresponding to at least one pixel in the image frame to be encoded; and by reconstructing the reconstructed pixel value and the original pixel value Calculate the pixel value to obtain the pixel distortion value corresponding to at least one pixel in the image frame to be encoded.
- the calculation unit 803 is further configured to perform absolute value processing on the dispersion value to obtain an absolute value of dispersion corresponding to at least one pixel in the image frame to be encoded; and according to the obtained dispersion Absolute value, statistical probability values corresponding to different absolute values of dispersion; and calculating the frame-level dispersion probability distribution function of the image frame to be encoded according to the obtained absolute values of dispersion and the respective corresponding probability values .
- the comparison unit 805 is further configured to determine whether the image frame to be encoded is a tail frame; and if the image frame to be encoded is not a tail frame, continue to perform the video encoding optimization method of the next frame image And the end of the video encoding optimization method if the image frame to be encoded is a tail frame.
- the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it may be stored in a computer-readable storage medium.
- the technical solution of this embodiment essentially or It is said that part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product.
- the computer software product is stored in a storage medium and includes several instructions to make a computer device (may It is a personal computer, a server, or a network device, etc.) or a processor (processor) that performs all or part of the steps of the method described in this embodiment.
- this embodiment provides a computer storage medium that stores a video encoding optimization program that, when executed by at least one processor, implements the steps of the video encoding optimization method described in the foregoing embodiments .
- FIG. 12 shows the specific hardware structure of the video encoding optimization device 80 provided by the embodiment of the present application, which may include: a network interface 1201, a memory 1202, and a processor 1203; the various components are coupled together via the bus system 1204.
- the bus system 1204 is used to implement connection and communication between these components.
- the bus system 1204 also includes a power bus, a control bus, and a status signal bus.
- various buses are marked as the bus system 1204 in FIG. 12.
- the network interface 1201 is used to receive and send signals in the process of sending and receiving information with other external network elements;
- the memory 1202 is used to store a computer program that can run on the processor 1203;
- the processor 1203 is configured to execute:
- block-level coding optimization processing is performed on the image frame to be coded.
- the processor 1203 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 1203 or an instruction in the form of software.
- the foregoing processor 1203 may be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), an existing programmable gate array (Field Programmable Gate Array, FPGA), or other Programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
- DSP Digital Signal Processor
- ASIC Application Specific Integrated Circuit
- FPGA Field Programmable Gate Array
- the methods, steps, and logical block diagrams disclosed in the embodiments of the present application may be implemented or executed.
- the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
- the steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied and executed by a hardware decoding processor, or may be executed and completed by a combination of hardware and software modules in the decoding processor.
- the software module may be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, and registers.
- the storage medium is located in the memory 1202, and the processor 1203 reads the information in the memory 1202 and completes the steps of the above method in combination with its hardware.
- the techniques described herein may be implemented through modules (eg, procedures, functions, etc.) that perform the functions described herein.
- the software codes can be stored in the memory and executed by the processor.
- the memory may be implemented in the processor or external to the processor.
- the pixel distortion value corresponding to at least one pixel in the image frame to be coded is obtained; wherein the pixel distortion value is used to characterize the coding quality of the image frame to be coded;
- the quality of the motion area so that the quality of the foreground motion area is close to the quality of the background static area, and thus the quality error of the foreground content and the background content is reduced, has a very important application value.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Theoretical Computer Science (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
一种视频编码优化方法、装置及计算机存储介质,所述方法包括:获取待编码图像帧中至少一个像素点对应的像素失真值,其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度(S101);根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度(S102);基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理(S103)。
Description
本申请实施例涉及视频编解码技术领域,尤其涉及一种视频编码优化方法、装置及计算机存储介质。
视频图像的采集形式多种多样。通常来讲,较为静止的摄像机位获取的视频图像具有背景较为固定、前景人物或者物体运动的情景。多数的视频编码器能够将背景部分的质量保持得比较好,呈现视觉质量较高的特点;而对于运动的前景部分,由于率-失真优化(Rate Distortion Optimization,RDO)技术的广泛引入,编码器为了节省比特率常常选择恢复质量较差的模式进行编码,这就导致了重构后的视频图像在运动区域常常出现块现象,甚至模糊拖影等低质量情况。
在实际应用中,人们观看视频图像,往往重点都放在了对运动区域的关注和追踪;与此同时,背景部分的图像内容常常被人们忽略。当前主流的编码器都倾向于投入比特率编码较好的背景像素,节省比特率编码较差的前景像素,这与人们的主观感受相违背。虽然从编码器的客观性能统计上提升了平均质量;但是引起了运动区域,即前景部分的质量下降,使得图像的视觉质量并没有达到预期效果。
发明内容
有鉴于此,本申请实施例期望提供一种视频编码优化方法、装置及计算机存储介质,可以有效地提升图像运动区域的编码质量,客观上使得前景内容和背景内容的质量误差缩小,整体达到主观质量改善和提高的目的。
本申请实施例的技术方案可以如下实现:
第一方面,本申请实施例提供了一种视频编码优化方法,所述方法包括:
获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;
根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;
基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
在上述方案中,在所述获取待编码图像帧中至少一个像素点对应的像素失真值之后,所述方法还包括:
对所述待编码图像帧中所有像素点对应的像素失真值进行均值计算,得到所述待编码图像帧对应的第一像素失真均值;
基于所述待编码图像帧中各个像素点对应的像素失真值以及所述第一像素失真均值,得到所述待编码图像帧中至少一个像素点的离差值。
在上述方案中,所述根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,包括:
根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数;并基于对所述 待编码图像帧的块级划分,计算所述待编码图像帧的块级离差概率分布函数;
根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子。
在上述方案中,所述根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,包括:
将所述像素失真值与预设失真阈值进行比较;
当所述像素失真值大于预设失真阈值时,得到第一失真集合;其中,所述第一失真集合用于表征像素失真值大于预设失真阈值所对应的像素失真值集合;
对所述第一失真集合中的像素失真值进行均值计算,得到所述待编码图像帧对应的第二像素失真均值;
基于所述第一失真集合中的像素失真值以及所述第二像素失真均值,确定所述待编码图像帧的块级划分以及所述待编码图像帧的块级优化因子。
在上述方案中,所述基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理,包括:
根据所述块级优化因子,对块级拉格朗日乘子进行优化调整;
基于拉格朗日乘子与量化参数之间的对应关系,根据优化调整后的块级拉格朗日乘子得到优化调整后的块级量化参数;
基于优化调整后的块级拉格朗日乘子和优化调整后的块级量化参数,对所述待编码图像帧进行块级编码处理。
在上述方案中,所述获取待编码图像帧中至少一个像素点对应的像素失真值,,包括:
获取所述待编码图像帧中各个像素点对应的重构像素值和原始像素值;
通过对所述重构像素值和所述原始像素值进行计算,得到所述待编码图像帧中各个像素点对应的像素失真值。
在上述方案中,所述根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数,包括:
对所述离差值进行绝对值处理,得到所述待编码图像帧中至少一个像素点对应的离差绝对值;
根据得到的离差绝对值,统计不同的离差绝对值分别对应的概率值;
根据所述得到的离差绝对值以及分别与其对应的概率值,计算出所述待编码图像帧的帧级离差概率分布函数。
在上述方案中,所述根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子,包括:
对所述帧级离差概率分布函数和所述块级离差概率分布函数进行差值积分,得到所述待编码图像帧划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为所述块级优化因子。
在上述方案中,所述根据所述块级优化因子,对块级拉格朗日乘子进行优化调整,包括:
若所述待编码图像帧是P帧,则记录所述块级优化因子,并将所述块级优化因子作为B帧的块级优化因子参考值;
若所述待编码图像帧是B帧,则根据所述块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的。
在上述方案中,在所述基于所述块级优化因子,对所述待编码图像帧进行块级编码 优化处理之后,所述方法还包括:
判断所述待编码图像帧是否为尾帧;
若所述待编码图像帧不是尾帧,则继续执行下一帧图像的视频编码优化方法的流程;
若所述待编码图像帧是尾帧,则结束所述视频编码优化方法的流程。
第二方面,本申请实施例提供了一种视频编码优化装置,所述视频编码优化装置包括:获取单元和编码单元,
所述获取单元,配置为获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;
所述获取单元,还配置为根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;
所述编码单元,配置为基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
在上述方案中,所述视频编码优化装置还包括计算单元,配置为对所述待编码图像帧中所有像素点对应的像素失真值进行均值计算,得到所述待编码图像帧对应的第一像素失真均值;以及基于所述待编码图像帧中各个像素点对应的像素失真值以及所述第一像素失真均值,得到所述待编码图像帧中至少一个像素点的离差值。
在上述方案中,所述计算单元,还配置为根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数;并基于对所述待编码图像帧的块级划分,计算所述待编码图像帧的块级离差概率分布函数;
所述获取单元,配置为根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子。
在上述方案中,所述获取单元,还配置为将所述像素失真值与预设失真阈值进行比较;以及当所述像素失真值大于预设失真阈值时,得到第一失真集合;其中,所述第一失真集合用于表征像素失真值大于预设失真阈值所对应的像素失真值集合;
所述计算单元,还配置为对所述第一失真集合中的像素失真值进行均值计算,得到所述待编码图像帧对应的第二像素失真均值;
所述获取单元,还配置为基于所述第一失真集合中的像素失真值以及所述第二像素失真均值,确定所述待编码图像帧的块级划分以及所述待编码图像帧的块级优化因子。
在上述方案中,所述视频编码优化装置还包括调整单元,配置为根据所述块级优化因子,对块级拉格朗日乘子进行优化调整;以及基于拉格朗日乘子与量化参数之间的对应关系,根据优化调整后的块级拉格朗日乘子得到优化调整后的块级量化参数;
所述编码单元,配置为基于优化调整后的块级拉格朗日乘子和优化调整后的块级量化参数,对所述待编码图像帧进行块级编码处理。
在上述方案中,所述获取单元,还配置为获取所述待编码图像帧中至少一个像素点对应的重构像素值和原始像素值;以及通过对所述重构像素值和所述原始像素值进行计算,得到所述待编码图像帧中至少一个像素点对应的像素失真值。
在上述方案中,所述计算单元,还配置为对所述离差值进行绝对值处理,得到所述待编码图像帧中至少一个像素点对应的离差绝对值;以及根据得到的离差绝对值,统计不同的离差绝对值分别对应的概率值;以及根据所述得到的离差绝对值以及分别与其对应的概率值,计算出所述待编码图像帧的帧级离差概率分布函数。
在上述方案中,所述计算单元,还配置为对所述帧级离差概率分布函数和所述块级离差概率分布函数进行差值积分,得到所述待编码图像帧划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为所述块级优化因子。
在上述方案中,所述视频编码优化装置还包括比较单元,配置为若所述待编码图像帧是P帧,则记录所述块级优化因子,并将所述块级优化因子作为B帧的块级优化因子参考值;以及若所述待编码图像帧是B帧,则根据所述块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的。
在上述方案中,所述比较单元,还配置为判断所述待编码图像帧是否为尾帧;以及若所述待编码图像帧不是尾帧,则继续执行下一帧图像的视频编码优化方法的流程;以及若所述待编码图像帧是尾帧,则结束所述视频编码优化方法的流程。
第三方面,本申请实施例提供了一种视频编码优化装置,所述视频编码优化装置包括:存储器和处理器;
所述存储器,用于存储能够在所述处理器上运行的计算机程序;
所述处理器,用于在运行所述计算机程序时,执行如第一方面中任一项所述方法的步骤。
第四方面,本申请实施例提供了一种计算机存储介质,所述计算机存储介质存储有视频编码优化程序,所述视频编码优化程序被至少一个处理器执行时实现如第一方面中任一项所述方法的步骤
本申请实施例提供了一种视频编码优化方法、装置及计算机存储介质,通过获取待编码图像帧中至少一个像素点对应的像素失真值,再根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;由于像素失真值用于表征所述待编码图像帧编码质量的优劣程度,从而可以获取到用于表征块级编码质量提升所需参数调整的块级优化因子;最后基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理;这样,通过块级优化因子对待编码图像帧进行块级编码优化处理,可以提升待编码图像帧中前景运动区域质量,以使得前景运动区域质量逼近背景静止区域质量,进而使得前景内容和背景内容的质量误差缩小,具有非常重要的应用价值。
图1为本申请实施例提供的一种视频编码优化方法的流程示意图;
图2为本申请实施例提供的一种离差概率密度函数的直方图示意图;
图3为本申请实施例提供的另一种离差概率密度函数的直方图示意图;
图4为本申请实施例提供的一种离差概率分布曲线的结构示意图;
图5为本申请实施例提供的一种块级离差概率分布曲线和帧级离差概率分布曲线的结构示意图;
图6为本申请实施例提供的一种视频编码优化方法的详细流程示意图;
图7为本申请实施例提供的一种块级编码优化处理的详细流程示意图;
图8为本申请实施例提供的一种视频编码优化装置的结构示意图;
图9为本申请实施例提供的另一种视频编码优化装置的结构示意图;
图10为本申请实施例提供的又一种视频编码优化装置的结构示意图;
图11为本申请实施例提供的再一种视频编码优化装置的结构示意图;
图12为本申请实施例提供的一种视频编码优化装置的具体硬件结构示意图。
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。
随着数字媒体时代的发展,通过网络传输连续的媒体数据已经成为大势所趋,同时越来越多的用户希望用个人计算机(Personal Computer,PC)和非PC设备通过互联网和无线网络来进行视频通信和服务,这种随时随地的视频通信和服务对当前视频编码技术提出了更大的挑战。
目前的视频编码利用分割技术,把图像的空间区域划分为互不交叠的小块作为编码的基本单元,然后再对其进行编码。主流的编码器,比如H.264、H.265、H.266等,对于确定的一帧图像,它划分的每一个编码单元(Coding Unit,CU)一般采用相同的参数进行编码,该参数可以包括量化参数(Quantization Parameter,QP)和拉格朗日乘子(Lambda,λ)。而通过引入的率失真优化(Rate Distortion Optimization,RDO)技术对于块级编码模式进行抉择,这时候为了平衡质量和比特率,将会导致编码器抉择出的图像质量在一帧图像中呈现出差异非常大的特点。虽然从失真的均值统计角度来看,视频编码的效率有所提升,但是从图像的视觉质量角度来看,图像质量并没有达到预期。因此,如何有效控制一帧图像的最差质量比提升其均值更为有意义。
然而,目前主流的视频编码优化技术都把目标放在了如何节省码率、如何降低像素的平均失真方面,并没有考虑到视频编码中最差部分的质量,也即失真最大部分的质量控制。例如,在广电网络关于视频压缩效率的评价中,并不是以客观的峰值信噪比(Peak Signal to Noise Ratio,PSNR)均值来进行质量评价,而是以人眼的视觉效果进行质量评价;其中,人眼通常关注的是图像中运动的物体和内容,常常忽略背景的质量。由于目前主流的编码器优化工具的主要特点就是将码字提供给了背景内容以换取质量提升,节省了编码运动物体的码字,达到了客观平均质量提升的目的;但是引起了图像运动区域,也就是前景部分的质量下降问题。
为了解决上述技术问题,本申请实施例的基本思想是通过调节待编码图像帧中的块级优化因子,达到待编码图像帧在失真区域的质量平滑。具体地,本申请实施例提供了一种视频编码优化方法,通过获取待编码图像帧中至少一个像素点对应的像素失真值;再根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;最后基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理;这样,通过块级优化因子对待编码图像帧进行块级编码优化处理,可以提升待编码图像帧中前景运动区域质量,以使得前景运动区域质量逼近背景静止区域质量,从而缩小前景内容和背景内容的质量误差,可以达到编码后的整帧图像质量趋于平滑的目的,具有非常重要的应用价值。下面将结合附图对本申请各实施例进行详细描述。
参见图1,其示出了本申请实施例提供的一种视频编码优化方法的流程示意图,该方法可以包括:
S101:获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;
S102:根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;
S103:基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
需要说明的是,在视频编码中,块级编码质量提升所需参数至少包括块级拉格朗日乘子λ
CU和块级量化参数QP
CU。在获取到待编码图像帧之后,对待编码图像帧进行块级划分,可以得到多个CU,然后以CU为单位进行编码。这样,根据获取的块级优化因子对λ
CU和QP
CU进行优化调整,可以更好地达到控制块级编码质量的目的。
基于图1所示的技术方案,在一种可能的实现方式中,所述获取待编码图像帧中至少一个像素点对应的像素失真值,包括:
获取所述待编码图像帧中至少一个像素点对应的重构像素值和原始像素值;
通过对所述重构像素值和所述原始像素值进行计算,得到所述待编码图像帧中至少一个像素点对应的像素失真值。
需要说明的是,待编码图像帧的像素值是数字化的图像信号。其中,重构像素值表示待编码图像帧编码后所对应的重构图像帧中各个像素点的重构值,原始像素值表示待编码图像帧编码前所对应的原始图像帧中各个像素点的原始值;这样,重构像素值与原始像素值之间的像素差值是用于刻画待编码图像帧在编码前后的信息丢失程度,通常称之为失真。
在视频编码中,YUV表示一种色彩空间,基于YUV的颜色编码是流媒体的常用编码方式;其中,“Y”表示明亮度(Luminance,Y),“U”表示色度(Chrominance,U),“V”表示浓度(Chroma,V)。下面以YUV视频图像为例,像素失真值可以根据式(1)进行计算;根据式(1)可以看出,像素失真值是由重构像素值和原始像素值之间的像素差值的绝对值得到的。
D(p,q)=|C
rec(p,q)-C
src(p,q)| (1)
其中,p和q表示像素点在待编码图像帧中第p行第q列的位置;C表示YUV视频图像某一分量的色彩空间,C=Y或者C=U或者C=V;C
rec(p,q)表示待编码图像帧编码后所对应的重构图像帧中第p行第q列对应的重构像素值,C
src(p,q)表示待编码图像帧编码前所对应的原始图像帧中第p行第q列对应的原始像素值;D(p,q)表示待编码图像帧中第p行第q列对应的像素失真值。
还需要说明的是,像素差值表示重构像素值距离原始像素值之间的差距,正负意义相同;因此,像素差值的绝对值用于表示待编码图像帧编码前后的失真程度,即,像素失真值可以用像素差值的绝对值表示。在本申请实施例中,除了可以用像素失真值来判断CU的运动/失真属性之外,还可以用其他特征值进行判断,本申请实施例不作具体限定。
可以理解地,在获取到待编码图像帧所有像素点对应的像素失真值之后,可以进一步获取待编码图像帧各个像素点对应的离差值;因此,基于图1所示的技术方案,在一种可能的实现方式中,在所述获取待编码图像帧中至少一个像素点对应的像素失真值之后,所述方法还包括:
对所述待编码图像帧中所有像素点对应的像素失真值进行均值计算,得到所述待编码图像帧对应的像素失真均值;
基于所述待编码图像帧中各个像素点对应的像素失真值以及所述像素失真均值,得到所述待编码图像帧中至少一个像素点的离差值。
需要说明的是,在获取到待编码图像帧所有像素点对应的像素失真值之后,针对这些所有像素失真值求取平均值,可以得到待编码图像帧对应的像素失真均值,具体地,根据下述的式(2)进行计算,
这样,待编码图像帧中任意一个像素点失真的离差值可以根据下述的式(3)得出,
其中,Dev(p,q)表示待编码图像帧中第p行第q列像素点对应的离差值。
还需要说明的是,离差值的大小刻画了像素失真值与平均值之间的差距,同时反映了数据的离散程度。在本申请实施例中,像素值的变化范围根据实际情况进行具体设定,比如0到1023之间的整数,本申请实施例对此不作具体限定。假如待编码图像帧以10bit视频为例,设定像素值的变化范围为0到1023之间的整数,那么D(p,q)的取值范围为0到1023之间的整数;再根据式(2)计算得到像素失真均值
之后,式(3)中D(p,q)相对于
的偏移大小决定了离差强度。这样,当D(p,q)的最小值为0时,表示了重构图像的重构像素值与原始图像的原始像素值是相同的,此时Dev(p,q)会得到最小值,即
在上述实现方式中,具体地,所述根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,包括:
根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数;并基于对所述待编码图像帧的块级划分,计算所述待编码图像帧的块级离差概率分布函数;
根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子。
在上述具体实现方式中,更具体地,所述根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数,包括:
对所述离差值进行绝对值处理,得到所述待编码图像帧中至少一个像素点对应的离差绝对值;
根据得到的离差绝对值,统计不同的离差绝对值分别对应的概率值;
根据所述得到的离差绝对值以及分别与其对应的概率值,计算出所述待编码图像帧的帧级离差概率分布函数。
需要说明的是,概率密度函数用于描述随机变量的取值在某个确定值附近的概率情况。这样,在获取到待编码图像帧中至少一个像素点对应的离差值之后,概率密度函数能够形象地刻画出Dev(p,q)的概率分布情况;其中,Dev(p,q)表示离散型随机变量,下述的式(4)表示Dev(p,q)的分布律,而p
k是根据式(5)计算得到的。
其中,Dev
k表示离差值为k的像素点个数,N表示待编码图像帧的总像素点个数,即N=W·H,p
k表示离差值为k所对应的概率值。
还需要说明的是,假定将离差值Dev(p,q)作为统计样本的随机变量x
k,根据式(4)和式(5)进行统计,可以分别得出x
k所对应的概率p
k;根据x
k与p
k之间的对应关系,可以绘制出离差概率密度函数的直方图如图2所示。参见图2,其示出了本申请实施例提供的一种离差概率密度函数的直方图示意图;一般情况下,在离差值为0的左右区域,离差值对应的概率较大,随着离差值增大,概率会降低至0;靠近离差值为0的区域的概率值,表示了视频质量好的比例;反之,离差值越大的区域的概率值,也就表示了视频质量差的比例;从图2所示的直方图可以看出,视频质量差的区域的比例不容忽视。本申请实施例的目的就是为了实现减小拖尾,即减小离差值较大时的概率,尽可能使得离差值较大时的概率趋于0,从而能够提升前景运动区域质量以逼近背景静止区域质量。
可以理解地,如果对Dev(p,q)进行绝对值处理,可以得到|Dev(p,q)|;那么根据|Dev(p,q)|所绘制出离差概率密度函数的直方图如图3所示。参见图3,其示出了本申请实施例提供的另一种离差概率密度函数的直方图示意图;图3所示的直方图是根据图2 所示的直方图经过绝对值运算得到的,从图3所示的直方图可以看出,离差值≤8的区域,反映了离差值较小的区域的概率值,该区域的概率较大,而且相对集中;而离差值在10~35范围内的区域,反映了离差值较大的区域的概率值,该区域的概率较低,而且存在较长拖尾;可见,图3所示的直方图进一步表明本申请实施例的目的就是为了实现减小拖尾,即减小离差值较大时的概率,尽可能使得离差值较大时的概率趋于0。
需要说明的是,以图3所示的直方图为例,结合式(6)提供的离差概率分布函数,图4给出了与图3相对应的离差概率分布曲线的结构示意图;其中,横坐标x表示离差值,纵坐标F(x)表示累积概率,即F(x)为离差值小于等于x所对应的概率累加值。由于目前主流的视频编码标准都是采用基于块的混合编码框架,一帧图像可以被划分为多个块,也即被划分为多个CU,然后编码以CU为单位进行。这样,块级失真离差统计与帧级失真离差统计的关系可以看做为样本与总体的关系;仍以图3所示的直方图为例,可以分别计算出块级离差概率分布曲线和帧级离差概率分布曲线,如图5所示本申请实施例提供的一种块级离差概率分布曲线和帧级离差概率分布曲线的结构示意图;其中,横坐标x表示离差值,纵坐标F(x)表示累积概率;从图5中可以看出,块级离差概率分布曲线和帧级离差概率分布曲线之间的偏离程度,以便根据两者的偏离程度对块级拉格朗日乘子和块级量化参数进行优化调整,从而达到控制编码质量的目的。
在上述具体实现方式中,更具体地,所述根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子,包括:
对所述帧级离差概率分布函数和所述块级离差概率分布函数进行差值积分,得到所述待编码图像帧划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为所述块级优化因子。
需要说明的是,在获取到帧级离差概率分布函数F
frame(x)和块级离差概率分布函数F
CU(x)之后,通过计算比较块级与帧级的离差概率分布情况,得到它们之间的偏离程度。偏离程度值是根据帧级离差概率分布函数F
frame(x)和块级离差概率分布函数F
CU(x)的差值积分得到的,具体地,根据下述的式(7)进行计算,
其中,F
frame(x)表示帧级离差概率分布函数,F
CU(x)表示块级离差概率分布函数,S表示两者的偏离程度值,具体为两者围出的面积,比如图5所示的帧级离差概率分布函数和块级离差概率分布函数以及两者围出的面积。
进一步地,S的离散计算过程,可以根据式(8)进行,
还需要说明的是,S可以看作帧内划分出块的块级离差概率分布与帧级离差概率分布的偏离程度,一般来说,S尽可能的小,以使得样本和总体之间趋于一致。这样,当S为正值时,表明当前CU块的图像质量较差。即块级样本质量低于帧级总体质量;当S为负值时,表明当前CU块的图像质量较好,即块级样本质量高于帧级总体质量。
基于图1所示的技术方案,在一种可能的实现方式中,所述根据所述像素失真值以 及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,包括:
将所述像素失真值与预设失真阈值进行比较;
当所述像素失真值大于预设失真阈值时,得到第一失真集合;其中,所述第一失真集合用于表征像素失真值大于预设失真阈值所对应的像素失真值集合;
对所述第一失真集合中的像素失真值进行均值计算,得到所述待编码图像帧对应的第二像素失真均值;
基于所述第一失真集合中的像素失真值以及所述第二像素失真均值,确定所述待编码图像帧的块级划分以及所述待编码图像帧的块级优化因子。
需要说明的是,预设失真阈值表示用于衡量待编码图像帧中的像素失真值是否作为统计样本的一个判定值;在实际应用中,预设失真阈值根据具体情况进行设定,本申请实施例不作具体限定。例如,以预设失真阈值为分界线,可以将大于预设失真阈值的这部分像素失真值作为统计样本,即第一失真集合;然后通过对第一失真集合中的像素失真值进行均值计算,可以得到第二像素失真均值;最后根据第一失真集合中的像素失真值以及第二像素失真均值进行待编码图像帧的块级划分,并确定出待编码图像帧的块级优化因子。
基于图1所示的技术方案,在一种可能的实现方式中,所述基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理,包括:
根据所述块级优化因子,对块级拉格朗日乘子进行优化调整;
基于拉格朗日乘子与量化参数之间的对应关系,根据优化调整后的块级拉格朗日乘子得到优化调整后的块级量化参数;
基于优化调整后的块级拉格朗日乘子和优化调整后的块级量化参数,对所述待编码图像帧进行块级编码处理。
需要说明的是,在视频编码中,通常采用的是调整CU编码参数来达到控制编码质量的目的。率失真优化技术中的拉格朗日乘子用于抉择编码模式,是十分重要和灵敏的一个编码参数。为了避免拉格朗日乘子的调整过于偏大或者偏小,本申请实施例中λ
CU的优化调整可以由式(9)给出,
λ
CU=λ
sys×2
-ρ×S (9)
其中,λ
CU表示分配的为块级拉格朗日乘子,λ
sys表示为编码器系统默认的拉格朗日乘子,ρ表示常量参数。
进一步地,在视频编码中,拉格朗日乘子与量化参数之间具有一一对应关系,也就是说,块级拉格朗日乘子λ
CU与块级量化参数QP
CU之间具有一一对应关系;其中,λ
CU可以为浮点数,用于小幅度调整;但是QP
CU只能为整数,用于大幅度调整;如果降低QP
CU值,λ
CU随之减小,此时图像质量会变好;反之,如果增加QP
CU值,λ
CU随之增大,此时图像质量会变差。一帧图像可以被划分为多个块,针对每一个CU,具有自身分配的λ
CU和QP
CU;CU的不同,其对应的λ
CU和QP
CU也可以不同。在本申请实施例中,在得到优化调整后的λ
CU之后,为了简化QP
CU的计算,减少编码复杂度,可以根据λ
CU与QP
CU之间的对应关系,如式(10)所示,直接求取优化调整后的QP
CU。
QP
CU=a×ln(λ
CU)+b (10)
其中,a和b均为常量参数;经过大量样本训练之后,a的取值一般为4.2005,b的取值一般为13.7122。在实际应用中,对于不同内容的视频图像,a和b还可以自适应取值,本申请实施例不作限定。
需要说明的是,除了根据上述优化方法计算得到λ
CU和QP
CU之外,如果基于经验模 型获取到部分CU的块级量化参数QP
CU,此时还可以根据上述的式(10)所示的λ
CU与QP
CU之间的对应关系,进行反算得到λ
CU,从而根据所得到的λ
CU和QP
CU对待编码图像帧进行块级编码优化处理;本申请实施例对此不作具体限定。
还需要说明的是,为了使得待编码图像帧的失真区域质量平滑,本申请实施例除了可以通过帧级离差概率分布函数和块级离差概率分布函数之间的偏离程度来对块级优化因子(λ
CU和QP
CU)进行调整之外,本申请实施例还可以通过像素失真均值或者能量值(即像素失真值与图像运动距离的平方作乘积)来对块级优化因子(λ
CU和QP
CU)进行调整;甚至还可以是先通过帧级离差概率分布函数和块级离差概率分布函数之间的偏离程度来确定待编码图像帧的块级划分,然后再针对划分之后的块级优化因子(λ
CU和QP
CU)进行调整;本申请实施例对此不作具体限定。
在上述实现方式中,具体地,所述根据所述块级优化因子,对块级拉格朗日乘子进行优化调整,包括:
若所述待编码图像帧是P帧,则记录所述块级优化因子,并将所述块级优化因子作为B帧的块级优化因子参考值;
若所述待编码图像帧是B帧,则根据所述块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的。
需要说明的是,待编码图像帧可以包括I帧、P帧和B帧;其中,I帧表示帧内预测帧,P帧表示单向预测帧(也称之为前向预测帧),B帧表示双向预测帧;从数量上看,B帧数量远多于P帧,P帧数量远多于I帧。在本申请实施例中,前述技术方案中的块级优化因子是根据P帧进行的,但是所计算得到的块级优化因子则是应用于对B帧的块级编码优化处理;而对于I帧和P帧而言,本申请实施例不干预其编码处理。在整个视频图像中,质量最差的是B帧运动区域,因此,本申请实施例通过块级优化因子对B帧进行块级编码优化处理,可以有效提升图像运动区域的编码质量,整体上达到主观质量改善和提高的目的。
基于图1所示的技术方案,在一种可能的实现方式中,在所述基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理之后,所述方法还包括:
判断所述待编码图像帧是否为尾帧;
若所述待编码图像帧不是尾帧,则继续执行下一帧图像的视频编码优化方法的流程;
若所述待编码图像帧是尾帧,则结束所述视频编码优化方法的流程。
需要说明的是,当待编码图像帧执行过块级编码优化处理后,需要判断该待编码图像帧是否为尾帧,如果是尾帧,代表整个视频编码优化流程的结束;如果不是尾帧,则进入下一帧,重新执行视频编码优化的流程。
本实施例提供了一种视频编码优化方法,通过获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理;这样通过块级优化因子对待编码图像帧进行块级编码优化处理,可以提升待编码图像帧中前景运动区域质量,以使得前景运动区域质量逼近背景静止区域质量,进而使得前景内容和背景内容的质量误差缩小,具有非常重要的应用价值。
基于前述实施例相同的发明构思,参见图6,其示出了本申请实施例提供的一种视频编码优化方法的详细流程示意图,该详细流程可以包括:
S601:读取当前帧图像所对应的原始图像帧和重构图像帧,获取各个像素点分别对应的原始像素值和重构像素值;
S602:通过对所述重构像素值和所述原始像素值进行计算,得到各个像素点对应的像素失真值;并基于所述像素失真值的均值计算,得到所述当前帧图像中至少一个像素点的离差值;
S603:根据所述离差值,拟合得到帧级离差概率分布函数和块级离差概率分布函数;
S604:对所述当前帧图像进行块级编码优化处理;
S605:判断所述当前帧图像是否为尾帧;
S606:若所述当前帧图像不是尾帧,则载入下一帧图像,并返回步骤S601;
S607:若所述当前帧图像是尾帧,则结束流程。
需要说明的是,在步骤S605之后,若所述当前帧图像不是尾帧,则执行步骤S606;若所述当前帧图像是尾帧,则执行步骤S607。
还需要说明的是,对于步骤S604来说,参见图7,其示出了本申请实施例提供的一种块级编码优化处理的详细流程示意图,该详细流程可以包括:
S701:对当前帧图像对应的帧级离差概率分布函数和块级离差概率分布函数进行差值积分,得到当前帧图像划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为块级优化因子;
S702:判断当前帧图像是否为P帧;
S703:若当前帧图像是P帧,则记录所述块级优化因子,并结束流程;
S704:判断当前帧图像是否为B帧;
S705:若当前帧图像是B帧,则根据块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的;
S706:若当前帧图像不是B帧,则结束流程。
需要说明的是,在步骤S702之后,若当前帧图像是P帧,则执行步骤S703;若当前帧图像不是P帧,则执行步骤S704;在步骤S704之后,若当前帧图像是B帧,则执行步骤S705;若当前帧图像也不是B帧,则执行步骤S706,直接结束流程。
在本申请实施例中,假如大家重点统计视频图像中失真最大区域,可以得到极差情况下的视频重构质量,也就相当于建立了视频观看时的最差基线;这里,质量越差,代表着视频图像中运动越剧烈的图像内容。举例来说,假设分别统计重构图像中最差的1%、2%、4%、8%、16%区域的PSNR,然后采用行业通用的BD-Rate计算工具,以质量增强(Quality Enhancement,QE)为例,从而可以计算出本申请实施例的性能增益情况;其中,BD-Rate的百分数值表示在同等质量下,比特率的节省比值。参见表1,其示出了本申请实施例提供的一种随机访问(Random Access,RA)模式下BD-Rate性能的示意表;RA模式除了I帧和P帧之外,还存在B帧,待测序列以联合视频研究组(Joint Video Exploration Team,JVET)所制定的部分10bit 4K序列为例,如表1所示,QE disable表示不采用本申请的技术方案,QE enable表示采用本申请的技术方案,PSNR(1%)表示统计质量为1%区域的PSNR,PSNR(2%)表示统计质量为2%区域的PSNR,依次类推。从表1中可以看出,本申请的技术方案能够在图像运动区域部分即人们关注内容取得较好的增益,比如在最差1%区域的PSNR统计下,采用本申请的技术方案可以得到BD-Rate值为-3.23%,也就表示了本申请的技术方案可以节省码率3.23%。
表1
上述实施例对前述实施例的具体实现进行了详细阐述,从中可以看出,通过前述实施例的技术方案,可以有效地提升图像运动区域的编码质量,客观上使得前景内容和背景内容的质量误差缩小,整体达到主观质量改善和提高的目的,具有非常重要的应用价值。
基于前述实施例相同的发明构思,参见图8,其示出了本申请实施例提供的一种视频编码优化装置80的组成,所述视频编码优化装置80可以包括:获取单元801和编码单元802,其中,
所述获取单元801,配置为获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;
所述获取单元801,还配置为根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;
所述编码单元802,配置为基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
在上述方案中,参见图9,所述视频编码优化装置80还包括计算单元803,配置为对所述待编码图像帧中所有像素点对应的像素失真值进行均值计算,得到所述待编码图像帧对应的第一像素失真均值;以及基于所述待编码图像帧中各个像素点对应的像素失真值以及所述第一像素失真均值,得到所述待编码图像帧中至少一个像素点的离差值。
在上述方案中,所述计算单元803,还配置为根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数;并基于对所述待编码图像帧的块级划分,计算所述待编码图像帧的块级离差概率分布函数;
所述获取单元801,配置为根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子。
在上述方案中,所述获取单元801,还配置为将所述像素失真值与预设失真阈值进行比较;以及当所述像素失真值大于预设失真阈值时,得到第一失真集合;其中,所述第一失真集合用于表征像素失真值大于预设失真阈值所对应的像素失真值集合;
所述计算单元803,还配置为对所述第一失真集合中的像素失真值进行均值计算,得到所述待编码图像帧对应的第二像素失真均值;
所述获取单元801,还配置为基于所述第一失真集合中的像素失真值以及所述第二像素失真均值,确定所述待编码图像帧的块级划分以及所述待编码图像帧的块级优化因子。
在上述方案中,参见图10,所述视频编码优化装置80还包括调整单元804,配置为根据所述块级优化因子,对块级拉格朗日乘子进行优化调整;以及基于拉格朗日乘子与量化参数之间的对应关系,根据优化调整后的块级拉格朗日乘子得到优化调整后的块级量化参数;
所述编码单元802,配置为基于优化调整后的块级拉格朗日乘子和优化调整后的块级量化参数,对所述待编码图像帧进行块级编码处理。
在上述方案中,所述获取单元801,还配置为获取所述待编码图像帧中至少一个像素点对应的重构像素值和原始像素值;以及通过对所述重构像素值和所述原始像素值进 行计算,得到所述待编码图像帧中至少一个像素点对应的像素失真值。
在上述方案中,所述计算单元803,还配置为对所述离差值进行绝对值处理,得到所述待编码图像帧中至少一个像素点对应的离差绝对值;以及根据得到的离差绝对值,统计不同的离差绝对值分别对应的概率值;以及根据所述得到的离差绝对值以及分别与其对应的概率值,计算出所述待编码图像帧的帧级离差概率分布函数。
在上述方案中,所述计算单元803,还配置为对所述帧级离差概率分布函数和所述块级离差概率分布函数进行差值积分,得到所述待编码图像帧划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为所述块级优化因子。
在上述方案中,参见图11,所述视频编码优化装置80还包括比较单元805,配置为若所述待编码图像帧是P帧,则记录所述块级优化因子,并将所述块级优化因子作为B帧的块级优化因子参考值;以及若所述待编码图像帧是B帧,则根据所述块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的。
在上述方案中,所述比较单元805,还配置为判断所述待编码图像帧是否为尾帧;以及若所述待编码图像帧不是尾帧,则继续执行下一帧图像的视频编码优化方法的流程;以及若所述待编码图像帧是尾帧,则结束所述视频编码优化方法的流程。
可以理解地,在本实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本实施例提供了一种计算机存储介质,该计算机存储介质存储有视频编码优化程序,所述视频编码优化程序被至少一个处理器执行时实现前述实施例中所述视频编码优化方法的步骤。
基于上述视频编码优化装置80的组成以及计算机存储介质,参见图12,其示出了本申请实施例提供的视频编码优化装置80的具体硬件结构,可以包括:网络接口1201、存储器1202和处理器1203;各个组件通过总线系统1204耦合在一起。可理解,总线系统1204用于实现这些组件之间的连接通信。总线系统1204除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图12中将各种总线都标为总线系统1204。其中,网络接口1201,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
存储器1202,用于存储能够在处理器1203上运行的计算机程序;
处理器1203,用于在运行所述计算机程序时,执行:
获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;
根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧 的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;
基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
可以理解,本申请实施例中的存储器1202可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本文描述的系统和方法的存储器1202旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器1203可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1203中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1203可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1202,处理器1203读取存储器1202中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本文描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。
对于软件实现,可通过执行本文所述功能的模块(例如过程、函数等)来实现本文所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,处理器1203还配置为在运行所述计算机程序时,执行前述实施例中所述视频编码优化方法的步骤。
需要说明的是:本申请实施例所记载的技术方案之间,在不冲突的情况下,可以任意组合。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应 涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
本申请实施例中,通过获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;再根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理;这样,通过块级优化因子对待编码图像帧进行块级编码优化处理,可以提升待编码图像帧中前景运动区域质量,以使得前景运动区域质量逼近背景静止区域质量,进而使得前景内容和背景内容的质量误差缩小,具有非常重要的应用价值。
Claims (22)
- 一种视频编码优化方法,其中,所述方法包括:获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
- 根据权利要求1所述的方法,其中,在所述获取待编码图像帧中至少一个像素点对应的像素失真值之后,所述方法还包括:对所述待编码图像帧中所有像素点对应的像素失真值进行均值计算,得到所述待编码图像帧对应的第一像素失真均值;基于所述待编码图像帧中各个像素点对应的像素失真值以及所述第一像素失真均值,得到所述待编码图像帧中至少一个像素点的离差值。
- 根据权利要求2所述的方法,其中,所述根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,包括:根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数;并基于对所述待编码图像帧的块级划分,计算所述待编码图像帧的块级离差概率分布函数;根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子。
- 根据权利要求1所述的方法,其中,所述根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子,包括:将所述像素失真值与预设失真阈值进行比较;当所述像素失真值大于预设失真阈值时,得到第一失真集合;其中,所述第一失真集合用于表征像素失真值大于预设失真阈值所对应的像素失真值集合;对所述第一失真集合中的像素失真值进行均值计算,得到所述待编码图像帧对应的第二像素失真均值;基于所述第一失真集合中的像素失真值以及所述第二像素失真均值,确定所述待编码图像帧的块级划分以及所述待编码图像帧的块级优化因子。
- 根据权利要求1所述的方法,其中,所述基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理,包括:根据所述块级优化因子,对块级拉格朗日乘子进行优化调整;基于拉格朗日乘子与量化参数之间的对应关系,根据优化调整后的块级拉格朗日乘子得到优化调整后的块级量化参数;基于优化调整后的块级拉格朗日乘子和优化调整后的块级量化参数,对所述待编码图像帧进行块级编码处理。
- 根据权利要求1所述的方法,其中,所述获取待编码图像帧中至少一个像素点对应的像素失真值,包括:获取所述待编码图像帧中至少一个像素点对应的重构像素值和原始像素值;通过对所述重构像素值和所述原始像素值进行计算,得到所述待编码图像帧中至少一个像素点对应的像素失真值。
- 根据权利要求3所述的方法,其中,所述根据所述离差值,计算所述待编码图 像帧的帧级离差概率分布函数,包括:对所述离差值进行绝对值处理,得到所述待编码图像帧中至少一个像素点对应的离差绝对值;根据得到的离差绝对值,统计不同的离差绝对值分别对应的概率值;根据所述得到的离差绝对值以及分别与其对应的概率值,计算出所述待编码图像帧的帧级离差概率分布函数。
- 根据权利要求3所述的方法,其中,所述根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子,包括:对所述帧级离差概率分布函数和所述块级离差概率分布函数进行差值积分,得到所述待编码图像帧划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为所述块级优化因子。
- 根据权利要求5所述的方法,其中,所述根据所述块级优化因子,对块级拉格朗日乘子进行优化调整,包括:若所述待编码图像帧是P帧,则记录所述块级优化因子,并将所述块级优化因子作为B帧的块级优化因子参考值;若所述待编码图像帧是B帧,则根据所述块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的。
- 根据权利要求1至9任一项所述的方法,其中,在所述基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理之后,所述方法还包括:判断所述待编码图像帧是否为尾帧;若所述待编码图像帧不是尾帧,则继续执行下一帧图像的视频编码优化方法的流程;若所述待编码图像帧是尾帧,则结束所述视频编码优化方法的流程。
- 一种视频编码优化装置,其中,所述视频编码优化装置包括:获取单元和编码单元,所述获取单元,配置为获取待编码图像帧中至少一个像素点对应的像素失真值;其中,所述像素失真值用于表征所述待编码图像帧编码质量的优劣程度;所述获取单元,还配置为根据所述像素失真值以及对所述待编码图像帧的块级划分,获取所述待编码图像帧的块级优化因子;其中,所述块级优化因子用于表征块级编码质量提升所需参数的调整程度;所述编码单元,配置为基于所述块级优化因子,对所述待编码图像帧进行块级编码优化处理。
- 根据权利要求11所述的视频编码优化装置,其中,所述视频编码优化装置还包括计算单元,配置为对所述待编码图像帧中所有像素点对应的像素失真值进行均值计算,得到所述待编码图像帧对应的第一像素失真均值;以及基于所述待编码图像帧中各个像素点对应的像素失真值以及所述第一像素失真均值,得到所述待编码图像帧中至少一个像素点的离差值。
- 根据权利要求12所述的视频编码优化装置,其中,所述计算单元,还配置为根据所述离差值,计算所述待编码图像帧的帧级离差概率分布函数;并基于对所述待编码图像帧的块级划分,计算所述待编码图像帧的块级离差概率分布函数;所述获取单元,配置为根据所述帧级离差概率分布函数和所述块级离差概率分布函数的偏离程度,获取所述待编码图像帧的块级优化因子。
- 根据权利要求12所述的视频编码优化装置,其中,所述获取单元,还配置为将所述像素失真值与预设失真阈值进行比较;以及当所述像素失真值大于预设失真阈值 时,得到第一失真集合;其中,所述第一失真集合用于表征像素失真值大于预设失真阈值所对应的像素失真值集合;所述计算单元,还配置为对所述第一失真集合中的像素失真值进行均值计算,得到所述待编码图像帧对应的第二像素失真均值;所述获取单元,还配置为基于所述第一失真集合中的像素失真值以及所述第二像素失真均值,确定所述待编码图像帧的块级划分以及所述待编码图像帧的块级优化因子。
- 根据权利要求11所述的视频编码优化装置,其中,所述视频编码优化装置还包括调整单元,配置为根据所述块级优化因子,对块级拉格朗日乘子进行优化调整;以及基于拉格朗日乘子与量化参数之间的对应关系,根据优化调整后的块级拉格朗日乘子得到优化调整后的块级量化参数;所述编码单元,配置为基于优化调整后的块级拉格朗日乘子和优化调整后的块级量化参数,对所述待编码图像帧进行块级编码处理。
- 根据权利要求11所述的视频编码优化装置,其中,所述获取单元,还配置为获取所述待编码图像帧中至少一个像素点对应的重构像素值和原始像素值;以及通过对所述重构像素值和所述原始像素值进行计算,得到所述待编码图像帧中至少一个像素点对应的像素失真值。
- 根据权利要求13所述的视频编码优化装置,其中,所述计算单元,还配置为对所述离差值进行绝对值处理,得到所述待编码图像帧中至少一个像素点对应的离差绝对值;以及根据得到的离差绝对值,统计不同的离差绝对值分别对应的概率值;以及根据所述得到的离差绝对值以及分别与其对应的概率值,计算出所述待编码图像帧的帧级离差概率分布函数。
- 根据权利要求13所述的视频编码优化装置,其中,所述计算单元,还配置为对所述帧级离差概率分布函数和所述块级离差概率分布函数进行差值积分,得到所述待编码图像帧划分的块级与帧级之间的偏离程度值,将所述偏离程度值作为所述块级优化因子。
- 根据权利要求15所述的视频编码优化装置,其中,所述视频编码优化装置还包括比较单元,配置为若所述待编码图像帧是P帧,则记录所述块级优化因子,并将所述块级优化因子作为B帧的块级优化因子参考值;以及若所述待编码图像帧是B帧,则根据所述块级优化因子参考值对块级拉格朗日乘子进行优化调整;其中,所述块级优化因子参考值是根据P帧对应位置的块级优化因子得到的。
- 根据权利要求11至19任一项所述的视频编码优化装置,其中,所述比较单元,还配置为判断所述待编码图像帧是否为尾帧;以及若所述待编码图像帧不是尾帧,则继续执行下一帧图像的视频编码优化方法的流程;以及若所述待编码图像帧是尾帧,则结束所述视频编码优化方法的流程。
- 一种视频编码优化装置,其中,所述视频编码优化装置包括:存储器和处理器;所述存储器,用于存储能够在所述处理器上运行的计算机程序;所述处理器,用于在运行所述计算机程序时,执行如权利要求1至10任一项所述方法的步骤。
- 一种计算机存储介质,其中,所述计算机存储介质存储有视频编码优化程序,所述视频编码优化程序被至少一个处理器执行时实现如权利要求1至10任一项所述方法的步骤。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2018/118012 WO2020107288A1 (zh) | 2018-11-28 | 2018-11-28 | 视频编码优化方法、装置及计算机存储介质 |
CN201880097309.3A CN112655212B (zh) | 2018-11-28 | 2018-11-28 | 视频编码优化方法、装置及计算机存储介质 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2018/118012 WO2020107288A1 (zh) | 2018-11-28 | 2018-11-28 | 视频编码优化方法、装置及计算机存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020107288A1 true WO2020107288A1 (zh) | 2020-06-04 |
Family
ID=70854257
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/118012 WO2020107288A1 (zh) | 2018-11-28 | 2018-11-28 | 视频编码优化方法、装置及计算机存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112655212B (zh) |
WO (1) | WO2020107288A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114554224A (zh) * | 2021-09-10 | 2022-05-27 | 电子科技大学 | 基于核心参考帧的块级拉格朗日乘子优化方法 |
CN115428451A (zh) * | 2020-07-31 | 2022-12-02 | Oppo广东移动通信有限公司 | 视频编码方法、编码器、系统以及计算机存储介质 |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023240618A1 (zh) * | 2022-06-17 | 2023-12-21 | Oppo广东移动通信有限公司 | 一种滤波方法、解码器、编码器及计算机可读存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101945275A (zh) * | 2010-08-18 | 2011-01-12 | 镇江唐桥微电子有限公司 | 一种基于感兴趣区域的视频编码方法 |
CN102300094A (zh) * | 2011-09-06 | 2011-12-28 | 中国科学院计算技术研究所 | 一种视频编码方法 |
CN102780886A (zh) * | 2012-07-23 | 2012-11-14 | 深圳广晟信源技术有限公司 | 一种率失真优化方法 |
CN104093022A (zh) * | 2014-06-25 | 2014-10-08 | 华为技术有限公司 | 一种率失真优化方法及装置 |
WO2018200293A1 (en) * | 2017-04-28 | 2018-11-01 | Microsoft Technology Licensing, Llc | Image encoding |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1830573A1 (en) * | 2006-03-02 | 2007-09-05 | Thomson Licensing | Method and apparatus for determining in picture signal encoding the bit allocation for groups of pixel blocks in a picture |
KR20120084168A (ko) * | 2011-01-19 | 2012-07-27 | 삼성전자주식회사 | 비디오 인코딩 모드 선택 방법 및 이를 수행하는 비디오 인코딩 장치 |
GB2495469B (en) * | 2011-09-02 | 2017-12-13 | Skype | Video coding |
CN104994382B (zh) * | 2015-04-30 | 2017-12-19 | 西安电子科技大学 | 一种感知率失真的优化方法 |
KR102390162B1 (ko) * | 2015-10-16 | 2022-04-22 | 삼성전자주식회사 | 데이터 인코딩 장치 및 데이터 인코딩 방법 |
CN105812805A (zh) * | 2016-01-31 | 2016-07-27 | 西安电子科技大学 | 一种用于视频图像的编码方法和装置 |
CN107846593B (zh) * | 2016-09-21 | 2020-01-03 | 中国移动通信有限公司研究院 | 一种率失真优化方法及装置 |
-
2018
- 2018-11-28 WO PCT/CN2018/118012 patent/WO2020107288A1/zh active Application Filing
- 2018-11-28 CN CN201880097309.3A patent/CN112655212B/zh active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101945275A (zh) * | 2010-08-18 | 2011-01-12 | 镇江唐桥微电子有限公司 | 一种基于感兴趣区域的视频编码方法 |
CN102300094A (zh) * | 2011-09-06 | 2011-12-28 | 中国科学院计算技术研究所 | 一种视频编码方法 |
CN102780886A (zh) * | 2012-07-23 | 2012-11-14 | 深圳广晟信源技术有限公司 | 一种率失真优化方法 |
CN104093022A (zh) * | 2014-06-25 | 2014-10-08 | 华为技术有限公司 | 一种率失真优化方法及装置 |
WO2018200293A1 (en) * | 2017-04-28 | 2018-11-01 | Microsoft Technology Licensing, Llc | Image encoding |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115428451A (zh) * | 2020-07-31 | 2022-12-02 | Oppo广东移动通信有限公司 | 视频编码方法、编码器、系统以及计算机存储介质 |
CN114554224A (zh) * | 2021-09-10 | 2022-05-27 | 电子科技大学 | 基于核心参考帧的块级拉格朗日乘子优化方法 |
CN114554224B (zh) * | 2021-09-10 | 2023-10-27 | 电子科技大学 | 基于核心参考帧的块级拉格朗日乘子优化方法 |
Also Published As
Publication number | Publication date |
---|---|
CN112655212A (zh) | 2021-04-13 |
CN112655212B (zh) | 2023-04-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11159801B2 (en) | Video characterization for smart encoding based on perceptual quality optimization | |
US10567764B2 (en) | Controlling a video content system by adjusting the compression parameters | |
US10123015B2 (en) | Macroblock-level adaptive quantization in quality-aware video optimization | |
JP5204269B2 (ja) | ビデオ・コーデック量子化のための方法および装置 | |
WO2020107288A1 (zh) | 视频编码优化方法、装置及计算机存储介质 | |
US10873763B2 (en) | Video compression techniques for high dynamic range data | |
WO2014139396A1 (en) | Video coding method using at least evaluated visual quality and related video coding apparatus | |
WO2021185257A1 (zh) | 图像编码方法、图像解码方法及相关装置 | |
US11006124B2 (en) | Method and apparatus for real-time SAO parameter estimation | |
US11792399B2 (en) | Systems and methods for quantization of video content | |
CN116456101A (zh) | 图像编码方法、图像解码方法及相关装置 | |
WO2022021422A1 (zh) | 视频编码方法、编码器、系统以及计算机存储介质 | |
US20160353107A1 (en) | Adaptive quantization parameter modulation for eye sensitive areas | |
Hu et al. | Complexity-guided slimmable decoder for efficient deep video compression | |
WO2020186763A1 (zh) | 图像分量预测方法、编码器、解码器以及存储介质 | |
CN108353178B (zh) | 编码和解码方法及相应设备 | |
WO2022198465A1 (zh) | 一种编码方法及装置 | |
WO2020258052A1 (zh) | 图像分量预测方法、装置及计算机存储介质 | |
Cui et al. | Perceptual Based Fast CU Partition Algorithm for VVC Intra Coding | |
CN118055234B (zh) | 视频帧编码方法、装置、设备、介质和计算机程序产品 | |
WO2020125649A1 (zh) | 数据处理方法、装置及存储介质 | |
WO2020258053A1 (zh) | 图像分量预测方法、装置及计算机存储介质 | |
Yang et al. | Content adaptive spatial-temporal rescaling for video coding optimization | |
CN118450123A (zh) | 一种图像编码方法、装置、设备及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18941940 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: 18941940 Country of ref document: EP Kind code of ref document: A1 |