Image processing method and device, electronic equipment and readable storage medium

CN116962693BActive Publication Date: 2026-09-18VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310957147.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-31
Publication Date
2026-09-18
Estimated Expiration
2043-07-31

AI Technical Summary

Technical Problem

[0004]如此,导致在使用上述两种方式对图像进行无损压缩时,所适用的范围较小,且数据压缩率较大,容易造成数据丢失

Benefits of technology

[0012] In this embodiment, the electronic device acquires the data volume and data value of the image data of each pixel in a first image block, wherein the data volume of the image data of each pixel is the same; based on the first data value, a target encoding method is selected from N preset encoding methods, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the first image block is encoded and compressed using the target encoding method to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n -3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 Let n be the amount of image data for the pixels being encoded and compressed. Thus, by adding N preset encoding methods, the range of image data values ​​for the pixels being encoded and compressed is broadened, allowing electronic devices to perform lossless compression on more images. Simultaneously, electronic devices can flexibly select a target encoding method with a lower compression ratio based on the maximum data value of different image data, thereby reducing the compression ratio of the image data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116962693B_ABST
    Figure CN116962693B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method and device, electronic equipment and a readable storage medium, and belongs to the electronic technical field. The method comprises the following steps: acquiring the data amount and data value of the image data of each pixel point in a first image block, wherein the data amount of the image data of each pixel point is the same; selecting a target encoding mode from N preset encoding modes based on a first data value, wherein the first data value is the data value of the image data of a first pixel point, and the first pixel point is a pixel point with the maximum image data value in the first image block; and adopting the target encoding mode to perform encoding compression on the first image block to obtain target data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing, and specifically relates to an image processing method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] With the rapid development of digital information technology, the massive amount of data generated after image digitization puts pressure on data transmission. To adapt to the development of the multimedia field and meet the demand for higher-speed image transmission, data stream simplification is often chosen when network bandwidth is limited, i.e., image compression. Among these methods, lossless compression ensures that no data information is lost from the image, and the original content of the image is completely restored during decompression. This method is widely used in the field of image transmission.

[0003] In related technologies, electronic devices typically employ either 3-based Bounded Integer Sequence Encoding (BISE) or 5-based BISE lossless image compression to losslessly compress image data within a specific range. Because this method requires combining information within image blocks into multiple binary integer sequences, the 3-based BISE lossless image compression method is only suitable for image data values ​​smaller than 3 × 2^35. n-2 In cases where the BISE image lossless compression method based on 5 is only applicable to image data values ​​smaller than 5×2, the actual compression method is not applicable. n-3 The situation.

[0004] As a result, the two methods mentioned above are only applicable to a small range of images and have a high compression ratio, which can easily lead to data loss. Summary of the Invention

[0005] The purpose of this application is to provide an image processing method, apparatus, electronic device, and readable storage medium that can increase the applicability of lossless image compression and reduce the data compression rate, thereby improving the data transmission rate.

[0006] In a first aspect, embodiments of this application provide an image processing method, comprising: acquiring the data volume and data value of image data for each pixel in a first image block, wherein the data volume of image data for each pixel is the same; selecting a target encoding method from N preset encoding methods based on the first data value, wherein the first data value is the data value of image data for the first pixel, and the first pixel is the pixel with the largest data value of image data in the first image block; and encoding and compressing the first image block using the target encoding method to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; and the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13 × 2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n -4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 , where n is the amount of image data for the pixels being encoded and compressed.

[0007] Secondly, embodiments of this application provide an image processing apparatus, comprising: an acquisition module, a determination module, and a processing module; the acquisition module is configured to acquire the data volume and data value of image data for each pixel in a first image block, wherein the data volume of image data for each pixel is the same; the determination module is configured to select a target encoding method from N preset encoding methods based on the first data value, wherein the first data value is the data value of image data for the first pixel, and the first pixel is the pixel with the largest data value of image data in the first image block; the processing module is configured to encode and compress the first image block using the target encoding method to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel compressed using the first encoding method is greater than or equal to 13 × 2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 , where n is the amount of image data for the pixels being encoded and compressed.

[0008] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions, when executed by the processor, implementing the steps of the method described in the first aspect.

[0009] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0010] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0011] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0012] In this embodiment, the electronic device acquires the data volume and data value of the image data of each pixel in a first image block, wherein the data volume of the image data of each pixel is the same; based on the first data value, a target encoding method is selected from N preset encoding methods, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the first image block is encoded and compressed using the target encoding method to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n -3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 Let n be the amount of image data for the pixels being encoded and compressed. Thus, by adding N preset encoding methods, the range of image data values ​​for the pixels being encoded and compressed is broadened, allowing electronic devices to perform lossless compression on more images. Simultaneously, electronic devices can flexibly select a target encoding method with a lower compression ratio based on the maximum data value of different image data, thereby reducing the compression ratio of the image data. Attached Figure Description

[0013] Figure 1 This is one of the schematic flowcharts of an image processing method provided in an embodiment of this application;

[0014] Figure 2 This is a schematic diagram illustrating an example of determining the target encoding method provided in an embodiment of this application;

[0015] Figure 3 This is a schematic diagram of pixel grouping in image data in an image processing method provided in an embodiment of this application;

[0016] Figure 4 This is a second schematic flowchart of an image processing method provided in an embodiment of this application;

[0017] Figure 5 This is the third schematic flowchart of an image processing method provided in this application embodiment;

[0018] Figure 6 This is a schematic diagram of the image compression and decompression processes in an image processing method provided in an embodiment of this application;

[0019] Figure 7 This is a fourth schematic flowchart of an image processing method provided in an embodiment of this application;

[0020] Figure 8 This is one of the structural schematic diagrams of an image processing apparatus provided in the embodiments of this application;

[0021] Figure 9 This is a second schematic diagram of the structure of an image processing device provided in an embodiment of this application;

[0022] Figure 10 This is the third schematic diagram of the structure of an image processing device provided in the embodiments of this application;

[0023] Figure 11 This is one of the hardware structure diagrams of an electronic device provided in the embodiments of this application;

[0024] Figure 12 This is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0026] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0027] The terms "at least one," "at least one of," etc., used in the specification and claims of this application refer to any one, any two, or a combination of two or more of the included items. For example, at least one of a, b, and c can mean: "a," "b," "c," "a and b," "a and c," "b and c," and "a, b, and c," where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more items, and its meaning is similar to that of "at least one."

[0028] The image processing method, apparatus, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0029] With the rapid development of digital information technology, the massive amount of data generated after image digitization puts pressure on data transmission. To adapt to the development of the multimedia field and meet the demand for higher-speed image transmission, data stream simplification is often chosen when network bandwidth is limited, namely image compression. Image compression can improve data transmission bandwidth to a certain extent. When transmitting content containing important information, such as fingerprints, it is necessary to complete the image compression and decompression process with the highest possible quality. Lossless compression methods can ensure that no data information is lost and completely restore the original content of the image. Therefore, lossless image compression methods are widely used in special image transmission fields.

[0030] In related technologies, electronic devices typically employ BISE 3-based lossless image compression (hereinafter referred to as BISE3) or BISE 5-based lossless image compression (hereinafter referred to as BISE5) to losslessly compress image data within a specific range. Because this method requires combining information within image blocks into multiple sets of binary integer sequences, BISE 3-based lossless image compression is only suitable for image data values ​​smaller than 3 × 2^3. n-2In cases where the BISE image lossless compression method based on 5 is only applicable to image data values ​​smaller than 5×2, the actual compression method is not applicable. n-3 For example, for a 4x4 image block with a 4-bit width, BISE3 is applicable to the range [0,11] with a data compression rate of 90.63%; while BISE5 is applicable to the range [0,9] with a data compression rate of 84.38%.

[0031] As a result, the two methods mentioned above are only applicable to a small range of images and have a high compression ratio, which can easily lead to data loss.

[0032] In this embodiment, the electronic device acquires the data volume and data value of the image data of each pixel in a first image block, wherein the data volume of the image data of each pixel is the same; based on the first data value, a target encoding method is selected from N preset encoding methods, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the first image block is encoded and compressed using the target encoding method to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n -3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3Let n be the amount of image data for the pixels being encoded and compressed. Thus, by adding N preset encoding methods, the range of image data values ​​for the pixels being encoded and compressed is broadened, allowing electronic devices to perform lossless compression on more images. Simultaneously, electronic devices can flexibly select a target encoding method with a lower compression ratio based on the maximum data value of different image data, thereby reducing the compression ratio of the image data.

[0033] The image processing method provided in this embodiment can be executed by an image processing device, which can be an electronic device, or a control module or processing module within the electronic device. The following description uses an electronic device as an example to illustrate the technical solution provided in this application embodiment.

[0034] This application provides an image processing method. Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this application is shown, which can be applied to electronic devices. Figure 1 As shown, the image processing method provided in this application embodiment may include the following steps 201 to 203.

[0035] Step 201: The electronic device acquires the data volume and data value of the image data of each pixel in the first image block.

[0036] In this embodiment of the application, the first image block can be a 4×4 image block, and each image block corresponds to one pixel, that is, a 4×4 image block contains 16 pixels.

[0037] In this embodiment of the application, the above image data is used to characterize various data of each pixel in the first image block, such as data of the three color channels R, G, or B.

[0038] In this embodiment of the application, for the image data of a pixel in the first image block, the above-mentioned data amount is used to characterize the data size of the pixel. For example, the data amount of the R channel image data of the pixel is 4 bits.

[0039] In the embodiments of this application, the amount of image data for each pixel is the same.

[0040] In this embodiment of the application, for the image data of a pixel in the first image block, the above data value is used to characterize the numerical value of the data of the pixel. For example, the data value of the R channel image data of the pixel is 245.

[0041] For example, taking a 4×4 image block as the first image block, the electronic device reads the image data of the 4×4 image block. Since the amount of data of each pixel in the 4×4 image block is the same, assuming that the amount of data of one pixel is n bits, the electronic device reads a total of 16n bits of data, that is, the total amount of image data of 16 pixels, as well as the data value of each pixel.

[0042] Step 202: The electronic device selects the target encoding method from N preset encoding methods based on the first data value.

[0043] In this embodiment of the application, the first data value is the data value of the image data for each first pixel.

[0044] In this embodiment of the application, the first pixel is the pixel with the largest data value in the image data of the first image block.

[0045] In this embodiment of the application, the electronic device compares the data values ​​of the image data of each pixel and finally obtains the maximum value among the data values, namely the first data value mentioned above.

[0046] For example, taking a 4×4 image block as the first image block, the electronic device can first compare the image data values ​​of every two adjacent pixels and take the larger value. After comparing 8 times, the image data values ​​of 8 pixels are obtained. Then, the image data values ​​of these 8 pixels are compared and the larger value is taken. After comparing 4 times, the image data values ​​of 4 pixels are obtained. Then, the image data values ​​of these 4 pixels are compared and the larger value is taken. After comparing 2 times, the image data values ​​of 2 pixels are obtained. Finally, the image data values ​​of the remaining 2 pixels are compared to obtain the maximum value, which is the first data value mentioned above.

[0047] In this embodiment of the application, the electronic device selects a target encoding method that conforms to the range of the first data value from the preset encoding methods based on the first data value.

[0048] In the embodiments of this application, the above-mentioned N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method.

[0049] For example, the encoding methods used in the first to sixth encoding methods described above can be BISE lossless compression, Huffman compression, or fractal image compression. It should be noted that this application uses BISE lossless compression as an example for illustration.

[0050] In this embodiment of the application, the image data value of the pixels encoded and compressed using the first encoding method described above is greater than or equal to 13×2.n-4 And less than 7×2 n-3 Hereinafter referred to as BISE7.

[0051] In this embodiment of the application, the image data value of the pixels encoded and compressed using the second encoding method described above is less than 9×2. n-4 Hereinafter referred to as BISE9.

[0052] In this embodiment of the application, the image data value of the pixels encoded and compressed using the third encoding method described above is greater than or equal to 5×2. n-3 And less than 11×2 n-4 Hereinafter referred to as BISE11.

[0053] In this embodiment, the image data value of the pixels encoded and compressed using the fourth encoding method described above is greater than or equal to 3×2. n-2 And less than 13×2 n-4 Hereinafter referred to as BISE13.

[0054] In this embodiment of the application, the image data value of the pixel points encoded and compressed using the fifth encoding method described above is greater than or equal to 11×2. n-4 And less than 3×2 n-2 Hereinafter referred to as BISE3.

[0055] In this embodiment, the image data value of the pixels encoded and compressed using the sixth encoding method described above is greater than or equal to 9×2. n-4 And less than 5×2 n-3 Hereinafter referred to as BISE5.

[0056] Where n is the amount of image data for the pixels being encoded and compressed.

[0057] In the embodiments of this application, the target encoding method can be at least one of the first to sixth encoding methods.

[0058] Optionally, in this embodiment of the application, step 202 above includes steps 202a to 202f:

[0059] Step 202a: When the first data value is less than 9 × 2 n-4 In such cases, the electronic device will use the second encoding method described above as the target encoding method.

[0060] Step 202b: When the above first data value is greater than or equal to 9 × 2 n-4 And less than 5×2 n-3 In such cases, the electronic device will use the sixth encoding method mentioned above as the target encoding method.

[0061] Step 202c: When the first data value is greater than or equal to 5 × 2 n-3 And less than 11×2 n-4 In such cases, the electronic device will use the aforementioned third encoding method as the target encoding method.

[0062] Step 202d: When the above first data value is greater than or equal to 11 × 2 n-4 And less than 3×2 n-2 In such cases, the electronic device will use the fifth encoding method mentioned above as the target encoding method.

[0063] Step 202e: When the above first data value is greater than or equal to 3 × 2 n-2 And less than 13×2 n-4 In such cases, the electronic device will use the fourth encoding method mentioned above as the target encoding method.

[0064] Step 202f: When the above first data value is greater than or equal to 13 × 2 n-4 And less than 7×2 n-3 In this case, the electronic device will use the first encoding method mentioned above as the target encoding method.

[0065] Further optionally, in this embodiment of the application, in conjunction with the above steps 202a to 202f, the image processing method provided in this embodiment of the application further includes step 202g:

[0066] Step 202g: When the first data value mentioned above is greater than 7 × 2 n-3 In this case, the electronic device determines not to encode or compress the first image block.

[0067] The following describes, using one possible embodiment, the process by which an electronic device determines the target encoding method. For example... Figure 2 As shown, specifically, it includes steps A1 to A6.

[0068] Step A1: The electronic device determines the maximum value (max), i.e., whether the first data value mentioned above is less than 3 × 2. n-2 If it is less than, then proceed to step A2; otherwise, proceed to step A5.

[0069] Step A2: The electronic device determines whether the maximum value max is less than 5 × 2. n-3 If it is less than, then proceed to step A3; otherwise, proceed to step A4.

[0070] Step A3: The electronic device determines whether the maximum value (max) is less than 9 × 2. n-4 If the value is less than 1, the BISE9 image compression method is used; otherwise, the BISE5 image compression method is used.

[0071] Step A4: The electronic device determines whether the maximum value max is less than 11×2. n-4 If the value is less than 1, the BISE11 compression method is used; otherwise, the BISE3 image compression method is used.

[0072] Step A5: The electronic device determines whether the maximum value (max) is less than 7 × 2. n-3 If the value is less than 1, proceed to step A6; otherwise, do not compress the data and add an identifier before the image data.

[0073] Step A6: The electronic device determines whether the maximum value (max) is less than 13 × 2. n-4 If the value is less than 1, the BISE13 image compression method is used; otherwise, the BISE7 image compression method is used.

[0074] Thus, since different encoding methods are applicable to different ranges, electronic devices can determine the most suitable target encoding method for the current image block by judging the largest data value in the image block. This allows electronic devices to flexibly select an encoding method with a lower image compression rate based on the data value of the actual image block's image data, thereby reducing the image compression rate.

[0075] Step 203: The electronic device uses the target encoding method to encode and compress the first image block to obtain target data.

[0076] In this embodiment of the application, the target data may be binary data.

[0077] In this embodiment of the application, the electronic device groups each pixel in the first image block according to the number of group elements corresponding to the target encoding method, and performs encoding and compression processing on the image data of each group of pixels according to the grouping, and finally obtains the encoded and compressed data, that is, the target data mentioned above.

[0078] In the image processing method provided in this application embodiment, the electronic device acquires the data volume and data value of the image data of each pixel in a first image block, wherein the data volume of the image data of each pixel is the same; based on the first data value, a target encoding method is selected from N preset encoding methods, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the first image block is encoded and compressed using the target encoding method to obtain target data; wherein, the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 Let n be the amount of image data for the pixels being encoded and compressed. Thus, by adding N preset encoding methods, the range of image data values ​​for the pixels being encoded and compressed is broadened, allowing electronic devices to perform lossless compression on more images. Simultaneously, electronic devices can flexibly select a target encoding method with a lower compression ratio based on the maximum data value of different image data, thereby reducing the compression ratio of the image data.

[0079] Optionally, in this embodiment of the application, step 203 above includes steps 203a and 203b:

[0080] Step 203a: The electronic device groups the image data of all pixels in the first image block according to the number of group elements M corresponding to the target encoding method.

[0081] In this embodiment of the application, each set of image data contains image data of M pixels.

[0082] In this embodiment of the application, the number of group elements M corresponding to the first encoding method is 6; the number of group elements M corresponding to the second and fourth encoding methods is 4; the number of group elements M corresponding to the third encoding method is 2; the number of group elements M corresponding to the fifth encoding method is 5; and the number of group elements M corresponding to the sixth encoding method is 3.

[0083] For example, taking a 4×4 image block as the first image block, when BISE3 is used to encode and compress the first image block, the pixels of the first image block are divided into 3 groups of 5 pixels each; when BISE5 is used to encode and compress the first image block, the pixels of the first image block are divided into 5 groups of 3 pixels each; when BISE7 is used to encode and compress the first image block, the pixels of the first image block are divided into 2 groups of 6 pixels each; when BISE9 is used to encode and compress the first image block, the pixels of the first image block are divided into 4 groups of 4 pixels each; when BISE11 is used to encode and compress the first image block, the pixels of the first image block are divided into 8 groups of 2 pixels each; and when BISE13 is used to encode and compress the first image block, the pixels of the first image block are divided into 4 groups of 4 pixels each.

[0084] For example, such as Figure 3 As shown, taking an image block with a group element count M of 4 and a first image block of 4×4 as an example, the 16 pixels in the first image block are divided into 4 groups of 4 pixels each. For example, the first group includes d 00 to d 03 The second group includes d 10 to d 13 The third group includes d 20 to d 23 The fourth group includes d 30 to d 33 Alternatively, taking a group element count M of 5 and a first image block of 4×4 as an example, the 16 pixels in the first image block are divided into 3 groups of 5 pixels each, and the remaining 1 pixel is not grouped.

[0085] Step 203b: The electronic device uses the target encoding method to encode and compress each group of image data to obtain each group of encoded image data.

[0086] In this embodiment of the application, the target data includes each group of encoded image data and the image data of ungrouped pixels in the first image block.

[0087] In the embodiments of this application, for each group of image data, encoding and compression are performed according to the algorithm corresponding to the target encoding method to obtain the corresponding encoded image data for each group.

[0088] Example 1, for BISE3, taking a 4×4 image block as an example, divide the 16 pixels of the first image block into 3 groups. First, take the highest 2 bits of the data of 5 pixels in each group and multiply them by 3 to the power of 0, 1, 2, 3, and 4 in turn, and accumulate them to obtain an 8-bit image data. Then, perform the same operation on the remaining 5 pixels in each group to obtain 3 groups of 8-bit image data. Add the image data of the pixels that were not grouped to obtain the final target data.

[0089] Example 2, for BISE5, taking a 4×4 image block as an example, divide the 16 pixels of the first image block into 5 groups. First, take the highest 3 bits of the data of 3 pixels in each group and multiply them by 5 to the power of 0, 1, and 2 in turn, and accumulate them to obtain a 7-bit image data. Then, perform the same operation on the remaining 3 pixels in each group to obtain 5 groups of 7-bit image data. Add the image data of the pixels that are not grouped to obtain the final target data.

[0090] Example 3, for BISE7, taking a 4×4 image block as an example, divide the 16 pixels of the first image block into two groups. First, take the highest 3 bits of the data of the 6 pixels in each group and multiply them by 7 to the power of 0, 1, 2, 3, 4 and 5 in sequence to obtain a 17-bit image data. Then, perform the same operation on the remaining 6 pixels in each group to obtain two groups of 17-bit image data. Add the image data of the pixels that were not grouped to obtain the final target data.

[0091] Example 4, for BISE9, taking a 4×4 image block as an example, divide the 16 pixels of the first image block into 4 groups. First, take the highest 4 bits of the data of the 4 pixels in each group and multiply them by 9 to the power of 0, 1, 2, and 3 in turn, and accumulate them to obtain a 13-bit image data. Then, perform the same operation on the remaining 4 pixels in each group to obtain 4 groups of 13-bit image data. Add the image data of the pixels that were not grouped to obtain the final target data.

[0092] Example 5, for BISE11, taking a 4×4 image block as an example, divide the 16 pixels of the first image block into 8 groups. First, take the highest 4 bits of the data of 2 pixels in each group, multiply them by 11 to the power of 0 and 11 to the power of 1, and accumulate them to get a 7-bit image data. Then, perform the same operation on the remaining 2 pixels in each group to get 8 groups of 7-bit image data. Add the image data of the pixels that did not participate in the grouping to finally get the target data.

[0093] Example 6, for BISE13, taking a 4×4 image block as an example, divide the 16 pixels of the first image block into 4 groups. First, take the highest 4 bits of the data of the 4 pixels in each group and multiply them by 16 to the power of 0, 1, 2 and 3 in turn, and accumulate them to obtain a 15-bit image data. Then, perform the same operation on the remaining 4 pixels in each group to obtain 4 groups of 15-bit image data. Add the image data of the pixels that are not grouped to obtain the final target data.

[0094] It should be noted that each of the above method examples, or various possible implementations of each method example, can be executed individually, or any two or more can be combined and executed. The specific implementation can be determined according to actual usage requirements, and this application embodiment does not impose any restrictions on this.

[0095] In this way, electronic devices can calculate images of different image data based on algorithms with different encoding methods, thereby expanding the applicability of BISE method for image compression.

[0096] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 4 As shown, after step 203 above, the image processing method provided in this application embodiment further includes step 301:

[0097] Step 301: The electronic device adds a target identifier to the target data.

[0098] In this embodiment of the application, the target identifier indicates the target encoding method.

[0099] In the embodiments of this application, the target identifier can be in binary number form or a special symbol.

[0100] For example, taking a binary value as the target identifier, the identifier 010 is added to the target data obtained by encoding and compression using the first encoding method; the identifier 111 is added to the target data obtained by encoding and compression using the second encoding method; the identifier 101 is added to the target data obtained by encoding and compression using the third encoding method; the identifier 011 is added to the target data obtained by encoding and compression using the fourth encoding method; the identifier 100 is added to the target data obtained by encoding and compression using the fifth encoding method; the identifier 110 is added to the target data obtained by encoding and compression using the sixth encoding method; and the identifier 00 is added to the uncompressed data.

[0101] In this way, electronic devices can add different identifiers to target data encoded using different encoding methods, so that the electronic devices can identify the corresponding encoding method based on the different identifiers, making it convenient for the electronic devices to use different encoding methods for decompression operations in the future.

[0102] Optionally, in the embodiments of this application, combined with Figure 4 ,like Figure 5 As shown, after step 301 above, the image processing method provided in this application embodiment further includes step 401:

[0103] Step 401: The electronic device decompresses the target data according to the target encoding method indicated by the target identifier to obtain the decompressed data.

[0104] In this embodiment of the application, target data is obtained, and according to the target encoding method indicated by the target identifier in the target data, decompression encoding operation is performed on each group of encoded image data in the target data according to the target encoding method to obtain each group of decompressed image data.

[0105] For example, combined Figure 3 ,like Figure 6 As shown, in conjunction with Example 4 above, taking BISE9 as an example, four groups of 13-bit image data are read sequentially. For the first data in the first group of image data, taking the remainder after dividing by 9 yields the high 4 bits d of the first data in the first group of image data. 00 The quotient of [n-1:n-4], when divided by 9 and then modulo 9, yields the high 4 bits d of the second data in the first set of image data. 01 The quotient of [n-1:n-4], divided by 81 and then modulo 9, yields the high 4 bits d of the third data in the first group of image data. 02 The quotient after dividing by 729 is the high 4 bits d of the fourth data in the first set of image data. 03 [n-1:n-4]. Repeat this step to process each group of encoded image data to obtain the high 4 bits of all data in the 4x4 image block. Finally, combine the highest and lowest bits in sequence to obtain the decompressed image data.

[0106] In this way, electronic devices can quickly identify the target encoding method used by the target data by using different target identifiers, which makes it convenient for electronic devices to decompress the target data in the corresponding way according to different target encoding methods.

[0107] The following describes the entire process of the image processing method provided in this application embodiment using one possible example. (In conjunction with...) Figure 2 ,like Figure 7As shown, specifically, steps B1 to B19 are included:

[0108] Step B1: The electronic device reads n bits of 4x4 block image data from within the image, which is the image data of the first image block mentioned above, totaling 16n bits.

[0109] Step B2: The electronic device determines the maximum value of the input data, max, which is the first data value mentioned above, by comparing the data values ​​in the 4x4 block of image data.

[0110] Step B3: The electronic device determines the maximum value (max), i.e., whether the first data value mentioned above is less than 3 × 2. n-2 If it is less than, proceed to step B4; otherwise, proceed to step B7.

[0111] Step B4: The electronic device determines whether the maximum value (max) is less than 5 × 2. n-3 If it is less than, proceed to step B5; otherwise, proceed to step B6.

[0112] Step B5: The electronic device determines whether the maximum value (max) is less than 9 × 2. n-4 If the image compression value is less than 1, then BISE9 image compression method is used, and then step B9 is executed; otherwise, BISE5 image compression method is used, and then step B10 is executed.

[0113] Step B6: The electronic device determines whether the maximum value max is less than 11×2. n-4 If the value is less than 1, the BISE11 compression method is used, and then step B11 is executed; otherwise, the BISE3 image compression method is used, and then step B12 is executed.

[0114] Step B7: The electronic device determines whether the maximum value (max) is less than 7 × 2. n-3 If the value is less than 1, proceed to step B8; otherwise, do not compress the data and proceed to step B15.

[0115] Step B8: The electronic device determines whether the maximum value (max) is less than 13 × 2. n-4 If the image compression value is less than 1, then BISE13 image compression method is used, and then step B13 is executed; otherwise, BISE7 image compression method is used, and then step B14 is executed.

[0116] Step B9: The electronic device adds flag 111, i.e. the aforementioned target identifier, to the compressed data stream, and then executes step 116.

[0117] Step B10: The electronic device adds a flag 110 before the compressed image data, and then performs step 116.

[0118] Step B11: The electronic device adds flag 101 before the compressed image data, and then performs step 116.

[0119] Step B12: The electronic device adds a flag 100 before the compressed image data, and then performs step 116.

[0120] Step B13: The electronic device adds the flag 011 before the compressed image data, and then performs step 116.

[0121] Step B14: The electronic device adds the flag 010 before the compressed image data, and then performs step 116.

[0122] Step B15: The electronic device adds a flag 00 before the compressed image data, and then performs step 116.

[0123] Step B16: The electronic device combines the flag, compressed high bits, uncompressed low bits, and all uncompressed pixel data into variable-length image data, i.e., the aforementioned target data. The decompression process proceeds to step B17.

[0124] Step B17: The electronic device reads the flag bit of the compressed image data.

[0125] Step B18: The electronic device selects the corresponding BISE compression method according to the flag bit and performs the corresponding decompression process.

[0126] Step B19: Output the complete image data in n-bit 4x4 blocks.

[0127] Thus, compared with the proposed BISE compression method based on 3 and the BISE compression method based on 5, the embodiments of this application add four BISE compression methods based on 7, 9, 11 and 13 for images. This combination method has a wider range of applications and a lower data compression rate, thereby achieving lossless compression of information within the image, ensuring the quality of transmitted images, effectively saving storage space compared to the original data, and improving the transmission rate to a certain extent.

[0128] It should be noted that the image processing method provided in this application embodiment can be executed by an image processing device, an electronic device, or a functional module or entity within an electronic device. This application embodiment uses an image processing device executing the image processing method as an example to illustrate the image processing device provided in this application embodiment.

[0129] Figure 8 A schematic diagram of a possible structure of the image processing apparatus involved in an embodiment of this application is shown. For example... Figure 8As shown, the image processing device 700 may include: an acquisition module 701, a determination module 702, and a processing module 703;

[0130] The acquisition module 701 is used to acquire the data volume and data value of the image data of each pixel in the first image block, wherein the data volume of the image data of each pixel is the same; the determination module 702 is used to select a target encoding method from N preset encoding methods based on the first data value, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the processing module 703 is used to encode and compress the first image block acquired by the acquisition module 701 using the target encoding method determined by the determination module 702 to obtain target data; wherein the N preset encoding methods include at least one of the following: first encoding method, second encoding method, third encoding method, fourth encoding method, fifth encoding method, and sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 , where n is the amount of image data for the pixels being encoded and compressed.

[0131] Optionally, in this embodiment of the application, the above-mentioned processing module 703 is specifically used for:

[0132] According to the number of group elements M corresponding to the target encoding method determined by the above-mentioned determining module 702, the image data of all pixels in the first image block are grouped, and each group of image data contains the image data of M pixels; using the target encoding method determined by the above-mentioned determining module 702, each group of image data is encoded and compressed to obtain each group of encoded image data; the target data includes each group of encoded image data and the image data of ungrouped pixels in the first image block.

[0133] Among them, the number of group elements M corresponding to the first encoding method is 6; the number of group elements M corresponding to the second and fourth encoding methods is 4; the number of group elements M corresponding to the third encoding method is 2; the number of group elements M corresponding to the fifth encoding method is 5; and the number of group elements M corresponding to the sixth encoding method is 3.

[0134] Optionally, in this embodiment of the application, the processing module 703 is further configured to, when the first data value is greater than 7×2 n-3 In this case, it is determined that the first image block will not be encoded or compressed.

[0135] Optionally, in the embodiments of this application, combined with Figure 8 ,like Figure 9 As shown, the image processing apparatus 700 further includes an adding module 704; the adding module 704 is used to add a target identifier to the target data after encoding and compressing the first image block using the target encoding method to obtain target data, the target identifier indicating the target encoding method.

[0136] Optionally, in the embodiments of this application, combined with Figure 8 ,like Figure 10 As shown, the image processing apparatus 700 further includes a decompression module 705: the decompression module 705 is used to decompress the target data according to the target encoding method determined by the determination module 702 indicated by the target identifier added by the addition module 704 after the addition module 704 adds a target identifier to the target data, so as to obtain decompressed data.

[0137] In the image processing apparatus provided in this application embodiment, the apparatus acquires the data volume and data value of the image data of each pixel in a first image block, wherein the data volume of the image data of each pixel is the same; based on the first data value, a target encoding method is selected from N preset encoding methods, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the first image block is encoded and compressed using the target encoding method to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 Let n be the amount of image data for the pixels being encoded and compressed. Thus, by adding N preset encoding methods, the range of image data values ​​for the pixels being encoded and compressed is broadened, allowing electronic devices to perform lossless compression on more images. Simultaneously, electronic devices can flexibly select a target encoding method with a lower compression ratio based on the maximum data value of different image data, thereby reducing the compression ratio of the image data.

[0138] The image processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0139] The image processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.

[0140] The image processing apparatus provided in this application embodiment can achieve... Figures 1 to 7 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0141] Optionally, such as Figure 11 As shown, this application embodiment also provides an electronic device 800, including a processor 801 and a memory 802. The memory 802 stores a program or instructions that can run on the processor 801. When the program or instructions are executed by the processor 801, they implement the various steps of the above-described image processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0142] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0143] Figure 12 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0144] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.

[0145] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 12 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0146] The processor 110 is configured to acquire the data volume and data value of the image data of each pixel in the first image block, wherein the data volume of the image data of each pixel is the same; the processor 110 is further configured to select a target encoding method from N preset encoding methods based on the first data value, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the processor 110 is further configured to encode and compress the first image block using the target encoding method determined by the processor 110 to obtain target data; wherein the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13 × 2 n-4 And less than 7×2 n-3 The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2n-3 , where n is the amount of image data for the pixels being encoded and compressed.

[0147] Optionally, in this embodiment of the application, the processor 110 is specifically used for:

[0148] According to the number of group elements M corresponding to the target encoding method, the image data of all pixels in the first image block are grouped, and each group of image data contains the image data of M pixels. The target encoding method is used to encode and compress each group of image data to obtain the encoded image data of each group. The target data includes the encoded image data of each group and the image data of the ungrouped pixels in the first image block. Among them, the number of group elements M corresponding to the first encoding method is 6; the number of group elements M corresponding to the second and fourth encoding methods is 4; the number of group elements M corresponding to the third encoding method is 2; the number of group elements M corresponding to the fifth encoding method is 5; and the number of group elements M corresponding to the sixth encoding method is 3.

[0149] Optionally, in this embodiment of the application, the processor 110 is further configured to, when the first data value is greater than 7×2 n-3 In this case, it is determined that the first image block will not be encoded or compressed.

[0150] Optionally, in this embodiment of the application, the processor 110 is further configured to add a target identifier to the target data after encoding and compressing the first image block using the target encoding method to obtain target data, wherein the target identifier indicates the target encoding method.

[0151] Optionally, in this embodiment of the application, the processor 110 is further configured to add a target identifier to the target data and then decompress the target data according to the target encoding method indicated by the target identifier to obtain decompressed data.

[0152] In the electronic device provided in this application embodiment, the electronic device acquires the data volume and data value of the image data of each pixel in a first image block, wherein the data volume of the image data of each pixel is the same; based on the first data value, a target encoding method is selected from N preset encoding methods, wherein the first data value is the data value of the image data of the first pixel, and the first pixel is the pixel with the largest data value of the image data in the first image block; the first image block is encoded and compressed using the target encoding method to obtain target data; wherein, the N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; the maximum value of the data value of the image data of the pixel encoded and compressed using the first encoding method is greater than or equal to 13×2 n-4 And less than 7×2 n-3The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 The maximum value of the image data of pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 Let n be the amount of image data for the pixels being encoded and compressed. Thus, by adding N preset encoding methods, the range of image data values ​​for the pixels being encoded and compressed is broadened, allowing electronic devices to perform lossless compression on more images. Simultaneously, electronic devices can flexibly select a target encoding method with a lower compression ratio based on the maximum data value of different image data, thereby reducing the compression ratio of the image data.

[0153] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.

[0154] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0155] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.

[0156] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0157] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0158] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0159] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0160] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described image processing method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0161] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0162] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0163] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. An image processing method, characterized in that, The method includes: Obtain the data volume and data value of each pixel in the first image block, wherein the data volume of each pixel is the same; Based on the first data value, a target encoding method is selected from N preset encoding methods. The first data value is the data value of the image data of the first pixel point, and the first pixel point is the pixel point with the largest data value of the image data in the first image block. The first image block is encoded and compressed using the target encoding method to obtain target data; The N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; The maximum value of the image data of pixels encoded and compressed using the first encoding method is greater than or equal to 13 × 2. n-4 And less than 7×2 n-3 ; The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 ; The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 ; The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 ; The maximum value of the image data of the pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 ; The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 , where n is the amount of image data for the pixels being encoded and compressed.

2. The method according to claim 1, characterized in that, The step of encoding and compressing the first image block using the target encoding method to obtain target data includes: According to the number of group elements M corresponding to the target encoding method, the image data of all pixels in the first image block are grouped, and each group of image data contains image data of M pixels. Using the target encoding method, each group of image data is encoded and compressed to obtain each group of encoded image data; The target data includes the encoded image data of each group and the image data of the ungrouped pixels in the first image block.

3. The method according to claim 2, characterized in that, The number of group elements M corresponding to the first encoding method is 6; The number of group elements M corresponding to the second encoding method and the fourth encoding method is 4; The number of group elements M corresponding to the third encoding method is 2; The number of group elements M corresponding to the fifth encoding method is 5; The number of group elements M corresponding to the sixth encoding method is 3.

4. The method according to claim 1 or 2, characterized in that, The method further includes: When the first data value is greater than 7×2 n-3 In this case, it is determined that the first image block will not be encoded or compressed.

5. The method according to claim 1, characterized in that, After encoding and compressing the first image block using the target encoding method to obtain target data, the method further includes: Add a target identifier to the target data, the target identifier indicating the target encoding method.

6. The method according to claim 3, characterized in that, After adding the target identifier to the target data, the method further includes: The target data is decompressed according to the target encoding method indicated by the target identifier to obtain the decompressed data.

7. An image processing apparatus, characterized in that, The image processing device includes: an acquisition module, a determination module, and a processing module; The acquisition module is used to acquire the data volume and data value of the image data of each pixel in the first image block, wherein the data volume of the image data of each pixel is the same. The determining module is used to select a target encoding method from N preset encoding methods based on a first data value, wherein the first data value is the data value of the image data of the first pixel point, and the first pixel point is the pixel point with the largest data value of the image data in the first image block obtained by the obtaining module. The processing module is used to encode and compress the first image block using the target encoding method determined by the determining module to obtain target data; The N preset encoding methods include at least one of the following: a first encoding method, a second encoding method, a third encoding method, a fourth encoding method, a fifth encoding method, and a sixth encoding method; The maximum value of the image data of pixels encoded and compressed using the first encoding method is greater than or equal to 13 × 2. n-4 And less than 7×2 n-3 ; The maximum value of the image data of pixels encoded and compressed using the second encoding method is less than 9×2. n-4 ; The maximum value of the image data of pixels encoded and compressed using the third encoding method is greater than or equal to 5 × 2. n-3 And less than 11×2 n-4 ; The maximum value of the image data of pixels encoded and compressed using the fourth encoding method is greater than or equal to 3 × 2. n-2 And less than 13×2 n-4 ; The maximum value of the image data of the pixels encoded and compressed using the fifth encoding method is greater than or equal to 11 × 2. n-4 And less than 3×2 n-2 ; The maximum value of the image data of pixels encoded and compressed using the sixth encoding method is greater than or equal to 9 × 2. n-4 And less than 5×2 n-3 , where n is the amount of image data for the pixels being encoded and compressed.

8. The apparatus according to claim 7, characterized in that, The processing module is specifically used for: According to the number of group elements M corresponding to the target encoding method determined by the determining module, the image data of all pixels in the first image block are grouped, and each group of image data contains image data of M pixels; Using the target encoding method determined by the determining module, each group of image data is encoded and compressed to obtain each group of encoded image data; The target data includes the encoded image data of each group and the image data of the ungrouped pixels in the first image block.

9. The apparatus according to claim 8, characterized in that, The number of group elements M corresponding to the first encoding method is 6; The number of group elements M corresponding to the second encoding method and the fourth encoding method is 4; The number of group elements M corresponding to the third encoding method is 2; The number of group elements M corresponding to the fifth encoding method is 5; The number of group elements M corresponding to the sixth encoding method is 3.

10. The apparatus according to claim 7 or 8, characterized in that, The processing module is further configured to handle cases where the first data value is greater than 7 × 2. n-3 In this case, it is determined that the first image block will not be encoded or compressed.

11. The apparatus according to claim 7, characterized in that, The device further includes: an addition module; The adding module is used to add a target identifier to the target data processed by the processing module after encoding and compressing the first image block using the target encoding method to obtain target data. The target identifier indicates the target encoding method.

12. The apparatus according to claim 11, characterized in that, The device further includes: a decompression module. The decompression module is used to decompress the target data processed by the processing module according to the target encoding method determined by the determining module, as indicated by the target identifier added by the adding module, after the adding module adds a target identifier to the target data, so as to obtain decompressed data.

13. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the image processing method as described in any one of claims 1 to 6.

14. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the image processing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Bounded rate near-lossless and lossless image compression

    CN104704828A

  • Bayer domain image lossy compression method

    CN115474044A