Video encoding method and apparatus, video decoding method and apparatus
Patent Information
- Application Number
- CN202310587539.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-05-23
AI Technical Summary
这类方法的计算复杂度非常高,视频压缩所消耗的编码时间较长,编码效率低,对整体性能提升有限
[0017]本申请实施例提供的视频编码方法,利用残差数据的分布特性,将目标图像块对应的第一残差矩阵进行划分,划分为多个第二残差矩阵,并根据多个第二残差矩阵各自的第一特征值,将多个第二残差矩阵分组组合为多个第三残差矩阵,使得每个第三残差矩阵拥有分布较为均匀的残差数据,并基于多个第三残差矩阵、多个第二残差矩阵与多个第三残差矩阵的对应关系,确定目标图像块的第一编码数据,使得第一残差矩阵的划分更加灵活,简化了第一残差矩阵的均匀化处理过程,降低了计算复杂度,提升了编码效率及整体编码性能,此外,还有利于降低数据冗余及图像失真幅度,提高压缩效率。
Smart Images

Figure CN116614624B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and more particularly to a video encoding method and apparatus, and a video decoding method and apparatus. Background Technology
[0002] In video encoding, the distribution of residual data in image blocks is usually uneven. Directly processing such residual data using transformation techniques results in poor processing quality and low encoding efficiency.
[0003] In existing technologies, for unevenly distributed residual data, the optimal topology is typically calculated and encoded by continuously and uniformly dividing the residual data into four equal parts until it is divided into smaller blocks that cannot be further subdivided. This method has very high computational complexity, results in long encoding times for video compression, low encoding efficiency, and limited improvement in overall performance. Summary of the Invention
[0004] To address the aforementioned technical problems, this application is proposed. Embodiments of this application provide a video encoding method and apparatus, and a video decoding method and apparatus.
[0005] In a first aspect, one embodiment of this application provides a video coding method, the method comprising: obtaining a first residual matrix corresponding to a target image block in a video frame; dividing the first residual matrix into a plurality of second residual matrices; determining a first eigenvalue of each of the plurality of second residual matrices based on the elements contained in each of the plurality of second residual matrices; grouping the plurality of second residual matrices according to the first eigenvalues of each of the plurality of second residual matrices to obtain a plurality of third residual matrices with the same number of groups; and determining first coding data of the target image block based on the correspondence between the plurality of third residual matrices, the plurality of second residual matrices and the plurality of third residual matrices.
[0006] In conjunction with the first aspect, in some implementations of the first aspect, the multiple second residual matrices are grouped according to their respective first eigenvalues to obtain multiple third residual matrices with the same number of groups. This includes: sorting the multiple second residual matrices according to the magnitude of their respective first eigenvalues; grouping the sorted multiple second residual matrices into multiple groups; and merging the second residual matrices contained in each of the multiple groups to obtain multiple third residual matrices with the same number of groups.
[0007] In conjunction with the first aspect, in some implementations of the first aspect, determining the first eigenvalue of each of the multiple second residual matrices based on the elements contained in each of the multiple second residual matrices includes: calculating the sum of the absolute values or the sum of the squares of the elements contained in each of the multiple second residual matrices; and determining the first eigenvalue of each of the multiple second residual matrices based on the sum of the absolute values or the sum of the squares of the elements contained in each of the multiple second residual matrices.
[0008] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: grouping multiple third residual matrices to obtain multiple sets, each set including at least one third residual matrix; for each second residual matrix, determining a first judgment result of the second residual matrix based on whether each set contains the second residual matrix; determining a second judgment result of the second residual matrix based on whether the third residual matrix in the set containing the second residual matrix contains the second residual matrix; and determining the correspondence between the multiple second residual matrices and the multiple third residual matrices according to the first judgment result and the second judgment result of each of the multiple second residual matrices.
[0009] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: determining second coded data of the target image block based on the first residual matrix; determining the coding cost of the first coded data and the second coded data respectively; and using the coded data with the lower coding cost from the first coded data and the second coded data as the final coded data of the target image block.
[0010] In conjunction with the first aspect, in some implementations of the first aspect, the encoding cost is determined based on the encoding length of the encoded data and the corresponding distortion data.
[0011] In conjunction with the first aspect, in some implementations of the first aspect, the number of second residual matrices is less than or equal to half of the larger of the number of rows or columns of the first residual matrix.
[0012] Secondly, one embodiment of this application provides a video decoding method, the method comprising: acquiring first encoded data of a target image block in a video frame, wherein the first encoded data is determined based on the video encoding method described in the first aspect; parsing the first encoded data to acquire a plurality of third residual recovery matrices corresponding to the first encoded data, and a correspondence between a plurality of second residual recovery matrices and the plurality of third residual recovery matrices; decomposing the third residual recovery matrices according to the correspondence between the plurality of second residual recovery matrices and the plurality of third residual recovery matrices to determine the first residual recovery matrix corresponding to the target image block in the video frame; and decoding the first encoded data into the target image block based on the first residual recovery matrix.
[0013] Thirdly, one embodiment of this application provides a video encoding apparatus, which includes: an acquisition module for acquiring a first residual matrix corresponding to a target image block in a video frame; a partitioning module for partitioning the first residual matrix into a plurality of second residual matrices; a determination module for determining a first eigenvalue of each of the plurality of second residual matrices based on the elements contained in each of the plurality of second residual matrices; a grouping module for grouping the plurality of second residual matrices according to the first eigenvalues of each of the plurality of second residual matrices to obtain a plurality of third residual matrices with the same number of groups; and an encoding module for determining first encoded data of the target image block based on the correspondence between the plurality of third residual matrices, the plurality of second residual matrices, and the plurality of third residual matrices.
[0014] Fourthly, one embodiment of this application provides a video decoding apparatus, the apparatus comprising: an acquisition module, configured to acquire first encoded data of a target image block in a video frame, wherein the first encoded data is determined by the video encoding method described in the first aspect; a parsing module, configured to parse the first encoded data to acquire a plurality of third residual recovery matrices corresponding to the first encoded data, and a correspondence between a plurality of second residual recovery matrices and the plurality of third residual recovery matrices; a determination module, configured to decompose the third residual recovery matrix according to the correspondence between the plurality of second residual recovery matrices and the plurality of third residual recovery matrices to determine the first residual recovery matrix corresponding to the target image block in the video frame; and a decoding module, configured to decode the first encoded data into the target image block based on the first residual recovery matrix.
[0015] Fifthly, one embodiment of this application provides an electronic device, the device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the video encoding method of the first aspect and / or the video decoding method of the second aspect by executing the executable instructions.
[0016] In a sixth aspect, one embodiment of this application provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the video encoding method described in the first aspect and / or the video decoding method described in the second aspect.
[0017] The video coding method provided in this application utilizes the distribution characteristics of residual data to divide the first residual matrix corresponding to the target image block into multiple second residual matrices. Based on the first eigenvalues of each of the multiple second residual matrices, the multiple second residual matrices are grouped and combined into multiple third residual matrices, so that each third residual matrix has relatively uniformly distributed residual data. Based on the correspondence between the multiple third residual matrices, the multiple second residual matrices, and the multiple third residual matrices, the first coding data of the target image block is determined. This makes the division of the first residual matrix more flexible, simplifies the uniformization process of the first residual matrix, reduces computational complexity, improves coding efficiency and overall coding performance, and also helps to reduce data redundancy and image distortion, thereby improving compression efficiency. Attached Figure Description
[0018] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0019] Figure 1 The diagram shown is a visualization of the three-dimensional distribution of residual data in the residual matrix provided in an embodiment of this application.
[0020] Figure 2 The diagram shown is a flowchart of a video encoding method provided in an embodiment of this application.
[0021] Figure 3 The diagram shown is a flowchart illustrating how a plurality of second residual matrices are grouped to obtain a plurality of third residual matrices with the same number of groups, according to an embodiment of this application.
[0022] Figure 4 The diagram shown is a flowchart for determining the first eigenvalues of each of a plurality of second residual matrices according to an embodiment of this application.
[0023] Figure 5 The diagram shown is a flowchart of a video encoding method provided in another embodiment of this application.
[0024] Figure 6 The diagram shown is a flowchart of a video encoding method provided in another embodiment of this application.
[0025] Figure 7 The diagram shown is a flowchart of a video decoding method provided in an embodiment of this application.
[0026] Figure 8The diagram shown is a structural schematic of a video encoding device provided in an embodiment of this application.
[0027] Figure 9 The diagram shown is a structural schematic of a video decoding device provided in an embodiment of this application.
[0028] Figure 10 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. Detailed Implementation
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] In video coding, the distribution of residual data in image blocks is usually non-uniform. Directly processing such residual data using techniques such as transformation and / or quantization results in poor processing quality and low coding efficiency.
[0031] In existing technologies, for unevenly distributed residual data, the optimal topology is typically calculated and encoded by continuously and uniformly dividing the residual data into four equal parts until it is divided into smaller blocks that cannot be further subdivided. This method has very high computational complexity, results in long encoding times for video compression, low encoding efficiency, and limited improvement in overall performance.
[0032] Figure 1 The diagram shown is a visualization of the three-dimensional distribution of residual data in a residual matrix provided in an embodiment of this application. Figure 1 As shown, the residual data is clearly not uniformly distributed and varies greatly. However, the residual data exhibits a certain correlation; that is, if the residual data of a certain pixel is large, its neighboring pixels are also highly likely to have large residuals. This application provides a video coding method that utilizes this distribution characteristic of residual data to process the residual matrix, more efficiently organizing regions with similar residual data together, thereby improving coding efficiency and overall coding performance.
[0033] Figure 2 The diagram shown is a flowchart illustrating a video encoding method provided in an embodiment of this application. Figure 2 As shown in the embodiments of this application, the video encoding method includes the following steps.
[0034] Step 10: Obtain the first residual matrix corresponding to the target image block in the video frame.
[0035] Specifically, the target image block is any image block after image segmentation during video encoding. The first residual matrix contains the residual data corresponding to the target image block.
[0036] Step 20: Divide the first residual matrix into multiple second residual matrices.
[0037] For example, the 32×32 first residual matrix can be divided into 32 32×1 second residual matrices, or into 16 8×8 second residual matrices, or into 8 8×16 second residual matrices, with flexible partitioning methods. The number of rows, columns, and quantities of the second residual matrix can be set according to actual conditions, and this embodiment does not impose specific limitations on this. In some embodiments, the number of rows and columns of the second residual matrix is a positive integer power of 1 or 2.
[0038] In some embodiments, to support second residual matrices with multiple numbers of rows and columns, corresponding bytes are added to the current encoding to indicate the number of rows and columns of the second residual matrix used when partitioning the first residual matrix. This allows for more flexible partitioning of the first residual matrix, enabling better differentiation of regions with different overall characteristics.
[0039] Step 30: Determine the first eigenvalue of each of the multiple second residual matrices based on the elements contained in each of the multiple second residual matrices.
[0040] Specifically, the first eigenvalue of each second residual matrix is obtained based on the elements contained in each second residual matrix itself, and is used to characterize the overall characteristics of the residual data of its corresponding second residual matrix. The first eigenvalue can be any value that can reflect the overall characteristics of the residual data of the corresponding second residual matrix, and can be set according to the actual situation. This embodiment does not impose any specific limitations.
[0041] Step 40: Based on the first eigenvalues of each of the multiple second residual matrices, group the multiple second residual matrices to obtain multiple third residual matrices with the same number of groups.
[0042] For example, there are 32 second residual matrices, and the first eigenvalues of each of the 32 second residual matrices are obtained. Second residual matrices with similar first eigenvalues are grouped together. For example, the second residual matrices are divided into 8 groups, resulting in 8 third residual matrices, each containing 4 second residual matrices. The grouping method and the number of groups can be set according to actual conditions, and this embodiment does not impose specific limitations on them. In some embodiments, the number of second residual matrices in each group is the same. In some embodiments, the number of rows and columns of the third residual matrix is equal, or the ratio of its number of rows to columns is the same as the ratio of the number of rows to columns of the second residual matrix.
[0043] Step 50: Based on the correspondence between multiple third residual matrices, multiple second residual matrices and multiple third residual matrices, determine the first encoded data of the target image block.
[0044] Specifically, the correspondence between the multiple second residual matrices and the multiple third residual matrices refers to which third residual matrix each second residual matrix is assigned to. For example, combining the previous example, based on the obtained 8 third residual matrices and the correspondence between the 32 second residual matrices and which of the 8 third residual matrices each second residual matrix is assigned to, the first encoded data of the target image patch is determined.
[0045] The technical solution in this application utilizes the distribution characteristics of residual data to divide the first residual matrix corresponding to the target image block into multiple second residual matrices. Based on the first eigenvalues of each of the multiple second residual matrices, the multiple second residual matrices are grouped and combined into multiple third residual matrices, so that each third residual matrix has relatively uniformly distributed residual data. On this basis, video encoding is performed to determine the first encoded data. This allows for more flexible division of the first residual matrix, simplifies the uniformization process of the first residual matrix, reduces computational complexity, improves encoding efficiency and overall encoding performance, and helps reduce data redundancy and image distortion, thereby improving compression efficiency.
[0046] Figure 3 The diagram shown is a schematic representation of a process according to an embodiment of this application, which involves grouping multiple second residual matrices to obtain multiple third residual matrices with the same number of groups. Figure 2 Extending from the illustrated embodiment Figure 3 The illustrated embodiment will be described in detail below. Figure 3 The illustrated embodiments and Figure 2 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.
[0047] like Figure 3 As shown, based on the first eigenvalues of each of the multiple second residual matrices, the multiple second residual matrices are grouped to obtain multiple third residual matrices with the same number of groups, including the following steps.
[0048] Step 401: Sort the multiple second residual matrices according to the magnitude of their respective first eigenvalues.
[0049] Step 402: Group the sorted second residual matrices into multiple groups.
[0050] Step 403: Merge the second residual matrices contained in each of the multiple groups to obtain multiple third residual matrices with the same number of groups.
[0051] Specifically, multiple second residual matrices within each group are merged to obtain a third residual matrix corresponding to each group. Within the third residual matrix, the elements of each second residual matrix are still arranged according to their original relative positions. For example, one group contains two 4×4 second residual matrices: matrix Then, one form of the third residual matrix corresponding to this group is: During fusion, the specific position and order of the second residual matrix can be set according to actual needs, and this embodiment does not impose specific limitations.
[0052] In some embodiments, the number of second residual matrices is 16. After obtaining the first eigenvalues corresponding to each of the 16 second residual matrices, the 16 residual matrices are sorted according to the ascending order of the 16 first eigenvalues, that is, the 16 second residual matrices are sorted according to the overall characteristics of the residual data they contain. The sorted 16 second residual matrices are then grouped. For example, after division, four groups are obtained, and each group contains four second residual matrices with similar overall residual data characteristics. The four second residual matrices from each of the four groups are then merged to obtain four third residual matrices.
[0053] By utilizing the magnitude of the first eigenvalue, multiple second residual matrices are sorted, grouped, and fused, effectively combining second residual matrices with similar overall residual data characteristics. This results in a relatively smooth distribution of residual data in each third residual matrix, facilitating subsequent technical processing such as transformation, quantization, and entropy coding, thereby improving the technical processing effect and coding efficiency.
[0054] Figure 4 The diagram shown is a flowchart illustrating the determination of the first eigenvalues of each of a plurality of second residual matrices according to an embodiment of this application. Figure 2 Extending from the illustrated embodiment Figure 4 The illustrated embodiment will be described in detail below. Figure 4 The illustrated embodiments and Figure 2 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.
[0055] like Figure 4 As shown, the first eigenvalue of each of the multiple second residual matrices is determined based on the elements contained in each of the multiple second residual matrices, including the following steps.
[0056] Step 301: Calculate the sum of the absolute values or the sum of the squares of the elements contained in each of the multiple second residual matrices.
[0057] For example, the second residual matrix The sum of the above is |c11 |+|c 12 |+|c 21 |+|c 22 |, or for
[0058] Step 302: Determine the first eigenvalue of each of the multiple second residual matrices based on the sum of the absolute values or the sum of the squares of the elements contained in each of the multiple second residual matrices.
[0059] For example, in conjunction with the above example, the first eigenvalue of the second residual matrix C is based on |c 11 |+|c 12 |+|c 21 |+|c 22 |or for It is determined that the first characteristic value can be the sum of the aforementioned values, or it can be another value obtained by performing other operations on the sum of the aforementioned values.
[0060] Through the technical solution of this embodiment, for each second residual matrix, its corresponding first eigenvalue is determined based on the sum of the absolute values or the sum of the squares of its respective elements, which can well reflect the overall characteristics of the residual data of each second residual matrix. For example, for a certain second residual matrix, if its first eigenvalue is the largest among all first eigenvalues, it can be determined that the residual data of this second residual matrix is generally larger than that of other second residual matrices.
[0061] Figure 5 The diagram shown is a flowchart illustrating a video encoding method provided in another embodiment of this application. Figure 2 Extending from the illustrated embodiment Figure 5 The illustrated embodiment will be described in detail below. Figure 5 The illustrated embodiments and Figure 2 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.
[0062] like Figure 5 As shown, before determining the first encoded data of the target image block, the following steps are also included.
[0063] Step 42: Group the multiple third residual matrices to obtain multiple sets, each set including at least one third residual matrix.
[0064] The grouping method of multiple third residual matrices and the number of sets obtained by grouping can be set according to actual needs, and this embodiment does not impose specific limitations.
[0065] Step 44: For each second residual matrix, determine the first judgment result of the second residual matrix based on whether each set contains the second residual matrix.
[0066] Specifically, the first judgment result indicates whether a certain second residual matrix is contained in a set consisting of at least one third residual matrix. The specific representation of the first judgment result can be set according to the actual situation, and this embodiment does not impose a specific limitation. For example, for the second residual matrix D, if it belongs to set0, its corresponding first judgment result is "yes", represented by one bit "1". If it is not contained in set0, it means that the second residual matrix D is contained in other sets, and its corresponding first judgment result is "no", represented by one bit "0".
[0067] Step 46: Determine the second judgment result of the second residual matrix based on whether the third residual matrix in the set containing the second residual matrix contains the second residual matrix.
[0068] Specifically, the second judgment result indicates whether a second residual matrix contained in a certain set is contained in a third residual matrix in this set. The specific representation of the second judgment result can be set according to the actual situation, and this embodiment does not impose a specific limitation. For example, in conjunction with the above example, if the second residual matrix D is contained in set0, and set0 contains third residual matrices E and F, then it is necessary to further determine whether it is contained in the third residual matrix E in set0. When the second residual matrix D is contained in the third residual matrix E, the second judgment result is "yes", which can be represented by one bit "1". When the second residual matrix D is not contained in the third residual matrix E, it means that the second residual matrix D contains the third residual matrix F, and the second judgment result is "no", which can be represented by one bit "0".
[0069] Step 48: Determine the correspondence between the multiple second residual matrices and the multiple third residual matrices based on the first and second judgment results of each of the multiple second residual matrices.
[0070] By first determining which set of third residual matrices each second residual matrix is contained in, and then determining which third residual matrix it is contained in within that set, the correspondence between multiple second residual matrices and multiple third residual matrices in the first residual matrix can be obtained. The technical solution in this embodiment does not require iteratively determining which third residual matrix each second residual matrix is contained in, thus representing the correspondence between multiple second residual matrices and multiple third residual matrices with fewer bytes, improving encoding efficiency.
[0071] Figure 6 The diagram shown is a flowchart illustrating a video encoding method according to another embodiment of this application. Figure 2 Extending from the illustrated embodiment Figure 6 The illustrated embodiment will be described in detail below. Figure 6 The illustrated embodiments and Figure 2 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.
[0072] like Figure 6 As shown, the video encoding method provided in this embodiment also includes the following steps.
[0073] Step 60: Determine the second encoded data of the target image block based on the first residual matrix.
[0074] Specifically, the first residual matrix of the same target image block is processed using a different method than the one used to process the first residual matrix corresponding to the first encoded data to obtain the second encoded data. When obtaining the second encoded data, the method for processing the first residual matrix can be set according to the actual situation, and this embodiment does not impose specific limitations. For example, the method for processing the first residual matrix corresponding to the second encoded data is to not divide the first residual matrix and directly perform transformations or other processing on the first residual matrix to determine the second encoded data.
[0075] Step 70: Determine the encoding costs of the first and second encoded data respectively.
[0076] Encoding cost is the criterion for determining which of the two encoded data is better, and it can be set according to the actual situation. This embodiment does not impose a specific limitation. For example, encoding cost is the encoding length of the encoded data.
[0077] Step 80: Use the coding data with lower coding cost from the first coding data and the second coding data as the final coding data for the target image block.
[0078] Due to the possibility of a relatively uniform distribution of residual data in the first residual matrix or other special circumstances, the first residual matrix may be more suitable for processing using other methods. This embodiment evaluates video coding methods, using coding cost as the evaluation criterion. Selecting coding data with lower coding cost as the final coding data is beneficial for improving coding efficiency and overall coding performance.
[0079] In some embodiments, one byte is used to indicate whether the final encoded data is first encoded data or second encoded data.
[0080] In some embodiments, the encoding cost is determined based on the encoding length of the encoded data and the corresponding distortion data. The distortion data can be determined by simulating decoding of the encoded data, and this embodiment does not specifically limit this. Determining the encoding cost based on the encoding length and distortion data allows for a more comprehensive performance evaluation of the encoding method. For example, the encoding cost is the sum of the product of the weighting coefficient and the distortion data and the encoding length. The weighting coefficient can be set according to actual conditions, and this embodiment does not specifically limit it.
[0081] In some embodiments, the number of second residual matrices is less than or equal to half the larger of the number of rows or columns of the first residual matrix.
[0082] Since the first encoded data is determined based on the correspondence between multiple second residual matrices and multiple third residual matrices, an excessive number of second residual matrices, while improving the compression effect of subsequent processing of the first residual matrix, also reduces the compression effect of the correspondence information because the correspondence also needs to be stored in the encoded data. Therefore, it is necessary to appropriately select the number of second residual matrices obtained by dividing the first residual matrix. When the number of second residual matrices is less than or equal to half of the larger value of the number of rows or columns of the first residual matrix, a better balance can be achieved between the compression effect of subsequent processing of the first residual matrix and the compression effect of the correspondence information.
[0083] For example, if the first residual matrix is an M×N matrix, where M≥N, then the number of the second residual matrices is less than or equal to...
[0084] Figure 7 The diagram shown is a flowchart illustrating a video decoding method provided in an embodiment of this application. Figure 7 As shown in the embodiments of this application, the video decoding method includes the following steps.
[0085] Step 71: Obtain the first encoded data of the target image block in the video frame.
[0086] The first encoded data is determined based on the video encoding method described above. In some embodiments, step 71 further includes parsing the encoded data of the target image block to determine that this encoded data is the first encoded data.
[0087] Step 72: Parse the first encoded data to obtain multiple third residual recovery matrices corresponding to the first encoded data, as well as the correspondence between multiple second residual recovery matrices and multiple third residual recovery matrices.
[0088] The residual data in the third and second residual recovery matrices are the recovered data of the original residual data at the encoding end. They may be the same as or different from the original residual data. For example, after the encoding end transforms and quantizes the third residual matrix, the corresponding residual data obtained at the decoding end is different from the original residual data in the third residual matrix.
[0089] Step 73: Based on the correspondence between the multiple second residual recovery matrices and the multiple third residual recovery matrices, decompose the third residual recovery matrix to determine the first residual recovery matrix corresponding to the target image block in the video frame.
[0090] Specifically, based on the correspondence between multiple second residual recovery matrices and multiple third residual recovery matrices, the residual data in the third residual recovery matrix can be filled into the corresponding positions of the second residual recovery matrix in the first residual matrix, thereby completing the decomposition of the third residual recovery matrix and restoring it to obtain the first residual recovery matrix.
[0091] Step 74: Based on the first residual recovery matrix, decode the first encoded data into the target image block.
[0092] The solution provided in this embodiment decodes the first encoded data determined based on the video encoding method described above, which can restore the residual data in the third residual recovery matrix and determine the first residual recovery matrix corresponding to the target image block in the video frame. This helps to reduce the magnitude of image distortion and obtain higher image quality.
[0093] The above text combined Figures 2 to 6 The embodiments of the video encoding method of this application are described in detail below, in conjunction with... Figure 8 This application describes in detail embodiments of the video encoding apparatus. It should be understood that the descriptions of the video encoding method embodiments correspond to the descriptions of the video encoding apparatus embodiments; therefore, any parts not described in detail can be found in the preceding method embodiments.
[0094] Figure 8 The diagram shown is a structural schematic of a video encoding apparatus provided in an embodiment of this application. Figure 8 As shown, the video encoding apparatus provided in this application embodiment includes:
[0095] The acquisition module 81 is used to acquire the first residual matrix corresponding to the target image block in the video frame;
[0096] The partitioning module 82 is used to partition the first residual matrix into multiple second residual matrices;
[0097] The determination module 83 is used to determine the first eigenvalue of each of the multiple second residual matrices based on the elements contained in each of the multiple second residual matrices;
[0098] Grouping module 84 is used to group multiple second residual matrices according to their respective first eigenvalues to obtain multiple third residual matrices with the same number of groups.
[0099] The encoding module 85 is used to determine the first encoded data of the target image block based on the correspondence between multiple third residual matrices, multiple second residual matrices and multiple third residual matrices.
[0100] In one embodiment of this application, the determining module 84 can also be used to obtain the correspondence between multiple second residual matrices and multiple third residual matrices.
[0101] The above text combined Figure 7 The embodiments of the video decoding method of this application are described in detail below, in conjunction with... Figure 9 This application describes in detail embodiments of the video decoding apparatus. It should be understood that the descriptions of the video decoding method embodiments correspond to the descriptions of the video decoding apparatus embodiments; therefore, any parts not described in detail can be found in the preceding method embodiments.
[0102] Figure 9 The diagram shown is a structural schematic of a video decoding device provided in an embodiment of this application. Figure 9 As shown, the video decoding device provided in this application embodiment includes:
[0103] The acquisition module 91 is used to acquire the first encoded data of the target image block in the video frame, wherein the first encoded data is determined based on the video encoding method described above;
[0104] The parsing module 92 is used to parse the first encoded data and obtain multiple third residual recovery matrices corresponding to the first encoded data, as well as the correspondence between multiple second residual recovery matrices and multiple third residual recovery matrices;
[0105] The determination module 93 is used to decompose the third residual recovery matrix according to the correspondence between the multiple second residual recovery matrices and the multiple third residual recovery matrices, and determine the first residual recovery matrix corresponding to the target image block in the video frame;
[0106] The decoding module 94 is used to decode the first encoded data into a target image block based on the first residual recovery matrix.
[0107] In some embodiments, the acquisition module 91 is further configured to determine whether the acquired encoded data is first encoded data or second encoded data.
[0108] Below, for reference Figure 10 This describes an electronic device according to embodiments of the present application. Figure 10 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application.
[0109] like Figure 10 As shown, the electronic device 1000 includes one or more processors 1001 and memory 1002.
[0110] The processor 1001 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 1000 to perform desired functions.
[0111] The memory 1002 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 1001 may execute the program instructions to implement the video encoding and / or video decoding methods and / or other desired functions of the various embodiments of this application described above. The computer-readable storage medium may also store various contents such as target image blocks, first feature values, first residual matrix, second residual matrix, third residual matrix, first residual recovery matrix, second residual recovery matrix, and third residual recovery matrix.
[0112] In one example, the electronic device 1000 may also include an input device 1003 and an output device 1004, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0113] The input device 1003 may include, for example, a keyboard, a mouse, etc.
[0114] The output device 1004 can output various information to the outside, including target image blocks, first feature values, first residual matrix, second residual matrix, third residual matrix, first residual recovery matrix, second residual recovery matrix, third residual recovery matrix, etc. The output device 1004 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0115] Of course, for the sake of simplicity, Figure 10 Only some of the components of the electronic device 1000 relevant to this application are shown in this illustration; components such as buses, input / output interfaces, etc., are omitted. In addition, the electronic device 1000 may include any other suitable components depending on the specific application.
[0116] In addition to the methods and devices described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the video encoding and / or video decoding methods according to the various embodiments of this application described above.
[0117] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0118] Furthermore, embodiments of this application may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the video encoding and / or video decoding methods according to the various embodiments of this application described above.
[0119] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0120] The basic principles of this application have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this application are merely examples and not limitations, and should not be considered as essential features of each embodiment of this application. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the application to the necessity of employing the aforementioned specific details for implementation.
[0121] The basic principles of this application have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this application are merely examples and not limitations, and should not be considered as essential features of each embodiment of this application. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the application to the necessity of employing the aforementioned specific details for implementation.
[0122] The block diagrams of devices, apparatuses, devices, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0123] It should also be noted that in the apparatus, equipment, and methods of this application, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions of this application.
[0124] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this application. Therefore, this application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0125] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this application to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A video encoding method, characterized in that, include: Obtain the first residual matrix corresponding to the target image block in the video frame; The first residual matrix is divided into multiple second residual matrices; Based on the elements contained in each of the plurality of second residual matrices, determine the first eigenvalue of each of the plurality of second residual matrices; The plurality of second residual matrices are sorted according to the magnitude of their respective first eigenvalues; The sorted second residual matrices are grouped to obtain multiple groups; The second residual matrices contained in each of the multiple groups are merged to obtain multiple third residual matrices with the same number of groups; Based on the correspondence between the plurality of third residual matrices, the plurality of second residual matrices and the plurality of third residual matrices, the first encoded data of the target image block is determined.
2. The video encoding method according to claim 1, characterized in that, The step of determining the first eigenvalue of each of the plurality of second residual matrices based on the elements contained in each of the plurality of second residual matrices includes: Calculate the sum of the absolute values or the sum of the squares of the elements contained in each of the plurality of second residual matrices; The first eigenvalue of each of the plurality of second residual matrices is determined based on the sum of the absolute values or the sum of the squares of the elements contained in each of the plurality of second residual matrices.
3. The video encoding method according to claim 1, characterized in that, Also includes: The plurality of third residual matrices are grouped to obtain a plurality of sets, each set including at least one third residual matrix; For each of the second residual matrices, a first judgment result for the second residual matrix is determined based on whether each set contains the second residual matrix; The second judgment result of the second residual matrix is determined based on whether the third residual matrix in the set containing the second residual matrix contains the second residual matrix; Based on the first and second judgment results of each of the plurality of second residual matrices, the correspondence between the plurality of second residual matrices and the plurality of third residual matrices is determined.
4. The video encoding method according to claim 1, characterized in that, Also includes: Based on the first residual matrix, the second encoded data of the target image block is determined; Determine the encoding cost of the first encoded data and the second encoded data respectively; The coded data with lower encoding cost between the first and second encoded data is used as the final encoded data for the target image block.
5. The video encoding method according to claim 4, characterized in that, The encoding cost is determined based on the encoding length of the encoded data and the corresponding distortion data.
6. The video encoding method according to claim 1, characterized in that, The number of the second residual matrix is less than or equal to half the larger of the number of rows or columns of the first residual matrix.
7. A video decoding method, characterized in that, include: Obtain first encoded data of a target image block in a video frame, wherein the first encoded data is determined based on the video encoding method according to any one of claims 1-6; The first encoded data is parsed to obtain multiple third residual recovery matrices corresponding to the first encoded data, as well as the correspondence between multiple second residual recovery matrices and the multiple third residual recovery matrices; Based on the correspondence between the plurality of second residual recovery matrices and the plurality of third residual recovery matrices, the third residual recovery matrix is decomposed to determine the first residual recovery matrix corresponding to the target image block in the video frame; Based on the first residual recovery matrix, the first encoded data is decoded into the target image block.
8. A video encoding device, characterized in that, include: The acquisition module is used to acquire the first residual matrix corresponding to the target image block in the video frame; A partitioning module is used to partition the first residual matrix into multiple second residual matrices; The determining module is used to determine the first eigenvalue of each of the plurality of second residual matrices based on the elements contained in each of the plurality of second residual matrices; The grouping module is used to sort the plurality of second residual matrices according to the magnitude of their respective first eigenvalues; The sorted second residual matrices are grouped to obtain multiple groups; the second residual matrices contained in each of the multiple groups are merged to obtain multiple third residual matrices with the same number of groups. The encoding module is used to determine the first encoded data of the target image block based on the correspondence between the plurality of third residual matrices, the plurality of second residual matrices and the plurality of third residual matrices.
9. A video decoding device, characterized in that, include: An acquisition module is used to acquire first encoded data of a target image block in a video frame, wherein the first encoded data is determined based on the video encoding method according to any one of claims 1-6; The parsing module is used to parse the first encoded data and obtain multiple third residual recovery matrices corresponding to the first encoded data, as well as the correspondence between multiple second residual recovery matrices and the multiple third residual recovery matrices; The determining module is used to decompose the third residual recovery matrix according to the correspondence between the plurality of second residual recovery matrices and the plurality of third residual recovery matrices, and determine the first residual recovery matrix corresponding to the target image block in the video frame; The decoding module is used to decode the first encoded data into the target image block based on the first residual recovery matrix.
10. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1-7 by executing the executable instructions.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-7.
Citation Information
Patent Citations
Image privacy recognition method and device, computer device and storage medium
CN110674830A
Video encoding method and electronic equipment
CN110958451A
