Video encoding method and apparatus, electronic device, medium, and program product
By dividing video footage into regions and applying differentiated encoding, the problem of low encoding efficiency in the cloud computing field has been solved, achieving more efficient encoding and transmission.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2025-10-14
- Publication Date
- 2026-04-23
AI Technical Summary
Existing video encoding technologies in the cloud computing field suffer from low encoding efficiency and are unable to flexibly adapt to the changing needs of different scenarios due to their use of fixed encoding modes.
By dividing the original video into multiple frames, the initial region in each frame is determined, and the encoding region and encoding strategy are determined based on the rate of change of pixels. Different encoding methods are used to process different regions.
It improves encoding efficiency, reduces encoding computation and network bandwidth requirements, and reduces transmission volume.
Smart Images

Figure CN2025127561_23042026_PF_FP_ABST
Abstract
Description
Video encoding methods, devices, electronic equipment, chips, media and software products
[0001] Cross-references to related applications
[0002] This application is based on and claims priority to Chinese Patent Application No. 202411447459.6, filed on October 16, 2024, the entire contents of which are incorporated herein by reference. Technical Field
[0003] This disclosure relates to the field of video processing technology, and in particular to a video encoding method, apparatus, electronic device, chip, medium, and program product. Background Technology
[0004] In the cloud computing field, desktop transmission protocols require real-time capture, encoding, and transmission of the entire desktop screen. However, in practical applications, encoding the entire screen is often unnecessary. For example, in windowed applications or text-based office scenarios, the area of screen change is small; or in scenarios such as slideshow playback or idle periods, the frequency of screen changes is low, and encoding the entire screen is not required. Current video encoding technologies typically employ fixed encoding patterns, resulting in inflexible encoding methods and low encoding efficiency. Summary of the Invention
[0005] This disclosure provides a video encoding method, apparatus, electronic device, chip, medium, and program product.
[0006] This disclosure proposes a video encoding method, which includes: determining multiple initial regions in each frame of a multi-frame video; determining the rate of change of each initial region based on the pixels in the multiple initial regions; determining at least one encoding region and an encoding strategy corresponding to each encoding region based on the rate of change; and performing video encoding on each encoding region using the encoding strategy corresponding to each encoding region to obtain target data.
[0007] In some embodiments of this disclosure, determining multiple initial regions in each frame of a multi-frame video includes: initially dividing the first frame of the original video according to initial parameters to obtain multiple first regions; re-dividing the multiple first regions based on the content features of the multiple first regions to determine multiple initial regions in the first frame, wherein the content features include boundary features and texture features; and adding identification information to the multiple initial regions, wherein the identification information includes position information and boundary information.
[0008] In some embodiments of this disclosure, determining the rate of change of each initial region based on pixels in multiple initial regions includes: traversing multiple frames in the original video, preprocessing pixels in each initial region for multiple initial regions to obtain the grayscale value of each pixel; and determining the rate of change of each initial region based on the grayscale value of each pixel.
[0009] In some embodiments of this disclosure, determining the rate of change of each initial region based on the grayscale value of each pixel includes: determining the difference in grayscale values of first pixels in a first initial region among multiple initial regions of adjacent frames; determining the average change value of the first initial region based on the grayscale value difference and the number of pixels in the first initial region; continuously acquiring the average change values of adjacent frames in the first initial region for a preset number of consecutive sets to obtain a set of average change values in the first initial region; and determining the rate of change of the first initial region based on the set of average change values.
[0010] In some embodiments of this disclosure, determining at least one coding region and the coding strategy corresponding to each coding region based on the rate of change includes: determining at least one coding region based on the rate of change of each initial region; determining the rate of change level of each coding region based on the correspondence table between rate of change and rate of change level; and determining the coding strategy of each coding region based on the rate of change level of each coding region according to preset rules.
[0011] In some embodiments of this disclosure, the change rate level of each coded region is determined according to the correspondence table between change rate and change rate level, including any one of the following: when the change rate is greater than a first threshold, the change rate level is determined to be high level; when the change rate is greater than a second threshold and less than or equal to the first threshold, the change rate level is determined to be medium level; when the change rate is less than or equal to the second threshold, the change rate level is determined to be low level, and the first threshold is greater than the second threshold.
[0012] In some embodiments of this disclosure, the method further includes: determining encoding parameters of a first encoding region according to the encoding strategy of the first encoding region in at least one encoding region; and determining parameter values of the encoding parameters based on the encoding parameters of the first encoding region, the rate of change level of the first encoding region, and encoding requirements.
[0013] In some embodiments of this disclosure, video encoding is performed on each encoding region using an encoding strategy corresponding to each encoding region, including: for a second frame in a multi-frame sequence, encoding the second encoding region according to the encoding strategy of the second encoding region in at least one encoding region to obtain region data corresponding to the second encoding region; determining the sorting value of the region data corresponding to the second encoding region in the second frame according to a first rule; adding the sorting value, the rate of change level corresponding to the second encoding region, and the encoding strategy corresponding to the second encoding region to the identification information of the second encoding region; and encapsulating the region data of the second encoding region with the corresponding identification information.
[0014] This disclosure proposes a video decoding method, comprising: acquiring target data, wherein the target data is obtained using the video encoding method described above, the target data including region data of at least one encoded region and corresponding identification information, and region data of at least one non-encoded region and corresponding identification information, wherein the identification information includes at least one of location information, sorting value, boundary information, rate of change level, and encoding strategy; and decoding the target data according to the identification information to obtain the original video.
[0015] In some embodiments of this disclosure, decoding the target data according to the identification information to obtain the original video includes: determining a decoding strategy corresponding to each region data according to the encoding strategy of each region data; using the decoding strategy to decode the region data corresponding to the decoding strategy to obtain pixel data corresponding to each region data; and combining the pixel data corresponding to each region data according to the position information and sorting value to obtain the original video.
[0016] This disclosure provides a video encoding apparatus, comprising: a segmentation module configured to determine multiple initial regions in each frame of an original video; a first determination module configured to determine a rate of change for each initial region based on pixels in the multiple initial regions; a second determination module configured to determine at least one encoding region and an encoding strategy corresponding to each encoding region based on the rate of change; and an encoding module configured to perform video encoding on each encoding region using the encoding strategy corresponding to each encoding region to obtain target data.
[0017] This disclosure provides a video decoding apparatus, comprising: an acquisition module configured to acquire target data, the target data being obtained using the video encoding apparatus described above, the target data including region data of at least one encoded region and corresponding identification information, and region data of at least one non-encoded region and corresponding identification information, the identification information including at least one of location information, sorting value, boundary information, rate of change level, and encoding strategy; and a decoding module configured to decode the target data according to the identification information to obtain the original video.
[0018] This disclosure provides an electronic device including: one or more processors and a storage device communicatively connected to the one or more processors, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the methods described in this disclosure.
[0019] This disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein when the computer instructions are executed by a computer, they implement the methods described in this disclosure.
[0020] This disclosure provides a chip including one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of an electronic device and send signals to the processors, the signals including computer instructions stored in the memory, which, when executed by the processor, cause the electronic device to perform the methods described in this disclosure.
[0021] This disclosure provides a computer program product, including a computer program or computer-executable instructions, which, when executed by a processor, implement the methods described in this disclosure.
[0022] In summary, according to the video coding scheme proposed in this disclosure, for multiple frames in the original video, multiple initial regions are determined in each frame; based on the pixels in the multiple initial regions, the rate of change of each initial region is determined; based on the rate of change, at least one coding region and a coding strategy corresponding to each coding region are determined; and video coding is performed on each coding region using the coding strategy corresponding to each coding region to obtain the target data. The video coding scheme proposed in this disclosure can identify the rate of change of different regions in each sampled frame of the original video, and determine the coding region and the coding strategy of the coding region based on the rate of change of different regions, so as to achieve the application of different coding strategies to different regions, avoid encoding the entire frame, thereby reducing the coding computation requirements, improving coding efficiency, reducing network bandwidth requirements, and reducing transmission volume.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the embodiments of this disclosure. Attached Figure Description
[0024] Figure 1 is a flowchart of a video coding method proposed in an embodiment of this disclosure;
[0025] Figure 2 is a flowchart illustrating the determination of multiple initial regions according to an embodiment of this disclosure;
[0026] Figure 3 is a flowchart of determining the rate of change of the initial region according to an embodiment of this disclosure;
[0027] Figure 4 is a flowchart of the process for determining the rate of change according to an embodiment of this disclosure;
[0028] Figure 5 is a flowchart of the determination of the encoding region and encoding strategy proposed in the embodiments of this disclosure;
[0029] Figure 6 is a flowchart of the video encoding method proposed in an embodiment of this disclosure;
[0030] Figure 7 is a flowchart of video encoding of the encoding region according to an embodiment of this disclosure;
[0031] Figure 8 is a flowchart of a video decoding method proposed in an embodiment of this disclosure;
[0032] Figure 9 is a flowchart of the target data decoding process proposed in an embodiment of this disclosure;
[0033] Figure 10 is a flowchart of a video encoding and decoding method provided in an embodiment of this disclosure;
[0034] Figure 11 is a schematic diagram of the structure of a video encoding device according to an embodiment of this disclosure;
[0035] Figure 12 is a schematic diagram of the structure of a video decoding device according to an embodiment of this disclosure;
[0036] Figure 13 is a schematic diagram of the structure of the electronic device proposed in the embodiments of this disclosure. Detailed Implementation
[0037] Embodiments of this disclosure are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments are described below with reference to the accompanying drawings.
[0038] In related technologies, the encoding process requires encoding the entire image, which is inflexible and inefficient. To address these problems, this disclosure proposes a video encoding method, comprising: determining an encoding region in each of multiple frames of an original video; determining the rate of change of the encoding region in each frame based on the pixels in the encoding region; determining an encoding strategy for the encoding region based on the rate of change; and using the encoding strategy to perform video encoding on the encoding region in each frame to obtain target data.
[0039] Compared with related technologies, the method proposed in this disclosure can identify the change frequency (i.e. change rate) of different regions, and adopt different encoding strategies based on the change frequency of different regions, thereby improving encoding efficiency and achieving the goal of not encoding the entire screen. By improving encoding efficiency and reducing encoding computation requirements, network bandwidth requirements and transmission volume are reduced.
[0040] The solution provided in this application will be described in detail below with reference to the accompanying drawings. The solution proposed in this disclosure is applied to a cloud computing scenario. A cloud computing scenario refers to the application of computer services based on cloud computing technology in different fields and scenarios. A cloud computer, also known as a cloud computing terminal or cloud desktop, virtualizes traditional computer hardware and operating systems, connecting to a remote server via a network, enabling users to access and use applications, data, and files on their personal computers from any location and on any device. The execution subject of the method proposed in this disclosure is an electronic device in a cloud computing scenario.
[0041] Figure 1 is a flowchart of a video encoding method proposed in an embodiment of this disclosure. As shown in Figure 1, the method includes the following steps:
[0042] Step 101: For multiple frames in the original video, determine multiple initial regions in each frame;
[0043] Step 102: Determine the rate of change for each initial region based on the pixels in the multiple initial regions;
[0044] Step 103: Based on the rate of change, determine at least one coding region and the coding strategy corresponding to each coding region;
[0045] Step 104: Using the encoding strategy corresponding to each encoding region, perform video encoding on each encoding region to obtain the target data.
[0046] In the embodiments of this disclosure, in step 101 above, the multiple frames in the original video can be multiple frame images determined according to a preset sampling frequency. In other words, the multiple frames in the original video are multiple sampled frame images in the original video.
[0047] For example, a sampling frequency of 3-5 seconds can be used to determine multiple frames in the original video.
[0048] In the embodiments of this disclosure, determining multiple initial regions in each frame can be done by performing an initial region division on each sampled frame, dividing multiple regions with different features existing in a sampled frame into multiple initial regions.
[0049] For example, the input video frame is read, and the regions with different features in the video frame are divided into multiple initial regions.
[0050] In the embodiments of this disclosure, the method of dividing each frame of the original video into multiple initial regions can be to first divide the video using initial parameters, and then optimize and adjust it according to the content characteristics of the video to determine multiple initial regions.
[0051] In the embodiments of this disclosure, the method of dividing each sampled frame in the original video to obtain multiple initial regions can be achieved by using an image segmentation algorithm. The image segmentation algorithm can be a threshold-based segmentation algorithm, an edge-based segmentation algorithm, a region-based segmentation algorithm, an energy-based segmentation algorithm, or a deep learning-based segmentation algorithm, etc. The embodiments of this disclosure do not limit this.
[0052] In the embodiments of this disclosure, in step 102 above, the rate of change of each initial region can be determined based on the pixels in the multiple initial regions in each sampled frame.
[0053] In embodiments of this disclosure, each initial region contains multiple pixels, and the rate of change of each initial region can be determined based on these multiple pixels.
[0054] In the embodiments of this disclosure, the rate of change can be the rate or frequency of change of pixel values in space within the initial region, or it can refer to the rate of change of pixel values over time.
[0055] In embodiments of this disclosure, the rate of change of each initial region is determined based on the pixels in multiple initial regions, which can be done by gradient calculation.
[0056] In the embodiments of this disclosure, the rate of change of each initial region is determined based on the pixels in multiple initial regions. This can be achieved by using the frame difference method, which calculates the rate of change by comparing the changes in pixel values of corresponding regions between two or more adjacent sampling frames.
[0057] In embodiments of this disclosure, the rate of change of each initial region is determined based on the pixels in multiple initial regions. This can be achieved by using optical flow to determine the rate of change of each initial region. Optical flow is an estimation method based on the motion of pixels or feature points. It calculates motion information by analyzing the trajectory of pixels or feature points changing over time in a video sequence, thereby evaluating the rate of change within the region.
[0058] In embodiments of this disclosure, the rate of change of each initial region is determined based on the pixels in multiple initial regions. This can be achieved by using a background subtraction method to determine the rate of change of each initial region. The background subtraction method detects moving objects by comparing the difference between the current frame and the background model, and indirectly evaluates the rate of change within the region.
[0059] In embodiments of this disclosure, the rate of change of each initial region is determined based on the pixels in multiple initial regions. This can be achieved by using a pixel statistics method, which analyzes the distribution and changes of pixel values within a region to evaluate the rate of change within that region.
[0060] In the embodiments of this disclosure, the method for determining the rate of change of each initial region based on the pixel values in multiple initial regions is not limited. A suitable method can be selected according to the application scenario and requirements. For example, in scenarios with high real-time requirements, the frame difference method or pixel statistics method can be selected. In scenarios with high accuracy requirements, the optical flow method can be selected.
[0061] In the above embodiments, by determining the rate of change of each initial region, the coding computation requirements can be reduced.
[0062] In the embodiments of this disclosure, in step 103 above, determining at least one coded region based on the rate of change can be based on the rate of change of multiple initial regions in each frame. At least one coded region and at least one non-coded region are determined in the multiple initial regions. The coded region is the changing region, and the non-coded region is the unchanging region. In other words, the coded region is the dynamic image that needs to be encoded and transmitted; the non-coded region is the static image that does not need to be encoded or is encoded and transmitted using a fixed low bit rate encoding strategy.
[0063] In the embodiments of this disclosure, the encoding strategy corresponding to at least one encoding region is determined based on the rate of change. This may involve adopting different encoding methods for the rate of change of each encoding region, or determining the business scenario based on the rate of change and determining the encoding strategy for each encoding region according to the encoding method corresponding to the business scenario.
[0064] In the embodiments of this disclosure, the coding strategy corresponding to at least one coding region is determined based on the rate of change. This can be achieved by pre-setting the correspondence between the rate of change and the coding strategy, and by looking up a table to determine the coding strategy corresponding to the rate of change, thereby determining the coding strategy corresponding to each coding region.
[0065] In the embodiments of this disclosure, the encoding strategy corresponding to at least one encoding region is determined based on the rate of change. This can be achieved by pre-setting the correspondence between business scenarios and encoding strategies, and determining the corresponding encoding strategy based on the business scenario determined by the rate of change.
[0066] In the embodiments of this disclosure, determining at least one encoding region based on the rate of change can achieve the goal of separately encoding regions with different rates of change in multiple initial regions, and achieving the purpose of not encoding the entire screen.
[0067] In the embodiments of this disclosure, determining at least one encoding region and the encoding strategy corresponding to each encoding region based on the rate of change can enable the use of differentiated encoding methods for different encoding regions. While ensuring image quality, this avoids the resource consumption caused by using a uniform encoding method for all encoding regions, thereby further improving encoding efficiency.
[0068] In the above embodiments, by determining the coded region, the non-coded region, and the coded region based on the rate of change, the coding efficiency can be improved, the coding computation requirements can be reduced, the network bandwidth requirements can be reduced, and the transmission volume can be reduced.
[0069] In the embodiments of this disclosure, in step 103 above, using the encoding strategy corresponding to each encoding region to perform video encoding on each encoding region can be achieved by adjusting the encoder parameters according to the encoding strategy to encode the corresponding encoding region and obtain the encoded data corresponding to the encoding region in each sampled frame of the original video.
[0070] In the embodiments of this disclosure, the target data includes coded data corresponding to at least one coded region and coded data corresponding to at least one non-coded region in each sampled frame, wherein the coded data corresponding to the non-coded region is coded data obtained by applying a fixed coding strategy to the non-coded region or by not performing coding processing.
[0071] In the embodiments of this disclosure, the encoded data obtained by encoding the encoded region is encapsulated with the information of the corresponding encoded region, and the encoded data corresponding to the non-encoded region is encapsulated with the information of the corresponding non-encoded region to obtain the target data.
[0072] In summary, the video encoding method proposed in this disclosure divides each frame of the original video into multiple initial regions and determines the rate of change for each initial region. Based on the rate of change, the encoded and non-encoded regions in each frame are determined. Based on the rate of change of the encoded regions, a corresponding encoding strategy is determined to encode the encoded regions and obtain the target data. By determining the regions to be encoded based on the rate of change, the entire video frame is not encoded. Simultaneously, determining the encoding strategy based on the rate of change enables differentiated encoding, reducing computational requirements and transmission volume, improving encoding efficiency, and reducing network bandwidth requirements.
[0073] Based on the embodiment shown in FIG1, FIG2 illustrates a flowchart of determining multiple initial regions according to an embodiment of the present disclosure. FIG2 provides an exemplary definition of step 101 based on the embodiment shown in FIG1. As shown in FIG2, step 101 may include the following steps:
[0074] Step 201: According to the initial parameters, the first frame of the original video is initially divided to obtain multiple first regions;
[0075] Step 202: Based on the content features of multiple first regions, the multiple first regions are re-divided to determine multiple initial regions in the first frame;
[0076] Step 203: Add identification information to multiple initial areas.
[0077] In the embodiments of this disclosure, the initial parameters can be preset initialization region division parameters, and the first frame is initialized and divided into multiple first regions.
[0078] For example, a grid-based partitioning method is used to evenly divide the frame into rectangular regions of fixed size, such as dividing a frame into a 9*9 or 3*3 pixel region.
[0079] In the embodiments of this disclosure, the first frame may be obtained by sampling each frame of the original video at a preset sampling frequency.
[0080] In the embodiments of this disclosure, the initial division of the first frame in the original video can be performed by initially dividing each frame sampled from the original video to obtain multiple first regions in each frame.
[0081] In the above embodiments, each first region is a region of the same size, that is, it is initially divided according to the initial parameters, which facilitates subsequent calculation and processing, and can adapt to images of different resolutions and sizes.
[0082] In embodiments of this disclosure, content features include boundary features and texture features.
[0083] In the embodiments of this disclosure, the multiple first regions are re-divided based on the content features of the multiple first regions. This can be achieved by optimizing and adjusting the multiple first regions in the first frame according to the boundary features and texture features of the first regions to obtain multiple initial regions.
[0084] In the embodiments of this disclosure, the boundary feature corresponds to the discontinuity of gray intensity in the image frame. That is, the boundary feature of the first region is the change of the boundary gray value of the first region, which can be a variety of modes, such as step type, slope type, roof type, narrow peak type, etc.
[0085] In the embodiments of this disclosure, texture features reflect the visual characteristics of homogeneous phenomena in an image frame, embodying the slowly changing or periodically changing surface structure organization and arrangement attributes of an object's surface. Texture features are mainly represented by the grayscale distribution of pixels and their surrounding spatial neighborhoods, i.e., local texture information. Texture features include local sequential repetition, non-random arrangement, global texture information, etc.
[0086] In the embodiments of this disclosure, based on the content features of multiple first regions, the multiple first regions are re-divided to determine the boundaries of high-frequency changing regions in the first frame and obtain multiple initial regions.
[0087] In embodiments of this disclosure, each of the plurality of initial regions may be the same size or different sizes; in other words, the number of pixels in each initial region may be the same or different.
[0088] For example, each sampled frame is divided into rectangular regions of a fixed size. Then, based on the content characteristics, regions with obvious boundaries and different texture features are adjusted to ensure the rationality of the division. For example, for a frame containing a person and a background, the person's face and body need to be divided into smaller regions to capture their changes more accurately.
[0089] For example, a fast image segmentation algorithm can be used to first perform edge detection on the image to determine possible region boundaries; then, by combining features such as color and texture, the initially segmented regions can be optimized and adjusted.
[0090] In embodiments of this disclosure, the identification information includes location information and boundary information.
[0091] In embodiments of this disclosure, adding identification information to multiple initial regions may involve adding the location coordinates and boundary information of each initial region.
[0092] In embodiments of this disclosure, the location information may be the coordinates of the edge of the initial region in the first frame, and the boundary information may be the dividing line or edge between multiple initial regions.
[0093] For example, for the optimized and adjusted regions, the location and boundary information of each region are marked, and identification information is added to each region.
[0094] In the above embodiments, by initially dividing the image of each sampling frame and optimizing and adjusting it according to content characteristics, multiple initial regions in each sampling frame are determined, thereby dividing the image of each sampling frame into multiple separate regions to achieve more accurate capture of changes in each initial region.
[0095] Figure 3 illustrates a flowchart of determining the rate of change of the initial region according to an embodiment of this disclosure. Based on the embodiments shown in Figures 1-2, Figure 3 provides an exemplary definition of step 102 in Figure 1, as shown in Figure 3, including the following steps:
[0096] Step 301: Traverse multiple frames in the original video, and for multiple initial regions, preprocess the pixels in each initial region to obtain the grayscale value of each pixel.
[0097] Step 302: Determine the rate of change for each initial region based on the grayscale value of each pixel.
[0098] In embodiments of this disclosure, preprocessing may involve converting the pixel values of a pixel to grayscale.
[0099] In embodiments of this disclosure, preprocessing may involve using an average value method or a weighted average value method to convert color pixel values into grayscale values.
[0100] In the embodiments of this disclosure, grayscale values are converted for multiple initial regions in each sampled frame to obtain the grayscale value of each pixel in each initial region.
[0101] For example, for each divided region, the pixel values of each region are converted to grayscale values.
[0102] In the embodiments of this disclosure, preprocessing of pixels in each initial region may also include noise reduction, background modeling, and other processing.
[0103] In embodiments of this disclosure, preprocessing further includes checking the integrity and format correctness of each sampled frame.
[0104] For example, two consecutive frames of image data are read from a video stream. The two frames are preprocessed as necessary, such as checking the integrity and format correctness of the frames. Each predefined region is traversed, and for each pixel within the region, its color pixel value is converted to a grayscale value using a grayscale conversion formula.
[0105] In the embodiments of this disclosure, the rate of change of each initial region is determined based on the gray value of each pixel. This can be done by determining the rate of change of each initial region based on the gray value of each pixel in multiple initial regions of each sampled frame.
[0106] In the embodiments of this disclosure, based on the grayscale value of each pixel, multiple initial regions can be calculated in parallel to determine the rate of change of each initial region.
[0107] In the embodiments of this disclosure, based on the pixels of each initial region in multiple sampled frames, the rate of change of each initial region can be determined by comparing the changes in pixels in the same initial region in adjacent sampled frames. In the above embodiments, by preprocessing the initial regions in each frame to improve the accuracy and robustness of the calculation, and by performing parallel calculations on multiple initial regions to obtain the rate of change of each initial region, the computational efficiency is improved and the computational load is reduced.
[0108] Figure 4 illustrates a flowchart for determining the rate of change according to an embodiment of this disclosure. Based on the embodiments shown in Figures 1-3, Figure 4 provides an exemplary definition of step 302 in Figure 3, as shown in Figure 4, including the following steps:
[0109] Step 401: Determine the grayscale value difference of the first pixel in the first initial region of multiple initial regions in adjacent frames;
[0110] Step 402: Determine the average change value of the first initial region based on the grayscale difference and the number of pixels in the first initial region;
[0111] Step 403: Continuously acquire the average change value of adjacent frames in a preset number of groups in the first initial region to obtain the set of average change values in the first initial region.
[0112] Step 404: Determine the rate of change of the first initial region based on the set of average change values.
[0113] In the embodiments of this disclosure, adjacent frames are two adjacent sampled frames among multiple sampled frames in the original video.
[0114] In the embodiments of this disclosure, the first initial region is any initial region in each sampled frame, and the first pixel is any pixel in an initial region.
[0115] In the embodiments of this disclosure, determining the grayscale value difference of the first pixel in the first initial region of adjacent frames is equivalent to determining the grayscale value difference of the corresponding pixel in the same initial region of adjacent sampled frames.
[0116] For example, for each divided region, its change frequency is calculated by comparing the pixel differences of corresponding regions in adjacent frames.
[0117] For example, for the same region in adjacent frames, grayscale values are compared pixel by pixel, the differences between grayscale values are calculated, and these differences are stored.
[0118] In the embodiments of this disclosure, the grayscale value difference of each pixel in the first initial region of adjacent frames can be zero, indicating that the first initial region is an area without change; or, among the multiple pixels in the first initial region, there are pixels with a grayscale value difference of zero and pixels with a grayscale value difference of non-zero, indicating that the first initial region is an area with change; or, the grayscale value difference of each pixel in the first initial region is not zero, indicating that the first initial region may be an area with relatively large changes.
[0119] In the embodiments of this disclosure, the number of pixels in the first initial region is the total number of pixels in any initial region in each sampling frame. The number of pixels in each initial region may be the same or different.
[0120] In embodiments of this disclosure, the average change value of the first initial region can be determined based on the grayscale difference and the number of pixels in the first initial region.
[0121] In embodiments of this disclosure, determining the average change value of the first initial region can be achieved by summing the absolute values of the grayscale differences of all pixels within the first initial region and dividing by the number of all pixels to obtain the average change value of the first initial region.
[0122] For example, for two adjacent frames, the difference in grayscale values of the corresponding regions is calculated. The larger the absolute value of the difference, the greater the change in the region. The values of these differences are summed and divided by the total number of pixels in the region to obtain the average change value.
[0123] For example, sum the absolute values of all differences within the same region and divide by the total number of pixels to obtain the average change value.
[0124] In the embodiments of this disclosure, the preset quantity group can be a pre-set number of consecutive sampled frames, such as ten consecutive sampled frames or 20 consecutive sampled frames.
[0125] In the embodiments of this disclosure, the adjacent frame images of the preset number group can be adjacent frame images in ten consecutive sampled frame images.
[0126] In the embodiments of this disclosure, continuously obtaining the average change value of adjacent frames in a preset number of groups in the first initial region can be achieved by repeating steps 401 and 402 to determine the average change value of every two adjacent frames in the preset number of groups in the first initial region, thereby obtaining a set of average change values in the first initial region.
[0127] For example, a series of average change values are obtained by repeatedly calculating the average change value over a period of time (e.g., 10 consecutive frames).
[0128] For example, new adjacent frames are continuously acquired, the average change value over a period of time is repeatedly calculated, and the average change value of the corresponding area of multiple sets of adjacent frames is accumulated. For example, the average change value of 10 sets of adjacent frames is calculated continuously to obtain more representative change data.
[0129] In the embodiments of this disclosure, the average change value set of the consecutively acquired adjacent frame images of a preset number of groups within the first initial region may contain values with an average change value of zero and non-zero, or both may be zero, or both may be non-zero.
[0130] In the embodiments of this disclosure, the rate of change of the first initial region is determined based on the set of average change values. This can be done by statistically analyzing multiple average change values of adjacent frames in the first initial region based on a predetermined set of numbers.
[0131] In embodiments of this disclosure, the rate of change of the first initial region is determined based on the set of average change values. This can be achieved by calculating the average value of multiple average change values in the set of average change values.
[0132] In embodiments of this disclosure, the rate of change of the first initial region is determined based on the set of average change values. This can be achieved by calculating the median of multiple average change values in the set of average change values.
[0133] In the embodiments of this disclosure, the rate of change of the first initial region is determined based on the set of average change values. This can be achieved by using other data statistical methods to determine the rate of change of the first initial region, and this disclosure does not limit this method.
[0134] For example, for a series of average change values repeatedly calculated over a period of time, the frequency of change in the region can be determined by statistically analyzing these values to calculate the mean or median.
[0135] For example, by organizing and sorting the obtained series of average change values, the average value of these values can be calculated as the average change frequency of the region, or the median can be calculated to avoid the influence of extreme values on the results. Based on the results of statistical analysis, the final change frequency of the region can be determined.
[0136] In the embodiments of this disclosure, when all values in the set of average change values are zero, the rate of change of the first initial region is zero, indicating that the first initial region is a region without change; when there are zero values and non-zero values in the set of average change values, or when neither is zero, the rate of change of the first initial region is determined by statistical analysis.
[0137] In the embodiments of this disclosure, each sampled frame contains regions with a rate of change of zero and regions with a rate of change of non-zero.
[0138] In the above embodiments, the average change value of each initial region can be determined based on the grayscale value of the pixels in each initial region of each sampled frame. By continuously determining the average change value of multiple adjacent frames in the same initial region, the change rate determined by statistical analysis is more accurate and can accurately reflect the change situation of the region.
[0139] Figure 5 shows a flowchart of the process for determining the encoding region and encoding strategy according to an embodiment of this disclosure. Based on the embodiments shown in Figures 1-4, Figure 5 provides an exemplary definition of step 103 in Figure 1, as shown in Figure 5, including the following steps:
[0140] Step 501: Determine at least one coded region based on the rate of change of each initial region;
[0141] Step 502: Determine the rate of change level for each coded region based on the correspondence table between the rate of change and the rate of change level.
[0142] Step 503: According to preset rules, determine the coding strategy for each coding region based on the rate of change level of each coding region.
[0143] In embodiments of this disclosure, at least one coded region and at least one non-coded region in each sampled frame are determined based on the rate of change of each initial region, which may be based on the rate of change of each initial region in each sampled frame.
[0144] In embodiments of this disclosure, based on the rate of change of each initial region in the first sampled frame determined in FIG4, initial regions with a rate of change of zero are determined as non-coded regions, and initial regions with a rate of change of non-zero are determined as coded regions, thereby determining at least one coded region.
[0145] In the embodiments of this disclosure, the non-coded region may be a region that does not undergo encoding processing, or a region that adopts a fixed encoding strategy, wherein the fixed encoding strategy may be a low encoding rate encoding strategy.
[0146] In embodiments of this disclosure, determining at least one encoded region based on the rate of change of each initial region may involve defining initial regions with a rate of change lower than a preset threshold as non-encoded regions and defining initial regions with a rate of change higher than or equal to the preset threshold as encoded regions. The preset threshold may be a pre-set minimum rate of change that needs to be encoded.
[0147] In the embodiments of this disclosure, the change rate level of each coded region is determined according to the correspondence table between change rate and change rate level, including any one of the following: when the change rate is greater than a first threshold, the change rate level is determined to be high level; when the change rate is greater than a second threshold and less than or equal to the first threshold, the change rate level is determined to be medium level; when the change rate is less than or equal to the second threshold, the change rate level is determined to be low level, and the first threshold is greater than the second threshold.
[0148] In the embodiments of this disclosure, the first threshold and the second threshold are pre-set thresholds for classifying the rate of change levels. That is, the first threshold is used to classify the rate of change at a high level, the second threshold is used to classify the rate of change at a low level, and the rate of change between the first threshold and the second threshold is the rate of change at a medium level.
[0149] In the embodiments of this disclosure, the rate of change level of each coding region can be determined based on the rate of change of each coding region through a correspondence table between the rate of change and the rate of change level.
[0150] For example, the first threshold can be 30fps and the second threshold can be 17fps. When the rate of change of the encoded region is greater than 30fps, the encoded region is of a high level. When the rate of change is greater than 17fps and less than or equal to 30fps, the encoded region is of a medium level. When the rate of change is less than or equal to 17fps, the encoded region is of a low level.
[0151] In the embodiments of this disclosure, the values of the first threshold and the second threshold can be configured according to actual needs, and this disclosure does not limit them.
[0152] In the embodiments of this disclosure, the preset rule may be a pre-set correspondence between the rate of change level and the coding strategy, or it may be a coding strategy for the scenario corresponding to the rate of change level.
[0153] In the embodiments of this disclosure, the encoding strategy for each encoding region is determined by finding the corresponding encoding strategy in preset rules based on the rate of change level of each encoding region.
[0154] In the embodiments of this disclosure, the preset rules can be a high-level encoding strategy corresponding to high bit rate and high precision, a medium-level encoding strategy corresponding to medium bit rate and precision, and a low-level encoding strategy corresponding to low bit rate and low precision. That is, the corresponding encoding strategy is determined according to the three levels of high, medium and low rate of change. For example, the corresponding encoding strategy is that the high level corresponds to the first encoding rate and the first encoding precision, the medium level corresponds to the second encoding rate and the second encoding precision, and the low level corresponds to the third encoding rate and the third encoding precision. The values of the first encoding rate, the second encoding rate and the third encoding rate decrease in sequence, and the values of the first encoding precision, the second encoding precision and the third encoding precision decrease in sequence.
[0155] For example, the appropriate encoding strategy is selected based on the level: For regions marked as high-level (high region of interest), it means that the content in these regions changes frequently and is important, requiring encoding methods that can provide high quality and high detail. This includes using more complex encoding algorithms and allocating more bits to identify pixel information to ensure the detail and smoothness of the image. For example, in video encoding standards such as H.265 / HEVC, advanced encoding modes are enabled to increase prediction accuracy and use more transform modes. For regions marked as medium-level (medium region of interest), a balance needs to be struck between image quality and encoding efficiency. Medium-complexity encoding algorithms are used, and an appropriate amount of bit resources are allocated to ensure a certain level of image quality without excessively increasing the amount of encoded data. For low-level (low region of interest) regions, since their rate of change is low, the impact on image quality is relatively small. Simple and efficient encoding modes can be used to reduce bit allocation, thereby saving encoding resources and reducing the amount of data.
[0156] In the embodiments of this disclosure, for different encoding strategies, the encoding parameters can be preset values, or they can be dynamically adjusted according to actual conditions or encoding requirements to adapt to different types of video images and improve the encoding effect.
[0157] In the above embodiments, differentiated encoding is achieved by adopting different encoding strategies for different encoding regions based on their rate of change. By differentiating the investment of computing resources, more computing resources are invested in high-speed changing scenarios, thereby ensuring smoothness and clarity. This allows for more effective use of encoding resources, reduces unnecessary data redundancy, and improves encoding efficiency. High bitrate encoding is used for regions with high change frequency to ensure image detail and quality, avoiding problems such as blurring or distortion. Under the premise of ensuring image quality, low bitrate encoding for low change frequency regions can reduce the overall bitrate, saving storage space and transmission bandwidth.
[0158] Figure 6 shows a flowchart of the video encoding method proposed in an embodiment of this disclosure. Based on the embodiments shown in Figures 1-5, as shown in Figure 6, the method includes the following steps:
[0159] Step 601: Determine the encoding parameters of the first encoding region according to the encoding strategy of the first encoding region in at least one encoding region;
[0160] Step 602: Determine the parameter values of the encoding parameters based on the encoding parameters of the first encoding region, the rate of change level of the first encoding region, and the encoding requirements.
[0161] In embodiments of this disclosure, the first coding region in at least one coding region can be any coding region in each sampled frame.
[0162] In embodiments of this disclosure, determining the encoding parameters of the first encoding region based on the encoding strategy of the first encoding region in at least one encoding region may be based on the encoding strategy of each encoding region in each sampled frame, thereby determining the encoding parameters of each encoding region.
[0163] In the embodiments of this disclosure, different encoding strategies may require the same or different encoding parameters to be adjusted.
[0164] In embodiments of this disclosure, the encoding parameters may be at least one of quantization parameters, prediction accuracy, and motion vectors, wherein the quantization parameters include frame rate, resolution, encoding format, bit rate, etc.
[0165] For example, after determining the encoding strategy, the specific encoding parameters are adjusted. Based on the encoding strategy corresponding to each encoding region, the encoding parameters that need to be adjusted are determined. The encoding parameters may include quantization parameters, prediction modes, motion vectors, etc.
[0166] In the embodiments of this disclosure, the encoding requirements can be pre-set encoding requirements for different regions, such as requirements for bitrate, image quality, etc.
[0167] In the embodiments of this disclosure, the encoding requirements may further include the following: Balance between image quality and bitrate: Based on specific application requirements, balance image quality and bitrate, minimizing bitrate while ensuring a certain level of image quality to save bandwidth or storage space; Real-time requirements: If encoding is performed in real-time, the impact of parameter adjustments on encoding speed needs to be considered to ensure the encoding process meets real-time requirements; Encoding standards and hardware support: Different encoding standards and hardware may have different support and performance for certain parameters. When adjusting parameters, the characteristics of the encoding standard and hardware used need to be considered; Experimentation and optimization: Adjusting encoding parameters usually requires experimentation and optimization. This can be achieved by conducting encoding tests on different parameter combinations, comparing encoding effects, and selecting better parameter settings.
[0168] In the embodiments of this disclosure, the parameter values of the encoding parameters are determined based on the encoding parameters of the first encoding region, the rate of change level of the first encoding region, and the encoding requirements. This can be based on a corresponding mapping relationship. For high-level encoding regions, the quantization parameter is reduced to improve the prediction accuracy and the accuracy of the motion vector, so as to retain more detailed information. For low-level encoding regions, the quantization parameter is increased to reduce the selection of prediction modes and reduce the accuracy of the motion vector, so as to reduce the amount of encoded data. For medium-level encoding regions, the encoding parameters are balanced between high-level and low-level.
[0169] For example, for each parameter that needs to be adjusted, a suitable parameter value is calculated based on the characteristics of the region (such as change frequency, texture complexity, etc.) and encoding requirements (such as bitrate, image quality, etc.), and the calculated parameter value is applied to the actual encoding process.
[0170] In the above embodiments, by adapting the encoding parameters of each encoding strategy to different encoding strategies based on the rate of change level of the encoding region and the encoding requirements, each encoding strategy can be adapted to the corresponding encoding region to adapt to different types of video images and improve the encoding effect.
[0171] Figure 7 illustrates a flowchart of video encoding of an encoded region according to an embodiment of this disclosure. Based on the embodiments shown in Figures 1-6, Figure 7 provides an exemplary definition of step 104 in Figure 1, as shown in Figure 7, which includes the following steps:
[0172] Step 701: For the second frame in the multi-frame picture, according to the encoding strategy of the second encoding region in at least one encoding region, the second encoding region is encoded to obtain the region data corresponding to the second encoding region.
[0173] Step 702: According to the first rule, determine the sorting value of the region data corresponding to the second encoding region in the second frame;
[0174] Step 703: Add the sorting value, the rate of change level corresponding to the second coding region, and the coding strategy corresponding to the second coding region to the identification information of the second coding region;
[0175] Step 704: Encapsulate the region data of the second encoding region with the corresponding identification information.
[0176] In the embodiments of this disclosure, the second frame is any one of the multiple sampled frames in the original video.
[0177] In embodiments of this disclosure, the second encoding region is any encoding region in the second frame.
[0178] In the embodiments of this disclosure, the encoding strategy of the second encoding region may be a preset encoding parameter value, or it may be an encoding strategy after adjusting the encoding parameters according to the method shown in FIG7.
[0179] In the embodiments of this disclosure, encoding the second encoding region according to the encoding strategy of the second encoding region can be performed by encoding each encoding region in each sampled frame according to the corresponding encoding strategy to obtain the region data corresponding to each encoding region.
[0180] In the embodiments of this disclosure, the second encoding region is encoded according to the encoding strategy of the second encoding region. This can be done by setting corresponding parameters in the encoder according to the encoding parameters in the encoding strategy, or by adjusting the encoding parameters using the interface provided by the encoding library to encode the second encoding region.
[0181] In the embodiments of this disclosure, the first rule may be a preset sorting rule, such as sorting according to the position in the screen, wherein the sorting rule may be from the top left corner to the bottom right corner, or according to row priority, or according to column priority.
[0182] In the embodiments of this disclosure, the sorting value of the regional data corresponding to the second encoding region in the second frame can be determined according to the first rule by determining the sorting value of the regional data corresponding to each encoding region in its own frame according to a preset sorting rule.
[0183] In the above embodiments, determining the sorting value of each encoded region in the image helps to process and restore it in the same order during decoding.
[0184] In the embodiments of this disclosure, the sorting value, the rate of change level, and the encoding strategy are added to the identification information of the corresponding encoding region to add identification information to each encoding region. The identification information of each encoding region also includes the location information and boundary information of the region.
[0185] For example, for each region, an identifier is generated that includes detailed information such as its location (e.g., start and end coordinates), size (e.g., width and height), frequency of change level (high, medium, low), and the encoding strategy used. This identifier information is usually in the form of a specific data structure or field so that it can be clearly represented and distinguished in the bitstream.
[0186] In the embodiments of this disclosure, encapsulating the region data of the second encoding region with the corresponding identification information can be achieved by encapsulating at least one encoding region in each frame with the corresponding identification information to generate the final target data.
[0187] In the embodiments of this disclosure, the target data also includes region data of at least one non-coded region and corresponding identification information. The region data of at least one non-coded region can be data that has not been encoded, or data that has been encoded according to a fixed encoding strategy. The identification information includes the location information and boundary information corresponding to the non-coded region, as well as header information, checksum number, version number, etc.
[0188] In the embodiments of this disclosure, the regional data and the corresponding identification information are encapsulated, including combining the regional data and the corresponding identification information, and adding header information, checksum, version number, etc., to ensure the integrity and correctness of the bitstream.
[0189] For example, data and identification information are encapsulated to generate the final bitstream. Using a specific encapsulation format or protocol, the encoded regional data and corresponding identification information are combined together. This encapsulation process can add header information, checksum, version number, etc., to ensure the integrity and correctness of the bitstream. The final generated bitstream can be transmitted over a network or stored in a file for parsing and processing at the decoding end.
[0190] In the above embodiments, based on the encoding strategy corresponding to the encoding region in each sampled frame, encoding processing is performed on each encoding region, which can realize differentiated encoding of video frames, avoid video encoding of the entire frame, reduce the computational requirements of encoding, reduce network bandwidth requirements and transmission volume, and thus improve encoding efficiency.
[0191] Figure 8 is a flowchart of a video decoding method proposed in an embodiment of this disclosure. As shown in Figure 8, it includes the following steps:
[0192] Step 801, Obtain target data;
[0193] Step 802: Decode the target data according to the identification information to obtain the original video.
[0194] In the embodiments of this disclosure, the target data is obtained using the video coding method shown in Figures 1-7. The target data includes region data of at least one coded region and corresponding identification information, and region data of at least one non-coded region and corresponding identification information. The identification information includes at least one of location information, sorting value, boundary information, rate of change level, and coding strategy.
[0195] In embodiments of this disclosure, the identification information also includes header information, verification number, version number, etc.
[0196] In the embodiments of this disclosure, the non-coded region is either a region that has not undergone encoding processing or a region that has undergone encoding processing according to a fixed encoding strategy. Accordingly, the region data of the non-coded region can be pixel data of the non-coded region that has not undergone encoding processing or region data that has undergone encoding processing according to a fixed encoding strategy.
[0197] For example, the encoded bitstream data is obtained from network transmission, a connection is established with the data source, and stable data reading is ensured.
[0198] In the embodiments of this disclosure, decoding the target data based on the identification information may involve parsing the identification information to obtain the location information, sorting value, boundary information, rate of change level, and encoding strategy in the identification information, so as to decode the target data.
[0199] In the embodiments of this disclosure, decoding the target data according to the identification information may involve obtaining the decoding strategy corresponding to the encoding strategy in the identification information, decoding the area data corresponding to the encoding strategy, and combining the decoded area images according to the identification information to obtain multiple frames of the original video.
[0200] In the embodiments of this disclosure, the target data is decoded according to the identification information to obtain the original video. This can be done by decoding the region data of the encoded region according to the decoding strategy corresponding to each encoded region, decoding the region data of the non-encoded region according to the encoding strategy corresponding to the non-encoded region, and combining the decoded pixel data to obtain multiple frames of the original video.
[0201] In the embodiments of this disclosure, decoding the region data of the non-encoded region according to the identification information can be performed by directly obtaining the pixel data of the non-encoded region that has not undergone encoding processing, or by using the corresponding decoding strategy to decode the region data obtained by encoding according to a fixed encoding strategy to obtain the corresponding pixel data.
[0202] In the above embodiments, by parsing the identification information in the target data, the encoding strategy of the encoded region and the encoding strategy of the non-encoded region can be obtained, so as to determine the corresponding decoding strategy, realize the decoding of the region data, and arrange and combine the decoded pixel data according to the identification information to obtain multiple frames of the original video.
[0203] Figure 9 illustrates a flowchart of the decoding process for target data according to an embodiment of this disclosure. Based on the embodiment shown in Figure 8, Figure 9 provides an exemplary definition of step 802 in Figure 8, as shown in Figure 9, including the following steps:
[0204] Step 901: Determine the decoding strategy corresponding to each region of data based on the encoding strategy of each region of data;
[0205] Step 902: Using a decoding strategy, decode the region data corresponding to the decoding strategy to obtain the pixel data corresponding to each region data.
[0206] Step 903: Combine the pixel data corresponding to each region according to the location information and sorting value to obtain the original video.
[0207] In the embodiments of this disclosure, a corresponding decoding strategy is determined based on the encoding strategy in the identification information corresponding to each region data.
[0208] In the embodiments of this disclosure, the decoding strategy corresponding to each region of data is determined according to the encoding strategy of each region of data. This can be done by determining the decoding strategy of each encoded region according to a pre-set correspondence table of encoding strategies and decoding strategies corresponding to three change rate levels: high, medium, and low. The decoding strategy of each non-encoded region is determined according to the encoding strategy of the non-encoded region and the identification information of the non-encoded region.
[0209] In embodiments of this disclosure, for non-encoded regions that have not undergone encoding processing, the decoding strategy may be to not perform decoding processing.
[0210] For example, for empty packets or padding data, the decoder will skip these packets without performing a decoding operation.
[0211] In the embodiments of this disclosure, for non-encoded regions encoded using a fixed encoding strategy, the decoding strategy is the decoding strategy corresponding to the fixed encoding strategy. The fixed encoding strategy and the corresponding decoding strategy represent a pre-defined encoding / decoding strategy mapping relationship for the non-encoded regions.
[0212] In the embodiments of this disclosure, a decoding strategy is used to decode the region data corresponding to the decoding strategy. This can be done by decoding the region data of the corresponding encoded region according to the decoding strategy of each encoded region, and by decoding the region data of the corresponding non-encoded region according to the decoding strategy of each non-encoded region, to obtain the pixel data corresponding to each region data.
[0213] In embodiments of this disclosure, the pixel data also includes pixel data corresponding to non-coded regions that have not undergone encoding processing.
[0214] In the embodiments of this disclosure, the decoding process of the region data corresponding to the decoding strategy can also be performed by referring to pre-set decoding parameters and reference frames, etc., and then decoding the region data according to the decoding strategy to obtain the pixel data corresponding to each region data.
[0215] For example, based on the obtained encoding method, the corresponding decoding algorithm is selected, and the decoding algorithm is used to process the encoded data of each region to restore the original pixel data.
[0216] In the embodiments of this disclosure, the pixel data corresponding to each region data is combined according to the location information and sorting value. This can be done by combining the pixel data of all coded regions and the pixel data of all non-coded regions according to the location information and sorting value of each coded region and the location information of each non-coded region, to obtain multiple frames of the original video.
[0217] For example, based on the location and size information of each region, the decoded images of each region are accurately placed in their respective positions, so that the splicing between each region is seamless and conforms to the layout of the original image, and the combined complete image is output to the real device.
[0218] In the embodiments of this disclosure, the following aspects also need to be considered during the decoding and display process: performance optimization, minimizing the time overhead of decoding and combining images to achieve smooth video playback; error handling, handling possible errors or missing data in the bitstream and taking appropriate error correction or recovery measures; dynamic adjustment, dynamically adjusting the decoding and display strategies according to the playback environment and user operations (such as zooming, pausing, etc.).
[0219] In the above embodiments, based on the information in the acquired target data, the decoding strategy corresponding to each region is parsed and obtained. The region data of each region is decoded using the decoding strategy to obtain the pixel data of each region. All pixel data are arranged and combined according to the position information and sort number to achieve decoding and display. The obtained original video can restore the multi-frame images input by the encoding end.
[0220] Figure 10 is a flowchart of a video encoding / decoding method provided in an embodiment of this disclosure. As shown in Figure 10, the method includes:
[0221] (1) Division of screen areas;
[0222] After the frame is loaded, a grid-based partitioning method is used to evenly divide the image into fixed-size rectangular regions, such as dividing a frame into a 9x9 pixel area. This partitioning method is not only convenient for calculation and processing but also adapts well to images of different resolutions and sizes. During the partitioning process, the content characteristics of the image are considered, and appropriate adjustments are made to areas with obvious boundaries and different texture features to ensure the rationality of the partitioning. For example, for an image containing a person and a background, the person's face and body may need to be partitioned into smaller areas to more accurately capture their changes.
[0223] To achieve efficient region segmentation, a fast image segmentation algorithm is employed. This algorithm first performs edge detection on the image to determine possible region boundaries, and then optimizes and adjusts the initially segmented regions by combining features such as color and texture.
[0224] (2) Calculation of the frequency of change;
[0225] For each segmented region, its change frequency is calculated by comparing the pixel differences of the corresponding region in adjacent frames.
[0226] The specific calculation method is as follows: First, convert the pixel values of each region to grayscale values to simplify the calculation; then, for two adjacent frames, calculate the difference in grayscale values of the corresponding regions. The larger the absolute value of the difference, the greater the change in the region; sum these differences and divide by the total number of pixels in the region to obtain the average change value; repeat the calculation process over a period of time (e.g., 10 consecutive frames) to obtain a series of average change values; finally, perform statistical analysis on the series of average change values to calculate the average or median and determine the change frequency of the region.
[0227] To improve computational efficiency, parallel computing techniques are employed to simultaneously calculate the change frequency of multiple regions. Furthermore, a caching mechanism is used to store pixel information from adjacent frames that have already been calculated, avoiding redundant reading and calculation.
[0228] The process for calculating the frequency of change is as follows:
[0229] 1) Acquire two adjacent frames: Read two consecutive frames of image data from the video stream; perform necessary preprocessing on the acquired frames, such as checking the integrity and format correctness of the frames.
[0230] 2) For each region, convert the pixel value to a grayscale value: Iterate through each divided region; for each pixel within the region, use common grayscale conversion formulas (such as the average method, weighted average method, etc.) to convert the color pixel value to a grayscale value; store the converted grayscale value for subsequent calculations.
[0231] 3) Calculate the difference in grayscale values of corresponding regions in adjacent frames: For the same region in adjacent frames, compare grayscale values pixel by pixel; calculate the difference between grayscale values and store these differences.
[0232] 4) Sum the differences and divide by the total number of pixels to get the average change value: Sum the absolute values of all differences; divide the sum by the total number of pixels in the region to get the average change value; the average change value reflects the average degree of change in the region between the two frames.
[0233] 5) Repeat steps 1) to 4) to calculate the average change value over a period of time: continue to acquire new adjacent frames, repeat the above steps, and accumulate the average change value of the corresponding regions of multiple sets of adjacent frames; for example, calculate the average change value of 10 sets of adjacent frames in succession to obtain more representative change data.
[0234] 6) Perform statistical analysis on the average change values to determine the frequency of change: Organize and sort the series of average change values obtained; calculate the average value of these values as the average frequency of change for the region; or calculate the median to avoid the influence of extreme values on the results; based on the statistical analysis results, determine the final frequency of change level (high, medium, low) for the region.
[0235] (3) Encoding strategy selection (or encoding strategy matching);
[0236] Based on the calculated regional change frequency, a suitable coding strategy is selected. The change frequency is divided into three levels: high, medium, and low, and a corresponding coding strategy is assigned to each level.
[0237] For high frequency-varying regions (regions of high interest), a high bitrate and high-precision encoding method is adopted, such as using advanced coding modes in advanced video coding standards, allocating more bits for encoding to ensure image detail and smoothness; for medium frequency-varying regions (regions of medium interest), a medium bitrate and precision encoding method is adopted to balance image quality and encoding efficiency; for low frequency-varying regions (regions of low interest), a low bitrate and low-precision encoding method is adopted, such as using a simple encoding mode to reduce the amount of data encoded, thereby saving resources.
[0238] The process for selecting an encoding strategy is as follows:
[0239] 1) Obtain the frequency of change of the region: The frequency of change of each region needs to be obtained by using the frequency of change calculation method in step (2);
[0240] 2) Based on the preset threshold, the frequency of change is divided into three levels: high, medium and low. The levels are divided by setting a clear threshold. Areas with a frequency of change greater than a certain higher value are marked as high level, areas with a frequency of change in the middle range are marked as medium level, and areas with a frequency of change less than a certain lower value are marked as low level.
[0241] 3) Select the appropriate coding strategy based on the level:
[0242] Regions marked as high-level indicate that their content changes frequently and is of high importance, requiring encoding methods that provide high quality and detail. More complex encoding algorithms and a greater number of bits allocated to represent pixel information can be used to ensure image detail and smoothness.
[0243] For medium-level areas, a balance needs to be struck between image quality and encoding efficiency. Medium-complexity encoding algorithms should be used, and an appropriate amount of bit resources should be allocated to ensure a certain level of image quality without excessively increasing the amount of encoded data.
[0244] For low-level areas, since their change frequency is low, their impact on image quality is relatively small. A simple and efficient encoding mode can be used to reduce bit allocation, thereby saving encoding resources and reducing data volume.
[0245] (4) Encoding parameter adjustment;
[0246] After determining the encoding strategy, specific encoding parameters are adjusted to achieve the best encoding results. Encoding parameters include quantization parameters, prediction modes, motion vectors, etc.
[0247] For regions encoded with high bitrates, the quantization parameter is reduced to improve prediction accuracy and motion vector accuracy, thus preserving more detailed information. For regions encoded with low bitrates, the quantization parameter is increased to reduce the selection of prediction modes and decrease the accuracy of motion vectors, thereby reducing the amount of data encoded.
[0248] The process for adjusting encoding parameters is as follows:
[0249] 1) Determine the parameters that need to be adjusted according to the encoding strategy: Based on the encoding strategy determined in (4), clarify the encoding parameters that need to be adjusted.
[0250] 2) Calculate appropriate parameter values based on regional characteristics and encoding requirements: For each parameter that needs to be adjusted, calculate appropriate parameter values based on regional characteristics (such as change frequency, texture complexity, etc.) and encoding requirements (such as bitrate, image quality, etc.).
[0251] 3) Applying parameters to the encoding process: Applying the calculated parameter values to the actual encoding process involves setting the corresponding parameters in the encoder or adjusting the parameters using the interface provided by the encoding library.
[0252] When adjusting encoding parameters, multiple factors need to be considered to achieve the best encoding results. The following are additional factors to consider:
[0253] Image quality and bitrate balance: Balance image quality and bitrate according to specific application requirements. While ensuring a certain level of image quality, minimize the bitrate to save bandwidth or storage space.
[0254] Real-time requirements: If the encoding is performed in real time, the impact of parameter adjustments on the encoding speed needs to be considered to ensure that the encoding process can meet the real-time requirements.
[0255] Encoding standards and hardware support: Different encoding standards and hardware may have varying levels of support and performance for certain parameters. When adjusting parameters, the characteristics of the encoding standard and hardware used must be considered.
[0256] Experimentation and optimization: Adjusting encoding parameters usually requires experimentation and optimization. This can be done by conducting encoding tests on different parameter combinations, comparing the encoding effects, and selecting the optimal parameter settings.
[0257] (5) Bitstream generation;
[0258] The encoded region data is combined into a bitstream. Within the bitstream, identification information is added to each region, including its location, size, frequency of change, and encoding strategy. This identification information helps the decoder correctly parse and reconstruct the image.
[0259] The process of generating the bitstream is as follows:
[0260] 1) Arrange the encoded region data in a certain order: Determine a reasonable sorting rule and arrange the encoded region data according to the position of the region in the picture (from the top left corner to the bottom right corner, or according to row priority, column priority, etc.); such sorting helps to process and restore the data in the same order during decoding.
[0261] 2) Add identification information for each region: For each region, generate an identifier containing detailed information such as its location (e.g., start and end coordinates), size (e.g., width and height), frequency of change level (high, medium, low), and the encoding strategy used; this identification information usually exists in the form of a specific data structure or field so that it can be clearly represented and distinguished in the bitstream.
[0262] 3) Encapsulate the data and identification information to generate the final bitstream: Use a specific encapsulation format or protocol to combine the encoded region data and the corresponding identification information together; this encapsulation process may involve adding some header information, checksums, version numbers, etc., to ensure the integrity and correctness of the bitstream; the final generated bitstream can be transmitted over the network or stored in a file for parsing and processing at the decoding end.
[0263] (6) Decoding and display;
[0264] At the decoding end, based on the identification information in the bitstream, the encoded data of different regions is decoded and restored to the original image. First, the identification information in the bitstream is read to determine the attributes and encoding method of each region; then, the region data is decoded according to the corresponding decoding algorithm; finally, the images of each region are combined to display the complete video image.
[0265] The decoding and display process is as follows:
[0266] 1) Read the bitstream:
[0267] Obtain the encoded bitstream data from network transmission; establish a link with the data source to ensure stable data reading.
[0268] 2) Parse the identifier information to obtain the region's attributes and encoding method:
[0269] The read bitstream data is parsed to extract the identification information of each region; key attributes such as the region's location (coordinates), size (width and height), frequency of change, and encoding strategy used are obtained from the identification information.
[0270] 3) Decode the regional data:
[0271] Based on the obtained encoding method, select the corresponding decoding algorithm; use the decoding algorithm to process the encoded data of each region to restore the original pixel data; during the decoding process, some additional decoding parameters and reference frames may need to be considered.
[0272] 4) Combine and display the decoded areas:
[0273] Based on the location and size information of each region, the decoded images of each region are accurately placed in their respective positions; ensuring that the splicing between each region is seamless and conforms to the layout of the original image; and outputting the combined complete image to the display device.
[0274] In the actual decoding and display process, the following aspects also need to be considered:
[0275] Performance optimization: Minimize the time overhead of decoding and combining images to achieve smooth video playback.
[0276] Error handling: Handle any errors or missing data that may exist in the bitstream and take appropriate error correction or recovery measures.
[0277] Dynamic adjustment: Dynamically adjust decoding and display strategies based on playback environment and user operations (such as zooming, pausing, etc.).
[0278] The beneficial effects of the above video coding method are as follows:
[0279] (1) Improve coding efficiency: By dividing the screen into regions and selecting coding strategies based on the frequency of change, coding resources can be utilized more effectively, unnecessary data redundancy can be reduced, and coding efficiency can be improved.
[0280] (2) Ensure image quality: High bit rate encoding is used for areas with high frequency of change to ensure image details and quality and avoid problems such as blurring or distortion.
[0281] (3) High adaptability: It can adapt to different types of video images. When there are complex movements or scene changes in the image, it can automatically adjust the encoding strategy to improve the encoding effect.
[0282] (4) Reduce bit rate: Under the premise of ensuring image quality, the overall bit rate can be reduced by encoding low bit rate regions with low frequency of change, thus saving storage space and transmission bandwidth.
[0283] Figure 11 is a schematic diagram of a video encoding device provided in an embodiment of this disclosure. As shown in Figure 11, this disclosure provides a schematic diagram of a video encoding device 1100.
[0284] In this embodiment of the disclosure, the device 1100 includes: a division module 1101, a first determination module 1102, a second determination module 1103, and an encoding module 1104.
[0285] In this embodiment of the disclosure, the segmentation module 1101 is configured to determine multiple initial regions in each frame of the original video.
[0286] The first determining module 1102 is configured to determine the rate of change of each initial region based on the pixels in multiple initial regions.
[0287] The second determining module 1103 is configured to determine at least one coding region and the coding strategy corresponding to each coding region based on the rate of change.
[0288] The encoding module 1104 is configured to use the encoding strategy corresponding to each encoding region to perform video encoding on each encoding region in order to obtain the target data.
[0289] In some embodiments, the segmentation module 1101 is further configured to: initially segment the first frame in the original video according to initial parameters to obtain multiple first regions; re-segment the multiple first regions based on the content features of the multiple first regions to determine multiple initial regions in the first frame, wherein the content features include boundary features and texture features; and add identification information to the multiple initial regions, wherein the identification information includes location information and boundary information.
[0290] In some embodiments, the first determining module 1102 is further configured to: traverse multiple frames in the original video, preprocess the pixels in each initial region for multiple initial regions to obtain the grayscale value of each pixel; and determine the rate of change of each initial region based on the grayscale value of each pixel.
[0291] In some embodiments, the first determining module 1102 is further configured to: determine the grayscale value difference of a first pixel in a first initial region within a plurality of initial regions of adjacent frames; determine the average change value of the first initial region based on the grayscale value difference and the number of pixels in the first initial region; continuously acquire the average change value of an adjacent frame in the first initial region of a preset number of groups to obtain a set of average change values in the first initial region; and determine the rate of change of the first initial region based on the set of average change values.
[0292] In some embodiments, the second determining module 1103 is further configured to: determine at least one coding region based on the rate of change of each initial region; determine the rate of change level of each coding region based on the correspondence table between rate of change and rate of change level; and determine the coding strategy of each coding region based on the rate of change level of each coding region according to preset rules.
[0293] In some embodiments, the second determining module 1103 is further configured to: determine the change rate level as high when the change rate is greater than the first threshold; determine the change rate level as medium when the change rate is greater than the second threshold and less than or equal to the first threshold; and determine the change rate level as low when the change rate is less than or equal to the second threshold, wherein the first threshold is greater than the second threshold.
[0294] In some embodiments, the second determining module 1103 is further configured to: determine the encoding parameters of the first encoding region according to the encoding strategy of the first encoding region in at least one encoding region; and determine the parameter values of the encoding parameters based on the encoding parameters of the first encoding region, the rate of change level of the first encoding region, and the encoding requirements.
[0295] In some embodiments, the encoding module 1104 is further configured to: for a second frame in a multi-frame image, encode the second encoding region according to the encoding strategy of the second encoding region in at least one encoding region to obtain the region data corresponding to the second encoding region; determine the sorting value of the region data corresponding to the second encoding region in the second frame according to a first rule; add the sorting value, the rate of change level corresponding to the second encoding region, and the encoding strategy corresponding to the second encoding region to the identification information of the second encoding region; and encapsulate the region data of the second encoding region with the corresponding identification information.
[0296] In summary, the video encoding apparatus provided in this embodiment divides multiple frames of the original video into regions, determines the encoding region based on the rate of change, and determines the encoding strategy for each encoding region based on the rate of change, so as to perform differentiated encoding on different encoding regions, thereby achieving the purpose of not encoding the entire picture, thereby reducing the overall bit rate, improving encoding efficiency, and saving storage space and transmission bandwidth while ensuring picture quality.
[0297] In practical applications, the partitioning module 1101, the first determining module 1102, the second determining module 1103, and the encoding module 1104 can be implemented by the processor in the video encoding device 1100.
[0298] Figure 12 is a schematic diagram of a video decoding device provided in an embodiment of this disclosure. As shown in Figure 12, this disclosure provides a schematic diagram of a video decoding device 1200.
[0299] In this embodiment of the disclosure, the device 1200 includes: an acquisition module 1201 and a decoding module 1202.
[0300] The acquisition module 1201 is configured to acquire target data, which is obtained using the video encoding device shown in Figure 11. The target data includes region data of at least one encoded region and corresponding identification information, and region data of at least one non-encoded region and corresponding identification information. The identification information includes at least one of the following: location information, sorting value, boundary information, rate of change level, and encoding strategy.
[0301] The decoding module 1202 is configured to decode the target data based on the identification information to obtain the original video.
[0302] In some embodiments, the decoding module is further configured to: determine a decoding strategy corresponding to each region data according to the encoding strategy of each region data; use the decoding strategy to decode the region data corresponding to the decoding strategy to obtain pixel data corresponding to each region data; and combine the pixel data corresponding to each region data according to the position information and sorting value to obtain the original video.
[0303] In practical applications, the acquisition module 1201 can be implemented by the processor in the video decoding device 1200 in conjunction with the communication interface, and the decoding module 1202 can be implemented by the processor in the video decoding device 1200.
[0304] The methods and apparatus provided in the embodiments of this application have been described above. To implement the functions of the methods provided in the embodiments of this application, the electronic device may include a hardware structure and software modules, and may implement the above functions in the form of a hardware structure, software modules, or a hardware structure plus software modules. One of the above functions may be executed in the form of a hardware structure, software modules, or a hardware structure plus software modules.
[0305] Figure 13 is a block diagram of an electronic device 1300 for implementing the above-described video encoding or video decoding method according to an exemplary embodiment.
[0306] Referring to FIG13, the electronic device 1300 may include a communication interface 1301, capable of interacting with other devices; a processor 1302, connected to the communication interface 1301 to enable interaction with other devices, configured to execute the methods provided by one or more of the above-described technical solutions when running a computer program; and a memory 1303, on which the computer program is stored. For example, the specific processing procedure of the processor 1302 may refer to the video encoding method or video decoding method described in the above embodiments of this disclosure.
[0307] Of course, in practical applications, the various components in electronic device 1300 are coupled together through bus system 1304. It can be understood that bus system 1304 is configured to enable communication between these components. In addition to a data bus, bus system 1304 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus system 1304 in Figure 13.
[0308] The memory 1303 in this embodiment is configured to store various types of data to support the operation of the electronic device 1300. Examples of such data include any computer program used to operate on the electronic device 1300.
[0309] The methods disclosed in the embodiments of this application can be applied to processor 1302, or implemented by processor 1302. Processor 1302 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 1302 or by instructions in the form of software. The processor 1302 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 1302 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 1303. Processor 1302 reads the information in memory 1303 and completes the steps of the aforementioned method in conjunction with its hardware.
[0310] In an exemplary embodiment, the electronic device 1300 may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components, and configured to perform the aforementioned method.
[0311] Embodiments of this disclosure also propose a non-transitory computer-readable storage medium storing computer instructions, wherein when the computer instructions are executed by a computer, they implement the video encoding method or video decoding method described in the above embodiments of this disclosure.
[0312] Embodiments of this disclosure also provide a computer program product, including a computer program that is executed by a processor using the video encoding or video decoding methods described in the above embodiments of this disclosure.
[0313] Embodiments of this disclosure also propose a chip including one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of an electronic device and send signals to the processors, the signals including computer instructions stored in the memory, which, when executed by the processor, cause the electronic device to perform the video encoding or video decoding methods described in the above embodiments of this disclosure.
[0314] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the embodiments of this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this disclosure as detailed in the appended claims.
[0315] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0316] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0317] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processing module, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (control method), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (such as EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0318] It should be understood that various parts of the embodiments of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0319] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0320] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc.
[0321] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A video encoding method, the method comprising: For multiple frames in the original video, determine multiple initial regions in each frame; Based on the pixels in the plurality of initial regions, determine the rate of change of each initial region; Based on the rate of change, at least one coding region and the coding strategy corresponding to each coding region are determined. Using the encoding strategy corresponding to each encoding region, video encoding is performed on each encoding region to obtain the target data.
2. The method of claim 1, wherein, The process of determining multiple initial regions for each frame of a multi-frame image in the original video includes: According to the initial parameters, the first frame of the original video is initially divided to obtain multiple first regions; Based on the content features of the plurality of first regions, the plurality of first regions are re-divided to determine a plurality of initial regions in the first frame. The content features include boundary features and texture features. Identification information is added to the multiple initial regions, including location information and boundary information.
3. The method of claim 1, wherein, Determining the rate of change for each initial region based on the pixels in the plurality of initial regions includes: Traverse multiple frames in the original video, and for each of the multiple initial regions, preprocess the pixels in each initial region to obtain the grayscale value of each pixel; Based on the grayscale value of each pixel, the rate of change of each initial region is determined.
4. The method of claim 3, wherein, Determining the rate of change of each initial region based on the grayscale value of each pixel includes: Determine the grayscale value difference of the first pixel in the first initial region of the plurality of initial regions for adjacent frames; Based on the grayscale difference and the number of pixels in the first initial region, the average change value of the first initial region is determined; The average change value of adjacent frames in the first initial region is continuously acquired by a preset number of groups to obtain a set of average change values in the first initial region. Based on the set of average change values, the rate of change of the first initial region is determined.
5. The method as recited in claim 1, wherein, The step of determining at least one coding region and the coding strategy corresponding to each coding region based on the rate of change includes: The at least one coded region is determined based on the rate of change of each initial region; Based on the correspondence table between the rate of change and the rate of change level, the rate of change level of each coded region is determined; According to preset rules, the encoding strategy for each encoding region is determined based on the rate of change level of each encoding region.
6. The method of claim 5, wherein, The determination of the rate of change level for each coded region based on the correspondence table between the rate of change and the rate of change level includes any one of the following: When the rate of change is greater than the first threshold, the rate of change level is determined to be high level; When the rate of change is greater than the second threshold and less than or equal to the first threshold, the rate of change level is determined to be medium level. When the rate of change is less than or equal to the second threshold, the rate of change level is determined to be a low level, and the first threshold is greater than the second threshold.
7. The method of claim 5, wherein, The method further includes: The encoding parameters of the first encoding region are determined according to the encoding strategy of the first encoding region in the at least one encoding region; The parameter values of the encoding parameters are determined based on the encoding parameters of the first encoding region, the rate of change level of the first encoding region, and the encoding requirements.
8. The method of claim 6 or 7, wherein, The step of using the encoding strategy corresponding to each encoding region to perform video encoding for each encoding region includes: For the second frame in the multi-frame image, the second encoding region is encoded according to the encoding strategy of the second encoding region in at least one encoding region to obtain the region data corresponding to the second encoding region; According to the first rule, determine the sorting value of the region data corresponding to the second encoding region in the second frame; Add the sorting value, the rate of change level corresponding to the second coding region, and the coding strategy corresponding to the second coding region to the identification information of the second coding region; The region data of the second encoded region is encapsulated with the corresponding identification information.
9. A video decoding method, the method comprising: Acquire target data, which is obtained using the video encoding method described in claims 1-8. The target data includes region data of at least one encoded region and corresponding identification information, and region data of at least one non-encoded region and corresponding identification information. The identification information includes at least one of location information, sorting value, boundary information, rate of change level, and encoding strategy. Based on the identification information, the target data is decoded to obtain the original video.
10. The method of claim 9, wherein, The step of decoding the target data based on the identification information to obtain the original video includes: Based on the encoding strategy of each region's data, determine the decoding strategy corresponding to each region's data; Using the decoding strategy, the region data corresponding to the decoding strategy is decoded to obtain the pixel data corresponding to each region data. The pixel data corresponding to each region data is combined according to the location information and the sorting value to obtain the original video.
11. A video encoding apparatus, comprising: The segmentation module is configured to determine multiple initial regions for each frame of the original video. The first determining module is configured to determine the rate of change of each initial region based on the pixels in the plurality of initial regions; The second determining module is configured to determine at least one coding region and the coding strategy corresponding to each coding region based on the change rate. The encoding module is configured to use the encoding strategy corresponding to each encoding region to perform video encoding on each encoding region to obtain target data.
12. A video decoding apparatus, comprising: The acquisition module is configured to acquire target data, which is obtained using the video encoding method as described in any one of claims 1-8. The target data includes region data of at least one encoded region and corresponding identification information, and region data of at least one non-encoded region and corresponding identification information. The identification information includes at least one of location information, sorting value, boundary information, rate of change level, and encoding strategy. The decoding module is configured to decode the target data based on the identification information to obtain the original video.
13. An electronic device, comprising: One or more processors; A storage device communicatively connected to the one or more processors, wherein one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in any one of claims 1 to 8 or any one of claims 9 to 10.
14. A non-transitory computer-readable storage medium storing computer instructions, which, when executed by a computer, implement the method of any one of claims 1 to 8 or 9 to 10.
15. A chip comprising one or more interface circuits and one or more processors; the interface circuits being configured to receive signals from a memory of an electronic device and to send the signals to the processors, the signals including computer instructions stored in the memory, which, when executed by the processors, cause the electronic device to perform the method of any one of claims 1 to 8 or any one of claims 9 to 10.
16. A computer program product comprising a computer program or computer-executable instructions, wherein when executed by a processor, the computer program or computer-executable instructions implement the method of any one of claims 1 to 8 or any one of claims 9 to 10.
Citation Information
Patent Citations
Image encoding and decoding method, system and equipment
CN113115045A
Video processing method and system for virtual desktop and related equipment
CN116233484A
Image coding method, coding device and computer readable storage medium
CN118158426A
Video coding method and device, electronic equipment, chip and medium
CN119299700A
Coding method of screen frame, and electronic device applied with the same
JP2012129712A