Image encoding methods, devices, electronic equipment and storage media
By pruning mismatched quantization paths during image encoding and selecting target quantization paths for quantization encoding, the problems of high computational resource consumption and low encoding efficiency are solved, achieving more efficient image and video encoding.
Patent Information
- Application Number
- CN202310182725.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-02-20
AI Technical Summary
In existing technologies, image and video encoding processes consume significant computational resources, are time-consuming, and have low encoding efficiency, mainly due to the need to calculate the rate-distortion loss corresponding to a large number of quantization paths.
By acquiring multiple original coding coefficients of the image and their corresponding multiple initial quantization paths, the quantization paths to be pruned are determined based on the coefficient magnitude, mismatched paths are pruned, and the target quantization paths are selected for quantization encoding, thereby reducing the computation of quantization paths.
It effectively reduces the system's computational resource consumption during image quantization and encoding, improves encoding efficiency, and enhances the quality of multimedia data.
Smart Images

Figure CN116489358B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image coding technology, and in particular to an image coding method, apparatus, electronic device and storage medium. Background Technology
[0002] Quantization is a core process in multimedia data encoding technologies such as video and images. Dependent scalar quantization (DQ) is one such quantization method used in multimedia data encoding. In related technologies, during the quantization of images (including individual images and each frame in a video) based on dependent scalar quantization, multiple quantization paths corresponding to the coefficients to be quantized are constructed. Since each coefficient has multiple quantization states, and there are three quantization paths from each quantization state to the next coefficient's corresponding quantization state, a large number of rate-distortion losses (a metric characterizing the coding performance of the corresponding quantization path) need to be calculated. This results in problems such as high computational resource consumption, long processing time, and low coding efficiency in the encoding process of multimedia data such as images and videos. Summary of the Invention
[0003] This disclosure provides an image encoding method, apparatus, electronic device, and storage medium to at least solve the technical problems of high computational resource consumption, long encoding time, and low encoding efficiency in related technologies. The technical solution of this disclosure is as follows:
[0004] According to a first aspect of the present disclosure, an image encoding method is provided, comprising:
[0005] Obtain multiple raw coding coefficients of the image and multiple initial quantization paths corresponding to each raw coding coefficient. Each initial quantization path is a path connecting the path node of a preset quantization state corresponding to each raw coding coefficient to the path node of a preset quantization state corresponding to the next raw coding coefficient.
[0006] Based on the magnitude of each of the plurality of original coding coefficients, a quantization path to be pruned is determined from the plurality of initial quantization paths; the path type of the quantization path to be pruned is matched with the magnitude of each of the original coding coefficients.
[0007] Prune the quantization path to be pruned in the plurality of initial quantization paths to obtain at least one quantization path to be selected;
[0008] Based on the coding performance metrics corresponding to each of the at least one candidate quantization path, a target quantization path is determined from the at least one candidate quantization path.
[0009] Based on the target quantization path, the multiple original coding coefficients are quantized and encoded to obtain the encoded data of the image.
[0010] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient;
[0011] The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the respective magnitudes of the plurality of original coding coefficients includes:
[0012] Among the plurality of original coding coefficients, the first coding coefficient whose value falls within a preset coefficient range is determined;
[0013] The even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient are used as the quantization paths to be pruned.
[0014] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient;
[0015] The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the respective magnitudes of the plurality of original coding coefficients includes:
[0016] Each of the plurality of original coding coefficients is quantized to obtain the first pre-quantized data corresponding to each original coding coefficient;
[0017] Among the plurality of original coding coefficients, determine the second coding coefficient whose corresponding first prequantized data is located in the preset quantization coefficient range;
[0018] The even quantization path corresponding to the second coding coefficient and the zero quantization path corresponding to the second coding coefficient are used as the quantization path to be pruned.
[0019] In an optional embodiment, determining the quantization path to be pruned from the plurality of initial quantization paths based on the magnitudes of the plurality of original coding coefficients includes:
[0020] Compare each of the plurality of original coding coefficients with the preset pixel threshold to obtain a first comparison result corresponding to each original coding coefficient;
[0021] Based on the first comparison result, the quantization path to be pruned is determined from the plurality of initial quantization paths.
[0022] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient; determining the quantization path to be pruned from the plurality of initial quantization paths based on the first comparison result includes:
[0023] If the first comparison result of any of the plurality of original coding coefficients indicates that it is greater than a preset pixel threshold, the zero-value quantization path corresponding to the third coding coefficient is taken as the first pruning path, wherein the third coding coefficient is the original coding coefficient among the plurality of original coding coefficients that is greater than the preset pixel threshold.
[0024] If the first comparison result corresponding to any of the plurality of original coding coefficients is less than the preset pixel threshold, the even-quantized path corresponding to the fourth coding coefficient is taken as the second pruning path; the fourth coding coefficient is the original coding coefficient among the plurality of original coding coefficients that is less than the preset pixel threshold;
[0025] The first pruning path and the second pruning path are used as the paths to be pruned and quantized.
[0026] In an optional embodiment, determining the quantization path to be pruned from the plurality of initial quantization paths based on the magnitudes of the plurality of original coding coefficients includes:
[0027] Each of the plurality of original coding coefficients is quantized to obtain the second pre-quantized data corresponding to each original coding coefficient;
[0028] By comparing the second prequantized data corresponding to each of the plurality of original coding coefficients with the preset quantized pixel threshold, a second comparison result corresponding to each of the original coding coefficients is obtained;
[0029] Based on the second comparison result, the quantization path to be pruned is determined from the plurality of initial quantization paths.
[0030] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient; determining the quantization path to be pruned from the plurality of initial quantization paths based on the second comparison result includes:
[0031] If the second comparison result of any of the plurality of original coding coefficients indicates that the second prequantization data is greater than a preset quantization pixel threshold, the zero-value quantization path corresponding to the fifth coding coefficient is used as the third pruning path. The fifth coding coefficient is the original coding coefficient among the plurality of original coding coefficients whose second prequantization data is greater than the preset quantization pixel threshold.
[0032] If the second prequantization data corresponding to any of the plurality of original coding coefficients is less than the preset quantization pixel threshold, the even quantization path corresponding to the sixth coding coefficient is used as the fourth pruning path; the sixth coding coefficient is the original coding coefficient among the plurality of original coding coefficients whose second prequantization data is less than the preset quantization pixel threshold.
[0033] The third pruning path and the fourth pruning path are used as the paths to be pruned and quantized.
[0034] In an optional embodiment, the step of quantizing and encoding the plurality of original coding coefficients based on the target quantization path to obtain the encoded data of the image includes:
[0035] Based on the preset quantization state corresponding to each path node in the target quantization path, the original coding coefficients corresponding to each path node are quantized to obtain quantized coding coefficients.
[0036] The encoded data is obtained by encoding based on the quantization coding coefficients.
[0037] According to a second aspect of the present disclosure, an image encoding apparatus is provided, comprising:
[0038] The data acquisition module is configured to acquire multiple raw coding coefficients of the image and multiple initial quantization paths corresponding to each raw coding coefficient. Each initial quantization path is a path connecting a path node containing a preset quantization state corresponding to each raw coding coefficient and a path node containing a preset quantization state corresponding to the next raw coding coefficient.
[0039] The quantization path to be pruned module is configured to determine the quantization path to be pruned from the plurality of initial quantization paths based on the size of each of the plurality of original coding coefficients; the path type of the quantization path to be pruned is matched with the size of each of the original coding coefficients.
[0040] The pruning module is configured to perform pruning of the quantization path to be pruned in the plurality of initial quantization paths, to obtain at least one quantization path to be selected.
[0041] The target quantization path determination module is configured to determine a target quantization path from the at least one candidate quantization path based on the coding performance metrics corresponding to each of the at least one candidate quantization path.
[0042] The quantization encoding processing module is configured to perform quantization encoding processing on the plurality of original encoding coefficients based on the target quantization path to obtain the encoded data of the image.
[0043] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient;
[0044] The quantization path determination module for pruning includes:
[0045] The first coding coefficient determining unit is configured to determine the first coding coefficient among the plurality of original coding coefficients whose numerical value is within a preset coefficient range;
[0046] The first quantization path determination unit is configured to determine the even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient as the quantization path to be pruned.
[0047] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient;
[0048] The quantization path determination module for pruning includes:
[0049] The first quantization processing unit is configured to perform quantization processing on each of the plurality of original coding coefficients to obtain first prequantized data corresponding to each original coding coefficient.
[0050] The second coding coefficient determination unit is configured to determine the second coding coefficient among the plurality of original coding coefficients, where the corresponding first prequantized data is located in the preset quantization coefficient range;
[0051] The second quantization path determination unit is configured to use the even quantization path corresponding to the second coding coefficient and the zero quantization path corresponding to the second coding coefficient as the quantization path to be pruned.
[0052] In an optional embodiment, the pruning quantization path determination module includes:
[0053] The first comparison unit is configured to perform a comparison between each of the plurality of original coding coefficients and the preset pixel threshold to obtain a first comparison result corresponding to each original coding coefficient;
[0054] The third quantization path determination unit is configured to determine the quantization path to be pruned from the plurality of initial quantization paths based on the first comparison result.
[0055] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient; the third quantization path to be pruned determination unit includes:
[0056] The first pruning path determination unit is configured to, when the first comparison result indication of any of the plurality of original coding coefficients is greater than a preset pixel threshold, take the zero-value quantization path corresponding to the third coding coefficient as the first pruning path, wherein the third coding coefficient is an original coding coefficient among the plurality of original coding coefficients that is greater than the preset pixel threshold.
[0057] The second pruning path determination unit is configured to, when the first comparison result indication of any of the plurality of original coding coefficients is less than the preset pixel threshold, take the even-quantized path corresponding to the fourth coding coefficient as the second pruning path; the fourth coding coefficient is the original coding coefficient among the plurality of original coding coefficients that is less than the preset pixel threshold.
[0058] The fourth pruning quantization path determination unit is configured to use the first pruning path and the second pruning path as the pruning quantization path.
[0059] In an optional embodiment, the pruning quantization path determination module includes:
[0060] The second quantization processing unit is configured to perform quantization processing on each of the plurality of original coding coefficients to obtain the second prequantized data corresponding to each original coding coefficient.
[0061] The second comparison unit is configured to perform a comparison between the second prequantized data corresponding to each of the plurality of original coding coefficients and the preset quantized pixel threshold, and to obtain the second comparison result corresponding to each of the original coding coefficients.
[0062] The fifth quantization path determination unit is configured to determine the quantization path to be pruned from the plurality of initial quantization paths based on the second comparison result.
[0063] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient; the fifth quantization path to be pruned determination unit includes:
[0064] The third pruning path determination unit is configured to, when the second pre-quantization data corresponding to the second comparison result indication of any of the plurality of original coding coefficients is greater than a preset quantization pixel threshold, take the zero-value quantization path corresponding to the fifth coding coefficient as the third pruning path, wherein the fifth coding coefficient is the original coding coefficient among the plurality of original coding coefficients whose second pre-quantization data is greater than the preset quantization pixel threshold.
[0065] The fourth pruning path determination unit is configured to, when the second prequantization data corresponding to the second comparison result indication of any of the plurality of original coding coefficients is less than the preset quantization pixel threshold, take the even quantization path corresponding to the sixth coding coefficient as the fourth pruning path; the sixth coding coefficient is the original coding coefficient among the plurality of original coding coefficients whose corresponding second prequantization data is less than the preset quantization pixel threshold;
[0066] The sixth pruning quantization path determination unit is configured to use the third pruning path and the fourth pruning path as the pruning quantization path.
[0067] In an optional embodiment, the quantization encoding processing module includes:
[0068] The third quantization processing unit is configured to perform quantization processing on the original coding coefficients corresponding to each path node according to the preset quantization state corresponding to each path node in the target quantization path, so as to obtain quantized coding coefficients.
[0069] The encoding processing unit is configured to perform encoding processing based on the quantization encoding coefficients to obtain the encoded data.
[0070] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method as described in any one of the first aspects above.
[0071] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform any one of the image encoding methods of the present disclosure.
[0072] According to a fifth aspect of the present disclosure, a computer program product comprising instructions is provided that, when run on a computer, causes the computer to perform the method as described in any one of the first aspects above.
[0073] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0074] In the image coding process, by combining the magnitudes of multiple original coding coefficients of the image, a quantization path to be pruned is determined from multiple initial quantization paths corresponding to each original coding coefficient. The path type of the quantization path to be pruned matches the magnitude of each original coding coefficient, and the quantization path to be pruned from the multiple initial quantization paths is pruned to obtain at least one quantization path to be selected. Then, by combining the coding performance index corresponding to each of the at least one quantization path to be selected after pruning, path pruning at the coding coefficient dimension can be achieved, effectively reducing the number of quantization paths that require calculation of coding performance indexes. Next, by combining the coding performance index corresponding to at least one quantization path to be selected, a target quantization path is selected. Based on the target quantization path, multiple original coding coefficients are quantized and encoded to obtain the encoded image data. This can effectively reduce the consumption of system computing resources during image quantization and encoding, and greatly improve the efficiency of image quantization and encoding while effectively ensuring image coding performance. In turn, it can also greatly improve the quality of multimedia data such as images and videos that need to be quantized and encoded in practical applications.
[0075] 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 this disclosure. Attached Figure Description
[0076] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0077] Figure 1 This is a schematic diagram illustrating an application environment according to an exemplary embodiment;
[0078] Figure 2 This is a flowchart illustrating an image encoding method according to an exemplary embodiment;
[0079] Figure 3 This is a flowchart illustrating, according to an exemplary embodiment, a method for determining a quantization path to be pruned from a plurality of initial quantization paths based on the magnitudes of the plurality of original coding coefficients.
[0080] Figure 4 This is a flowchart illustrating, according to an exemplary embodiment, a method for determining the quantization path to be pruned from the plurality of initial quantization paths based on the first comparison result;
[0081] Figure 5 This is a flowchart illustrating another method for determining a quantization path to be pruned from a plurality of initial quantization paths based on the magnitudes of the plurality of original coding coefficients, according to an exemplary embodiment.
[0082] Figure 6 This is a flowchart illustrating, according to an exemplary embodiment, a method for determining the quantization path to be pruned from the plurality of initial quantization paths based on the second comparison result;
[0083] Figure 7 This is a block diagram of an image encoding apparatus according to an exemplary embodiment;
[0084] Figure 8 This is a block diagram illustrating an electronic device for image encoding according to an exemplary embodiment;
[0085] Figure 9 This is a block diagram illustrating another electronic device for image encoding according to an exemplary embodiment. Detailed Implementation
[0086] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0087] 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 embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0088] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0089] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application environment according to an exemplary embodiment. Optionally, the application environment may include a terminal 100 and a server 200.
[0090] In an optional embodiment, taking the transmission of multimedia data such as images and videos as an example, the terminal 100 can optionally encode the multimedia data and then transmit it to the server 200. Specifically, the terminal 100 can be, but is not limited to, electronic devices such as smartphones, desktop computers, tablets, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices, or software running on the aforementioned electronic devices, such as applications. Optionally, the operating system running on the electronic device can include, but is not limited to, Android, iOS, Linux, and Windows. The server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0091] In addition, it should be noted that, Figure 1 The example shown is merely one application environment provided by this disclosure. In practical applications, other application environments may also be included, such as terminal 300. Optionally, the server can transmit the encoded multimedia data to terminal 300, and correspondingly, terminal 300 can decode the encoded multimedia data to obtain multimedia data. Optionally, the server can also encode the original multimedia data.
[0092] In the embodiments described in this specification, the terminal 100 and the server 200 can be directly or indirectly connected through wired or wireless communication, and this disclosure does not impose any restrictions.
[0093] Figure 2 This is a flowchart illustrating an image encoding method according to an exemplary embodiment, such as... Figure 2 As shown, this image encoding method can be applied to electronic devices such as terminals and servers, and may include the following steps:
[0094] In step S201, multiple original coding coefficients of the image and multiple initial quantization paths corresponding to each original coding coefficient are obtained.
[0095] In an optional embodiment, the image may be an image acquired in an image format, or at least one frame extracted from a video. The multiple raw coding coefficients of the image may be pixel data from multiple pixel blocks in the image.
[0096] In one specific embodiment, each initial quantization path is a path connecting a path node containing a preset quantization state corresponding to each original encoded coefficient to a path node containing a preset quantization state corresponding to the next original encoded coefficient. In practical applications, during dependent scalar quantization, each coefficient to be quantized corresponds to multiple preset quantization states. The first coefficient to be quantized corresponds to multiple preset quantization states including no encoding, quantization state 0, and quantization state 2. Other coefficients to be quantized correspond to multiple preset quantization states including no encoding, quantization state 0, quantization state 1, quantization state 2, and quantization state 3. Specifically, a preset quantizer is used during dependent scalar quantization. The preset quantizer can determine the quantization value corresponding to the coefficient to be quantized by combining the preset quantization states. The same coefficient to be quantized will correspond to different quantization values under different preset quantization states.
[0097] In the embodiments of this specification, during the construction of multiple initial quantization paths using multiple preset quantization states corresponding to multiple original coding coefficients as path nodes, the multiple original coding coefficients are coefficients to be quantized. Specifically, in constructing the aforementioned multiple initial quantization paths (DQ quantization paths), a preset scanning order (the order in which original coding coefficients are obtained from the image) corresponding to the multiple original coding coefficients can be used. The original coding coefficient of the first scan is taken as the first coefficient to be quantized, and so on, determining the next coefficient to be quantized in turn. Correspondingly, path nodes can be constructed sequentially using multiple preset quantization states corresponding to each original coding coefficient. Then, due to the dependency scalar quantization process, the connection between each preset quantization state corresponding to each coefficient to be quantized and the preset quantization state corresponding to the next coefficient to be quantized is formed by the coefficient state of the coefficient to be quantized and the next coefficient to be quantized in the corresponding preset... The parity of the quantized value in a quantization state is determined by combining a preset quantizer to calculate the quantized value of the next original quantized coefficient in the corresponding preset quantization state for each original quantized coefficient. Then, for each preset quantization state corresponding to each original quantized coefficient, the parity of the quantized value of the next original quantized coefficient in the corresponding preset quantization state, and a preset state transition table (recording the connection relationship between each preset quantization state corresponding to each coefficient to be quantized and the corresponding state when the next coefficient to be quantized has different parity quantization values in the corresponding preset quantization state), the path nodes of each preset quantization state corresponding to each original quantized coefficient are sequentially connected to the path nodes of the preset quantization state corresponding to the next original quantization path, thereby obtaining multiple initial quantization paths; each initial quantization path includes a preset quantization state corresponding to each of the multiple original quantized coefficients.
[0098] In a specific embodiment, there are three quantization paths (three connections) between each path node (preset quantization state) corresponding to each quantized coefficient and the path node corresponding to the next quantized coefficient. Specifically, the three quantization paths may include the path with a quantization value of 0 corresponding to the next quantized coefficient; the path with a quantization value of an odd number corresponding to the next quantized coefficient; and the path with a quantization value of an even number (excluding 0) corresponding to the next quantized coefficient. Correspondingly, the multiple initial quantization paths corresponding to each original encoded coefficient may include the zero-value quantization path, the even-value quantization path, and the odd-value quantization path corresponding to each original encoded coefficient. Specifically, the zero-value quantization path corresponding to each original encoded coefficient may be the initial quantization path containing the path with a quantization value of zero corresponding to the next original encoded coefficient; the odd-value quantization path corresponding to each original encoded coefficient may be the initial quantization path containing the path with a quantization value of an odd number corresponding to the next original encoded coefficient; and the even-value quantization path corresponding to each original encoded coefficient may be the initial quantization path containing the path with a quantization value of an even number corresponding to the next original encoded coefficient.
[0099] In step S203, the quantization path to be pruned is determined from multiple initial quantization paths based on the magnitude of each of the multiple original coding coefficients.
[0100] In one specific embodiment, the path type of the quantization path to be pruned is matched with the size of each original coding coefficient. Correspondingly, the quantization path to be pruned can be determined from multiple initial quantization paths by combining the path types of multiple initial quantization paths and the sizes of multiple original coding coefficients. In practical applications, when the coefficient to be quantized (original coding coefficient) is small, the corresponding even quantization path will have a relatively large coding performance index; when the coefficient to be quantized is large, the corresponding zero-value quantization path will have a relatively large coding performance index, and the smaller the coding performance index, the better the corresponding coding performance. Accordingly, by combining the analysis of the coding coefficients corresponding to a large number of sample images (multiple sample images) and the coding performance index of the corresponding initial quantization paths (DQ quantization paths), the coding coefficients of the determined even quantization paths and / or zero-value quantization paths that need to be filtered out can be determined.
[0101] In an optional embodiment, determining the quantization path to be pruned among multiple initial quantization paths based on the magnitudes of the multiple original coding coefficients may include:
[0102] Among multiple original coding coefficients, the first coding coefficient whose value falls within a preset coefficient range is identified;
[0103] Among the multiple initial quantization paths, the even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient are taken as the quantization paths to be pruned.
[0104] In a specific embodiment, the aforementioned preset coefficient range can be a coding coefficient filtering range corresponding to even-quantized paths (path type) and zero-quantized paths (path type) (the coefficient range that needs to be filtered for even-quantized paths and zero-quantized paths). Specifically, the preset coefficient range can be determined based on the sample coding coefficients (original coding coefficients of the sample images) corresponding to the first sample quantization path among multiple sample images corresponding to sample quantization paths (DQ quantization paths). The aforementioned first sample quantization path is a zero-quantized path or even-quantized path whose corresponding coding performance index is greater than a preset index threshold. Specifically, in the process of determining the preset coefficient range, zero-quantized paths and even-quantized paths with larger coding performance indices (greater than the preset index threshold) can be determined from the sample quantization paths corresponding to multiple sample images. Then, combined with the sample coding coefficients corresponding to the zero-quantized paths and even-quantized paths with larger coding performance indices, the upper and lower limits of the aforementioned preset coefficient range are determined, thereby determining the aforementioned preset coefficient range.
[0105] In a specific embodiment, the first coding coefficient can be an original coding coefficient located within a preset coefficient range from a plurality of original coding coefficients. Optionally, taking the preset coding coefficient range as [T1, T2] as an example, any original coding coefficient whose value is greater than or equal to T1 and less than or equal to T2 can be used as the first coding coefficient; then, the even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient in the plurality of initial quantization paths can be used as the quantization path to be pruned.
[0106] In the above embodiments, by combining a preset coefficient range to select the first coding coefficient from multiple original coding coefficients that need to be pruned for even quantization paths and zero-value quantization paths, path pruning at the coding coefficient dimension can be achieved, reducing the number of quantization paths that need to be calculated for coding performance indicators in the future, thereby reducing the consumption of system computing resources and greatly improving the efficiency of image quantization coding.
[0107] In an optional embodiment, such as Figure 3 As shown, determining the quantization path to be pruned from multiple initial quantization paths based on the magnitudes of the original coding coefficients can include:
[0108] In step S301, each of the multiple original coding coefficients is quantized to obtain the first pre-quantized data corresponding to each original coding coefficient.
[0109] In step S303, the second coding coefficient corresponding to the first prequantized data in the preset quantization coefficient range is determined among the multiple original coding coefficients;
[0110] In step S305, the even quantization path corresponding to the second coding coefficient and the zero quantization path corresponding to the second coding coefficient are taken as the quantization path to be pruned.
[0111] In a specific embodiment, the preset quantization coefficient range can be the quantization pixel filtering range corresponding to even-quantized paths and zero-quantized paths (the quantization coefficient range that needs to be filtered for even-quantized paths and zero-quantized paths). Specifically, the preset quantization coefficient range can be determined based on the quantization coding coefficients corresponding to the second sample quantization path among multiple sample images. The second sample quantization path is the zero-quantization path and even-quantization path whose corresponding coding performance index is greater than a preset index threshold. The quantization coding coefficients corresponding to the second sample quantization path are obtained by quantizing the sample coding coefficients (original coding coefficients corresponding to the sample images) corresponding to the second sample quantization path based on a first preset quantization step size. Specifically, quantizing the sample coding coefficients can narrow the numerical range of the coding coefficients corresponding to the zero-quantization path and even-quantization path, thereby improving the efficiency of determining the path pruning conditions for the coding coefficient dimension.
[0112] In a specific embodiment, each original coding coefficient can be divided by a first preset quantization step size to obtain the first pre-quantized data corresponding to each original coding coefficient. Specifically, the first preset quantization step size can be set according to the actual application. Optionally, the first preset quantization step size is greater than 1, thereby ensuring that the first pre-quantized data corresponding to each original coding coefficient is less than the original coding coefficient. The second coding coefficient can be an original coding coefficient whose corresponding first pre-quantized data is located within a preset quantization coefficient range. Optionally, taking the preset quantization coefficient range as [T3, T4] as an example, any original coding coefficient whose corresponding first pre-quantized data is greater than or equal to T3 and less than or equal to T4 can be used as the second coding coefficient. Then, the even quantization path corresponding to the second coding coefficient and the zero quantization path corresponding to the second coding coefficient can be used as the quantization path to be pruned.
[0113] In the above embodiments, by combining a preset quantization coefficient range, the second coding coefficients that need to be pruned from multiple original coding coefficients are selected, including even-quantized paths and zero-value quantization paths. This can improve the efficiency of determining the preset quantization coefficient range based on the path pruning in the coding coefficient dimension, thereby improving the efficiency of determining the path pruning conditions in the coding coefficient dimension, effectively reducing the consumption of system computing resources, and greatly improving the efficiency of image quantization coding.
[0114] In an optional embodiment, determining the quantization path to be pruned among multiple initial quantization paths based on the magnitudes of the multiple original coding coefficients may include:
[0115] Compare each original coding coefficient among multiple original coding coefficients with a preset pixel threshold to obtain the first comparison result corresponding to each original coding coefficient;
[0116] Based on the first comparison result, the quantization path to be pruned is determined from multiple initial quantization paths.
[0117] In one specific embodiment, the preset pixel threshold can be a pixel filtering threshold corresponding to even-quantized paths and zero-quantized paths. Specifically, the preset pixel threshold can be determined based on the sample coding coefficients of the first sample quantization path among multiple sample images. The first sample quantization path can be a zero-quantization path or an even-quantization path whose corresponding coding performance index is greater than a preset index threshold. Specifically, in determining the preset pixel threshold, zero-quantization paths and even-quantization paths with larger coding performance indices (greater than the preset index threshold) can be identified from the sample quantization paths corresponding to multiple sample images. Then, by combining the sample coding coefficients corresponding to the zero-quantization paths and even-quantization paths with larger coding performance indices, a critical value that can distinguish the sample coding coefficients corresponding to the zero-quantization paths and even-quantization paths with larger coding performance indices is determined, and this critical value is used as the preset pixel threshold.
[0118] In one specific embodiment, the first comparison result corresponding to any original coding coefficient can be used to indicate the comparison between the original coding coefficient and a preset pixel threshold.
[0119] In an optional embodiment, the initial quantization path corresponding to each original coding coefficient includes a zero-value quantization path, an even quantization path, and an odd quantization path for each original coding coefficient; optionally, such as Figure 4 As shown, the process of determining the quantization path to be pruned from multiple initial quantization paths based on the first comparison result may include:
[0120] In step S401, if the first comparison result of any of the original coding coefficients is greater than a preset pixel threshold, the zero-value quantization path corresponding to the third coding coefficient is taken as the first pruning path.
[0121] In step S403, if the first comparison result of any of the original coding coefficients is less than a preset pixel threshold, the even quantization path corresponding to the fourth coding coefficient is taken as the second pruning path.
[0122] In step S405, the first pruning path and the second pruning path are used as the paths to be pruned and quantized.
[0123] In a specific embodiment, the third coding coefficient can be an original coding coefficient that is greater than a preset pixel threshold among multiple original coding coefficients. Specifically, if the first comparison result corresponding to the third coding coefficient indicates that it is greater than the preset pixel threshold, the third coding coefficient can be determined to be a larger coefficient to be quantized. Correspondingly, the corresponding zero-quantization path will have a relatively large coding performance index. Accordingly, the zero-quantization path corresponding to the third coding coefficient can be used as the first pruning path that needs to be pruned, thereby achieving the pruning of the quantization path with poor coding performance.
[0124] In a specific embodiment, the fourth coding coefficient can be an original coding coefficient that is less than a preset pixel threshold among multiple original coding coefficients. Specifically, if the first comparison result corresponding to the fourth coding coefficient indicates that it is less than the preset pixel threshold, the fourth coding coefficient can be determined to be a smaller coefficient to be quantized. Correspondingly, the corresponding even quantization path will have a relatively large coding performance index. Accordingly, the even quantization path corresponding to the fourth coding coefficient can be used as the second pruning path that needs to be pruned, thereby achieving the pruning of quantization paths with poor coding performance.
[0125] In the above embodiments, by combining the first comparison results of multiple original coding coefficients with a preset pixel threshold, the zero-quantization path corresponding to the third coding coefficient with poor coding performance and the even-quantization path corresponding to the fourth coding coefficient with poor coding performance can be selected. The zero-quantization path corresponding to the third coding coefficient with poor coding performance and the even-quantization path corresponding to the fourth coding coefficient with poor coding performance are used as quantization paths to be pruned. This can reduce the number of quantization paths that need to be calculated for coding performance indicators in the future, while ensuring the rationality of path pruning. In this way, it can also effectively guarantee the performance and quality of subsequent image quantization coding.
[0126] Furthermore, it should be noted that in practical applications, if only the first pruning path exists among multiple initial quantization paths, the first pruning path can be used as the quantization path to be pruned; alternatively, if only the second pruning path exists among multiple initial quantization paths, the second pruning path can be used as the quantization path to be pruned.
[0127] In the above embodiments, by combining the comparison results of multiple original coding coefficients and preset pixel thresholds, path pruning of the coding coefficient dimension can be achieved, reducing the quantization path that needs to calculate coding performance indicators in the subsequent process, thereby reducing the consumption of system computing resources and greatly improving the efficiency of image quantization coding.
[0128] In an optional embodiment, such as Figure 5 As shown, determining the quantization path to be pruned from multiple initial quantization paths based on the magnitudes of the original coding coefficients can include:
[0129] In step S501, each of the multiple original coding coefficients is quantized to obtain the second pre-quantized data corresponding to each original coding coefficient.
[0130] In step S503, the second prequantization data corresponding to each of the multiple original coding coefficients is compared with the preset quantization pixel threshold to obtain the second comparison result corresponding to each original coding coefficient;
[0131] In step S505, based on the second comparison result, the quantization path to be pruned is determined from multiple initial quantization paths.
[0132] In one specific embodiment, the preset quantization pixel threshold can be a critical threshold for filtering quantization pixels corresponding to even-quantized paths and zero-quantized paths. Specifically, the preset quantization pixel threshold can be determined based on the quantization coding coefficients of the third sample quantization path among multiple sample images corresponding to sample quantization paths (DQ quantization paths). The third sample quantization path refers to the zero-quantization path and even-quantization path whose corresponding coding performance index is greater than the preset index threshold. The quantization coding coefficients corresponding to the third sample quantization path are obtained by quantizing the sample coding coefficients corresponding to the third sample quantization path based on a second preset quantization step size. Specifically, the second preset quantization step size can be set according to actual applications. Optionally, the second preset quantization step size is greater than 1, thereby ensuring that the second pre-quantized data corresponding to each original coding coefficient is less than the original coding coefficient. Specifically, in determining the preset quantization pixel threshold, zero-value quantization paths and even-value quantization paths with larger coding performance indicators (greater than the preset indicator threshold) can be identified from the sample quantization paths corresponding to multiple sample images. Then, by combining the quantization coding coefficients corresponding to the zero-value quantization paths and even-value quantization paths with larger coding performance indicators, a critical value that can distinguish the quantization coding coefficients corresponding to the zero-value quantization paths and even-value quantization paths with larger coding performance indicators is determined, and this critical value is used as the aforementioned preset quantization pixel threshold.
[0133] In one specific embodiment, the second comparison result corresponding to any original coding coefficient can be used to indicate the comparison between the original coding coefficient and a preset quantized pixel threshold.
[0134] In an optional embodiment, the multiple initial quantization paths corresponding to each original coding coefficient include a zero-value quantization path, an even quantization path, and an odd quantization path corresponding to each original coding coefficient; correspondingly, as... Figure 6 As shown, the process of determining the quantization path to be pruned from multiple initial quantization paths based on the second comparison result can include:
[0135] In step S601, if the second comparison result of any of the original coding coefficients indicates that the second pre-quantized data is greater than the preset quantized pixel threshold, the zero-value quantization path corresponding to the fifth coding coefficient is used as the third pruning path.
[0136] In step S603, if the second prequantization data corresponding to the second comparison result of any of the original coding coefficients is less than the preset quantization pixel threshold, the even quantization path corresponding to the sixth coding coefficient is taken as the fourth pruning path.
[0137] In step S605, the third pruning path and the fourth pruning path are selected as the paths to be pruned and quantized.
[0138] In one specific embodiment, the fifth coding coefficient can be any original coding coefficient whose second pre-quantized data is greater than a preset quantization pixel threshold. Specifically, if the second comparison result corresponding to the fifth coding coefficient indicates that the second pre-quantized data is greater than the preset quantization pixel threshold, the fifth coding coefficient can be determined as a larger coefficient to be quantized. Correspondingly, the corresponding zero-quantization path will have a relatively large coding performance index. Accordingly, the zero-quantization path corresponding to the fifth coding coefficient can be used as the third pruning path that needs to be pruned, thereby achieving the pruning of quantization paths with poor coding performance.
[0139] In one specific embodiment, the sixth coding coefficient can be an original coding coefficient whose corresponding second pre-quantized data is less than a preset quantization pixel threshold among multiple original coding coefficients. Specifically, when the second comparison result corresponding to the sixth coding coefficient indicates that the second pre-quantized data is less than the preset quantization pixel threshold, the sixth coding coefficient can be determined as a smaller coefficient to be quantized. Correspondingly, the corresponding even-valued quantization path will have a relatively large coding performance index. Accordingly, the even-valued quantization path corresponding to the sixth coding coefficient can be regarded as the fourth pruning path that needs to be pruned, thereby achieving the pruning of quantization paths with poor coding performance.
[0140] In the above embodiments, by combining the second pre-quantized data corresponding to multiple original coding coefficients with the second comparison result of the preset quantized pixel threshold, the zero-value quantization path corresponding to the fifth coding coefficient with poor coding performance and the even-value quantization path corresponding to the sixth coding coefficient with poor coding performance can be screened out. The zero-value quantization path corresponding to the fifth coding coefficient with poor coding performance and the even-value quantization path corresponding to the sixth coding coefficient with poor coding performance are taken as quantization paths to be pruned. This can reduce the number of quantization paths that need to be calculated for coding performance indicators in the future, and ensure the rationality of path pruning. In this way, it can also effectively guarantee the performance and quality of subsequent image quantization coding.
[0141] In addition, it should be noted that in practical applications, if only the third pruning path exists among multiple initial quantization paths, the third pruning path can be used as the quantization path to be pruned; alternatively, if only the fourth pruning path exists among multiple initial quantization paths, the fourth pruning path can be used as the quantization path to be pruned.
[0142] In the above embodiments, by combining the comparison results of the second pre-quantized data corresponding to multiple original coding coefficients and the preset quantization pixel threshold, path pruning of the coding coefficient dimension can be achieved, reducing the quantization path that needs to calculate coding performance indicators in the subsequent process, thereby reducing the consumption of system computing resources and greatly improving the efficiency of image quantization coding.
[0143] In step S205, the quantization paths to be pruned in the multiple initial quantization paths are pruned to obtain at least one quantization path to be selected.
[0144] In step S207, based on the coding performance metrics corresponding to each of the at least one selectable quantization path, a target quantization path is determined from the at least one selectable quantization path.
[0145] In a specific embodiment, the coding performance index corresponding to any quantization path to be selected can characterize the coding performance of image coding processing based on the quantization coding coefficients corresponding to that quantization path; optionally, the coding performance index can be rate-distortion loss. Specifically, in the dequantization stage corresponding to dependency scalar quantization, the preset quantizer can combine the dequantized coding coefficients and the original coding coefficients to calculate the rate-distortion loss.
[0146] In a specific embodiment, determining the target quantization path from at least one selectable quantization path based on the coding performance index corresponding to each of the at least one selectable quantization path includes: taking the selectable quantization path corresponding to the minimum coding performance index as the target quantization path, thereby ensuring the coding performance of subsequent coding processing.
[0147] In step S209, based on the target quantization path, multiple original coding coefficients are quantized and encoded to obtain the encoded data of the image.
[0148] In an optional embodiment, the above-described quantization encoding process, based on the target quantization path, of multiple original coding coefficients to obtain the encoded image data may include:
[0149] Based on the preset quantization state corresponding to each path node in the target quantization path, the original coding coefficients corresponding to each path node are quantized to obtain the quantized coding coefficients.
[0150] Encoding is performed based on quantization coding coefficients to obtain encoded data.
[0151] In a specific embodiment, a preset quantizer can be used to calculate the original coding coefficients corresponding to each path node in the target quantization path, and the preset quantization state corresponding to the path node can be used to obtain the above-mentioned quantized coding coefficients (the quantized values of multiple original coding coefficients in the preset quantization state corresponding to the target quantization path).
[0152] In one specific embodiment, the above-mentioned encoding processing based on quantization coding coefficients to obtain encoded data can be entropy encoding combined with quantization coding coefficients to obtain encoded data; optionally, the encoded data can be transmitted to the corresponding demand party; the demand party can obtain an image based on decoding the encoded data; optionally, if the image is at least one frame extracted from a video, the at least one frame image (image) can be converted into the corresponding video.
[0153] In the above embodiments, the original coding coefficients are quantized by combining the preset quantization state corresponding to each path node in the target quantization path. This can effectively improve the coding performance based on quantized coding coefficients while compressing the data volume of multimedia data such as images and videos.
[0154] As can be seen from the technical solutions provided in the embodiments of this specification above, in the image encoding process, this specification combines the magnitudes of multiple original coding coefficients of the image to determine the quantization path to be pruned from multiple initial quantization paths corresponding to each original coding coefficient. The path type of the quantization path to be pruned matches the magnitude of each original coding coefficient, and the quantization path to be pruned in the multiple initial quantization paths is pruned to obtain at least one quantization path to be selected. Then, combined with the coding performance index corresponding to each of the at least one quantization path to be selected after pruning, path pruning at the coding coefficient dimension can be achieved, effectively reducing the number of quantization paths that need to calculate coding performance indexes. Next, combined with the coding performance index corresponding to at least one quantization path to be selected, a target quantization path is selected. Based on the target quantization path, multiple original coding coefficients are quantized and encoded to obtain the encoded data of the image. This can effectively reduce the consumption of system computing resources during the image quantization and encoding process, and greatly improve the efficiency of image quantization and encoding while effectively ensuring image encoding performance. In turn, it can also greatly improve the quality of multimedia data such as images and videos that need to be quantized and encoded in practical applications.
[0155] Figure 7 This is a block diagram illustrating an image encoding apparatus according to an exemplary embodiment. (Refer to...) Figure 7 The device includes:
[0156] The data acquisition module 710 is configured to acquire multiple raw coding coefficients of the image and multiple initial quantization paths corresponding to each raw coding coefficient. Each initial quantization path is a path connecting a path node containing a preset quantization state corresponding to each raw coding coefficient and a path node containing a preset quantization state corresponding to the next raw coding coefficient.
[0157] The quantization path determination module 720 is configured to determine the quantization path to be pruned from multiple initial quantization paths based on the size of each of the multiple original coding coefficients; the path type of the quantization path to be pruned is matched with the size of each original coding coefficient.
[0158] The pruning module 730 is configured to prune the quantization paths to be pruned in multiple initial quantization paths, so as to obtain at least one quantization path to be selected.
[0159] The target quantization path determination module 740 is configured to determine a target quantization path from at least one candidate quantization path based on the coding performance metrics corresponding to each of the at least one candidate quantization path.
[0160] The quantization encoding processing module 750 is configured to perform quantization encoding processing on multiple original encoding coefficients based on the target quantization path to obtain the encoded data of the image.
[0161] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient.
[0162] The pruning path determination module 720 includes:
[0163] The first coding coefficient determination unit is configured to determine the first coding coefficient among a plurality of original coding coefficients whose numerical value is within a preset coefficient range;
[0164] The first quantization path determination unit is configured to determine the even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient as the quantization path to be pruned.
[0165] In an optional embodiment, the plurality of initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient.
[0166] The pruning path determination module 720 includes:
[0167] The first quantization processing unit is configured to perform quantization processing on each of the multiple original coding coefficients to obtain the first pre-quantized data corresponding to each original coding coefficient.
[0168] The second coding coefficient determination unit is configured to determine the second coding coefficient among a plurality of original coding coefficients, wherein the corresponding first prequantized data is located in a preset quantization coefficient range.
[0169] The second quantization path determination unit is configured to use the even quantization path corresponding to the second coding coefficient and the zero quantization path corresponding to the second coding coefficient as the quantization path to be pruned.
[0170] In an optional embodiment, the pruning quantization path determination module 720 includes:
[0171] The first comparison unit is configured to perform a comparison between each of the multiple original coding coefficients and a preset pixel threshold to obtain a first comparison result corresponding to each original coding coefficient.
[0172] The third quantization path determination unit is configured to determine the quantization path to be pruned from multiple initial quantization paths based on the first comparison result.
[0173] In an optional embodiment, the multiple initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient; the third quantization path to be pruned determination unit includes:
[0174] The first pruning path determination unit is configured to perform the following operation: if the first comparison result indication of any one of the original coding coefficients is greater than a preset pixel threshold, the zero-value quantization path corresponding to the third coding coefficient is taken as the first pruning path, and the third coding coefficient is the original coding coefficient that is greater than the preset pixel threshold among the multiple original coding coefficients.
[0175] The second pruning path determination unit is configured to, when the first comparison result indication of any of the original coding coefficients among the multiple original coding coefficients is less than a preset pixel threshold, take the even quantization path corresponding to the fourth coding coefficient as the second pruning path; the fourth coding coefficient is the original coding coefficient among the multiple original coding coefficients that is less than the preset pixel threshold.
[0176] The fourth pruning quantization path determination unit is configured to use the first pruning path and the second pruning path as pruning quantization paths.
[0177] In an optional embodiment, the pruning quantization path determination module 720 includes:
[0178] The second quantization processing unit is configured to perform quantization processing on each of the multiple original coding coefficients to obtain the second pre-quantized data corresponding to each original coding coefficient.
[0179] The second comparison unit is configured to perform a comparison between the second prequantized data corresponding to each of the multiple original coding coefficients and a preset quantized pixel threshold, and obtain the second comparison result corresponding to each original coding coefficient.
[0180] The fifth quantization path determination unit is configured to determine the quantization path to be pruned from multiple initial quantization paths based on the second comparison result.
[0181] In an optional embodiment, the multiple initial quantization paths include a zero-value quantization path corresponding to each original coding coefficient, an even quantization path corresponding to each original coding coefficient, and an odd quantization path corresponding to each original coding coefficient; the fifth quantization path to be pruned determination unit includes:
[0182] The third pruning path determination unit is configured to, when the second pre-quantization data corresponding to the second comparison result indication of any of the multiple original coding coefficients is greater than a preset quantization pixel threshold, take the zero-value quantization path corresponding to the fifth coding coefficient as the third pruning path, where the fifth coding coefficient is the original coding coefficient whose second pre-quantization data is greater than the preset quantization pixel threshold among the multiple original coding coefficients.
[0183] The fourth pruning path determination unit is configured to, when the second pre-quantization data corresponding to the second comparison result indication of any of the multiple original coding coefficients is less than a preset quantization pixel threshold, take the even quantization path corresponding to the sixth coding coefficient as the fourth pruning path; the sixth coding coefficient is the original coding coefficient whose second pre-quantization data is less than the preset quantization pixel threshold among the multiple original coding coefficients.
[0184] The sixth pruning path determination unit is configured to use the third and fourth pruning paths as pruning paths to be quantized.
[0185] In an optional embodiment, the quantization encoding processing module 750 includes:
[0186] The third quantization processing unit is configured to perform quantization processing on the original coding coefficients corresponding to each path node according to the preset quantization state corresponding to each path node in the target quantization path, so as to obtain quantized coding coefficients.
[0187] The encoding processing unit is configured to perform encoding processing based on quantization encoding coefficients to obtain encoded data.
[0188] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0189] Figure 8 This is a block diagram illustrating an electronic device for image encoding according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the electronic device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an image encoding method. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.
[0190] Figure 9 This is a block diagram illustrating another electronic device for image encoding according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, this electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an image encoding method.
[0191] Those skilled in the art will understand that Figure 8 or Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the electronic device to which the present disclosure is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0192] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the image encoding method as described in the embodiments of this disclosure.
[0193] In an exemplary embodiment, a computer-readable storage medium is also provided, wherein when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the image encoding method of the present disclosure.
[0194] In an exemplary embodiment, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the image encoding method of the present disclosure embodiments.
[0195] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0196] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0197] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. An image encoding method, characterized in that, include: Obtain multiple raw coding coefficients of the image and multiple initial quantization paths corresponding to each raw coding coefficient. Each initial quantization path is a path connecting the path node of a preset quantization state corresponding to each raw coding coefficient to the path node of a preset quantization state corresponding to the next raw coding coefficient. Based on the magnitude of each of the plurality of original coding coefficients, a quantization path to be pruned is determined from the plurality of initial quantization paths; the path type of the quantization path to be pruned is matched with the magnitude of each original coding coefficient, and the plurality of initial quantization paths include the zero-value quantization path corresponding to each original coding coefficient, the even quantization path corresponding to each original coding coefficient, and the odd quantization path corresponding to each original coding coefficient; The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the magnitude of the plurality of original coding coefficients includes: determining a first coding coefficient whose value is located within a preset coefficient range from the plurality of original coding coefficients; and taking the even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient as the quantization path to be pruned. Prune the quantization path to be pruned in the plurality of initial quantization paths to obtain at least one quantization path to be selected; Based on the coding performance metrics corresponding to each of the at least one candidate quantization path, a target quantization path is determined from the at least one candidate quantization path. Based on the target quantization path, the multiple original coding coefficients are quantized and encoded to obtain the encoded data of the image.
2. The image encoding method according to claim 1, characterized in that, The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the respective magnitudes of the plurality of original coding coefficients includes: Each of the plurality of original coding coefficients is quantized to obtain the first pre-quantized data corresponding to each original coding coefficient; Among the plurality of original coding coefficients, the corresponding second coding coefficient whose first prequantized data is located in a preset quantization coefficient range is determined; The even quantization path corresponding to the second coding coefficient and the zero quantization path corresponding to the second coding coefficient are used as the quantization path to be pruned.
3. The image encoding method according to claim 1, characterized in that, The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the respective magnitudes of the plurality of original coding coefficients includes: Compare each of the plurality of original coding coefficients with a preset pixel threshold to obtain a first comparison result corresponding to each original coding coefficient; Based on the first comparison result, the quantization path to be pruned is determined from the plurality of initial quantization paths.
4. The image encoding method according to claim 3, characterized in that, The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the first comparison result includes: If the first comparison result of any of the plurality of original coding coefficients indicates that it is greater than a preset pixel threshold, the zero-value quantization path corresponding to the third coding coefficient is taken as the first pruning path, wherein the third coding coefficient is the original coding coefficient among the plurality of original coding coefficients that is greater than the preset pixel threshold. If the first comparison result corresponding to any of the plurality of original coding coefficients is less than the preset pixel threshold, the even-quantized path corresponding to the fourth coding coefficient is taken as the second pruning path; the fourth coding coefficient is the original coding coefficient among the plurality of original coding coefficients that is less than the preset pixel threshold; The first pruning path and the second pruning path are used as the paths to be pruned and quantized.
5. The image encoding method according to claim 1, characterized in that, The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the respective magnitudes of the plurality of original coding coefficients includes: Each of the plurality of original coding coefficients is quantized to obtain the second pre-quantized data corresponding to each original coding coefficient; By comparing the second prequantized data corresponding to each of the plurality of original coding coefficients with a preset quantized pixel threshold, a second comparison result corresponding to each of the original coding coefficients is obtained; Based on the second comparison result, the quantization path to be pruned is determined from the plurality of initial quantization paths.
6. The image encoding method according to claim 5, characterized in that, The step of determining the quantization path to be pruned from the plurality of initial quantization paths based on the second comparison result includes: If the second comparison result of any of the plurality of original coding coefficients indicates that the second prequantization data is greater than a preset quantization pixel threshold, the zero-value quantization path corresponding to the fifth coding coefficient is used as the third pruning path. The fifth coding coefficient is the original coding coefficient among the plurality of original coding coefficients whose second prequantization data is greater than the preset quantization pixel threshold. If the second prequantization data corresponding to any of the plurality of original coding coefficients is less than the preset quantization pixel threshold, the even quantization path corresponding to the sixth coding coefficient is used as the fourth pruning path; the sixth coding coefficient is the original coding coefficient among the plurality of original coding coefficients whose second prequantization data is less than the preset quantization pixel threshold. The third pruning path and the fourth pruning path are used as the paths to be pruned and quantized.
7. The image encoding method according to any one of claims 1 to 6, characterized in that, The step of quantizing and encoding the multiple original coding coefficients based on the target quantization path to obtain the encoded data of the image includes: Based on the preset quantization state corresponding to each path node in the target quantization path, the original coding coefficients corresponding to each path node are quantized to obtain quantized coding coefficients. The encoded data is obtained by encoding based on the quantization coding coefficients.
8. An image encoding device, characterized in that, include: The data acquisition module is configured to acquire multiple raw coding coefficients of the image and multiple initial quantization paths corresponding to each raw coding coefficient. Each initial quantization path is a path connecting a path node containing a preset quantization state corresponding to each raw coding coefficient and a path node containing a preset quantization state corresponding to the next raw coding coefficient. The quantization path to be pruned module is configured to determine the quantization path to be pruned from the plurality of initial quantization paths based on the magnitude of each of the plurality of original coding coefficients; the path type of the quantization path to be pruned is matched with the magnitude of each original coding coefficient; the plurality of initial quantization paths include the zero-value quantization path corresponding to each original coding coefficient, the even quantization path corresponding to each original coding coefficient, and the odd quantization path corresponding to each original coding coefficient; The quantization path determination module to be pruned includes: a first coding coefficient determination unit, configured to determine a first coding coefficient whose value is within a preset coefficient range among the plurality of original coding coefficients; and a first quantization path determination unit to be pruned, configured to use the even quantization path corresponding to the first coding coefficient and the zero quantization path corresponding to the first coding coefficient as the quantization path to be pruned. The pruning module is configured to perform pruning of the quantization path to be pruned in the plurality of initial quantization paths, to obtain at least one quantization path to be selected. The target quantization path determination module is configured to determine a target quantization path from the at least one candidate quantization path based on the coding performance metrics corresponding to each of the at least one candidate quantization path. The quantization encoding processing module is configured to perform quantization encoding processing on the plurality of original encoding coefficients based on the target quantization path to obtain the encoded data of the image.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the image encoding method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the image encoding method as described in any one of claims 1 to 7.
11. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the image encoding method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Video coding method and device, storage medium and electronic equipment
CN113038124A
Dependent quantization pruning method based on context adaptive threshold
CN115086662A