Image data processing method, device, computer equipment and storage medium
By determining the target interval to which the pixel data of the image data belongs in multiple preset intervals and mapping it into a bit sequence, the problem of low image data transmission efficiency is solved, and more efficient image data transmission is achieved.
Patent Information
- Application Number
- CN202111308228.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-11-05
AI Technical Summary
In the prior art, pixel data of image data is usually stored with the same type of variables, resulting in excessive image data and reduced transmission efficiency, especially in scenarios with small bandwidth and high latency requirements.
By taking values based on the pixel data of the image data, the target preset interval to which the pixel data belongs is determined in a plurality of preset intervals, and the pixel data is mapped into a bit sequence formed by the number of target units, so as to reduce the number of bits occupied by the image data.
The number of bits occupied by image data is effectively reduced, and the transmission efficiency of image information is improved, especially in scenarios with small bandwidth and high latency requirements, which significantly improve the transmission performance.
Smart Images

Figure CN114092578B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the technical field of computer data processing, and particularly relates to an image data processing method, apparatus, computer device, and storage medium. Background Art
[0002] With the continuous development of computer and Internet technologies, the application of image data is becoming more and more extensive, and the depth of images is also increasing continuously. In many fields, a large number of images need to be transmitted and displayed. Among them, some fields have relatively high requirements for the rate of image information transmission. For example, in the fields of medical images and digital communications, fast and lossless image transmission is very important for some medical scenarios. However, the pixel data of image data in the prior art is usually stored using variables of the same type, which will cause the image data to be too large, reduce the transmission efficiency, and have a greater impact on some scenarios with small bandwidth and high latency requirements. Summary of the Invention
[0003] In view of this, multiple embodiments of this specification are dedicated to providing an image data processing method, apparatus, computer device, and storage medium to reduce the number of bit positions occupied by image data to a certain extent and improve the transmission efficiency of image information.
[0004] An embodiment of this specification provides an image data processing method, including: determining a target preset interval to which the pixel data belongs from multiple preset intervals based on the value of the pixel data of the image data; where the preset interval represents the value range of the pixel data; where the number of units corresponding to different preset intervals is different; the number of units corresponding to the target preset interval is the target number of units; mapping the pixel data into a bit sequence formed by the target number of bit units; where the bit unit includes a preset number of bit positions; so that a specified bit position of the bit sequence represents the target number of units.
[0005] An embodiment of this specification provides an image data processing method, including: obtaining bitstream data; where the bitstream data includes multiple bit units; where the bit unit includes a preset number of bit positions; determining the target number of units based on the specified bit position of the bit unit; where the target number of units is the number of bit units corresponding to one pixel data; converting the target number of bit units in the bitstream data into the corresponding pixel data.
[0006] An embodiment of this specification provides an image data processing apparatus, including: an interval determination module configured to determine a target preset interval to which the pixel data belongs from a plurality of preset intervals based on the value of the pixel data of the image data; wherein, the preset interval represents the value range of the pixel data; wherein, the number of units corresponding to different preset intervals is different; the number of units corresponding to the target preset interval is the target number of units; an encoding module configured to map the pixel data into a bit sequence formed by the target number of bit units; wherein, the bit unit includes a preset number of bits; so that a specified bit of the bit sequence represents the target number of units.
[0007] An embodiment of this specification provides an image data processing apparatus, including: an acquisition module configured to acquire bitstream data; wherein, the bitstream data includes a plurality of bit units; wherein, the bit unit includes a preset number of bits; a quantity determination module configured to determine a target number of units based on a specified bit of the bit unit; wherein, the target number of units is the number of bit units corresponding to one pixel data; a decoding module configured to convert the target number of bit units in the bitstream data into corresponding pixel data.
[0008] An embodiment of this specification provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the method described in the above embodiment when executing the computer program.
[0009] An embodiment of this specification provides a computer-readable storage medium, on which a computer program is stored, and the computer program implements the method described in the above embodiment when being executed by a processor.
[0010] By mapping pixel data with different values into a bit sequence including a different target number of bit units, the embodiment of this specification reduces the number of bits occupied by the image data. Description of the Drawings
[0011] Figure 1 Shown is a schematic diagram of interactions between different parties in a scenario example provided by an embodiment.
[0012] Figure 2 Shown is a schematic diagram of interactions between different parties in a scenario example provided by an embodiment.
[0013] Figure 3 Shown is a schematic flowchart of an image data processing method provided by an embodiment.
[0014] Figure 4 Shown is a schematic flowchart of an image data replacement method provided by an embodiment.
[0015] Figure 5 The figure shows a schematic flowchart of an image data processing method provided by an embodiment.
[0016] Figure 6 The figure shows a block diagram of the structure of an image data processing device provided by an embodiment.
[0017] Figure 7 The figure shows a block diagram of the structure of an image data processing device provided by an embodiment. Detailed implementation manners
[0018] To enable those skilled in the art of this technology to better understand the solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope protected by this specification.
[0019] Please refer to Figure 1 and Figure 2 . In a scenario example provided in this specification, an image data processing system is provided. The image data processing system includes multiple clients. One of the client users may be a radiologist who needs to transmit the collected medical images to the attending doctor through the image data processing system for the attending doctor to use as materials for diagnosing the patient's condition.
[0020] On the client side where the radiologist is located, the radiologist uploads the obtained medical images to the image data processing system for transmission. The system will automatically analyze the information of the medical images and extract the pixel data of the RAW format images therein. Then, it reads the values of each pixel data one by one, screens out different pixel values to form a pixel data set, and records the frequencies of the different pixel values appearing in the image. After obtaining the pixel data set, the system calculates the score of each pixel value based on the preset weight according to the number of bits of the binary represented by each pixel value and the frequency of its appearance in the image. Among them, a higher score of a pixel value indicates that both the frequency of its appearance and the number of bits occupied by the binary represented by this pixel value are relatively high. Then, the pixel values in the pixel data set are sorted from high to low according to the corresponding scores to obtain a pixel data sequence. Next, according to the order of the pixel data sequence, a correspondence between each pixel value and a positive integer is established. Among them, the first pixel value corresponds to 1 in the positive integers, the second pixel value corresponds to 2 in the positive integers, and so on. Each group of correspondences is recorded to form a mapping sequence. The mapping sequence includes key-value pairs of pixel values and their corresponding positive integers, and this positive integer is called the mapped pixel data. After obtaining the mapping sequence, the system replaces the same pixel data in the image with the corresponding mapped pixel data in the mapping sequence. Thereafter, the system further processes based on the replaced image data and maps each pixel data into a bit sequence formed by different numbers of bytes for transmission.
[0021] During the mapping process of each pixel data, the system first reads the value of the pixel data. Then, based on multiple intervals preset in the system, it determines the interval to which the pixel data belongs. Next, it obtains the number of target units corresponding to the belonging interval, and the number of target units is used to determine the conversion of the pixel data into a bit sequence formed by the number of bytes of the target units. Among them, when the value of the pixel data is between 0 and 63, the number of target units is 1; when the value of the pixel data is between 64 and 16447, the number of target units is 2; when the value of the pixel data is between 16448 and 4210751, the number of target units is 3; when the value of the pixel data is between 4210752 and 1077952575, the number of target units is 4. After determining the number of target units, the system obtains the offset of the pixel data corresponding to the number of target units preset in the system through the number of target units. Among them, when the number of target units is 1, the offset of the pixel data is 0; when the number of target units is 2, the offset of the pixel data is 16320; when the number of target units is 3, the offset of the pixel data is 8372160; when the number of target units is 4, the offset of the pixel data is 3217014720. Add the pixel value of the pixel data to the offset to obtain the value corresponding to the mapped bit sequence, and then represent the offset data in a binary sequence to obtain the bit sequence. Finally, the system will sequentially transmit the bit sequences corresponding to each pixel data in the form of a bit stream over the network.
[0022] On the client side where the attending physician is located, when the system receives the bit stream data transmitted from the radiologist side, the system first obtains a byte-length bit data and determines the number of bytes included in the bit sequence according to the specified bit positions. Among them, the highest two bit positions of the first byte-length bit data in the bit sequence are the specified bit positions. When the specified bit positions are 00, that is, when the value represented by the bit data is between 0 and 63, the number of target units of the bit sequence is 1 and is formed by one byte; when the specified bit positions are 01, that is, when the value represented by the bit data is between 64 and 127, the number of target units of the bit sequence is 2 and is formed by two bytes; when the specified bit positions are 10, that is, when the value represented by the bit data is between 128 and 191, the number of target units of the bit sequence is 3 and is formed by three bytes; when the specified bit positions are 11, that is, when the value represented by the bit data is between 192 and 255, the number of target units of the bit sequence is 4 and the bit sequence is formed by four bytes. When the bit sequence of the system is composed of bit data of more than two bytes, the system continues to obtain the corresponding number of bytes from the bit stream and splices these bytes in the order of acquisition to obtain the bit sequence. Among them, the byte obtained first is located at the high position of the bit sequence. Then, the system will obtain the offset according to the number of target units corresponding to the bit sequence, and then subtract the offset from the value corresponding to the bit sequence to obtain the pixel data.
[0023] After obtaining the bit sequence corresponding to the pixel data from the bitstream data, the system will continue to obtain the mapping sequence and swap the keys and values of each key-value pair in the mapping sequence. Then, each pixel data in the image data is compared with the keys in the key-value pairs in the mapping sequence. When the pixel data is the same as the key value in the key-value pair, the pixel value is replaced with the value in the key-value pair until all pixel data have completed the above steps. At this time, the system will generate an image based on each pixel data and display it on the display interface of the attending physician's terminal.
[0024] The above is only a scenario example provided in this specification and is not intended to limit the present invention. Any modifications, equivalent replacements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
[0025] The embodiments of this specification provide an image data processing system. The image data processing system may include a client and a server. The client may be an electronic device with network access capabilities. Specifically, for example, the client may be a desktop computer, a tablet computer, a laptop computer, a smart phone, a digital assistant, a smart wearable device, a shopping guide terminal, a television, a smart speaker, a microphone, etc. Among them, the smart wearable devices include but are not limited to smart bracelets, smart watches, smart glasses, smart helmets, smart necklaces, etc. Alternatively, the client may also be software that can run on the electronic device. The server may be an electronic device with certain computing and processing capabilities. It may have a network communication module, a processor, a memory, etc. Of course, the server may also refer to the software running on the electronic device. The server may also be a distributed server, which may be a system with multiple processors, memories, network communication modules, etc. operating in cooperation. Alternatively, the server may also be a server cluster formed by several servers. Or, with the development of science and technology, the server may also be a new technical means that can implement the corresponding functions of the embodiments of the specification. For example, it may be a new form of "server" based on quantum computing.
[0026] Please refer to Figure 3 , the embodiments of this specification provide an image data processing method, and the method includes the following steps.
[0027] Step S110: Based on the value of the pixel data of the image data, determine the target preset interval to which the pixel data belongs among multiple preset intervals; wherein, the preset interval represents the value range of the pixel data; wherein, the number of units corresponding to different preset intervals is different; the number of units corresponding to the target preset interval is the target number of units.
[0028] In this embodiment, according to the value of the pixel data, the number of target units can be determined, and then the pixel data can be further processed according to the number of target units.
[0029] The image data represents the information of an image, which can be the pixel data of the image or can also include the attributes of the image, such as resolution, number of channels, saturation, position information, generation time, and other information. The image data can represent a grayscale image, a color image, or a binary image. Of course, the depth of the image represented by the image data is not limited. Specifically, it can be 8 or 16. In addition, the format of the image data can also be any format, which can be common image formats such as JPG format and BMP format, or can also be image formats applied in specific fields such as RAW format and DICOM format.
[0030] The pixel data is the information of each pixel in the image data, which can include the pixel value of each pixel in the image or can also be the pixel values of some pixels. The pixel data can be presented through a pixel matrix, recorded in a one-dimensional vector, or recorded in a multi-dimensional tensor. Among them, the pixel data can be represented by multiple bits. Specifically, for example, the pixel data can be represented by 8 bits or 16 bits. When the pixel data is represented by 8 bits, the value range of the pixel data can be from 0 to 255. When the pixel data is represented by 16 bits, the value range of the pixel data can be from 0 to 65535. In some embodiments, the pixel data can also be the data obtained by encoding the original pixel data of the image data. For example, the pixel value of each pixel data is obtained by adding a certain fixed value to the original pixel value, or the pixel value of the pixel data is obtained by replacing the original pixel with the corresponding value in a set of corresponding relationships according to a set of corresponding relationships.
[0031] The preset interval represents the value range of a set of numerical values. Among them, the preset interval can be continuous or can also be discontinuous integers. For example, the discontinuous preset interval can be from 0 to 63 and from 127 to 255. The set of all integers in the multiple preset intervals contains the set composed of the pixel data of the image data to be processed. The preset interval can be pre-stored in the server or can also be calculated in real time during the image data processing process.
[0032] In image data processing, according to the value of pixel data, the preset interval to which the value belongs can be determined, and this preset interval is the target preset interval. Thus, the target unit quantity corresponding to the pixel data can be determined. The target unit quantity represents the unit quantity corresponding to the target preset interval. When different pixel data belong to different preset intervals, the target unit quantities corresponding to these pixel data are also different. However, when different pixels belong to the same preset interval, the target unit quantities corresponding to these pixels are the same. For example, there are two preset intervals. The first preset interval is from 0 to 127, and the corresponding target unit quantity is 1. The second preset interval is from 128 to 32895, and the corresponding target unit quantity is 2. When the input pixel data are 64 and 10000 respectively, their target unit quantities are 1 and 2 respectively. When the input pixel data are 200 and 16383, their corresponding target unit quantities are both 2.
[0033] Step S120: Map the pixel data into a bit sequence formed by the target unit quantity of bit units; wherein, the bit unit includes a preset quantity of bits; so that the specified bit of the bit sequence represents the target unit quantity.
[0034] After determining the target unit quantity, the process of mapping the pixel data into a bit sequence formed by the target unit quantity of bit units will convert the pixel data stored in the same type in the server into a bit sequence including different bits. While retaining the pixel data information, a part of the invalid bits during the same type of storage can be discarded, reducing the memory occupied by the pixel data and achieving the effect of compressing the image data. For example, for a 14-bit image, among which, the pixel data with values of 60 and 500 can be stored in the server through the uint16 type. The two pixel data need to occupy 4 bytes, that is, 32 bits. In some embodiments, the number of bits included in the bit sequences mapped from the pixel data with values of 60 and 500 can be 8 and 16 respectively. Compared with the storage through the uint16 type, one byte of space is reduced.
[0035] The bit unit is formed based on a preset quantity of bits and can be used to constitute a bit sequence. The preset quantity of the bit unit can be adjusted according to requirements. It can be 6 bits or 8 bits. Among them, when the preset number of bits is 8, one bit unit is one byte. The bit unit can represent a value. For example, when the bit unit has 8 bits all being 1, the binary of the value represented by the bit unit is 1111 1111, and the decimal number is 255; when the bit unit has 8 bits all being 0, the binary number represented by the bit unit is 0, and the decimal number is 0.
[0036] The bit sequence is a 0, 1 sequence formed by at least one bit unit. The bit sequence can be represented by one bit unit, and in this case, the number of bits included in the bit sequence is the number of bits included in one bit unit. Of course, the bit sequence can also be composed of multiple bit units, and then the number of bits included in the bit sequence is equal to the sum of the number of bits included in the multiple bit units. When the bit sequence includes multiple bit units, the number of bits of different bit units can be the same, and then the number of bits included in the bit sequence is an integer multiple of the number of bits of the bit unit.
[0037] In some embodiments, the number of bits of the multiple bit units included in the bit sequence can also be different, and the number of bits of the bit units at different positions in the bit sequence can be determined in advance. Specifically, for example, when the bit sequence includes one bit unit, the number of bits of the first bit unit is 8; when the bit sequence includes two bit units, the number of bits of the first bit unit is 8, and the number of bits of the second bit unit is 4; when the bit sequence includes three bit units, the number of bits of the first bit unit is 8, the number of bits of the second bit unit is 4; the number of bits of the third bit unit is 3. Here, the order of the first, second, and third bit units can be the order in the bit sequence or the order in which the bit units are transmitted during the bit stream transmission.
[0038] Each bit sequence can also represent a numerical value. For example, a bit sequence formed by four bit units each including 4 bits, which is 0010 1010 1011 1101, the binary number represented by the bit sequence is 10 1010 10111101, and the decimal is 10941.
[0039] The bit sequence is used to represent the pixel data in the image data. Among them, one bit sequence can be used to represent one pixel data, or multiple bit sequences can be used together to represent one pixel data. In some embodiments, one bit sequence can also represent multiple pixel data.
[0040] The specified bit of the bit sequence can represent the number of target units, and the number of target units is the number of bit units included in the bit sequence. Correspondingly, since the number of units corresponding to different preset intervals is different, the specified bit of the bit sequence can also determine the preset interval to which the pixel data corresponding to the bit sequence belongs. That is to say, there is a one-to-one correspondence between the number of target units, the target preset interval, and the specified bit.
[0041] The designated bit position of the bit sequence can be used to represent the number of target units, so that during the decoding process, when reading the data stream, the number of bit units included in each bit sequence can be determined, and the corresponding number of bit units can be read to form a bit sequence. The designated bit position can include only one bit position. In this case, the designated bit position can represent at most bit sequences including two numbers of bit units. Specifically, for example, when the designated bit position is 0, it means the number of target units is 2, and the bit sequence is composed of two bit units; when the designated bit position is 1, it means the number of target units is 4, and the bit sequence is composed of four bit units.
[0042] Of course, the designated bit position can also include multiple bit positions. Specifically, for example, it can be composed of two bit positions. When the designated bit position is 00, it means the number of target units is 1, and the bit sequence is composed of one bit unit; when the designated bit position is 01, it means the number of target units is 2, and the bit sequence is composed of two bit units; when the designated bit position is 10, it means the number of target units is 3, and the bit sequence is composed of three bit units; when the designated bit position is 11, it means the number of target units is 4, and the bit sequence is composed of four bit units. In some embodiments, when the designated bit position represents multiple values, for example, when two bit positions are used as the designated bit position, the designated bit position can include 4 values.
[0043] When the designated bit position includes multiple bit positions, each bit position can be adjacent or spaced. For example, the first and second bit positions of the bit sequence can be used as the designated bit position, or the first and third bit positions of the bit sequence can be used as the designated bit position. When the bit sequence includes multiple bit units, the designated bit position can be any bit position of any bit unit. For example, when the bit sequence includes three bit units, the designation can be the first bit position of the first bit unit, or the second bit position of the second bit unit, or all the bit positions of the first unit can be used as the designated bit position. Preferably, the designated bit position can be the front bit positions in the first bit unit. For example, the first two bit positions of the first bit unit in the bit sequence can be used as the designated bit position.
[0044] To enable a specified bit position of the bit sequence to represent the target unit quantity, the corresponding relationship between the bit sequence with this property and pixel data can be determined in advance, where the value of the specified bit position of the bit sequence, the corresponding target unit quantity, and the number of bits included in the bit unit have been determined. According to the corresponding relationship, the pixel data can be mapped into a bit sequence. For example, when the bit unit includes 8 bits, and the specified bit position is the first bit of the bit sequence, and a specified bit position of 0 indicates that the bit sequence includes one bit unit, and a specified bit position of 1 indicates that the bit sequence includes two bit units, then the corresponding bit sequences can be from 0000 0000 to 0111 1111 and from 10000000 0000 0000 to 1111 1111 1111 1111, and the values represented by the bit sequences are from 0 to 127 and from 32768 to 65535.
[0045] The method of establishing the relationship between the bit sequence and the pixel data can be to correspond the numerical values represented by the bit sequence to the pixel data in ascending order. For example, a pixel data value of 0 can be corresponded to a bit sequence with a value of 0, a pixel data value of 2 can be corresponded to a bit sequence with a value of 2, a pixel data value of 63 can be corresponded to a bit sequence with a value of 63, and a pixel data value of 64 can be corresponded to a bit sequence with a value of 32768. Of course, in some embodiments, the pixel data with the smallest value can also be corresponded to the bit sequence with the largest value. For example, the pixel data with a value of 0 is mapped to the bit sequence with a value of 65535, and the pixel data with a value of 1 is mapped to the bit sequence with a value of 65534.
[0046] In some embodiments, the number of values of the pixel data is greater than the number of bit sequences. At this time, it is necessary to adjust the preset number of bits of the bit unit or the number of specified bit positions. Correspondingly, when the number of bit sequences is much greater than the number of values of the pixel data, appropriate adjustments can be made to ensure that the number of bit sequences is slightly higher than or equal to the number of values of the pixel data.
[0047] In some embodiments, the bit sequence can also be formed by adding a specified bit position to the pixel data. For example, a pixel data value of 64 can be corresponded to a bit sequence with a value of 32830. Among them, the binary of 64 is 01000000, and the bit sequence corresponding to 32830 is 1000 0000 0100000. That is, first, the high bits of the binary corresponding to the pixel data are filled with zeros to make the number of bits of the binary corresponding to the pixel data equal to the number of bits of the bit sequence corresponding to the specified bit position, and then the corresponding specified bit position is set. For example, the corresponding bit position is set to 1 to obtain the bit sequence.
[0048] When processing different image data, the number of bits in the bit unit, the specified bit, the preset interval, and the corresponding number of target units can be adjusted according to the depth of the image data to be transmitted. For example, when the image depth to be processed is 14 bits, the pixel data can include at most 16384 different values. In some embodiments, the first bit in the bit sequence can be set as the specified bit, and the number of bit units is set to 8. When the specified bit is 0 and the number of target units is 1, the bit sequence consists of 8 bits, and the range of the represented value is 0 to 127; when the specified bit is 1 and the number of target units is 2, the bit unit consists of 16 bits, and the range of the represented value is 32768 to 65535. At this time, for the pixel data in the 14-bit image data, at most a bit sequence including two 8-bit bit units can be used to represent it, among which, 128 kinds of pixel data can be composed of 8-bit bit units. However, if the first and second bits in the bit sequence are set as the specified bits, when the specified bits are 00 and the number of target units is 1, the bit sequence consists of 8 bits, and the range of the represented value is 0 to 63; when the specified bits are 01 and the number of target units is 2, the bit unit consists of 16 bits, and the range of the represented value is 64 to 16447. At this time, for the pixel data in the 14-bit image data, similarly, at most a bit sequence including two 8-bit bit units can be used to represent it. However, only 64 kinds of pixel data can be composed of 8-bit bit units. Compared with the former, mapping the same pixel data when the first and second bits are the specified bits will occupy more space.
[0049] In some embodiments, according to the method described in claim 1, in the step of determining the target preset interval to which the pixel data belongs among multiple preset intervals based on the value of the pixel data of the image data, it includes determining the number of target units as one when the pixel data belongs to the first preset interval. Or, determining the number of target units as two when the pixel data belongs to the second preset interval. Or, determining the number of target units as three when the pixel data belongs to the third preset interval. Or, determining the number of target units as four when the pixel data belongs to the fourth preset interval.
[0050] The range and number of the preset intervals can be determined according to the specified bit, the bit unit, and the number of target units corresponding to the preset interval. After the preset interval is determined, the number of target units can be determined according to the preset interval to which the pixel data belongs, and then based on the number of target units, the pixel data can be mapped into a bit sequence that can make the specified bit represent the number of target units according to a preset method.
[0051] For example, a bit unit includes 8 bits. When the specified bits are the first and second bits of the first and second bit units in a bit sequence, the number of preset intervals can be 4. At this time, the number of target units corresponding to the first preset interval can be set to 1, the number of target units corresponding to the second preset interval can be set to 2, the number of target units corresponding to the third preset interval can be set to 3, and the number of target units corresponding to the fourth preset interval can be set to 4.
[0052] Then, the pixel data belonging to the first preset interval can be obtained by mapping a bit sequence with 8 bits and a leading bit of 00. At this time, the range of the value represented by this bit sequence is from 0000 0000 to 0011 1111, that is, from 0 to 63. The pixel data that these comparison sequences can correspond to can include at most 64. In some embodiments, the bit sequences can be used to correspond to pixel data with values from 0 to 63 respectively, that is, the range of the first preset interval can be from 0 to 63.
[0053] The pixel data belonging to the second preset interval can be obtained by mapping a bit sequence with 16 bits and a leading bit of 01. At this time, the range of the value represented by this bit sequence is from 0100 0000 0000 0000 to 0111 1111 1111 1111, that is, from 16384 to 32767. The pixel data that these comparison sequences can correspond to can include at most 16384. In some embodiments, the bit sequences can be used to correspond to pixel data from 64 to 16447 respectively, that is, the range of the first preset interval can be from 64 to 16447.
[0054] The pixel data belonging to the third preset interval can be obtained by mapping a bit sequence with 24 bits and a leading bit of 10. At this time, the range of the value represented by this bit sequence is from 0100 0000 0000 0000 0000 0000 to 0111 1111 1111 1111 1111 1111, that is, from 8388608 to 12582911. The pixel data that these comparison sequences can correspond to can include at most 4194304. In some embodiments, the bit sequences can be used to correspond to pixel data from 16448 to 4210751 respectively, that is, the range of the first preset interval can be from 16448 to 4210751.
[0055] The pixel data belonging to the fourth preset interval can be mapped by a bit sequence with the first two bits being 11 and having 32 bits. At this time, the range of the value represented by this bit sequence is from 0100 0000 0000 1100 0000 0000 0000 0000 to 1111 1111 1111 1111 1111 1111 1111 1111, that is, from 3221225472 to 4294967295. The pixel data that these comparison sequences can correspond to can include at most 1073741824. In some embodiments, the bit sequence can be used to correspond to the pixel data from 4210752 to 1077952575 respectively, that is, the range of the first preset interval can be from 4210752 to 1077952575.
[0056] When the multiple preset intervals and the corresponding target unit numbers are determined, according to the preset interval to which the value of the pixel belongs, the target unit number corresponding to the pixel value can be determined. When the target unit number corresponding to the preset area is too large, although each preset area can correspond to a relatively large number of bit sequences, the number of bits of the corresponding bit sequences will be too many. At the same time, it is also possible that the number of bit sequences is much larger than the number of pixel data, resulting in waste of bits.
[0057] In order to be able to convert a single pixel data into fewer bit units to save space during the processing of the pixel data, the target unit number can be a small consecutive positive integer. For example, the target unit number corresponding to the first preset interval is 1, the target unit number corresponding to the second preset interval is 2, the target unit number corresponding to the third preset interval is 3, and the target unit number corresponding to the fourth preset interval is 4.
[0058] In some embodiments, the first preset interval, the second preset interval, the third preset interval, and the fourth preset interval all include an even number of integer values.
[0059] When the target unit number and the specified number of bits are determined, the values that the bit sequence can represent are limited. Preferably, a corresponding relationship can be established between all the finite bit sequences and the pixel data. For example, when the range that the bit sequence can represent is from 0000 0000 to 0111 1111, then the value corresponding to the bit sequence is from 0 to 127. At this time, the bit sequences corresponding to 0 to 127 are all established with the corresponding relationship with the pixel data. At this time, the number of integers included in each preset interval is an even number.
[0060] In some embodiments, in the step of mapping the pixel data into a bit sequence formed by the target number of bit units, it includes determining an offset of the pixel data and calculating the bit sequence of the pixel data based on the offset. Wherein, the bit sequence has the target number of bit units.
[0061] The offset is used to map the pixel data into a bit sequence. Wherein, the offset can be pre-stored in the server or can be calculated according to the specified bit position, the number of bit positions included in the bit unit, the preset interval, and the target number of units corresponding to the preset interval. Based on the offset, the bit sequence corresponding to the pixel data is calculated.
[0062] For example, when the bit unit includes 8 bit positions and the specified bit positions are the first and second bit positions in the bit sequence. When the target number of units is 1, the specified bit positions are 00. At this time, the values of the bit sequence are from 0 to 63, which can respectively correspond to pixel data with values from 0 to 63, that is, when the target number of units is 1, the offset is 0.
[0063] When the target number of units is 2, the specified bit positions are 01. At this time, the values of the bit sequence are from 16384 to 32762, which can respectively correspond to pixel data with values from 64 to 16447, that is, when the target number of units is 2, the offset is 16320.
[0064] When the target number of units is 3, the specified bit positions are 10. At this time, the values of the bit sequence are from 8388608 to 12582911, which can respectively correspond to pixel data with values from 16448 to 4210751, that is, when the target number of units is 3, the offset is 8372160.
[0065] When the target number of units is 4, the specified bit positions are 11. At this time, the values of the bit sequence are from 3221225472 to 4294967295, which can respectively correspond to pixel data with values from 4210752 to 1077952575, that is, when the target number of units is 4, the offset is 3217014720.
[0066] In some embodiments, before the step of determining the target preset interval to which the pixel data belongs among multiple preset intervals based on the value of the pixel data of the image data, the following steps are further included.
[0067] Step S210: Obtain the mapping sequence of the image data; wherein, the mapping sequence includes a plurality of mapping pixel data corresponding to the pixel data of the image data; wherein, the mapping pixel value is a positive integer not exceeding the maximum pixel value in the pixel data; wherein, the mapping pixel value of the pixel data with a higher repetition frequency in the image data is less than the mapping pixel value of the pixel data with a lower repetition frequency.
[0068] Step S220: Based on the mapping sequence, replace the pixel data with the corresponding mapping pixel data.
[0069] The pixel data of some image data may include negative pixel data. At this time, the corresponding relationship with the bit sequence can be established sequentially starting from the smallest negative value, but this will make the calculation method of mapping the pixel data to the bit sequence relatively complex. Therefore, all pixel data are replaced with mapping pixel data composed of positive integers through the mapping sequence to simplify the calculation.
[0070] In addition, during the process of mapping pixel data to a bit sequence, for the convenience of calculation, in some embodiments, as the value of the pixel data continuously increases, a corresponding relationship will be established with a bit sequence with continuously increasing corresponding values. For example, the pixel data with a value of 1 is mapped to 0000 0001, the pixel data with a value of 2 is mapped to 00000010, and the pixel data with a value of 65 is mapped to 0100 0000 0000 0001, etc. Among them, the number of bits of the bit sequence corresponding to the pixel data with a smaller value is less than the number of bits of the bit sequence corresponding to a larger value.
[0071] When the values of the pixel data that often appear in some images are all relatively large values, while the values of the pixel data that rarely appear are relatively small, then mapping the pixel data into a bit sequence still occupies a large amount of memory. Therefore, a mapping sequence can be used to map the pixel data into the mapping pixel values respectively, aiming to map the pixel values that appear more frequently into smaller values, so that when encoding into a bit sequence, it occupies fewer bits. Among them, the mapping pixel value of the pixel data with a higher repetition frequency in the image data is less than the mapping pixel value of the pixel data with a lower repetition frequency.
[0072] The mapping sequence includes the pixel data and corresponding mapped pixel data. The mapping sequence can be calculated in real time according to the image data, or stored inside the server and obtained based on historical statistics. Specifically, for example, the server will count the frequencies of different pixel data in image data of different categories in history, and establish a mapping sequence for the corresponding category of image data according to the historical statistics. In the mapping sequence, the pixel data with a higher frequency of occurrence in the image data of the category will be mapped to a smaller mapped pixel value. When processing the image data, the mapping sequence pre-stored in the server can be obtained according to the category of the image. Of course, it is also possible to count the pixel data in the image data in real time and then form a mapping sequence.
[0073] In some embodiments, the step of obtaining the mapping sequence of the image data includes removing duplicate pixel data from the pixel data to obtain a set of pixel data; and assigning mapped pixel values to the pixel data in the set of pixel data; wherein, the mapped pixel values do not exceed the maximum pixel value in the pixel data.
[0074] In some mapping sequences, there may be a situation where the same pixel data corresponds to multiple mapped pixel data, which will result in a relatively large number of mapped pixel data and relatively large values. In some embodiments, pixel data with larger values tend to be mapped to bit sequences including more bits. Therefore, removing duplicate pixel data from the pixel data and establishing a correspondence between the de-duplicated pixel data and the mapped pixel data can better reduce the number of effective bits occupied after replacing the pixel data with the corresponding mapped pixel values.
[0075] In addition, in some image data, not all pixel information appears. Some pixel data that does not appear may correspond to a bit sequence with fewer bits. Mapping the pixel data into the partially non-appearing pixel data through the mapping sequence can also reduce the space occupied by the pixel data. For example, the pixel data of a 14-bit image has only two values, which are 16382 and 16383. In some embodiments, when converting the 14-bit image into a bit sequence, since the pixel data has relatively large values, it will be mapped to a bit sequence with multiple bit units. After mapping the pixel data to 1 and 2 respectively, it can be mapped to a bit sequence with one bit unit, thereby reducing the number of bits occupied after encoding the pixel data.
[0076] Assigning mapped pixel values to the pixel data in the pixel data set may involve randomly selecting pixel data from the pixel data set and then establishing corresponding relationships with positive integers starting from 1 until all the pixel data in the pixel data set have been selected. Of course, the method of assigning mapped pixel values may also be to select, from the set of positive integers composed of positive integers not exceeding the largest pixel value in the pixel data, the same number of positive integers as the number of elements in the pixel data set to establish a mapped pixel data set, and then sort the pixel data in the pixel data set and the mapped pixel data in the mapped pixel data set respectively, and establish the corresponding relationships between the pixel data and the mapped pixel data in sequence according to the sorting results to form a mapping set.
[0077] In some embodiments, in the step of assigning mapped pixel values to the pixel data in the pixel data set, it includes: sorting the pixel data in the pixel data set according to the frequency of repeated occurrence of the pixel data in the image data to obtain a pixel sequence. Establish the corresponding relationships between the pixel data in the pixel sequence and the mapped pixel values in sequence, so that the mapped pixel values of the pixel data with a higher repetition frequency in the image data are less than the mapped pixel values of the pixel data with a lower repetition frequency.
[0078] Replacing the pixel data with a higher frequency of repeated occurrence in the image data with smaller mapped pixel data can better reduce the number of effective bit positions of the image data. For example, the depth of the image data is 14. When the pixel data with the highest frequency of occurrence in the image data appears 100 times and its value is 16383, the corresponding bit sequence includes 16 bit positions. After replacing this pixel data with a mapped pixel data with a value of 1, the corresponding bit sequence only requires 8 bit positions, so the storage space can be reduced by 800 bit positions after the replacement of this pixel data. Of course, even if the pixel data with a value of 1 may be replaced with a mapped pixel data greater than 1, overall, the number of bit positions occupied by the pixel data in the image data is still reduced due to its relatively small frequency of occurrence.
[0079] In some embodiments, in the step of sorting the pixel data in the pixel data set according to the frequency of repeated occurrence of the pixel data in the image data, it further includes: calculating the weighted score of the frequency of repeated occurrence of the pixel data in the pixel data set in the image data and the number of effective bits of the binary represented by the pixel data. Sort the pixel data in the pixel data set according to the score to obtain a pixel sequence.
[0080] Sorting the set of pixel data only according to the frequency of occurrence of the pixel data in the image is not sufficient. The number of significant bits of the binary represented by the pixel data can also be added as a reference index for sorting during the sorting process. In some embodiments, pixel data with a larger number of significant bits of the binary often maps to a bit sequence with more bit units. Therefore, replacing the pixel data with a larger number of significant bits of the binary with a smaller mapped pixel value can also reduce the number of bits occupied by the pixel data. For example, the weights corresponding to the number of significant bits of the binary represented by the pixel data and the frequency of occurrence of the pixel data can be obtained based on historical experience, and a weighted score can be calculated to sort the pixel data according to the weighted score. Of course, when sorting the pixel data, the score can also be calculated according to the value and frequency of the pixel data. Before calculating the weighted score of the frequency of occurrence of the pixel data and the number of significant bits of the binary, the target unit number of the pixel data can also be determined based on the value of the pixel data, and then the weighted score is calculated and sorted according to the target unit number and the frequency of occurrence of the pixel data. In some embodiments, the weighted score can also be calculated based on more dimensions. For example, the value range, frequency, significant bits of the binary, positive or negative of the pixel data value, and target unit number of the pixel data can be considered.
[0081] Please refer to Figure 4 , an embodiment of this specification provides an image data processing method, and the method includes the following steps.
[0082] Step S310: Obtain bitstream data; wherein, the bitstream data includes a plurality of bit units; wherein, the bit unit includes a preset number of bits.
[0083] Obtaining the bitstream data is to decode the bitstream data into pixel data. The bitstream data is a string of binary information and includes a plurality of bit units. Among them, the number of bits of the bit unit is determined. The bitstream data may include a protocol frame header and a data part, or may only include the data part. The data part of the bitstream data is used to record pixel information.
[0084] Step S320: Determine the target unit number based on the specified bit of the bit unit; wherein, the target unit number is the number of bit units corresponding to a pixel data.
[0085] Before converting the bitstream data into pixel data, it is necessary to process the bitstream data to facilitate determining the bit sequence corresponding to each pixel data. The bit sequence is composed of a target unit number of bit units. During the process of processing the bitstream data, the target unit number can be determined according to the state of the specified bit position. For example, the corresponding relationship between the specified bit position and the target unit number is predefined during the encoding process. When the specified bit position is 0, the target unit number is 1, and when the specified bit position is 1, the target unit number is 2. After obtaining the value of the specified bit position, the target unit number can be determined according to the corresponding relationship. The corresponding relationship between the specified bit position and the target unit number can be recorded in the bitstream data, can be additionally transmitted during the data transmission process, can be preset in the server and the terminal, and of course can also be calculated according to a preset algorithm.
[0086] In some embodiments, the target unit number can also be determined according to the value corresponding to the bit unit where the specified bit position is located. For example, when the specified bit position is the first and second bit positions of the first bit unit in the bit sequence and the bit unit includes 8 bit positions, if the specified bit position is determined, the value range corresponding to the bit unit can also be determined. Specifically, if the specified bit position is 00, then the value range of the first bit unit is from 00000000 to 00111111, that is, from 0 to 63. If the specified bit position is 01, then the value range of the first bit unit is from 01000000 to 01111111, that is, from 64 to 127. If the specified bit position is 10, then the value range of the first bit unit is from 10000000 to 10111111, that is, from 128 to 191. If the specified bit position is 11, then the value range of the first bit unit is from 11000000 to 11111111, that is, from 192 to 255. Therefore, when the value corresponding to a bit unit is determined, according to the value range to which the value belongs, the state of the specified bit position can be determined, that is, the target unit number can be determined.
[0087] After determining the target unit number, a bit sequence including the target unit number of bit units corresponding to one pixel data can be determined by taking out the target unit number of bit units from the bitstream data. Repeating the above operation can determine the bit sequences corresponding to all pixel data, thereby converting the target unit number of bit units into the corresponding pixel data.
[0088] Step S330: Convert the target unit number of bit units in the bitstream data into the corresponding pixel data.
[0089] After determining the bit sequence including the number of target units of bit units, the bit sequence can be processed to obtain the corresponding pixel data. The way to process the bit sequence can be determined based on the encoding method. For example, during the encoding process, if the bit sequence is obtained by adding an offset to the pixel data, then the pixel data can be obtained by subtracting the offset from the value corresponding to the bit sequence. Of course, in some embodiments, the bit sequence may also be obtained by adding specified bits to the binary value of the pixel data. For example, when the pixel data with a value of 64 corresponds to a bit sequence of 16 bit units, and the first and second bits are specified bits, the binary 1000000 corresponding to 64 is added with the specified bits and padded with 0s at the high positions to form the bit sequence 0100 0000 0100 0000. Then the pixel data can be obtained by removing the specified bits from the bit sequence, or setting the specified bits to zero, and then using the bit sequence after removing the specified bits.
[0090] In some embodiments, the specified bit is within the first bit unit among the number of target units of bit units. The first bit unit is the first one sorted among the number of target units of bit units in the bit stream data. That is to say, when reading the bit stream data, the first bit unit is the first one to be read. If the specified bit is the second one among the number of target units of bit units, it means that when determining the number of target units for determining the bit sequence in the bit stream data, two bit units need to be obtained during reading. In some embodiments, this also means that the bit sequence is formed by at least two bit units, while a part of the pixel data actually only needs a bit sequence including one bit unit to represent, which will cause a waste of bit positions to a certain extent. At the same time, the calculation will be more complex. Therefore, when the specified bit is within the first bit unit among the number of target units of bit units, after obtaining the first bit unit and finding that the number of target units is 1, decoding can be performed according to the one bit unit.
[0091] In some embodiments, the specified bit positions at least include the first bit position of the corresponding bit unit. The position of the specified bit position in the bit unit can be arbitrary. However, when the specified bit position is not the first bit position of the bit unit, after the specified bit position is determined, the value range of the value corresponding to the bit unit is not continuous. For example, in an 8-bit bit unit, the second bit position is the specified bit position. When the specified bit position is 1, the value range of the value corresponding to the bit unit is from 0100 0000 to 0111 1111 and from 1100 0000 to 1111 1111. This will increase the complexity of constructing a calculation method for mapping pixel data to a bit sequence. Therefore, when the specified bit positions at least include the first bit position of the corresponding bit unit, it is more beneficial to determine the value range of the value corresponding to the bit unit within a certain range. When there are multiple specified bit positions, the specified bit positions can be the corresponding number of bit positions with a relatively early order in the corresponding bit unit.
[0092] In some embodiments, the bit units of the target unit quantity are continuously sorted in the bitstream data. In the bitstream data, the bit units of the target unit quantity belonging to the same bit sequence may be discontinuous. For example, the first bit unit in all bit sequences is continuously stored, the second bit unit in bit sequences with multiple bit units is continuously stored, the third bit unit in bit sequences with three or more bit units is continuously stored, and so on.
[0093] When the bit units of the target unit quantity are continuously sorted in the bitstream data, it is more convenient to extract the bit sequences of the target unit quantity corresponding to different pixel data from the bitstream data. In addition, in the bitstream data, after reading one bit sequence, while reading the next bit sequence, the terminal can process the obtained bit sequence and convert it into pixel data, thereby accelerating the decoding speed.
[0094] In some embodiments, converting the bit units of the target unit quantity in the bitstream data into corresponding pixel data includes determining an offset of the bit sequence including the bit units of the target unit quantity according to the target unit quantity; and calculating the pixel data corresponding to the bit sequence based on the offset.
[0095] The bit sequence has a corresponding relationship with the pixel data. Through the offset, the bit sequence can be converted into pixel data. The offsets corresponding to bit sequences with different numbers of target units are different. The offset can be pre-stored in the terminal, can exist in the bitstream data, or can be calculated in real time. In the process of converting the bit sequence including the number of bit units of the target unit in the bitstream data into the corresponding pixel data, if the number and position of the specified bit positions, the number of bit positions included in the bit unit, and the number of target units are all determined, then the corresponding offset can be calculated according to the corresponding relationship between the pixel data and the bit sequence during the encoding process. Based on the offset and the bit sequence, the corresponding pixel data can be calculated.
[0096] In some embodiments, after the step of decoding the bit sequence into image data, it further includes obtaining a mapping sequence of the image data; wherein, the mapping sequence includes a plurality of mapping values corresponding to the pixel data of the image data. Based on the mapping sequence, the pixel data is replaced with the corresponding mapping value.
[0097] During the image data processing, in order to further reduce the number of bit positions occupied by the encoded bit sequence. Before the step of determining the target preset interval to which the pixel data belongs among a plurality of preset intervals based on the value of the pixel data of the image data, the pixel data in the image data is replaced with a corresponding positive integer. Therefore, after obtaining the pixel data from the bitstream data, it is also necessary to restore the pixel data according to the mapping sequence. The mapping sequence includes a plurality of mapping values corresponding to the pixel data of the image data. In some embodiments, the mapping value can be represented as the initial pixel data of the image. The mapping sequence can be preset inside the terminal, for example, obtained from the historical statistics of different types of image data. Of course, the mapping sequence can also be obtained from the server side and transmitted through the bitstream data.
[0098] In some embodiments, an image data processing apparatus 1000 can be provided, including: an interval determination module 1100 and an encoding module 1200.
[0099] The interval determination module 1100 is configured to determine the target preset interval to which the pixel data belongs among a plurality of preset intervals based on the value of the pixel data of the image data; wherein, the preset interval represents the value range of the pixel data; wherein, the number of units corresponding to different preset intervals is different; wherein, the number of units corresponding to the target preset interval is the number of target units.
[0100] An encoding module 1200 is configured to map the pixel data into a bit sequence formed by the target number of bit units; wherein, each bit unit includes a preset number of bits; so that a specified bit of the bit sequence represents the target number of units.
[0101] Regarding the specific functions and effects achieved by the image data processing device, reference may be made to other embodiments of this specification for comparison and explanation, which will not be elaborated here. Each module in the image data processing device can be implemented in whole or in part by software, hardware, and their combination. Each module can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0102] In some embodiments, an image data processing device 2000 may be provided, including: an acquisition module 2100, a quantity determination module 2200, and a decoding module 2300.
[0103] The acquisition module 2100 is configured to acquire bitstream data. Among them, the bitstream data includes a plurality of bit units. Among them, each bit unit includes a preset number of bits.
[0104] The quantity determination module 2200 is configured to determine the target number of units based on the specified bit of the bit unit. Wherein, the target number of units is the number of bit units corresponding to one pixel data.
[0105] The decoding module 2300 is configured to convert the target number of bit units in the bitstream data into corresponding pixel data.
[0106] Regarding the specific functions and effects achieved by the image data processing device, reference may be made to other embodiments of this specification for comparison and explanation, which will not be elaborated here. Each module in the image data processing device can be implemented in whole or in part by software, hardware, and their combination. Each module can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0107] In some embodiments, a computer device may be provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the method steps in the above embodiments are implemented.
[0108] In some embodiments, a computer-readable storage medium may be provided, on which a computer program is stored. When the computer program is executed by a processor, the method steps in the embodiments are implemented. For the specific functions and effects achieved by the image data processing device, reference may be made to other embodiments of this specification for explanation, and details will not be elaborated here. Each module in the image data processing device may be implemented in whole or in part by software, hardware, or a combination thereof. Each module may be embedded in the processor of the computer device in hardware form or independent thereof, or may be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0109] In some embodiments, a computer device may be provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the method steps in the embodiments are implemented.
[0110] In some embodiments, a computer-readable storage medium may be provided, on which a computer program is stored. When the computer program is executed by a processor, the method steps in the embodiments are implemented.
[0111] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it may include the processes of the embodiments of the various methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in this specification may include at least one of non-volatile and volatile memories. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0112] It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, as well as the combination of processes and / or blocks in the flowchart and / or block diagram. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.
[0113] Among the multiple embodiments of this specification, a progressive manner is adopted for description. Different embodiments focus on describing the parts that are different from other embodiments. After reading this specification, those skilled in the art can learn about the multiple embodiments in this specification and the multiple technical features disclosed by the embodiments, and can make more combinations. For the sake of brevity of description, not all possible combinations of the various technical features in the embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.
[0114] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, commodity or device comprising the element.
[0115] The above description is only for the embodiments of this case and is not used to limit the scope of protection of the claims of this case. For those skilled in the art, various changes and modifications can be made to this case. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this case shall be included within the scope of the claims of this case.
Claims
1. An image data processing method, characterized in that, comprising: Based on the value of the pixel data of the image data, determining a target preset interval to which the pixel data belongs among a plurality of preset intervals; wherein, the preset interval represents the value range of the pixel data; wherein, the number of units corresponding to different preset intervals is different; the number of units corresponding to the target preset interval is the target number of units; Determining the offset of the pixel data, and calculating the bit sequence of the pixel data based on the offset; wherein, the bit sequence has the target number of bit units; the bit unit includes a preset number of bits, so that the specified bit of the bit sequence represents the target number of units.
2. The method according to claim 1, characterized in that, In the step of determining a target preset interval to which the pixel data belongs among a plurality of preset intervals based on the value of the pixel data of the image data, it includes: When the pixel data belongs to the first preset interval, determining the target number of units as one; or, When the pixel data belongs to the second preset interval, determining the target number of units as two; or, When the pixel data belongs to the third preset interval, determining the target number of units as three; or, When the pixel data belongs to the fourth preset interval, determining the target number of units as four.
3. The method according to claim 2, characterized in that, The first preset interval, the second preset interval, the third preset interval and the fourth preset interval all include an even number of integer values.
4. The method according to claim 1, characterized in that, Before the step of determining a target preset interval to which the pixel data belongs among a plurality of preset intervals based on the value of the pixel data of the image data, it further includes: Obtaining a mapping sequence of the image data; wherein, the mapping sequence includes a plurality of mapping pixel values corresponding to the pixel data of the image data; wherein, the mapping pixel value is a positive integer not exceeding the maximum pixel value in the pixel data; wherein, the mapping pixel value of the pixel data with a higher repetition frequency in the image data is less than the mapping pixel value of the pixel data with a lower repetition frequency; Based on the mapping sequence, replacing the pixel data with the corresponding mapping pixel value.
5. The method according to claim 4, characterized in that, In the step of obtaining the mapping sequence of the image data, it includes: Removing the repeated pixel data in the pixel data to obtain a pixel data set; Assigning mapping pixel values to the pixel data in the pixel data set; wherein, the mapping pixel value does not exceed the maximum pixel value in the pixel data.
6. The method according to claim 5, characterized in that, In the step of assigning mapping pixel values to the pixel data in the pixel data set, it includes: Sorting the pixel data in the pixel data set according to the frequency of repeated occurrence of the pixel data in the image data to obtain a pixel sequence; Establish the correspondence between the pixel data of the pixel sequence and the mapped pixel values in sequence, so as to make the mapped pixel values of the pixel data with a higher repetition frequency in the image data less than those of the pixel data with a lower repetition frequency.
7. The method according to claim 6, wherein, in the step of sorting the pixel data in the pixel data set according to the frequency of repeated occurrence of the pixel data in the image data, it further includes: calculating a weighted score of the frequency of repeated occurrence of the pixel data in the pixel data set in the image data and the number of valid bits of the binary represented by the pixel data; sorting the pixel data in the pixel data set according to the weighted score to obtain a pixel sequence.
8. An image data processing method, wherein, it includes: obtaining bitstream data; wherein, the bitstream data includes a plurality of bit units; wherein, the bit unit includes a preset number of bits; determining the number of target units based on the designated bit of the bit unit; wherein, the number of target units is the number of bit units corresponding to one pixel data; determining the offset of the bit sequence including the number of target units of bit units according to the number of target units; calculating the pixel data corresponding to the bit sequence based on the offset.
9. The method according to claim 8, wherein, the designated bit is within the first bit unit among the number of target units of bit units.
10. The method according to claim 8, wherein, the designated bit at least includes the first bit of the bit unit where it is located.
11. The method according to claim 8, wherein, the number of target units of bit units are continuously sorted in the bitstream data.
12. The method according to claim 8, wherein, after the step of calculating the pixel data corresponding to the bit sequence based on the offset, it further includes: obtaining the mapping sequence of the image data; wherein, the mapping sequence includes a plurality of mapping values corresponding to the pixel data of the image data; replacing the pixel data with the corresponding mapping value based on the mapping sequence.
13. An image data processing device, wherein, it includes: an interval determination module, which determines the target preset interval to which the pixel data belongs among a plurality of preset intervals based on the value of the pixel data of the image data; wherein, the preset interval represents the value range of the pixel data; wherein, the number of units corresponding to different preset intervals is different; the number of units corresponding to the target preset interval is the number of target units; an encoding module, which determines the offset of the pixel data and calculates the bit sequence of the pixel data based on the offset; wherein, the bit sequence has the number of target units of bit units; the bit unit includes a preset number of bits; so that the designated bit of the bit sequence represents the number of target units.
14. An image data processing device, wherein, it includes: An acquisition module that acquires bitstream data; wherein the bitstream data includes a plurality of bit units; wherein each bit unit includes a preset number of bits. A quantity determination module that determines the number of target units based on designated bits of the bit units; wherein the number of target units is the number of bit units corresponding to one pixel data. A decoding module that determines the offset of a bit sequence including the number of target units of bit units according to the number of target units; and calculates the pixel data corresponding to the bit sequence based on the offset.
15. A computer device, comprising a memory and a processor, where the memory stores a computer program. Characterized in that when the processor executes the computer program, the method according to any one of claims 1 to 12 is implemented.
16. A computer-readable storage medium, on which a computer program is stored. Characterized in that when the computer program is executed by a processor, the method steps according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Method and device for utilizing digital image to store and transmit information
CN103778590A
Dynamic image processing method and device
CN112598609A