Video coding method and device, electronic equipment and computer readable medium

By using the average gradient value to determine the motion vector accuracy mode and setting the corresponding analysis range in video encoding, the problem of the high computational burden of adaptive motion vector accuracy tool in video encoding is solved, and the encoding efficiency and computing resource utilization are improved.

CN119402646AActive Publication Date: 2025-02-07BEIJING VIMICRO ARTIFICIAL INTELLIGENCE CHIP TECH CO LTD +2
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411742441.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-02-07
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

During the video encoding process, when using the adaptive motion vector accuracy tool to select the encoding unit, it is necessary to analyze multiple motion vector accuracy of the encoding unit in one range, resulting in an increase in the computational burden, especially in processing When large-scale video data, efficiency is significantly reduced.

Method used

By obtaining the average gradient value of the video frame, the corresponding motion vector accuracy mode is determined, and the motion vector accuracy range of the adaptive motion vector accuracy tool is set according to this mode, thereby narrowing the analysis range and improving coding efficiency.

Benefits of technology

The overall characteristics of the image are used to select motion vector accuracy more reasonably, which improves coding efficiency and reduces computing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402646A_ABST
    Figure CN119402646A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a video coding method and device, electronic equipment and a computer readable medium. A specific embodiment of the method comprises the following steps: acquiring a video; for each frame of image, determining an average gradient value; in response to the fact that the average gradient value is not lower than a first threshold value, determining a motion vector precision mode as a first mode; in response to the condition not higher than the first threshold and not lower than a second threshold, determining that the motion vector precision mode is a second mode; in response to not higher than the second threshold, determining the motion vector precision mode as a third mode; obtaining each coding unit; determining a self-adaptive motion vector precision tool; setting a motion vector precision range; performing encoding processing on each encoding unit to generate encoding information; and determining each piece of coding information as video coding information. According to the embodiment, the overall characteristics of the image are utilized, so that the selection range of the motion vector precision is more reasonable, the coding efficiency is improved, the consumption of computing resources is reduced, and the overall performance of video coding is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a video encoding method, apparatus, electronic device, and computer-readable medium. Background Art

[0002] Video coding technology is an indispensable part of modern communication systems. It is mainly used to reduce the amount of video data to facilitate video storage and transmission. In some video coding standards, when encoding videos, it is usually necessary to use an adaptive motion vector precision tool to select the default range of motion vector precision for the coding unit (CU) corresponding to the image in the video.

[0003] However, when using the above method, the following technical problems often occur:

[0004] When using the adaptive motion vector precision tool to select the motion vector precision for a coding unit, it is necessary to analyze multiple motion vector precisions for the coding unit within a range, which increases the computational burden of the encoder. In particular, when processing large-scale video data, the efficiency is significantly reduced.

[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention

[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.

[0007] Some embodiments of the present disclosure propose a video encoding method, an apparatus, an electronic device, and a computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.

[0008] In a first aspect, some embodiments of the present disclosure provide a video encoding method, comprising: acquiring a video, wherein the video comprises at least one frame of image; for each frame of the at least one frame of image, performing the following first generation step: determining an average gradient value corresponding to the image; determining a first threshold and a second threshold, wherein the first threshold is higher than the second threshold; in response to the average gradient value being not lower than the first threshold, determining that the motion vector accuracy mode corresponding to the image is a first mode; in response to the average gradient value being not higher than the first threshold and not lower than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a second mode; in response to the average gradient value being not higher than the first threshold and not lower than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a second mode; higher than the second threshold, determining that the motion vector accuracy mode corresponding to the above image is the third mode; obtaining the respective coding units corresponding to the above image; determining an adaptive motion vector accuracy tool for the respective coding units, wherein the adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video coding standard; according to the motion vector accuracy mode, setting the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool; according to the set adaptive motion vector accuracy tool, performing encoding processing on each of the respective coding units corresponding to the above image to generate encoding information; determining the respective encoding information generated as video encoding information.

[0009] In a second aspect, some embodiments of the present disclosure provide a video encoding device, including: an acquisition unit, configured to acquire a video, wherein the video includes at least one frame of image; a generation unit, configured to perform the following first generation step for each frame of the at least one frame of image: determining an average gradient value corresponding to the image; determining a first threshold and a second threshold, wherein the first threshold is higher than the second threshold; in response to the average gradient value being not lower than the first threshold, determining that the motion vector accuracy mode corresponding to the image is a first mode; in response to the average gradient value being not higher than the first threshold and not lower than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a second mode; in response to the average gradient value being not higher than the first threshold and not lower than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a second mode; The gradient value is not higher than the second threshold value, and the motion vector accuracy mode corresponding to the image is determined to be the third mode; the encoding units corresponding to the image are obtained; an adaptive motion vector accuracy tool for each encoding unit is determined, wherein the adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video encoding standard; according to the motion vector accuracy mode, a motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is set; according to the set adaptive motion vector accuracy tool, each encoding unit in the encoding units corresponding to the image is encoded to generate encoding information; a determination unit is configured to determine the generated encoding information as video encoding information.

[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.

[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner in the first aspect is implemented.

[0012] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the video encoding method of some embodiments of the present disclosure, the overall characteristics of the image are utilized, so that the selection range of motion vector accuracy is more reasonable. The encoding efficiency is improved and the consumption of computing resources is reduced. Specifically, the reasons for the low encoding efficiency and excessive consumption of computing resources are: first, the use of the adaptive motion vector accuracy tool to select the motion vector accuracy of the coding unit requires the analysis of multiple motion vector accuracy of the coding unit in a range. This increases the computational burden. Especially when processing large-scale video data, the efficiency is significantly reduced. Secondly, the use of the adaptive motion vector accuracy tool to select the motion vector accuracy of the coding unit will ignore the overall characteristics of the image in the video, such as the average gradient of the image. Based on this, the video encoding method of some embodiments of the present disclosure, first, obtain a video, wherein the video includes at least one frame of image. Secondly, for each frame of the at least one frame of image, the following first generation step is performed: the first step is to determine the average gradient value corresponding to the image. Here, the average gradient value corresponding to the image is determined to obtain the overall characteristic information of the image. For example, the clarity, detail contrast, texture change and edge information of the image. In order to facilitate the subsequent setting of the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool for each coding unit in the above image according to the above overall characteristic information. The second step is to determine the first threshold and the second threshold, wherein the first threshold is higher than the second threshold. Here, the first threshold and the second threshold are thresholds for determining the motion vector accuracy mode corresponding to the subsequent image. The motion vector accuracy mode corresponding to the image can be determined by comparing the average gradient value corresponding to the image with the first threshold and the second threshold respectively. In order to facilitate the subsequent setting of the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool for each coding unit in the above image according to the motion vector accuracy mode. The third step is to determine that the motion vector accuracy mode corresponding to the image is the first mode in response to the average gradient value being not lower than the first threshold. The fourth step is to determine that the motion vector accuracy mode corresponding to the image is the second mode in response to the average gradient value being not higher than the first threshold and not lower than the second threshold. The fifth step is to determine that the motion vector accuracy mode corresponding to the image is the third mode in response to the average gradient value being not higher than the second threshold. The sixth step is to obtain each coding unit corresponding to the above image. Here, the coding unit is a basic unit for encoding a video in video encoding. The seventh step is to determine an adaptive motion vector accuracy tool for each of the above coding units, wherein the adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video coding standard. Here, the adaptive motion vector accuracy tool is used to determine the motion vector accuracy corresponding to each of the above coding units.Step 8: According to the motion vector accuracy mode, the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is set. Here, according to the motion vector accuracy mode, the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is set. When the adaptive motion vector accuracy tool is used to determine the motion vector accuracy corresponding to the coding unit, the analysis range can be narrowed, thereby improving the coding efficiency. Step 9: According to the set adaptive motion vector accuracy tool, each coding unit in each coding unit corresponding to the above image is encoded to generate coding information. Finally, the generated coding information is determined as video coding information. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[0014] Figure 1 is a flowchart of some embodiments of the video encoding method according to the present disclosure;

[0015] Figure 2 is a schematic structural diagram of some embodiments of a video encoding device according to the present disclosure;

[0016] Figure 3 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0018] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0019] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0020] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0022] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0023] refer to Figure 1 , shows a process 100 of some embodiments of the video encoding method according to the present disclosure. The video encoding method comprises the following steps:

[0024] Step 101, obtaining a video.

[0025] In some embodiments, the execution subject (eg, electronic device) of the video encoding method can obtain the video through a wired connection or a wireless connection. The receiving object of the video is the execution subject. The video includes at least one frame of image.

[0026] It should be noted that the above-mentioned wireless connection methods may include but are not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or developed in the future.

[0027] Step 102: for each frame of at least one frame of image, perform the following first generation step:

[0028] Step 1021, determining the average gradient value corresponding to the above image.

[0029] In some embodiments, the execution subject may determine the average gradient value corresponding to the image. The average gradient value corresponding to the image reflects the clarity and detail expression capability of the image. In practice, the execution subject may calculate the average gradient value corresponding to the image by using an operator for calculating gradient values ​​in OpenCV.

[0030] In some optional implementations of some embodiments, determining the average gradient value corresponding to the image includes:

[0031] In the first step, in response to the image being a color image, the image is converted into a grayscale image.

[0032] The second step is to determine the set of gradient values ​​corresponding to the grayscale image. The gradient value set refers to the set of gradient values ​​corresponding to each pixel point corresponding to the grayscale image. In practice, the built-in function in MATLAB can be used to calculate the set of gradient values ​​corresponding to the image.

[0033] The third step is to determine the average gradient value corresponding to the above image based on the above gradient value set.

[0034] As an example, first, the execution subject may add the gradient values ​​corresponding to each pixel in the gradient value set to obtain an addition result, and then divide the addition result by the total number of pixels in the grayscale image to obtain an average gradient value corresponding to the image.

[0035] Optionally, the above-mentioned determination of the gradient value set corresponding to the above-mentioned grayscale image may include the following steps:

[0036] The first step is to perform the following second generation step for each pixel in the above grayscale image:

[0037] The first sub-step is to determine the horizontal gradient value and the vertical gradient value corresponding to the above pixel point. The horizontal gradient value corresponding to the above pixel point refers to the magnitude of the rate of change of the pixel point in the horizontal direction. The vertical gradient value corresponding to the above pixel point refers to the magnitude of the rate of change of the pixel point in the vertical direction.

[0038] The second sub-step is to generate a gradient value corresponding to the pixel point according to the horizontal gradient value and the vertical gradient value.

[0039] As an example, the square of the horizontal gradient value and the square of the vertical gradient value may be added to obtain an addition result, and then a square root operation is performed on the addition result to obtain the gradient value corresponding to the pixel point.

[0040] The second step is to generate a gradient value set corresponding to a pixel point set, wherein the pixel point set corresponds to the grayscale image.

[0041] Optionally, the above-mentioned determination of the horizontal gradient value and the vertical gradient value corresponding to the above-mentioned pixel point may include the following steps:

[0042] The first step is to obtain the first convolution kernel and the second convolution kernel. The first convolution kernel is used to calculate the horizontal gradient value corresponding to the pixel point, and the second convolution kernel is used to calculate the vertical gradient value corresponding to the pixel point. For example, the first convolution kernel can be [-1, 0, 1, -2, 0, 2, -1, 0, 1], and the second convolution kernel can be [1, 2, 1, 0, 0, 0, -1, -2, -1].

[0043] In the second step, the convolution operation is performed on the convolution area corresponding to the pixel point using the first convolution kernel and the second convolution kernel, respectively, to obtain the first convolution result and the second convolution result. The convolution area is a neighborhood centered on the pixel point. For example, for a 3x3 convolution kernel, the convolution area is a 3x3 matrix area centered on the target pixel point, including the pixel point itself and the 8 pixels around it.

[0044] In the third step, the first convolution result and the second convolution result are respectively determined as the horizontal gradient value and the vertical gradient value corresponding to the pixel point.

[0045] Step 1022, determining a first threshold and a second threshold.

[0046] In some embodiments, the execution subject may determine the first threshold and the second threshold. The first threshold is higher than the second threshold. The first threshold and the second threshold are thresholds for determining a motion vector accuracy mode corresponding to the subsequent image. For example, the first threshold may be set to "20" and the second threshold may be set to "5".

[0047] Step 1023: In response to the average gradient value being higher than the first threshold, determining that the motion vector accuracy mode corresponding to the image is the first mode.

[0048] In some embodiments, the execution subject may determine that the motion vector accuracy mode corresponding to the image is the first mode in response to the average gradient value being higher than the first threshold. The motion vector accuracy mode is a mode for characterizing the accuracy of motion vectors corresponding to the encoding units corresponding to the image. Motion vector accuracy refers to the degree of detail of describing the motion vector, that is, the pixel level to which the motion vector can be accurate. In video coding, the motion vector is used to describe the displacement of an image block in the current frame relative to the corresponding position in the reference frame. It is usually composed of displacements in both horizontal and vertical directions. The reference frame refers to a frame used as a reference to calculate the motion vector of the current frame. The motion vector accuracy mode corresponds to three modes, namely the first mode, the second mode and the third mode. The first mode corresponds to the high-precision motion vector accuracy mode. The high-precision motion vector accuracy mode is used to characterize that the accuracy of motion vectors corresponding to the encoding units corresponding to the image is high-precision. The second mode corresponds to the medium-precision motion vector accuracy mode. The medium-precision motion vector accuracy mode is used to characterize that the accuracy of motion vectors corresponding to the encoding units corresponding to the image is medium-precision. The third mode corresponds to the low-precision motion vector accuracy mode. The low-precision motion vector accuracy mode is used to indicate that the motion vector accuracy corresponding to each coding unit corresponding to the above-mentioned image is low-precision.

[0049] Step 1024: In response to the average gradient value being lower than the first threshold and higher than the second threshold, determining that the motion vector accuracy mode corresponding to the image is the second mode.

[0050] In some embodiments, the execution entity may determine that the motion vector accuracy mode corresponding to the image is the second mode in response to the average gradient value being lower than the first threshold value and higher than the second threshold value.

[0051] Step 1025: In response to the average gradient value being lower than the second target threshold, determining that the motion vector accuracy mode corresponding to the image is the third mode.

[0052] In some embodiments, the execution entity may determine that the motion vector accuracy mode corresponding to the image is the third mode in response to the average gradient value being lower than the second target threshold.

[0053] Step 1026, obtaining each coding unit corresponding to the above image.

[0054] In some embodiments, the execution entity may use a division method in the AVS3 video coding standard to divide the coding units corresponding to the image.

[0055] Step 1027, determining an adaptive motion vector accuracy tool for each of the above coding units.

[0056] In some embodiments, the execution subject may determine an adaptive motion vector accuracy tool for each coding unit. The adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video coding standard. The adaptive motion vector accuracy tool is a tool in video coding that can adaptively select the motion vector accuracy corresponding to the coding unit. The motion vector accuracy range corresponding to the adaptive motion vector accuracy tool under the target video coding standard may include quarter pixel accuracy, half pixel accuracy, one pixel accuracy, two pixel accuracy and four pixel accuracy. The target video coding standard is the AVS3 video coding standard. In video coding, first, the adaptive motion vector accuracy tool causes the encoder to traverse each motion vector accuracy in the motion vector accuracy range in turn, and calculate the motion vector under each motion vector accuracy. Then, for each motion vector under each motion vector accuracy, the rate-distortion cost is calculated respectively. Finally, the motion vector accuracy corresponding to the case where the rate-distortion cost is the smallest is selected as the motion vector accuracy corresponding to the coding unit. The rate-distortion cost represents an evaluation index of the comprehensive bit rate and distortion, and the smaller the value, the better the coding effect.

[0057] Step 1028: According to the motion vector accuracy mode, the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is set.

[0058] In some embodiments, the execution entity may set the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool according to the motion vector accuracy mode.

[0059] As an example, when the above-mentioned motion vector accuracy mode is the first mode, the above-mentioned execution entity may set the motion vector accuracy range in the source file corresponding to the above-mentioned adaptive motion vector accuracy tool to the first range. When the above-mentioned motion vector accuracy mode is the second mode, the above-mentioned execution entity may set the motion vector accuracy range in the source file corresponding to the above-mentioned adaptive motion vector accuracy tool to the second range. When the above-mentioned motion vector accuracy mode is the third mode, the above-mentioned execution entity may set the motion vector accuracy range in the source file corresponding to the above-mentioned adaptive motion vector accuracy tool to the third range. Among them, any motion vector accuracy in the first range is higher than any motion vector accuracy in the second range, and any motion vector accuracy in the second range is higher than any motion vector accuracy in the third range. In some optional implementation methods of some embodiments, the above-mentioned execution entity sets the motion vector accuracy range corresponding to the above-mentioned adaptive motion vector accuracy tool according to the above-mentioned motion vector accuracy mode, which may include the following steps:

[0060] The first step is to determine a first motion vector accuracy and a second motion vector accuracy, wherein the motion vector accuracy represented by the first motion vector accuracy is higher than the motion vector accuracy represented by the second motion vector accuracy. For example, the first motion vector accuracy is a quarter pixel accuracy, and the second motion vector accuracy is a half pixel accuracy. The motion vector accuracy range corresponding to the adaptive motion vector accuracy tool includes the first motion vector accuracy and the second motion vector accuracy.

[0061] In the second step, in response to determining that the motion vector accuracy mode corresponding to the above image is the first mode, the motion vector accuracy range corresponding to the above adaptive motion vector accuracy tool is set to a default range.

[0062] In the third step, in response to determining that the motion vector accuracy mode corresponding to the above image is the second mode, removing the motion vector accuracy range that is greater than the above first motion vector accuracy from the motion vector accuracy range corresponding to the above adaptive motion vector accuracy tool.

[0063] In the fourth step, in response to determining that the motion vector accuracy mode corresponding to the above image is the third mode, removing the motion vector accuracy range that is greater than the second motion vector accuracy in the motion vector accuracy range corresponding to the above adaptive motion vector accuracy tool.

[0064] In the process of adopting technical solutions to solve the above technical problems, the following technical problem 2 often occurs: when watching a video, people's attention is mainly focused on the main part of the image in the video. When using the adaptive motion vector precision tool to select the motion vector precision for each coding unit in the image, they do not pay attention to the coding unit corresponding to the image area where the main body is located. This will cause some coding units corresponding to the image area where the main body is located to not be able to select high-precision motion vector precision, thereby affecting the subsequent video encoding effect and wasting encoding resources. In response to the above technical problem 2, we decided to adopt the following solution:

[0065] In some other optional implementations of some embodiments, the execution subject sets the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool according to the motion vector accuracy mode, which may include the following steps:

[0066] The first step is to determine the first motion vector accuracy, the second motion vector accuracy and the third motion vector accuracy, wherein the motion vector accuracy represented by the first motion vector accuracy is higher than the motion vector accuracy represented by the second motion vector accuracy, and the motion vector accuracy represented by the second motion vector accuracy is higher than the motion vector accuracy represented by the third motion vector accuracy. Here, the first motion vector accuracy is a quarter pixel accuracy, the second motion vector accuracy is a half pixel accuracy, and the third motion vector accuracy is a pixel accuracy. The motion vector accuracy range corresponding to the adaptive motion vector accuracy tool includes the first motion vector accuracy, the second motion vector accuracy and the third motion vector accuracy.

[0067] The second step is to perform subject recognition on the above image to obtain the subject recognition result. The subject refers to the object or element that occupies an important position in an image, attracts the most visual attention, or is the most expressive and representative. For example: people, animals, cars and plants. The opposite of the subject is the image background. For example: sky, wall and grass. The subject recognition result is a target box containing the subject. In practice, the target detection model can be used to perform subject recognition on the above image.

[0068] For example, an image data set including subject annotation information can be input into an untrained YOLOV8 target detection model for training to obtain a target detection model that can perform target detection on the subject in the above image.

[0069] The third step is to determine each coding unit corresponding to the subject identification result to obtain a subject identification coding unit, wherein the subject identification coding unit is a coding unit in the subject identification result.

[0070] In the fourth step, for the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool of the subject recognition coding unit, the following first removal step is performed:

[0071] In a first sub-step, in response to determining that the motion vector accuracy mode corresponding to the above image is the first mode, the motion vector accuracy range corresponding to the above adaptive motion vector accuracy tool is set to a default range.

[0072] In the second sub-step, in response to determining that the motion vector accuracy mode corresponding to the above image is the second mode or the third mode, removing the motion vector accuracy greater than the above first motion vector accuracy in the motion vector accuracy range corresponding to the above adaptive motion vector accuracy tool.

[0073] The third sub-step is to determine each area in the image that does not include the subject recognition result, and obtain the background area.

[0074] The fourth sub-step is to determine each coding unit corresponding to the background area to obtain a background coding unit, wherein the background coding unit is a coding unit corresponding to the background area.

[0075] Step 5: For the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool for the background coding unit, perform the following second removal step:

[0076] In a first sub-step, in response to determining that the motion vector accuracy mode corresponding to the image is the first mode, removing the motion vector accuracy greater than the second motion vector accuracy in the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool.

[0077] In the second sub-step, in response to determining that the motion vector accuracy mode corresponding to the above image is the second mode or the third mode, removing the motion vector accuracy greater than the above third motion vector accuracy in the motion vector accuracy range corresponding to the above adaptive motion vector accuracy tool.

[0078] Step 1029: perform encoding processing on each of the encoding units corresponding to the above image according to the set adaptive motion vector precision tool to generate encoding information.

[0079] In some embodiments, the execution subject may perform encoding processing on each of the encoding units corresponding to the image according to the set adaptive motion vector precision tool to generate encoding information, wherein the encoding information refers to a binary bit stream generated after encoding the encoding unit.

[0080] As an example, first, the above-mentioned execution subject can use the adaptive motion vector accuracy tool in the AVS3 video coding standard to make the encoder traverse each motion vector accuracy in the above-mentioned motion vector accuracy range in turn, and calculate the motion vector under each motion vector accuracy. Then, according to the motion vector under each motion vector accuracy, the rate-distortion cost is calculated respectively. Finally, the motion vector accuracy corresponding to the case where the rate-distortion cost is the smallest is selected as the motion vector accuracy corresponding to the coding unit. Thereby, the coding unit characterizes the motion vector residual corresponding to the coding unit according to its corresponding motion vector accuracy. Then, the above-mentioned execution subject can encode the above-mentioned motion vector residual and the information to be encoded corresponding to the coding unit according to the AVS3 video coding standard to obtain the encoding information. Among them, the above-mentioned information to be encoded includes but is not limited to: prediction mode, transformation information, residual information and division method.

[0081] Step 103: determine each generated encoding information as video encoding information.

[0082] In some embodiments, the execution entity may determine each generated encoding information as video encoding information.

[0083] Optionally, for each of the above-mentioned coded information, the above-mentioned execution subject may perform the following steps:

[0084] The first step is to obtain at least one motion vector accuracy mode corresponding to at least one frame of image;

[0085] In the second step, at least one mode information corresponding to the at least one motion vector accuracy mode is respectively embedded into each of the coded information, so as to be used for the decoder to decode the coded information. The mode information is the target data that can be embedded in the coded information. In practice, first, the execution subject defines the target data and determines the position of the target data in the PPS. PPS is a picture parameter set (PPS, Picture Parameter Set), which is a NAL unit. The NAL unit (Network Abstraction Layer Unit) is a basic structure for encapsulating various types of data in video coding. Then, the structure of the PPS is modified to accommodate the target data. This involves updating the syntax description of the PPS so that the target data can be encoded into the coded information. This process is a routine process in the formulation of a video coding standard. Then, a flag is set in the PPS to identify the target data. Finally, during the encoding process, when the encoder generates the PPS, the execution subject can fill the target data into the PPS. This information will be encoded as part of the coded information and become a component of the entire video coding information.

[0086] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the video encoding method of some embodiments of the present disclosure, the overall characteristics of the image are utilized, so that the selection range of motion vector accuracy is more reasonable. The encoding efficiency is improved and the consumption of computing resources is reduced. Specifically, the reasons for the low encoding efficiency and excessive consumption of computing resources are: first, the use of the adaptive motion vector accuracy tool to select the motion vector accuracy of the coding unit requires the analysis of multiple motion vector accuracy of the coding unit in a range. This increases the computational burden. Especially when processing large-scale video data, the efficiency is significantly reduced. Secondly, the use of the adaptive motion vector accuracy tool to select the motion vector accuracy of the coding unit will ignore the overall characteristics of the image in the video, such as the average gradient of the image. Based on this, the video encoding method of some embodiments of the present disclosure, first, obtain a video, wherein the video includes at least one frame of image. Secondly, for each frame of the at least one frame of image, the following first generation step is performed: the first step is to determine the average gradient value corresponding to the image. Here, the average gradient value corresponding to the image is determined to obtain the overall characteristic information of the image. For example, the clarity, detail contrast, texture change and edge information of the image. In order to facilitate the subsequent setting of the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool for each coding unit in the above image according to the above overall characteristic information. The second step is to determine the first threshold and the second threshold, wherein the first threshold is higher than the second threshold. Here, the first threshold and the second threshold are thresholds for determining the motion vector accuracy mode corresponding to the subsequent image. The motion vector accuracy mode corresponding to the image can be determined by comparing the average gradient value corresponding to the image with the first threshold and the second threshold respectively. In order to facilitate the subsequent setting of the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool for each coding unit in the above image according to the motion vector accuracy mode. The third step is to determine that the motion vector accuracy mode corresponding to the image is the first mode in response to the average gradient value being not lower than the first threshold. The fourth step is to determine that the motion vector accuracy mode corresponding to the image is the second mode in response to the average gradient value being not higher than the first threshold and not lower than the second threshold. The fifth step is to determine that the motion vector accuracy mode corresponding to the image is the third mode in response to the average gradient value being not higher than the second threshold. The sixth step is to obtain each coding unit corresponding to the above image. Here, the coding unit is a basic unit for encoding a video in video encoding. The seventh step is to determine an adaptive motion vector accuracy tool for each of the above coding units, wherein the adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video coding standard. Here, the adaptive motion vector accuracy tool is used to determine the motion vector accuracy corresponding to each of the above coding units.Step 8: According to the motion vector accuracy mode, the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is set. Here, according to the motion vector accuracy mode, the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is set. When the adaptive motion vector accuracy tool is used to determine the motion vector accuracy corresponding to the coding unit, the analysis range can be narrowed, thereby improving the coding efficiency. Step 9: According to the set adaptive motion vector accuracy tool, each coding unit in each coding unit corresponding to the above image is encoded to generate coding information. Finally, the generated coding information is determined as video coding information.

[0087] Further references Figure 2 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a video encoding device, and these device embodiments are Figure 1 Corresponding to the method embodiments shown, the video encoding device can be specifically applied to various electronic devices.

[0088] like Figure 2 As shown, a video encoding device 200 includes: an acquisition unit 201, a generation unit 202 and a determination unit 203. The acquisition unit 201 is configured to: acquire a video, wherein the video includes at least one frame of image. The generating unit 202 is configured to: for each frame of the at least one frame of the image, perform the following first generating step: determine an average gradient value corresponding to the image; determine a first threshold and a second threshold, wherein the first threshold is higher than the second threshold; in response to the average gradient value being not lower than the first threshold, determine that the motion vector accuracy mode corresponding to the image is the first mode; in response to the average gradient value being not higher than the first threshold and not lower than the second threshold, determine that the motion vector accuracy mode corresponding to the image is the second mode; in response to the average gradient value being not higher than the second threshold, determine that the motion vector accuracy mode corresponding to the image is the third mode; obtain each coding unit corresponding to the image; determine an adaptive motion vector accuracy tool for each coding unit, wherein the adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video coding standard; according to the motion vector accuracy mode, set a motion vector accuracy range corresponding to the adaptive motion vector accuracy tool; according to the set adaptive motion vector accuracy tool, perform encoding processing on each coding unit corresponding to the image to generate encoding information; the determining unit 203 is configured to: determine the generated encoding information as video encoding information.

[0089] It can be understood that the units described in the video encoding device 200 are similar to those described in the reference Figure 1Therefore, the operations, features and beneficial effects described above for the method are also applicable to the video encoding device 200 and the units included therein, and will not be described in detail here.

[0090] Reference below Figure 3 , which shows a structural schematic diagram of an electronic device (eg, an electronic device) 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0091] like Figure 3 As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0092] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0093] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.

[0094] It should be noted that the computer-readable medium in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In some embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0095] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with 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"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0096] The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist independently without being assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: acquires a video, wherein the video includes at least one frame of image; for each frame of the at least one frame of image, performs the following first generation step: determines an average gradient value corresponding to the above-mentioned image; determines a first threshold and a second threshold, wherein the above-mentioned first threshold is higher than the above-mentioned second threshold; in response to the above-mentioned average gradient value being not lower than the above-mentioned first threshold, determines that the motion vector accuracy mode corresponding to the above-mentioned image is the first mode; in response to the above-mentioned average gradient value being not higher than the above-mentioned first threshold and not lower than the above-mentioned second threshold, determines that the motion vector accuracy mode corresponding to the above-mentioned image is the second mode; in response In response to the above-mentioned average gradient value being not higher than the above-mentioned second threshold value, determining that the motion vector accuracy mode corresponding to the above-mentioned image is the third mode; obtaining each coding unit corresponding to the above-mentioned image; determining an adaptive motion vector accuracy tool for each of the above-mentioned coding units, wherein the above-mentioned adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to the target video coding standard; according to the above-mentioned motion vector accuracy mode, setting a motion vector accuracy range corresponding to the above-mentioned adaptive motion vector accuracy tool; according to the set adaptive motion vector accuracy tool, performing encoding processing on each of the coding units corresponding to the above-mentioned image to generate encoding information; determining each of the generated encoding information as video encoding information.

[0097] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0098] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0099] The units described in some embodiments of the present disclosure may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes an acquisition unit, a generation unit, and a determination unit, and the names of these units do not constitute a limitation on the units themselves in some cases, for example, the acquisition unit may also be described as a "unit for acquiring video".

[0100] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0101] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.

Claims

1. A video encoding method, comprising: Acquire a video, wherein the video includes at least one frame of image; For each frame of the at least one frame of image, the following first generating step is performed: Determine an average gradient value corresponding to the image; determining a first threshold and a second threshold, wherein the first threshold is higher than the second threshold; In response to the average gradient value being not lower than the first threshold, determining that the motion vector accuracy mode corresponding to the image is a first mode; In response to the average gradient value being not higher than the first threshold value and not lower than the second threshold value, determining that the motion vector accuracy mode corresponding to the image is the second mode; In response to the average gradient value being not higher than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a third mode; Obtaining each coding unit corresponding to the image; Determining an adaptive motion vector precision tool for each coding unit, wherein the adaptive motion vector precision tool is an adaptive motion vector precision tool corresponding to a target video coding standard; According to the motion vector accuracy mode, setting the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool; According to the set adaptive motion vector precision tool, encoding processing is performed on each of the encoding units corresponding to the image to generate encoding information; The generated pieces of encoding information are determined as video encoding information.

2. The method according to claim 1, wherein: Determining the average gradient value corresponding to the image includes: In response to the image being a color image, converting the image into a grayscale image; Determine a gradient value set corresponding to the grayscale image; An average gradient value corresponding to the image is determined according to the gradient value set.

3. The method according to claim 2, wherein: The step of determining a set of gradient values ​​corresponding to the grayscale image comprises: For each pixel in the grayscale image, the following second generation step is performed: Determine the horizontal gradient value and the vertical gradient value corresponding to the pixel point; Generating a gradient value corresponding to the pixel point according to the horizontal gradient value and the vertical gradient value; A gradient value set corresponding to a pixel point set is generated, wherein the pixel point set corresponds to the grayscale image.

4. The method according to claim 3, wherein: The determining of the horizontal gradient value and the vertical gradient value corresponding to the pixel point includes: Get the first convolution kernel and the second convolution kernel; Using the first convolution kernel and the second convolution kernel, respectively perform convolution operations on the convolution areas corresponding to the pixel points to obtain a first convolution result and a second convolution result; The first convolution result and the second convolution result are respectively determined as the horizontal gradient value and the vertical gradient value corresponding to the pixel point.

5. The method according to claim 1, wherein the step of setting the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool according to the motion vector accuracy mode comprises: Determining a first motion vector accuracy and a second motion vector accuracy, wherein a motion vector accuracy represented by the first motion vector accuracy is higher than a motion vector accuracy represented by the second motion vector accuracy; In response to determining that the motion vector accuracy mode corresponding to the image is the first mode, setting the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool to a default range; in response to determining that the motion vector accuracy mode corresponding to the image is the second mode, removing the motion vector accuracy higher than the first motion vector accuracy in the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool; In response to determining that the motion vector accuracy mode corresponding to the image is the third mode, the motion vector accuracy higher than the second motion vector accuracy in the motion vector accuracy range corresponding to the adaptive motion vector accuracy tool is removed.

6. The method according to claim 1, further comprising: Acquire at least one motion vector accuracy mode corresponding to at least one frame of image; At least one mode information corresponding to the at least one motion vector accuracy mode is respectively embedded into each of the encoded information, so as to be used by a decoder to decode the each of the encoded information.

7. A video encoding device, comprising: An acquisition unit is configured to acquire a video, wherein the video includes at least one frame of image; A generating unit is configured to perform the following first generating step for each frame of the at least one frame of the image: determining an average gradient value corresponding to the image; determining a first threshold and a second threshold, wherein the first threshold is higher than the second threshold; in response to the average gradient value being not lower than the first threshold, determining that the motion vector accuracy mode corresponding to the image is a first mode; in response to the average gradient value being not higher than the first threshold and not lower than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a second mode; in response to the average gradient value being not higher than the second threshold, determining that the motion vector accuracy mode corresponding to the image is a third mode; acquiring each coding unit corresponding to the image; determining an adaptive motion vector accuracy tool for each coding unit, wherein the adaptive motion vector accuracy tool is an adaptive motion vector accuracy tool corresponding to a target video coding standard; according to the motion vector accuracy mode, setting a motion vector accuracy range corresponding to the adaptive motion vector accuracy tool; and according to the set adaptive motion vector accuracy tool, encoding each coding unit of each coding unit corresponding to the image to generate encoding information; The determining unit is configured to determine each generated encoding information as video encoding information.

8. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Calculation of affine modes of different video block sizes

    CN110891174A

  • Fast method and device based on adaptive motion vector precision in VVC

    CN113242427A

  • Adaptive motion vector resolution signaling

    CN114009010A

  • High-precision coding mode coding method and high-precision coding mode decoding method

    CN118381933A

  • Motion vector detecting device

    US20060188021A1