Image processing method and device, electronic equipment and storage medium

In the adaptive k-order exponential Columbus encoding, the encoding order is dynamically predicted based on the difference information of the pixels around the pixels to be encoded, and the problem of low prediction accuracy in the case of fluctuations in the encoded data is solved, and the encoding efficiency is improved.

CN119254980APending Publication Date: 2025-01-03BEIJING X RING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310807916.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-03
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In the prior art, the adaptive k-order exponential Columbus encoding has low accuracy in predicting the encoding order when the encoded data fluctuates greatly, resulting in waste of encoding bits.

Method used

By determining the target fluctuation index and target fluctuation level based on the difference information of the pixels around the pixels to be encoded, the target k value is predicted using corresponding calculation strategies, and the encoding order is dynamically adjusted to adapt to the encoded data size.

Benefits of technology

The accuracy of coding order prediction is improved, the waste of coding bits is reduced, and the encoding efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254980A_ABST
    Figure CN119254980A_ABST
Patent Text Reader

Abstract

The invention provides an image processing method and device, electronic equipment and a storage medium. The method comprises the steps of determining a target fluctuation index of a to-be-coded pixel based on k value difference information of pixels around the to-be-coded pixel; the k value is a k-order exponential-Golomb coding order, and the k value distribution information represents the k-order exponential-Golomb coding order distribution condition of different pixels; determining a target fluctuation level of the to-be-coded pixel from a plurality of preset fluctuation levels by using the target fluctuation index; predicting a target k value of the to-be-coded pixel by using a calculation strategy corresponding to the target fluctuation level; the target k value is used for carrying out k-order exponential Golomb coding on the pixel to be coded. According to the scheme provided by the invention, the accuracy of the coding order prediction result can be improved, and the waste of coding bits is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing, and in particular to an image processing method, device, electronic device and storage medium. Background Art

[0002] In the related art, in order to reduce the storage space of image or video data and reduce the data transmission bandwidth requirements, video coding technology can be used to encode video images to achieve lossless compression of data, for example, adaptive k-order exponential Golomb coding technology is used to encode image data. Among them, in the process of adaptive k-order exponential Golomb coding, context modeling is often performed based on the previous coded pixel to predict the coding order of the current coded pixel to achieve the adaptation of the coding order to the coded data size and reduce the number of coded bits. However, the coding order predicted by the previous coded pixel has a low accuracy, resulting in a waste of coding bits. Summary of the invention

[0003] The present disclosure provides an image processing method, device, electronic device and storage medium to solve the problems in the related art, improve the accuracy of coding order prediction results, and reduce the waste of coding bits.

[0004] A first aspect of the present disclosure provides an image processing method, the method comprising:

[0005] Based on the k value difference information of the pixels around the pixel to be encoded, the target fluctuation index of the pixel to be encoded is determined; the k value is the k-order exponential Golomb coding order, and the k value distribution information represents the distribution of the k-order exponential Golomb coding orders of different pixels;

[0006] Determining a target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels using the target fluctuation index;

[0007] The target k value of the pixel to be encoded is predicted by using the calculation strategy corresponding to the target fluctuation level; the target k value is used to perform k-order exponential Golomb coding on the pixel to be encoded.

[0008] In the above scheme, determining the target fluctuation index of the pixel to be encoded based on the k value difference information of the pixels around the pixel to be encoded includes:

[0009] Determining whether the pixel to be encoded is the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block;

[0010] In the case that the pixel to be encoded is not the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block, the target fluctuation index of the pixel to be encoded is determined based on k value difference information of pixels surrounding the pixel to be encoded.

[0011] In the above scheme, the method further comprises:

[0012] Determine that the target k value of the pixel to be encoded is a preset k value initial value; the pixel to be encoded is the first pixel to be encoded in the encoding sub-block;

[0013] Based on the preset k value initial value, the k value factor is calculated, and the calculated k value factor is used as the target k value of the pixel to be encoded; the pixel to be encoded is the second pixel to be encoded in the encoding sub-block.

[0014] In the above scheme, the target fluctuation index includes a first fluctuation index and a second fluctuation index, and determining the target fluctuation index of the pixel to be encoded based on the k value difference information of the pixels around the pixel to be encoded includes:

[0015] Based on the first information, the second information and the third information of the pixel to be encoded, calculating the difference of the k value between the first encoding row where the pixel to be encoded is located and the adjacent second encoding row, to obtain a first fluctuation index of the pixel to be encoded;

[0016] Based on the third information and the fourth information of the pixel to be encoded, the difference of the k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded is calculated to obtain the second fluctuation index of the pixel to be encoded; wherein,

[0017] The first information represents the mean of the k values ​​of the first encoding row, the second information represents the mean of the k values ​​of the second encoding row, the third information represents the k values ​​of the adjacent pixels of the pixel to be encoded, and the fourth information represents the distribution of the k values ​​of the context of the pixel to be encoded.

[0018] In the above solution, the use of the target fluctuation index to determine the target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels includes one of the following:

[0019] Determine that the target fluctuation level is the first level; the first fluctuation index is the first preset value, and the second fluctuation index is the third preset value;

[0020] Determine that the target dynamic level is the second level; the first fluctuation index is a first preset value, and the second fluctuation index is a fourth preset value;

[0021] Determine that the target fluctuation level is the third level; the first fluctuation index is the second preset value, and the second fluctuation index is the third preset value;

[0022] Determine that the target fluctuation level is the fourth level; the first fluctuation index is the second preset value, and the second fluctuation index is the fourth preset value; wherein,

[0023] The first preset value is smaller than the second preset value, and the third preset value is smaller than the fourth preset value.

[0024] In the above scheme, the difference of the k value between the first coding row where the pixel to be encoded is located and the adjacent second coding row is calculated based on the first information, the second information and the third information of the pixel to be encoded to obtain the first fluctuation index of the pixel to be encoded, including:

[0025] Calculate the absolute value of the difference between any two of the first information, the second information and the third information to obtain three absolute values ​​of the difference;

[0026] determining a first number of the three absolute difference values ​​that are less than or equal to a first threshold;

[0027] When the first number is greater than or equal to 2, the first fluctuation index is determined to be a first preset value; or, when the first number is less than 2, the first fluctuation index is determined to be a second preset value.

[0028] In the above scheme, the difference between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded is calculated based on the third information and the fourth information of the pixel to be encoded to obtain the second fluctuation index of the pixel to be encoded, including:

[0029] determining whether a first difference between the third information and the second information is less than or equal to a second threshold;

[0030] When the first difference is less than or equal to the second threshold, the second fluctuation index is a third preset value; or, when the first difference is greater than the second threshold, the second fluctuation index is a fourth preset value.

[0031] In the above scheme, the calculation strategy corresponding to the target fluctuation level is used to predict the target k value of the pixel to be encoded, including:

[0032] The target fluctuation level corresponding calculation strategy is utilized to weight the third information, the fourth information, the k value factor and the preset rounding parameter to calculate the target k value of the pixel to be encoded; wherein the preset rounding parameter weight coefficients corresponding to the first level to the fourth level increase sequentially.

[0033] In the above scheme, the method further comprises:

[0034] The first information and the second information are weighted to obtain the fourth information.

[0035] In the above solution, the second coding row is the previous coding row of the first coding row where the pixel to be coded is located, and the adjacent pixel is the pixel on the left side of the pixel to be coded.

[0036] In the above scheme, the method further comprises:

[0037] The product of the coding sub-block compression rate and the coding sub-block bit width is calculated to obtain the preset initial value of the k value.

[0038] A second aspect of the present disclosure provides an embodiment, wherein the device comprises:

[0039] A calculation unit, configured to determine a target fluctuation index of the pixel to be encoded based on k value difference information of pixels surrounding the pixel to be encoded; the k value is a k-order exponential Golomb coding order, and the k value distribution information represents a distribution of k-order exponential Golomb coding orders of different pixels;

[0040] A processing unit is used to use the target fluctuation index to determine the target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels; and to use a calculation strategy corresponding to the target fluctuation level to predict the target k value of the pixel to be encoded; the target k value is used to perform k-order exponential Columbus encoding on the pixel to be encoded.

[0041] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect embodiment of the present disclosure.

[0042] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.

[0043] A fifth aspect embodiment of the present disclosure provides a computer program product, including a computer program, which executes the method described in the first aspect embodiment of the present disclosure when a processor is used to execute the computer program.

[0044] The sixth aspect embodiment of the present disclosure proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send signals to the processor, the signals including computer instructions stored in the memory, and when the processor executes the computer instructions, the electronic device executes the method described in the first aspect embodiment of the present disclosure.

[0045] In summary, the image processing method, device, electronic device and storage medium proposed in the present invention predict the exponential Golomb coding order of the current pixel to be encoded by adopting different calculation strategies according to the differences of pixels surrounding the pixel to be encoded, so as to dynamically predict the order of the exponential Golomb coding according to the fluctuation of the encoded data, thereby improving the adaptability of the prediction order to the size of the encoded data, improving the accuracy of the prediction result, and reducing the waste of bits in the encoding.

[0046] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0048] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0049] Figure 2 A flowchart of an image processing method provided by an embodiment of the present disclosure;

[0050] Figure 3 A flowchart of an image processing method provided by an embodiment of the present disclosure;

[0051] Figure 4 A schematic diagram of updating positions of pixel k values ​​in a sub-block in an embodiment of the present disclosure;

[0052] Figure 5 A flowchart of an image encoding method provided by an application embodiment of the present disclosure;

[0053] Figure 6 A schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure;

[0054] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure;

[0055] Figure 8 A schematic diagram of the structure of a chip provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0056] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0057] With the continuous development of multimedia technology, in order to provide users with a better user experience, the resolution and other parameters of video images are gradually improved, and the amount of video image data is also increasing. In order to effectively store and quickly transmit video image data while ensuring the quality of video images, the concept of video image coding is proposed, and a variety of coding standards are proposed, such as the Joint Photographic Experts Group (JPEG), H.26X and Moving Picture Experts Group (MPEG) standards; video image coding is to efficiently compress image and video data while ensuring subjective image quality, so as to reduce storage space and transmission bandwidth. Among them, entropy coding (such as exponential Golomb coding) is an important part of the coding process. Entropy coding is mainly used to reduce redundancy from the bit stream, and the result of entropy coding will directly affect the final compression efficiency.

[0058] In the related art, in the process of performing exponential Golomb coding on video image data, the image to be processed can be first divided into multiple blocks, with the blocks as coding units, and each coding unit can be encoded with variable length or fixed length according to actual needs, and then each coding unit can be sequentially controlled, encoded and decoded; wherein, the exponential Golomb coding can be extended to k order, that is, k-order exponential Golomb coding, and the more the order k used in the coding process conforms to the probability distribution of the information source, the shorter the code length and the higher the coding efficiency. The optimal order is the base-two logarithm of the data to be encoded; k-order exponential Golomb coding can include the following two methods:

[0059] The first method: fixed k-order exponential Golomb coding;

[0060] The second method: adaptive k-order exponential Golomb coding.

[0061] For the first method, the order of k-order exponential Golomb coding is fixed, that is, when encoding each pixel, the same k value is used as the exponential Golomb coding order, for example, order 0 or order 1; however, since the numerical ranges of different data to be encoded are also different, using a fixed order for encoding will cause a large difference between the numerical value of the data to be encoded and the data range that can be represented by the exponential Golomb coding corresponding to the applied order, thereby making the applied order less adaptable to the data to be encoded and causing more bit waste.

[0062] For the second method, context modeling is performed based on the previous coded data of the current coded data, and then the k-th exponential Golomb coding order of the current coded data is predicted; however, when the coded data fluctuates greatly, for example, the pixel value of the previous coded pixel is 255, and the pixel value of the current coded pixel is 0, the optimal orders of different coded data will also be quite different. At this time, if the coding order of the current pixel is predicted based on the previous coded data, there will be a large gap between the application order of the current coded data and the optimal order, wasting coding bits.

[0063] In order to solve the problems existing in the related art, the present disclosure proposes an image processing method, device, electronic device and storage medium, which predicts the exponential Golomb coding order of the current pixel to be encoded by adopting different calculation strategies according to the differences of pixels around the pixel to be encoded, so as to dynamically predict the order of the exponential Golomb coding according to the fluctuation of the encoded data, thereby improving the adaptability of the prediction order and the size of the encoded data, improving the accuracy of the prediction result, and reducing the waste of bits in the encoding.

[0064] Before introducing the detailed solution of the present disclosure, the scenario to which the solution of the present disclosure is applied is described first. Figure 1 FIG. 1 is an application scenario diagram of an image processing method in an embodiment. Figure 1 As shown, the application scenario includes an electronic device 104, in which a camera module and several applications can be installed. The application can initiate an image acquisition instruction to acquire an image, and the camera module acquires the image 102. Among them, the camera module can include a front camera module and / or a rear camera module. Finally, the target image is sent to the target application. Among them, the electronic device 104 can be a smart phone, a tablet computer, a personal digital assistant, a wearable device, etc.

[0065] In some optional embodiments, the electronic device may also be a vehicle-mounted device or an Internet of Vehicles device, such as a smart car, etc. In the present disclosure, only a smart phone is taken as an example, but it does not limit the scope of the present disclosure.

[0066] A camera can be installed on an electronic device, and images can be acquired through the installed camera. Cameras can be divided into laser cameras, visible light cameras and other types according to the different images acquired. Laser cameras can acquire images formed by irradiating lasers onto objects, and visible light cameras can acquire images formed by irradiating visible light onto objects. Several cameras can be installed on an electronic device, and the installation locations are not limited. For example, a camera can be installed on the front panel of an electronic device, and two cameras can be installed on the back panel. The camera can also be installed inside the electronic device in an embedded manner, and then the camera can be opened by rotating or sliding. Specifically, a front camera and a rear camera can be installed on an electronic device. The front camera and the rear camera can acquire images from different perspectives. Generally, the front camera can acquire images from the front perspective of the electronic device, and the rear camera can acquire images from the back perspective of the electronic device.

[0067] It should be understood that in the present disclosure, the front camera or the rear camera is only used as an example to distinguish the shooting angles of different cameras, rather than to limit the functions of multiple cameras. The multiple cameras in the present disclosure can be rear cameras or front cameras at the same time, which is not limited in the present disclosure.

[0068] Several applications can be installed in electronic devices. Applications refer to software written for a certain application purpose in electronic devices. Electronic devices can provide services for users through applications. When an application needs to capture an image, it will initiate an image capture instruction. The electronic device will call the camera module according to the image capture instruction to capture the image. Image capture instructions refer to instructions used to trigger image capture operations.

[0069] The electronic device is also provided with a processor, and the image processing module in the processor can perform correction processing on the image captured by the camera module, for example, execute the image processing method provided in the present disclosure.

[0070] Figure 2 An image processing method is provided in an embodiment of the present disclosure. Figure 2 As shown, the method may include:

[0071] Step 201: Based on the k value difference information of the pixels around the pixel to be encoded, determine the target fluctuation index of the pixel to be encoded; the k value is the k-order exponential Golomb coding order, and the k value distribution information represents the distribution of the k-order exponential Golomb coding orders of different pixels.

[0072] In some embodiments, the k value difference information of the pixels around the pixel to be encoded may include the difference information between the encoding row where the pixel to be encoded is located and the previous encoding row, and may also include the difference information between the pixel to be encoded and adjacent pixels.

[0073] In some embodiments, it can be determined whether the difference between the coding row where the pixel to be encoded is located and the previous coding row meets a preset condition, and a first fluctuation index is generated based on the judgment result, and it can be determined whether the difference between the pixel to be encoded and the adjacent pixels meets the preset condition, and a second fluctuation index is generated based on the judgment result. Then, the target fluctuation index is composed of the first fluctuation index and the second fluctuation index.

[0074] Here, since the difference in pixel k values ​​around the pixel to be encoded can reflect the fluctuation between the pixel to be encoded and the surrounding pixels, adding a reference to the above difference in the process of predicting the k value of the current pixel to be processed can improve the accuracy of the prediction result.

[0075] Step 202: using the target fluctuation index, determine the target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels.

[0076] In some embodiments, an association relationship between a target fluctuation index and a fluctuation level may be established in advance, and after determining the target fluctuation index, the fluctuation level corresponding to the pixel to be encoded, that is, the target fluctuation level, may be determined based on the association relationship; for example, when the first fluctuation index is 0 and the second fluctuation index is 0, the corresponding fluctuation level is Level 1, when the first fluctuation index is 0 and the second fluctuation index is 1, the corresponding fluctuation level is Level 2, when the first fluctuation index is 1 and the second fluctuation index is 0, the corresponding fluctuation level is Level 3, and when the first fluctuation index is 1 and the second fluctuation index is 1, the corresponding fluctuation level is Level 4.

[0077] Step 203: using the calculation strategy corresponding to the target fluctuation level, predicting the target k value of the pixel to be encoded; the target k value is used to perform k-order exponential Golomb coding on the pixel to be encoded.

[0078] In some embodiments, a corresponding calculation strategy can be pre-established for each fluctuation level. Specifically, relevant parameters related to the difference in k values ​​of pixels surrounding the pixel to be encoded can be used for weighting. For example, the k value of the previous pixel, the context k value, the k value factor and the manually calibrated rounding parameter are weighted, and by adjusting the weights of the relevant parameters, the k value of the current pixel to be encoded can be dynamically predicted according to the fluctuation of the surrounding pixels, thereby improving the adaptability of the prediction result to the current pixel to be encoded and improving the accuracy of the prediction result.

[0079] In some embodiments, for each coding sub-block, since there is less available reference information in the adaptive prediction process of the first coding pixel, and the second coding pixel already has a left reference (i.e., the first coding pixel) during adaptive prediction, a predefined initial k value can be used to first perform k-order exponential Golomb coding on the first and coding pixels, and then a k value factor can be calculated using the initial k value as the k value of the second coding pixel; and for each pixel after the second coding pixel, the steps described in steps 201 to 203 are used to perform k-order exponential Golomb coding pixel by pixel.

[0080] In summary, the image processing method proposed in the present invention predicts the exponential Golomb coding order of the current pixel to be encoded by adopting different calculation strategies according to the differences of the pixels around the pixel to be encoded, so as to dynamically predict the order of the exponential Golomb coding according to the fluctuation of the encoded data, thereby improving the adaptability of the predicted order to the size of the encoded data, improving the accuracy of the prediction result, and reducing the waste of bits in encoding.

[0081] Figure 3 An image processing method is provided in an embodiment of the present disclosure. Figure 3 As shown, the method may include:

[0082] Step 301: Based on the first information, the second information and the third information of the pixel to be encoded, the difference of the k value between the first encoding row where the pixel to be encoded is located and the adjacent second encoding row is calculated to obtain the first fluctuation index of the pixel to be encoded; wherein,

[0083] The first information represents the average value of k values ​​of the first coding row, the second information represents the average value of k values ​​of the second coding row, and the third information represents the k values ​​of neighboring pixels of the pixel to be encoded.

[0084] In actual application, the second coding line may be the previous line of the first coding line.

[0085] In some embodiments, the difference in k value between the first coding row and the adjacent second coding row can be determined by judging whether the difference between each two of the first information, the second information and the third information meets a preset condition.

[0086] Based on this, in some embodiments, step 301 may specifically include:

[0087] Calculate the absolute value of the difference between any two of the first information, the second information and the third information to obtain three absolute values ​​of the difference;

[0088] determining a first number of the three absolute difference values ​​that are less than or equal to a first threshold;

[0089] When the first number is greater than or equal to 2, the first fluctuation index is determined to be a first preset value; or, when the first number is less than 2, the first fluctuation index is determined to be a second preset value; wherein the first preset value is less than the second preset value.

[0090] In actual application, when the first number is greater than or equal to 2, that is, when two or three absolute values ​​of the difference are less than the first threshold, it means that the fluctuation of the k value between the first coding row where the pixel to be encoded is located and the adjacent second coding row is small. At this time, the first fluctuation index is small, which is the first preset value; when the first number is less than 2, it means that the fluctuation of the k value between the first coding row where the pixel to be encoded is located and the adjacent second coding row is large. At this time, the first fluctuation index is large, which is the second preset value.

[0091] In some embodiments, the value of the first fluctuation index can be set to: a first preset value of 0, and a second preset value of 1.

[0092] In some embodiments, a k-value fluctuation detector D may be constructed, wherein the input information of D is the first information, the second information, and the third information, and the output is the first fluctuation index.

[0093] Exemplarily, the fluctuation detector D is used to determine the absolute value of the difference between two pieces of information in the three input information, namely, abs(x2-h1), abs(x2-h2), abs(h1-h2);

[0094] Wherein, h1 represents the mean value of k in the current coding row, h2 represents the mean value of k in the previous coding row, x1 represents the k value of the context of the pixel to be coded, and x2 represents the k value of the neighboring pixel of the pixel to be coded;

[0095] Determine whether abs(x2-h1), abs(x2-h2), abs(h1-h2) are less than or equal to the threshold t1;

[0096] When any two of them are less than or equal to the threshold t1, or when all three are less than or equal to t1, the output information of the fluctuation detector D is 0, indicating that the fluctuation between the current coding row and the previous coding row is small;

[0097] When only one absolute value of the difference among abs(x2-h1), abs(x2-h2), and abs(h1-h2) is less than or equal to the threshold t1, or all three are greater than t1, the output information of the fluctuation detector D is 1, indicating that the fluctuation between the current coding line and the previous coding line is small.

[0098] In some embodiments, the first threshold may be manually calibrated according to actual application requirements; specifically, the value range of the first threshold may be [0, 2].

[0099] Step 302: Based on the third information and the fourth information of the pixel to be encoded, the difference in k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded is calculated to obtain a second fluctuation index of the pixel to be encoded; wherein,

[0100] The fourth information represents the distribution of the k value of the pixel context to be encoded.

[0101] In practical applications, the adjacent pixel may be a pixel that is encoded before the pixel to be encoded, that is, a pixel on the left side of the pixel to be encoded.

[0102] In practical applications, the difference in k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded can be determined by judging whether the difference between the third information and the fourth information meets a preset condition.

[0103] Based on this, in some embodiments, step 302 may specifically include:

[0104] determining whether a first difference between the third information and the second information is less than or equal to a second threshold;

[0105] When the first difference is less than or equal to the second threshold, the second fluctuation index is a third preset value; or, when the first difference is greater than the second threshold, the second fluctuation index is a fourth preset value; wherein the third preset value is less than the fourth preset value.

[0106] In actual application, when the first difference is less than or equal to the second threshold, it means that the difference in k value between the context and the adjacent pixels is small, that is, the context k value is close to the adjacent pixel k value. At this time, the second fluctuation index is small, which is the third preset value; correspondingly, when the first difference is greater than the second threshold, it means that the difference in k value between the context and the adjacent pixels is large, that is, the context k value is not close to the adjacent pixel k value. At this time, the second fluctuation index is large, which is the third preset value.

[0107] In some embodiments, the value of the second fluctuation index can be set to: the third preset value is 0, and the fourth preset value is 1.

[0108] In some embodiments, the second threshold may be manually calibrated according to actual application requirements; specifically, the value range of the second threshold may be [0, 3].

[0109] In some embodiments, the context k value distribution of the pixel to be encoded may be determined based on the k value between the first encoding line and the adjacent second encoding line.

[0110] Based on this, in some embodiments, the method may further include:

[0111] The first information and the second information are weighted to obtain the fourth information.

[0112] Specifically, the mean k value of the first encoding row and the mean k value of the second encoding row may be weighted.

[0113] In some embodiments, the fourth information may also be calculated using the k value of the pixel to the left of the pixel to be encoded and the comprehensive k value information of the second encoding row.

[0114] It should be noted that step 302 may be executed after step 301, or before step 301, or simultaneously with step 301, which is not limited in the present embodiment.

[0115] Here, since the difference in k value between the first coding row and the adjacent second coding row, as well as the difference in k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded, can reflect the fluctuation between the pixel to be encoded and the surrounding pixels, therefore, adding a reference to the above-mentioned difference in the process of predicting the k value of the current pixel to be processed can improve the accuracy of the prediction result.

[0116] Step 303: using a target fluctuation index, determine a target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels; the target fluctuation index includes the first fluctuation index and the second fluctuation index.

[0117] In some embodiments, a first association relationship between the fluctuation index and the fluctuation level can be pre-established, and after determining the target fluctuation index, the fluctuation level corresponding to the pixel to be encoded, that is, the target fluctuation level, can be determined based on the first association relationship.

[0118] Based on this, in some embodiments, using the target fluctuation index to determine the target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels includes one of the following:

[0119] Determine that the target fluctuation level is the first level; the first fluctuation index is the first preset value, and the second fluctuation index is the third preset value;

[0120] Determine that the target fluctuation level is the second level; the first fluctuation index is a first preset value, and the second fluctuation index is a fourth preset value;

[0121] Determine that the target fluctuation level is the third level; the first fluctuation index is the second preset value, and the second fluctuation index is the third preset value;

[0122] The target fluctuation level is determined to be the fourth level; the first fluctuation index is the second preset value, and the second fluctuation index is the fourth preset value.

[0123] In actual application, the greater the fluctuation of the surrounding pixels of the pixel to be encoded, the higher the target fluctuation level corresponding to the pixel to be encoded, that is, the fluctuation degrees of the surrounding pixels corresponding to the first to fourth fluctuation levels increase successively.

[0124] For example, the first correlation relationship between the volatility index and the volatility level can be represented by the following table:

[0125] c1 c2 Volatility Level 0 0 1 0 1 2 1 0 3 1 1 4

[0126] Table 1

[0127] Wherein, c1 represents the first volatility index, and c2 represents the second volatility index.

[0128] Step 304: using the calculation strategy corresponding to the target fluctuation level, predicting the target k value of the pixel to be encoded; the target k value is used to perform k-order exponential Golomb coding on the pixel to be encoded.

[0129] In some embodiments, the target k value of the pixel to be encoded may be predicted by weighting using parameters related to the difference in k values ​​of pixels surrounding the pixel to be encoded.

[0130] Based on this, in some embodiments, step 304 may specifically include:

[0131] The target fluctuation level corresponding calculation strategy is utilized to weight the third information, the fourth information, the k value factor and the preset rounding parameter to calculate the target k value of the pixel to be encoded; wherein the preset rounding parameter weight coefficients corresponding to the first level to the fourth level increase sequentially.

[0132] In some embodiments, the k value factor can be calculated based on a preset initial k value.

[0133] In actual application, as mentioned above, the fluctuation degrees of surrounding pixels corresponding to the first level of fluctuation to the fourth level of fluctuation increase successively. The embodiment of the present disclosure uses the third information, the fourth information, the k value factor and the preset rounding parameter for weighting, and sets the weight of the rounding parameter to increase with the increase of the level. In this way, the k value prediction result of the current pixel to be encoded can be dynamically adjusted according to the fluctuation of the surrounding pixels, thereby improving the degree of adaptation of the prediction result and the current pixel to be encoded, and improving the accuracy of the prediction result.

[0134] In some embodiments, the preset rounding parameters can be manually calibrated according to actual application requirements.

[0135] In some embodiments, the sum of the third information, the fourth information, the k-value factor, and the weight coefficient of the preset rounding parameter may be 1.

[0136] In some embodiments, a corresponding calculation strategy may be pre-established for each fluctuation level, and a second association relationship between the fluctuation and the calculation strategy may be established.

[0137] Exemplarily, the second association relationship between the fluctuation level and the calculation strategy can be represented by the following table:

[0138]

[0139] Table 2

[0140] Wherein, c1 represents the first fluctuation index, c2 represents the second fluctuation index, fi(x1,x2,k_factor) represents the calculation strategy of level i, x1 represents the k value of the context of the pixel to be encoded, x2 represents the k value of the neighboring pixel of the pixel to be encoded, and k_factor is the k value factor;

[0141] The k value of the pixel to be encoded can be calculated using the following formula:

[0142] code_k=coeff1*x1+coeff2*x2+coeff3*k_factor+coeff4*pi;

[0143] Wherein, code_k represents the k value of the pixel to be encoded, pi represents the rounding parameter of leveli, coeffj represents the weight coefficient, and satisfies coeff1+coeff2+coeff3+coeff4=1; pi and coeffj can be obtained by manual calibration.

[0144] It should be noted that step 301 to step 305 are steps of performing k-order exponential Golomb coding pixel by pixel; for the first two coded pixels in each coded sub-block (such as Figure 4 As shown in the first row of dots in the figure, there is less reference information for adaptive prediction. In order to ensure the accuracy of the prediction results, the process of predicting the target k value needs to have sufficient reference information. Therefore, in order to ensure the accuracy of the prediction results, only the third coded pixel (such as Figure 4 (as shown in the far point of the second row in the figure) starts by using the method described in steps 301 to 305 to perform k-order exponential Golomb coding pixel by pixel.

[0145] Based on this, in some embodiments, the method may further include:

[0146] Determining whether the pixel to be encoded is the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block;

[0147] In the case that the pixel to be encoded is not the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block, the target fluctuation index of the pixel to be encoded is determined based on k value difference information of pixels surrounding the pixel to be encoded.

[0148] In practical applications, for each coded sub-block, since the first coded pixel (such as Figure 4 The first row of dots on the left in the adaptive prediction process has less reference information available, and the second coded pixel (such as Figure 4 (as shown by the dot on the right side of the first row in the figure) has a left reference (i.e., the first coded pixel) during adaptive prediction. Therefore, a predefined initial k value can be used to perform k-order exponential Golomb coding on the first and coded pixels, and then a k value factor can be calculated using the initial k value as the k value of the second coded pixel; and for each pixel after the second coded pixel, the steps described in steps 301 to 305 are used to perform k-order exponential Golomb coding pixel by pixel.

[0149] Based on this, in some embodiments, the method may further include:

[0150] The target k value of the pixel to be encoded is determined to be a preset k value initial value; the pixel to be encoded is the first pixel to be encoded in the encoding sub-block.

[0151] Based on the preset k value initial value, the k value factor is calculated, and the calculated k value factor is used as the target k value of the pixel to be encoded; the pixel to be encoded is the second pixel to be encoded in the encoding sub-block.

[0152] In some embodiments, the method may further include:

[0153] The target k value is used to perform k-order Exponential Golomb coding on the pixel to be encoded.

[0154] In some embodiments, when using the target k value to perform k-order exponential Golomb coding on the pixel to be encoded, the target k value can be used to encode the prefix code and suffix code of the pixel to be encoded; wherein the prefix code represents the quotient, which can be expressed as prefix in English, and the suffix code represents the remainder, which can be expressed as suffix in English.

[0155] Exemplarily, quotient=(data to be encoded) / (2^code_k), remainder=(data to be encoded)%(quotient); wherein the data to be encoded is the value of the pixel to be encoded, and code_k represents the k value of the pixel to be encoded.

[0156] It should be noted that in the image encoding process, the image to be processed needs to be divided into multiple blocks of equal width and height first, and the block is used as a coding unit, and then each coding unit is divided into multiple sub-blocks of equal width and height, and then each pixel of each sub-block is subjected to k-order exponential Golomb coding.

[0157] In summary, the image processing method proposed in the present invention predicts the exponential Golomb coding order of the current pixel to be encoded by adopting different calculation strategies according to the differences of the pixels around the pixel to be encoded, so as to dynamically predict the order of the exponential Golomb coding according to the fluctuation of the encoded data, thereby improving the adaptability of the predicted order to the size of the encoded data, improving the accuracy of the prediction result, and reducing the waste of bits in encoding.

[0158] The technical solution of the present disclosure is further described below in conjunction with specific application examples.

[0159] Figure 5 A flowchart of an image encoding method provided by an application embodiment of the present disclosure; Figure 5 As shown, the method may include:

[0160] Step 501: block division, that is, dividing the coding unit, and then executing step 502.

[0161] Specifically, the input image is divided into multiple blocks with equal width and height, and a block is used as a coding unit. Each coding unit can be encoded with variable length or fixed length according to actual needs.

[0162] Step 502: Code control, then execute step 502.

[0163] Specifically, a block is divided into multiple sub-blocks with equal width and height, or a block is taken as a sub-block; then, each sub-block is pre-read and texture analysis is performed; texture analysis is mainly used to adjust the number of bits allocated to each sub-block according to the complexity of the texture, and in the process of texture analysis, when the JPEG-LS method is used to losslessly encode the sub-block, the accumulated prediction residual is used as the gradient of the sub-block, and the block gradient is the sum of the gradients of all its sub-blocks.

[0164] If it is variable-length coding, the target code length of each block may be different; specifically, block target code length = (residual code length / residual number of blocks), sub-block target code length = block target code length*((1 / number of sub-blocks in the block)+(sub-block gradient / residual sub-block gradient in the block)) / 2; wherein, the initial value of the residual code length is the image target code length, and then after each coding unit is encoded, the code length used for the coding unit is subtracted; the initial value of the block residual sub-block gradient is the sum of all sub-block gradients of the block, and then after each sub-block is encoded, the sub-block gradient is subtracted.

[0165] If it is fixed-length coding, the target code length of each block is the same; specifically, the block target code length = image target code length / number of blocks, and the sub-block target code length is = (block target code length)*((1 / number of sub-blocks in the block)+(sub-block gradient / remaining sub-block gradient in the block)) / 2.

[0166] Use multiple sets of existing quantization parameters for JPEG-LS adaptive prediction and precoding, obtain the coding length required to encode the sub-block under multiple sets of quantization parameters, obtain the quantization parameter that meets the sub-block target code length, and use the obtained quantization parameter as the quantization parameter qp for encoding the current sub-block, write the qp of the sub-block to be encoded into the bitstream, and the encoding method can be direct transmission, variable length coding, etc.

[0167] When performing JPEG-LS adaptive prediction and pre-coding, the residual is calculated based on the true pixel value and the predicted value, and non-negative number mapping is performed. Then, quantization is performed based on the calculation result, and exponential Golomb coding is performed based on the quantization result. In this process, inverse quantization can be performed based on the quantization result, and a reference is decoded based on the inverse quantized bitstream data and preset decoding rules. Then, the pixel value is reconstructed based on the predicted value and the decoded residual, and the reconstructed pixel value is used to re-perform JPEG-LS adaptive prediction.

[0168] Step 503: Encode, and then execute step 504.

[0169] Here, after writing the qp of the current sub-block into the bitstream, the predicted value of the pixel to be encoded is obtained when performing JPEG-LS adaptive prediction pixel by pixel, and the quantized residual value of the pixel to be encoded is calculated, that is, (true value - predicted value) >> qp. Since the exponential Columbus can only encode non-negative data, non-negative data mapping is required. If the quantized residual value is less than zero, the data to be encoded is 2*the absolute value of the quantized residual value -1. If the quantized residual value is greater than or equal to zero, the data to be encoded is 2*the absolute value of the quantized residual value.

[0170] After the data to be encoded is obtained, exponential Golomb coding can be performed pixel by pixel; wherein, the update position of the pixel k value in the sub-block mainly includes three categories: the k value of the first pixel (such as Figure 4 The first row shows the left dot), the second pixel's k value (as shown in Figure 4The dots on the right side of the first row) and the pixel-by-pixel k value (as shown in Figure 4 The second row of dots).

[0171] Among them, since there is less reference information in the adaptive prediction process of the first pixel, the quantized residual value of the first pixel is usually large, and the corresponding data to be encoded is also large. Therefore, an initial k value is defined for the first quantized residual value of the encoding sub-block. The k value is calculated from the compression rate and bit width in the configuration and can be expressed by the following formula:

[0172] init_k=cmp_ratio*bit_depth

[0173] Among them, init_k is the initial k value, cmp_ratio is the compression ratio, and bit_depth represents the data bit width.

[0174] Compared with the first pixel, which has a larger quantization residual value due to lack of reference information, the second pixel has a left reference (i.e., the first pixel) during adaptive prediction. If the new k value is still directly adaptively predicted based on the first k value for the order prediction of the second data to be encoded, a certain number of bits will be wasted due to the large k value. Therefore, a k value factor k_factor can be calculated based on the initial k, k_factor=f(init_k), and the calculated k_factor is used as the k-order exponential Golomb coding order of the second pixel.

[0175] For the pixels after the second pixel, that is, from the third pixel to the last pixel in the current sub-block, the k value is updated pixel by pixel, that is, the order prediction of the k-order exponential Golomb coding of each pixel is performed pixel by pixel.

[0176] In the process of updating the k value pixel by pixel, the k value prediction will be based on three factors: the context k value x1, the k value used to encode the previous pixel (i.e., the neighboring k value) x2, and the k value factor k_factor; wherein, x1 can be determined by modeling the comprehensive k value information of the pixels to the left of the pixel to be encoded and the previous row of pixels; in the application embodiment of the present disclosure, x1 is obtained by weighting the k-mean h1 of the current encoding row of the sub-block and the k-mean h2 of the previous encoding row, i.e., x1=f_c(h1,h2).

[0177] In the k-value prediction process, a k-value fluctuation detector D can be modeled, whose input information is h1, h2 and x2, and the output is c1, that is, c1 = D(h1, h2, x2).

[0178] The specific judgment logic of the fluctuation detector D is: calculate the absolute value of the difference between the three input information, that is, abs(x2-h1), abs(x2-h2), abs(h1-h2), and determine whether the absolute value of each difference is less than or equal to the threshold t1. When the number of the three difference absolute values ​​that is less than or equal to the threshold t1 is two or three, it means that the fluctuation is small. At this time, c1 output by the fluctuation detector D is 0. Otherwise, it means that the fluctuation is large. At this time, c1 output by the fluctuation detector D is 1. Among them, the threshold t1 is an artificially calibrated threshold, and its value range is [0,2].

[0179] At the same time, a threshold t2 is set to determine whether the neighboring k value is close to the context k value, and the output is c2; the specific judgment logic is: if abs(x1-x2)<=t2, it means that the neighboring k value is close to the context k value, and the output c2 is 0; otherwise, the output c2 is 1; wherein the threshold t2 is obtained by manual calibration, and the threshold t2 value range is [0,3].

[0180] According to the results of c1 and c2, the pixel fluctuation degree around the pixel to be encoded is divided into four levels from 1 to 4. The corresponding relationship between c1, c2 and the divided levels is shown in Table 1; the k value prediction result can be expressed by the following formula:

[0181] code_k=fi(x1,x2,k_factor);

[0182] Wherein, code_k represents the k value of the pixel to be encoded, and fi(x1,x2,k_factor) represents the weighted formula of level i corresponding to the pixel to be encoded; the specific calculation formula can be expressed as:

[0183] code_k=coeff1*x1+coeff2*x2+coeff3*k_factor+coeff4*pi;

[0184] Among them, coeff j represents the weight coefficient, and pi is the rounding parameter of leveli; wherein, the weight coefficient and pi can be obtained by manual calibration, the weight coefficient satisfies coeff1+coeff2+coeff3+coeff4=1, and the rounding parameters p1 to p4 are different, and p1 to p4 gradually increase.

[0185] After predicting the k value code_k of the current data to be encoded, code_k can be used to encode the current pixel; wherein, the k-order Golomb code uses the prefix code prefix to represent the quotient and the suffix code suffix to represent the remainder, the quotient = (data to be encoded) / (2^code_k), the remainder = (data to be encoded)%(quotient).

[0186] The code table used for prefixes is shown in Figure 3:

[0187] business Codeword 0 1 1 110 2 100 3 1100 4 1000 5 11000 6 10000 7 01000 8 00000

[0188] The suffix length is code_k, which is used to write the remainder into the code stream.

[0189] It should be pointed out that if a fixed k value is used, when k is small and the data to be encoded is large, the quotient will be large, and when k is large and the data to be encoded is small, the remainder will be large. In both cases, the number of bits allocated is unreasonable. It can be seen that the k value directly affects the coding efficiency. If an adaptive k value is used, so that the k value has a certain correlation with the size of the data to be encoded, the rationality of the bit allocation can be improved, thereby saving more bits; among them, when k = log2 (data to be encoded), the sum of the prefix and suffix lengths is the shortest, that is, the encoding code length is the shortest.

[0190] After encoding the last sub-block of the current block, if it is variable-length coding, the remaining code length is updated; if it is fixed-length coding, the number of zeros padded is: block target code length - block coding code length.

[0191] It should be noted that the decoding process of the block is the inverse process of the encoding process; wherein the size of the decoding unit is consistent with the encoding unit; in the process of decoding with the block as the decoding unit, entropy decoding, residual calculation and reconstruction are performed in sequence.

[0192] Step 504: After the current pixel is encoded, determine whether the current pixel is the last pixel of the current coding unit; if the current pixel is not the last pixel, perform JPEG-LS adaptive prediction on the next pixel; if the current pixel is the last pixel, determine whether the current coding unit is the last coding unit, if not, re-execute step S2, if yes, end the current processing process.

[0193] In summary, the scheme proposed in the application embodiment of the present disclosure, in the process of image coding, after block division, code control, adaptive prediction and residual calculation, by calculating the fluctuation information around the data to be encoded, and adding the calculated fluctuation information to the prediction calculation of the k value, can dynamically predict the order of the exponential Columbus code, that is, the k value, according to the fluctuation of the surrounding pixels, thereby improving the accuracy of the prediction order, effectively reducing the difference between the prediction order and the optimal order, thereby improving the coding efficiency.

[0194] Figure 6 FIG. 6 is a schematic diagram of the structure of an image processing device 600 provided in an embodiment of the present disclosure. Figure 6 As shown, the image processing device comprises:

[0195] A calculation unit 601 is used to determine a target fluctuation index of the pixel to be encoded based on k value difference information of pixels around the pixel to be encoded; the k value is a k-order exponential Golomb coding order, and the k value distribution information represents the distribution of k-order exponential Golomb coding orders of different pixels;

[0196] Processing unit 602 is used to use the target fluctuation index to determine the target fluctuation level of the pixel to be encoded from multiple preset fluctuation levels; and to use the calculation strategy corresponding to the target fluctuation level to predict the target k value of the pixel to be encoded; the target k value is used to perform k-order exponential Columbus encoding on the pixel to be encoded.

[0197] In some embodiments, the computing unit 601 may be specifically configured to:

[0198] Determining whether the pixel to be encoded is the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block;

[0199] In the case that the pixel to be encoded is not the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block, the target fluctuation index of the pixel to be encoded is determined based on k value difference information of pixels surrounding the pixel to be encoded.

[0200] In some embodiments, the processing unit 602 may also be used to:

[0201] Determine that the target k value of the pixel to be encoded is a preset k value initial value; the pixel to be encoded is the first pixel to be encoded in the encoding sub-block;

[0202] Based on the preset k value initial value, the k value factor is calculated, and the calculated k value factor is used as the target k value of the pixel to be encoded; the pixel to be encoded is the second pixel to be encoded in the encoding sub-block.

[0203] In some embodiments, the computing unit 601 may be specifically configured to:

[0204] Based on the first information, the second information and the third information of the pixel to be encoded, calculating the difference of the k value between the first encoding row where the pixel to be encoded is located and the adjacent second encoding row, to obtain a first fluctuation index of the pixel to be encoded;

[0205] Based on the third information and the fourth information of the pixel to be encoded, the difference of the k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded is calculated to obtain the second fluctuation index of the pixel to be encoded; wherein,

[0206] The first information represents the mean of the k values ​​of the first encoding row, the second information represents the mean of the k values ​​of the second encoding row, the third information represents the k values ​​of the adjacent pixels of the pixel to be encoded, and the fourth information represents the distribution of the k values ​​of the context of the pixel to be encoded.

[0207] In some embodiments, the computing unit 601 may be used for one of the following:

[0208] Determine that the target fluctuation level is the first level; the first fluctuation index is the first preset value, and the second fluctuation index is the third preset value;

[0209] Determine that the target dynamic level is the second level; the first fluctuation index is a first preset value, and the second fluctuation index is a fourth preset value;

[0210] Determine that the target fluctuation level is the third level; the first fluctuation index is the second preset value, and the second fluctuation index is the third preset value;

[0211] Determine that the target fluctuation level is the fourth level; the first fluctuation index is the second preset value, and the second fluctuation index is the fourth preset value; wherein,

[0212] The first preset value is smaller than the second preset value, and the third preset value is smaller than the fourth preset value.

[0213] In some embodiments, the computing unit 601 may be specifically configured to:

[0214] Calculate the absolute value of the difference between any two of the first information, the second information and the third information to obtain three absolute values ​​of the difference;

[0215] determining a first number of the three absolute difference values ​​that are less than or equal to a first threshold;

[0216] When the first number is greater than or equal to 2, the first fluctuation index is determined to be a first preset value; or, when the first number is less than 2, the first fluctuation index is determined to be a second preset value.

[0217] In some embodiments, the computing unit 601 may be specifically configured to:

[0218] determining whether a first difference between the third information and the second information is less than or equal to a second threshold;

[0219] When the first difference is less than or equal to the second threshold, the second fluctuation index is a third preset value; or, when the first difference is greater than the second threshold, the second fluctuation index is a fourth preset value.

[0220] In some embodiments, the processing unit 602 may be specifically configured to:

[0221] The target fluctuation level corresponding calculation strategy is utilized to weight the third information, the fourth information, the k value factor and the preset rounding parameter to calculate the target k value of the pixel to be encoded; wherein the preset rounding parameter weight coefficients corresponding to the first level to the fourth level increase sequentially.

[0222] In some embodiments, the processing unit 602 may also be used to:

[0223] The first information and the second information are weighted to obtain the fourth information.

[0224] In some embodiments, the second coding row is a previous coding row of the first coding row where the pixel to be encoded is located, and the adjacent pixel is a pixel on the left side of the pixel to be encoded.

[0225] In some embodiments, the computing unit 601 may also be used to:

[0226] The product of the coding sub-block compression rate and the coding sub-block bit width is calculated to obtain the preset initial value of the k value.

[0227] Since the device provided in the embodiment of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation of the method is also applicable to the device provided in the embodiment and will not be described in detail in this embodiment.

[0228] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.

[0229] Figure 7 is a block diagram of an electronic device 700 for implementing the above-mentioned image processing method according to an exemplary embodiment. For example, the electronic device 700 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0230] Reference Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 610 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .

[0231] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.

[0232] The memory 704 is configured to store various types of data to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0233] The power supply component 706 provides power to the various components of the electronic device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 700.

[0234] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0235] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.

[0236] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0237] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0238] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0239] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0240] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0241] An embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the image processing method described in the above embodiment of the present disclosure.

[0242] An embodiment of the present disclosure further provides a computer program product, including a computer program, which executes the image processing method described in the above embodiment of the present disclosure when a processor is used.

[0243] The embodiment of the present disclosure also provides a chip, which can be seen in Figure 8 Schematic diagram of the chip structure shown. Figure 8 The chip shown includes a processor 801 and an interface circuit 802. The number of the processor 801 can be one or more, and the number of the interface circuit 802 can be one or more.

[0244] Optionally, the chip also includes a memory 803, which is used to store necessary computer programs and data; the interface circuit 802 is used to receive signals from the memory 803 and send signals to the processor 801, and the signals include computer instructions stored in the memory 803. When the processor 801 executes the computer instructions, the electronic device executes the image processing method described in the above embodiments of the present disclosure.

[0245] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0246] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0247] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0248] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.

[0249] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0250] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0251] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0252] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. An image processing method, characterized in that: The method comprises: Based on the k value difference information of the pixels around the pixel to be encoded, the target fluctuation index of the pixel to be encoded is determined; the k value is the k-order exponential Golomb coding order, and the k value distribution information represents the distribution of the k-order exponential Golomb coding orders of different pixels; Determining a target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels using the target fluctuation index; The target k value of the pixel to be encoded is predicted by using the calculation strategy corresponding to the target fluctuation level; the target k value is used to perform k-order exponential Golomb coding on the pixel to be encoded.

2. The method according to claim 1, characterized in that The step of determining a target fluctuation index of the pixel to be encoded based on k value difference information of pixels surrounding the pixel to be encoded includes: Determining whether the pixel to be encoded is the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block; In the case that the pixel to be encoded is not the first pixel to be encoded or the second pixel to be encoded in the encoding sub-block, the target fluctuation index of the pixel to be encoded is determined based on k value difference information of pixels surrounding the pixel to be encoded.

3. The method according to claim 2, characterized in that The method further comprises: Determine that the target k value of the pixel to be encoded is a preset k value initial value; the pixel to be encoded is the first pixel to be encoded in the encoding sub-block; Based on the preset k value initial value, the k value factor is calculated, and the calculated k value factor is used as the target k value of the pixel to be encoded; the pixel to be encoded is the second pixel to be encoded in the encoding sub-block.

4. The method according to claim 3, characterized in that The target fluctuation index includes a first fluctuation index and a second fluctuation index, and determining the target fluctuation index of the pixel to be encoded based on the k value difference information of the pixels around the pixel to be encoded includes: Based on the first information, the second information and the third information of the pixel to be encoded, calculating the difference of the k value between the first encoding row where the pixel to be encoded is located and the adjacent second encoding row, to obtain a first fluctuation index of the pixel to be encoded; Based on the third information and the fourth information of the pixel to be encoded, the difference of the k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded is calculated to obtain the second fluctuation index of the pixel to be encoded; wherein, The first information represents the mean of the k values ​​of the first encoding row, the second information represents the mean of the k values ​​of the second encoding row, the third information represents the k values ​​of the adjacent pixels of the pixel to be encoded, and the fourth information represents the distribution of the k values ​​of the context of the pixel to be encoded.

5. The method according to claim 4, characterized in that The using the target fluctuation index to determine the target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels includes one of the following: Determining the target fluctuation level as the first level; The first fluctuation index is a first preset value, and the second fluctuation index is a third preset value; Determine that the target dynamic level is the second level; the first fluctuation index is a first preset value, and the second fluctuation index is a fourth preset value; Determine that the target fluctuation level is the third level; the first fluctuation index is the second preset value, and the second fluctuation index is the third preset value; Determining the target fluctuation level to be level 4; The first fluctuation index is a second preset value, and the second fluctuation index is a fourth preset value; wherein, The first preset value is smaller than the second preset value, and the third preset value is smaller than the fourth preset value.

6. The method according to claim 5, characterized in that The step of calculating the difference in k value between a first coding row where the pixel to be encoded is located and an adjacent second coding row based on the first information, the second information and the third information of the pixel to be encoded, to obtain a first fluctuation index of the pixel to be encoded, comprises: Calculate the absolute value of the difference between any two of the first information, the second information and the third information to obtain three absolute values ​​of the difference; determining a first number of the three absolute difference values ​​that are less than or equal to a first threshold; When the first number is greater than or equal to 2, the first fluctuation index is determined to be a first preset value; or, when the first number is less than 2, the first fluctuation index is determined to be a second preset value.

7. The method according to claim 5, characterized in that The step of calculating the difference in k value between the context of the pixel to be encoded and the adjacent pixels of the pixel to be encoded based on the third information and the fourth information of the pixel to be encoded to obtain the second fluctuation index of the pixel to be encoded includes: determining whether a first difference between the third information and the second information is less than or equal to a second threshold; When the first difference is less than or equal to the second threshold, the second fluctuation index is a third preset value; or, when the first difference is greater than the second threshold, the second fluctuation index is a fourth preset value.

8. The method according to claim 5, characterized in that The method of using the calculation strategy corresponding to the target fluctuation level to predict the target k value of the pixel to be encoded includes: The target fluctuation level corresponding calculation strategy is utilized to weight the third information, the fourth information, the k value factor and the preset rounding parameter to calculate the target k value of the pixel to be encoded; wherein the preset rounding parameter weight coefficients corresponding to the first level to the fourth level increase sequentially.

9. The method according to claim 4, characterized in that The method further comprises: The first information and the second information are weighted to obtain the fourth information.

10. The method according to claim 4, characterized in that The second coding row is a previous coding row of the first coding row where the pixel to be coded is located, and the adjacent pixels are pixels on the left side of the pixel to be coded.

11. The method according to claim 3, characterized in that The method further comprises: The product of the coding sub-block compression rate and the coding sub-block bit width is calculated to obtain the preset initial value of the k value.

12. An image processing device, characterized in that: The device comprises: A calculation unit, configured to determine a target fluctuation index of the pixel to be encoded based on k value difference information of pixels surrounding the pixel to be encoded; the k value is a k-order exponential Golomb coding order, and the k value distribution information represents a distribution of k-order exponential Golomb coding orders of different pixels; A processing unit is used to use the target fluctuation index to determine the target fluctuation level of the pixel to be encoded from a plurality of preset fluctuation levels; and to use a calculation strategy corresponding to the target fluctuation level to predict the target k value of the pixel to be encoded; the target k value is used to perform k-order exponential Columbus encoding on the pixel to be encoded.

13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 11.

15. A chip, characterized in that: It comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory of an electronic device and send the signal to the processor, the signal includes a computer instruction stored in the memory, and when the processor executes the computer instruction, the electronic device executes the method described in any one of claims 1 to 11.