Run length coding device, run length coding method and computer equipment

By pre-setting run-length encoding logic in the query table and using the pre-encoding module and query module to generate encoding results, the problem of low run-length encoding efficiency for large datasets is solved, and an efficient encoding process is achieved.

CN121643772APending Publication Date: 2026-03-10AXERA TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

When dealing with large amounts of data, the real-time computation of existing run-length encoding algorithms results in long time delays and low encoding efficiency.

Method used

The complex logic of run-length encoding is pre-set in the lookup table. The first encoding result is generated by the pre-encoding module, and the second encoding result is directly retrieved from the lookup table by the lookup module, thus avoiding real-time calculation.

Benefits of technology

This greatly improves the efficiency of run-length encoding, reduces the time consumption, and increases the encoding speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121643772A_ABST
    Figure CN121643772A_ABST
Patent Text Reader

Abstract

The invention provides a run length coding device, a run length coding method and computer equipment, the run length coding device comprises a pre-coding module, a query module and an association module, the pre-coding module can pre-code to-be-coded data to obtain a first coding result, and the query module can query the to-be-coded data to obtain a second coding result; the query module can query the second coding result corresponding to the first coding result through the preset query table, and the association module can associate the second coding result with the to-be-coded data to obtain a target coding result. And the second coding result is directly queried from the query table based on the first coding result, so that the condition of relatively long time consumption caused by real-time calculation and generation of the run length coding result is avoided, the efficiency of run length coding is greatly improved, and the time consumption of run length coding is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a run-length encoding device, a run-length encoding method and a computer device. BACKGROUND

[0002] With the continuous growth of data, the application of data compression technology is gradually widespread. Among them, the run-length encoding algorithm is a commonly used data compression algorithm, which can represent the continuous repeated data in the form of data value plus repetition number, so as to compress the data.

[0003] In the related art, the run-length encoding result is usually calculated in real time based on the run-length encoding algorithm. In the case of large amount of encoded data, the time delay of run-length encoding by using this method is usually long, thereby resulting in low run-length encoding efficiency. SUMMARY

[0004] The embodiments of the present application provide a run-length encoding device, a run-length encoding method and a computer device, which can improve the efficiency of run-length encoding and reduce the time consumption of run-length encoding.

[0005] According to a first aspect of the embodiments of the present application, a run-length encoding device is provided, comprising:

[0006] a pre-encoding module, a query module and an association module;

[0007] The pre-encoding module is configured to pre-encode the to-be-encoded data according to the elements in the to-be-encoded data, to obtain a first encoding result.

[0008] The query module is configured to perform a base conversion on the first encoding result to obtain an index value, query target data corresponding to the index value from a pre-set query table based on the index value, and take the target data as a second encoding result corresponding to the first encoding result, wherein the query table is composed of an index value, a valid bit marker code and an invalid bit marker code, the valid bit marker code represents the number of consecutive pre-set data in the first encoding result, and the invalid bit marker code represents that the target data bit is consecutive with the previous data bit and the counting result is invalid.

[0009] The association module is configured to associate the second encoding result and the to-be-encoded data to obtain a target encoding result, wherein the target encoding result represents the number of consecutive same elements in the to-be-encoded data.

[0010] In some embodiments of the present application, the pre-encoding module is specifically configured to, for an element in the to-be-encoded data, perform an AND operation on the element and each element in the to-be-encoded data to determine a first AND operation result corresponding to the element.

[0011] performing an AND operation on the first AND operation result corresponding to the element and the first AND operation result corresponding to a previous element of the element, to obtain a second AND operation result corresponding to the element;

[0012] determining the first encoding result based on the second AND operation result corresponding to each element in the to-be-encoded data.

[0013] In some embodiments of the present application, the pre-encoding module comprises a first pre-encoding module;

[0014] The first pre-encoding module is configured to, for an element in the to-be-encoded data, perform an AND operation on the element and each element in the to-be-encoded data, and determine that the first AND operation result corresponding to the element is 1 in the case that the elements participating in the AND operation are the same;

[0015] performing an AND operation on the first AND operation result corresponding to the element and the first AND operation result corresponding to a previous element of the element, to obtain a second AND operation result corresponding to the element; and determining that the second AND operation result corresponding to the first element in the to-be-encoded data is 0;

[0016] determining the first encoding result based on the second AND operation result corresponding to each element in the to-be-encoded data.

[0017] In some embodiments of the present application, the pre-encoding module further comprises a second pre-encoding module;

[0018] The second pre-encoding module is configured to, for an element in the to-be-encoded data, perform an AND operation on the element and each element in the to-be-encoded data, and determine that the first AND operation result corresponding to the element is 0 in the case that the elements participating in the AND operation are the same;

[0019] performing an AND operation on the first AND operation result corresponding to the element and the first AND operation result corresponding to a previous element of the element, to obtain a second AND operation result corresponding to the element; and determining that the second AND operation result corresponding to the first element in the to-be-encoded data is 1;

[0020] determining the first encoding result based on the second AND operation result corresponding to each element in the to-be-encoded data.

[0021] In some embodiments of the present application, the first encoding result comprises the original encoding result and the complementary encoding result.

[0022] The second encoding result comprises an original second encoding result corresponding to the original encoding result and a complementary second encoding result corresponding to the complementary encoding result, and the target encoding result comprises a first target encoding result obtained by associating the original second encoding result and the to-be-encoded data and a second target encoding result obtained by associating the complementary second encoding result and the to-be-encoded data.

[0023] The device further comprises a verification module.

[0024] The verification module is configured to compare the first target encoding result and the second target encoding result, and determine the first target encoding result or the second target encoding result as the target encoding result in the case where the first target encoding result is identical to the second target encoding result.

[0025] In some embodiments of the present application, the query module is specifically configured to split the first encoding result according to a preset length to obtain at least two first sub-encoding results.

[0026] For a first sub-encoding result, the first sub-encoding result is subjected to a base conversion to obtain an index value.

[0027] Based on the index value, target data corresponding to the index value is queried from the query table through a query path corresponding to the first sub-encoding result, and the target data is taken as a second sub-encoding result corresponding to the first sub-encoding result, one first sub-encoding result corresponding to one query path.

[0028] The second sub-encoding result corresponding to each first sub-encoding result is spliced to obtain a second encoding result corresponding to the first encoding result.

[0029] In some embodiments of the present application, the device further comprises a correction module.

[0030] The correction module is configured to, for a first sub-encoding result, correct the target encoding result in the case where a tail marker code in a second sub-encoding result corresponding to the first sub-encoding result is an invalid marker code, and a start marker code in a second sub-encoding result corresponding to a next first sub-encoding result of the first sub-encoding result is a valid marker code.

[0031] In some embodiments of the present application, the association module is specifically configured to determine a run marker interval corresponding to a target element in the second encoding result according to the first encoding result, the target element being an element that is the same and continuous in the to-be-encoded data.

[0032] determining the run number corresponding to the target element according to the information of the valid bit marker code in the run marker interval;

[0033] associating the run number with the target element to obtain a target encoding result.

[0034] According to a second aspect of the embodiments of the present application, a run encoding method is provided, comprising:

[0035] pre-encoding the to-be-encoded data according to the elements included in the to-be-encoded data to obtain a first encoding result;

[0036] performing a base conversion on the first encoding result to obtain an index value;

[0037] querying, based on the index value, a target data corresponding to the index value from a preset query table, taking the target data as a second encoding result corresponding to the first encoding result, the query table being composed of an index value, a valid bit marker code and an invalid bit marker code, the valid bit marker code indicating a number of preset data that are continuous in the pre-encoding result, and the invalid bit marker code indicating that a target data bit and a previous data bit are continuous in the pre-encoding result and the counting result is invalid;

[0038] associating the second encoding result and the to-be-encoded data to obtain a target encoding result, the target encoding result being used to indicate a continuous number of the same element in the to-be-encoded data.

[0039] According to a third aspect of the embodiments of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory being used to store at least one program, the at least one program being loaded and executed by the processor to implement the run encoding method.

[0040] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, the computer readable storage medium storing at least one program, the at least one program being loaded and executed by a processor to implement the run encoding method.

[0041] Thus, the run-length coding device in the embodiment of the present application can first precode the to-be-coded data through the pre-coding module to obtain a first coding result, and query a second coding result corresponding to the first coding result from the preset query table through the query module, and then associate the second coding result and the to-be-coded data through the association module to obtain a target coding result. That is, when the run-length coding device in the embodiment of the present application is used for run-length coding, it is not necessary to generate a run-length coding result in real time, but the complex logic of run-length coding is preset in the query table, the second coding result is directly obtained from the query table based on the first coding result, which avoids the situation that the time consumption is relatively long due to the real-time calculation of generating the run-length coding result, greatly improves the efficiency of run-length coding, and reduces the time consumption of run-length coding. BRIEF DESCRIPTION OF DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0043] Figure 1 is a structure schematic diagram of a run-length coding device provided by an embodiment of the present application;

[0044] Figure 2 is a structure schematic diagram of a query table provided by an embodiment of the present application;

[0045] Figure 3 is a schematic diagram of a pre-coding process of a first pre-coding module provided by an embodiment of the present application;

[0046] Figure 4 is a schematic diagram of a pre-coding process of a second pre-coding module provided by an embodiment of the present application;

[0047] Figure 5 is a schematic diagram of a parallel table lookup process provided by an embodiment of the present application;

[0048] Figure 6 is a flowchart of a run-length coding method provided by an embodiment of the present application;

[0049] Figure 7 is a structure schematic diagram of a terminal provided by an embodiment of the present application;

[0050] Figure 8 is a structure schematic diagram of a server provided by an embodiment of the present application. DETAILED DESCRIPTION

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0052] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.

[0053] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items that have essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or execution order. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various objects, these objects should not be limited by the terms.

[0054] These terms are simply used to distinguish one object from another. For example, without departing from the various examples, a first action can be called a second action, and similarly, a second action can be called a first action. Both the first and second actions can be actions, and in some cases, they can be separate and distinct actions.

[0055] "At least one" refers to one or more actions. For example, at least one action can be one action, two actions, three actions, or any integer number of actions greater than or equal to one. "Multiple" refers to two or more actions. For example, multiple actions can be two actions, three actions, or any integer number of actions greater than or equal to two.

[0056] Currently, with the continuous growth of data volume, data compression technology, as a core means to reduce storage costs and improve transmission efficiency, is gradually being applied in multiple fields such as network communication and industrial control. Among them, run-length encoding is a commonly used data compression algorithm that can represent continuously repeating data by adding the number of repetitions to the data value, thereby achieving data compression.

[0057] In related technologies, run-length encoding is often implemented using a real-time computation model. During the encoding process, it is necessary to identify and count consecutive repeating data, and then calculate and generate the corresponding encoded segments in real time based on the statistical results. When encoding large amounts of data, the time delay of this method is often quite long, resulting in low encoding efficiency.

[0058] To solve the above technical problems, the embodiment of the present application provides a run-length coding device, which pre-sets the complex logic of run-length coding in a query table, directly queries the second coding result from the query table based on the first coding result, avoids the case that real-time calculation generates run-length coding result and leads to long time consumption, greatly improves the efficiency of run-length coding, and reduces the time consumption of run-length coding.

[0059] Figure 1 A structural schematic diagram of a run-length coding device provided by the embodiment of the present application is shown in FIG. 1. The structure of the run-length coding device 100 will be described in detail below. Figure 1 The structure of the run-length coding device 100 will be described in detail below.

[0060] The run-length coding device 100 comprises a pre-coding module 101, a query module 102, and an association module 103.

[0061] The run-length coding device 100 is used for data compression of the to-be-coded data, to obtain a target coding result after compression, so as to facilitate subsequent compression storage of the target coding result, thereby greatly reducing the occupation of data to storage resources. Alternatively, the target coding result can also be sent to a corresponding decoding device, so that the decoding device decodes the target coding result, restores the data consistent with the target coding result, and further processes the restored data.

[0062] The to-be-coded data refers to original data that has not been subjected to run-length coding processing and has continuous repeated elements. The to-be-coded data can be character sequences, binary data streams, pixel value sequences, etc. The elements in the to-be-coded data can be characters in character sequences, binary bits in binary data streams, pixel values in pixel value sequences, etc., which are not limited in the present application. For example, the to-be-coded data is AAAABBCC.

[0063] The pre-coding module 101 can perform pre-coding processing on the to-be-coded data according to the elements in the to-be-coded data, to obtain a first coding result. The pre-coding module 101 can generate binary bits aligned with each element in the to-be-coded data, so as to obtain a binary sequence with the same length as the to-be-coded data, and take the binary sequence as the first coding result. The first coding result can indirectly reflect the regularity of the continuous appearance of each element in the to-be-coded data, and provides a standardized and easy-to-process input form for subsequent run-length coding.

[0064] After obtaining the first encoding result through pre-encoding processing, the query module 102 can query a preset lookup table based on the first encoding result to obtain the second encoding result corresponding to the first encoding result. The second encoding result is a binary sequence composed of a valid bit marker code and / or an invalid bit marker code, and one valid bit marker code or invalid bit marker code in the second encoding result corresponds to one binary bit in the first encoding result. The valid bit marker code and invalid bit marker code can also be referred to as marker codes.

[0065] For example, both the valid bit flag and the invalid bit flag can be set to 4-bit binary data. The invalid bit flag can be set to 1111, and other combinations of 4-bit binary data are valid bit flags.

[0066] The lookup table can consist of an index value, a valid bit marker, and an invalid bit marker. The invalid bit marker indicates that the target data bit in the first encoding result is consecutive to the previous data bit and the counting result is invalid. The target data bit is the binary bit in the first encoding result corresponding to the invalid bit marker. The valid bit marker indicates the number of consecutive data bits in the first encoding result. For example, the valid bit marker indicates the number of consecutive "1" bits in the first encoding result.

[0067] The following example illustrates the lookup table. Figure 2 , Figure 2 This is a schematic diagram of the structure of a lookup table provided for an embodiment of this application.

[0068] like Figure 2 As shown, the lookup table includes sixteen index values, each corresponding to a binary sequence consisting of four valid bit markers and / or invalid bit markers.

[0069] Specifically, the query module 102 can first perform a base conversion on the first encoding result, that is, convert the binary first encoding result to decimal to obtain an index value. Then, it can query the target data corresponding to the index value from a preset query table and use the target data as the second encoding result corresponding to the first encoding result.

[0070] Continuing with the previous example, the first encoding result is "0111". After base conversion, the index value is 7. The target data corresponding to the index value 7 is "0000001111111111". That is, "0000001111111111" is used as the second encoding result corresponding to the first encoding result "0111".

[0071] The second encoding result is composed of four mark codes, which are "0000", "0011", "1111" and "1111". The first valid bit mark code "0000" indicates that there are zero continuous "1"s, the second valid bit mark code "0011" indicates that there are three continuous "1"s, the third invalid bit mark code "1111" indicates that the target data bit "1" at the third position in the first encoding result is continuous with the data bit "1" at the second position and the counting result of the invalid bit mark code "1111" is invalid, and the fourth invalid bit mark code "1111" indicates that the target data bit "1" at the fourth position in the first encoding result is continuous with the data bit "1" at the third position and the counting result of the invalid bit mark code "1111" is invalid.

[0072] The association module 103 can associate the second encoding result and the to-be-encoded data, so as to obtain a target encoding result that can represent the number of continuous same elements in the to-be-encoded data. For example, there are five continuous "A"s, two continuous "B"s and two continuous "C"s in the to-be-encoded data.

[0073] Therefore, the run-length encoding device in the embodiment of the present application can first perform pre-encoding on the to-be-encoded data by the pre-encoding module to obtain a first encoding result, query a second encoding result corresponding to the first encoding result from a preset query table by the query module, and then obtain a target encoding result by associating the second encoding result and the to-be-encoded data by the association module. That is, when the run-length encoding device in the embodiment of the present application is used for run-length encoding, it is not necessary to generate a run-length encoding result in real time, but the complex logic of run-length encoding is preset in the query table, the second encoding result is directly obtained from the query table based on the first encoding result, which avoids the situation that the run-length encoding result is generated in real time and time-consuming is relatively long, greatly improves the efficiency of run-length encoding and reduces the time consumption of run-length encoding.

[0074] In some embodiments of the present application, the pre-encoding module 101 can perform pre-encoding processing on the to-be-encoded data to obtain a first encoding result.

[0075] Specifically, the pre-encoding module 101 can perform an exclusive-OR operation between each element in the to-be-encoded data and each element in the to-be-encoded data to determine a first exclusive-OR result corresponding to the element. The first exclusive-OR result is a binary sequence with the same number of elements as the to-be-encoded data, and each element corresponds to a first operation result.

[0076] Then, for each element corresponding to the first and operation result, the element corresponding to the first and operation result is anded with the element corresponding to the first and operation result of the previous element to obtain the second and operation result corresponding to the element. The second and operation result is a binary bit, and one element corresponds to one second operation result. It should be noted that the second operation result corresponding to the first element in the to-be-encoded data is a preset value, which is binary 0 or binary 1. The specific setting rule of the preset value will be described later, and will not be described here.

[0077] After determining the second and operation result corresponding to each element, the first encoding result corresponding to the to-be-encoded data can be obtained according to the second and operation result corresponding to each element in the to-be-encoded data.

[0078] In some embodiments of the present application, the pre-encoding module 101 can include a first pre-encoding module, that is, pre-encoding can be performed through the first pre-encoding module to obtain the first encoding result. Specifically, the first pre-encoding module can perform and operation on each element in the to-be-encoded data and each element in the to-be-encoded data. In the case that the two elements participating in the and operation are the same, it is determined that the first and operation result corresponding to the element is 1. Otherwise, it is determined that the first and operation result corresponding to the element is 0.

[0079] For each element corresponding to the first and operation result, the element corresponding to the first and operation result is anded with the element corresponding to the first and operation result of the previous element. In the case that the first and operation results participating in the and operation are the same, it is determined that the second and operation result corresponding to the element is 1. Otherwise, it is determined that the second and operation result corresponding to the element is 0. And the second and operation result corresponding to the first element in the to-be-encoded data is 0.

[0080] Further, the original encoding result corresponding to the to-be-encoded data can be determined according to the second and operation result corresponding to each element in the to-be-encoded data, and the original encoding result is taken as the first encoding result.

[0081] Next, the pre-encoding process of the first pre-encoding module will be further described by taking an example, as follows Figure 3 As shown in the figure, Figure 3 A schematic diagram of a first pre-encoding module pre-encoding process provided by an embodiment of the present application.

[0082] As Figure 3As shown, the to-be-encoded data is "AAAABBCC", which includes eight elements, i.e., "A" "A" "A" "A" "B" "B" "C" "C". Each element is subjected to an AND operation with the to-be-encoded data "AAAABBCC" to obtain eight first operation results, i.e., "11110000" "11110000" "11110000" "11110000" "00001100" "00001100" "00000011" "00000011". The first operation result corresponding to the second element is subjected to an AND operation again with the first operation result corresponding to the first element to obtain the second operation result corresponding to the second element, which is 1. The first operation result corresponding to the third element is subjected to an AND operation again with the first operation result corresponding to the second element to obtain the second operation result corresponding to the third element, which is 1. The second operation results of the subsequent elements are calculated in the same manner. In addition, the second operation result corresponding to the first element is 0. Finally, the original encoding result corresponding to the to-be-encoded data is "01110101", which is taken as the first encoding result.

[0083] In some embodiments of the present application, in order to improve the reliability of the run-length encoding result and avoid logical omissions or data errors that may exist in a single encoding module, the first pre-encoding module and the second pre-encoding module can be used for collaborative pre-encoding, so as to ensure the accuracy of subsequent run-length encoding.

[0084] Therefore, the pre-encoding module 101 can further include a second pre-encoding module, i.e., the to-be-encoded data can also be pre-encoded by the second pre-encoding module to obtain the first encoding result. Specifically, the second pre-encoding module can perform an AND operation on each element in the to-be-encoded data and each element in the to-be-encoded data. In the case that the two elements participating in the AND operation are the same, it is determined that the first operation result corresponding to the element is 0. Otherwise, it is determined that the first operation result corresponding to the element is 1.

[0085] For the first operation result corresponding to each element, the first operation result corresponding to the element is subjected to an AND operation with the first operation result corresponding to the previous element of the element. In the case that the first operation results participating in the AND operation are the same, it is determined that the second operation result corresponding to the element is 0. Otherwise, it is determined that the second operation result corresponding to the element is 1. In addition, the second operation result corresponding to the first element in the to-be-encoded data is 1.

[0086] Further, the complementary encoding result corresponding to the to-be-encoded data can be determined according to the second operation result corresponding to each element in the to-be-encoded data, and the complementary encoding result is taken as the first encoding result.

[0087] The precoding process of the second precoding module will be further illustrated with examples below. Figure 4 As shown, Figure 4 This is a schematic diagram of a precoding process for a second precoding module provided in an embodiment of this application.

[0088] like Figure 4 As shown, the data to be encoded is "AAAABBCC", which includes eight elements: "A", "A", "A", "B", "B", "C", and "C". First, each element is ANDed with the data "AAAABBCC", resulting in eight first AND results: "00001111", "00001111", "00001111", "00001111", "11110011", "111110011", "11111100", and "11111100". The first AND result of the second element is then ANDed with the first element's first AND result again, resulting in a second AND result of 0. The second AND result of the third element is then ANDed with the second element's first AND result again, resulting in a second AND result of 0. Subsequent elements are calculated in the same way. Furthermore, the second AND result of the first element is 1. Ultimately, the complementary encoding result corresponding to the data to be encoded is "10001010", which is used as the first encoding result.

[0089] It should be noted that the above encoding module may also include only the second precoding module. That is, the precoding operation is performed only through the second precoding module to obtain the complementary encoding result. Then, the query module 102 queries the second encoding result corresponding to the complementary encoding result, associates the second encoding result with the data to be encoded, and obtains the second target encoding result, which is the final run-length encoding result.

[0090] In some embodiments of this application, the run-length encoding device may further include a verification module to verify the run-length encoding results and ensure the accuracy of the run-length encoding.

[0091] First, after performing collaborative precoding using the first precoding module and the second precoding module to obtain a first encoding result containing both the original encoding result and the complementary encoding result, the query module 102 can query a preset lookup table to obtain the original second encoding result corresponding to the original encoding result and the complementary second encoding result corresponding to the complementary encoding result. The query logic of the query module 102 has been described above and will not be repeated here.

[0092] Then, the association module 103 can associate the original second encoding result and the data to be encoded to obtain the first target encoding result, and associate the complementary second encoding result and the data to be encoded to obtain the second target encoding result. The specific association process will be described in the following content and will not be described here.

[0093] After determining the first target encoding result and the second target encoding result, the verification module can compare the two results. If the first and second target encoding results are the same, the verification passes, and either the first or second target encoding result is determined as the target encoding result. Otherwise, the verification fails, and run-length encoding can be performed again to obtain a new target encoding result.

[0094] In some embodiments of this application, to improve the efficiency of run-length encoding and reduce its encoding latency, the query module 102 may employ a parallel table lookup method. Specifically, the query module 102 may first split the first encoding result according to a preset length to obtain at least two first sub-encoding results, wherein the first encoding result may include the aforementioned original encoding result and / or complementary encoding result. For example, the first encoding result may be split into 4-bit segments, that is, the length of each first sub-encoding result is 4 bits.

[0095] Furthermore, each first sub-encoding result corresponds to a query path, thereby enabling parallel table lookups. For each first sub-encoding result, a base conversion is performed to obtain an index value. Based on this index value, the target data corresponding to the index value is retrieved from the query table through the query path corresponding to the first sub-encoding result, and this target data is used as the second sub-encoding result corresponding to the first sub-encoding result. Then, the second sub-encoding results corresponding to each first sub-encoding result can be concatenated to obtain the second encoding result corresponding to the first encoding result.

[0096] The following section uses the example of the first encoding result including both the original encoding result and the complementary encoding result to elaborate on the parallel table lookup process of the query module 102 mentioned above. Figure 5 As shown, Figure 5 This is a schematic diagram of a parallel table lookup process provided for an embodiment of this application.

[0097] like Figure 5As shown, the original encoding result and the complementary encoding result can be split into four first sub-encoding results with a length of 4 bits, namely "0111", "0101", "1000", and "1010". Each first sub-encoding result corresponds to a query path. Parallel queries are performed on these four first sub-encoding results to obtain four second sub-encoding results. The two second sub-encoding results obtained by splitting the original encoding result and querying are concatenated to obtain the second encoding result corresponding to the original encoding result. Similarly, the two second sub-encoding results obtained by splitting the complementary encoding result and querying are concatenated to obtain the second encoding result corresponding to the complementary encoding result.

[0098] Therefore, compared with the serial query method, the parallel query method can be used in this embodiment, which greatly shortens the query time. Furthermore, the complex logic of run-length encoding can be pre-set in the query table. During encoding, only the index value needs to be obtained through base conversion, so as to quickly match the encoding result. This avoids the situation where the time consumption caused by real-time calculation of run-length encoding results is long, greatly improving the efficiency of run-length encoding and reducing the time consumption of run-length encoding.

[0099] In some embodiments of this application, when determining the second encoding result using the aforementioned split-and-query method, identical and consecutive elements in the corresponding data to be encoded may be split into two first sub-encoding results. This can lead to run-length fragmentation and incomplete run counts in the subsequent second sub-encoding results, thus failing to guarantee the accuracy of the final target encoding result. Therefore, the aforementioned run-length encoding device also includes a correction module to correct the target encoding result.

[0100] Specifically, the correction module can obtain the end marker code of the second sub-encoding result corresponding to the first sub-encoding result after splitting. The end marker code refers to the last marker code in the second sub-encoding result.

[0101] Furthermore, the starting tag code of the second sub-encoding result corresponding to the next first sub-encoding result of the first sub-encoding result is obtained. The starting tag code refers to the first tag code of the second sub-encoding result.

[0102] If the last marker code in the second sub-encoding result corresponding to the first sub-encoding result is invalid, and the starting marker code in the second sub-encoding result corresponding to the next first sub-encoding result is valid, the correction module can determine that the runs corresponding to these two first sub-encoding results are two parts of the same original run that have been split. Therefore, by adding the run count corresponding to the first sub-encoding result to the run count corresponding to the next first sub-encoding result, the corrected run count is obtained. This corrected run count is then associated with the data to be encoded, thus correcting the target encoding result.

[0103] For example, there are two consecutive first sub-encoding results, "0111" and "1000", where the second sub-encoding result corresponding to "0111" is "0000001111111111". In this second sub-encoding result, there are four marker codes, namely "0000", "0011", "1111" and "1111". Among them, "0000" and "0011" are valid marker codes, that is, they indicate that the first sub-encoding result "0111" contains three consecutive "1"s, and the run count corresponding to the first sub-encoding result "0111" is three. The marker code at the end of the second sub-encoding result "0000001111111111" is "1111", which is an invalid marker code.

[0104] The second sub-encoding result corresponding to "1000" is "0001000000000000". In this second sub-encoding result, there are four marker codes, namely "0001", "0000", "0000" and "0000", indicating that the first sub-encoding result "1000" contains a "1". The number of runs corresponding to the first sub-encoding result "1000" is one, and the starting marker code is "0001", which is a valid marker code.

[0105] Therefore, by summing the run counts corresponding to the first sub-encoding result "0111" and the run counts corresponding to the first sub-encoding result "1000", the corrected run count is four. By associating the corrected run count with the data to be encoded, the correction of the target encoding result is achieved.

[0106] In some embodiments of this application, after the query module determines the second encoding result, the second encoding result can be associated with the data to be encoded in order to obtain the final target encoding result.

[0107] Specifically, the association module can determine the run-length marker interval corresponding to the target element in the second encoding result based on the first encoding result. The target element refers to a series of identical and consecutive elements in the data to be encoded. Taking the first encoding result as the original encoding result as an example, the run-length marker interval corresponding to the target element in the second encoding result can be determined based on the positions of binary bits "0" and "1" in the first encoding result. A binary bit "0" indicates the start of a run-length marker interval, and a binary bit "1" indicates the end of a run-length marker interval. Conversely, when the first encoding result is a complementary encoding result, a binary bit "1" indicates the start of a run-length marker interval, and a binary bit "0" indicates the end of a run-length marker interval.

[0108] The following explanation uses the first encoding result as an example. For instance, the original encoded data corresponding to the data to be encoded, "AAAABBCC", is "01110101". This is split into two first sub-encoding results, "0111" and "0101", each 4 bits apart. The second sub-encoding result corresponding to "0111" is "0000001111111111", and the second sub-encoding result corresponding to the first sub-encoding result "0101" is "0000000100000001". Concatenating these two second sub-encoding results yields the second encoding result "00000011111111110000000100000001". This second encoding result includes eight marker codes: "0000", "0011", "1111", "1111", "0000", "0001", "0 ... Based on the original encoded data "01110101", the second encoded result is determined to include three run-length marker intervals. These three run-length marker intervals include four marker codes, two marker codes, and two marker codes, respectively. The first run-length marker interval corresponds to element "A" and includes "0000", "0011", "1111", and "1111". The second run-length marker interval corresponds to element "B" and includes "0000" and "0001". The third run-length marker interval corresponds to element "C" and includes "0000" and "0001".

[0109] The following example, using the first encoding result as the complementary encoding, further illustrates the concept. For instance, the complementary encoding data corresponding to the data to be encoded, "AAAABBCC", is "10001010". This is split into two first sub-encoding results, "1000" and "1010", each 4 bits apart. The second sub-encoding result corresponding to "1000" is "0001000000000000", and the second sub-encoding result corresponding to the first sub-encoding result "1010" is "0001000000010000". Concatenating these two second sub-encoding results yields the second encoding result "0001000000000000000100000010000". This second encoding result includes eight marker codes: "0001", "0 ... Based on the complementary coding data "10001010", the second coding result is determined to include three run-length marker intervals. These three run-length marker intervals include four marker codes, two marker codes, and two marker codes, respectively. The first run-length marker interval corresponds to element "A" and includes "0001", "0000", "0000", and "0000". The second run-length marker interval corresponds to element "B" and includes "0001" and "0000". The third run-length marker interval corresponds to element "C" and includes "0001" and "0000".

[0110] Furthermore, based on the information of the valid bit markers within the run-length marker interval, the number of runs corresponding to the target element can be determined, and the run count can be associated with the target element to obtain the target encoding result. Specifically, for a run-length marker interval, the consecutive counts of the target element represented by the valid bit markers within that run-length marker interval can be determined, thereby obtaining the number of runs corresponding to the target element.

[0111] Continuing with the original encoding example above, the valid bit markers "0000" and "0011" in the first run-length marker interval corresponding to element "A" indicate that there are three consecutive "1"s at the corresponding position in the first encoded data. That is, the data to be encoded includes three consecutive elements "A". Due to the offset of the encoding logic in this embodiment, i.e., counting starts from the second bit, one needs to be added to this, i.e., the data to be encoded has four consecutive elements "A", and the run count corresponding to element "A" is four. The valid bit markers "0000" and "0001" in the second run-length marker interval corresponding to element "B" indicate that there is one "1" at the corresponding position in the first encoded data. That is, the data to be encoded has one element "B". Similarly, one needs to be added to this, i.e., the data to be encoded has two consecutive elements "B", and the run count corresponding to element "B" is two. The valid bit markers "0000" and "0001" in the third run marker interval corresponding to element "C" can indicate that there is a "1" at the corresponding position in the first encoded data, that is, there is one element "C" in the data to be encoded. Similarly, adding one to this indicates that there are two consecutive elements "C" in the data to be encoded, and the run number corresponding to element "C" is two.

[0112] Continuing with the complementary encoding example above, the valid bit markers "0001", "0000", "0000", and "0000" in the first run-length marker interval corresponding to element "A" indicate that the corresponding position in the first encoded data contains one "1" and three consecutive "0"s. That is, the data to be encoded includes three consecutive elements "A". Due to the offset of the encoding logic in this embodiment, i.e., counting starts from the second bit, one needs to be added to this, i.e., the data to be encoded has four consecutive elements "A", and the run count corresponding to element "A" is four. The valid bit markers "0001" and "0000" in the second run-length marker interval corresponding to element "B" indicate that the corresponding position in the first encoded data contains one "1" and one "0", i.e., the data to be encoded has one element "B". Similarly, one needs to be added to this, i.e., the data to be encoded has two consecutive elements "B", and the run count corresponding to element "B" is two. The valid bit marker code "0001" and "0000" in the third run marker interval corresponding to element "C" can indicate that there is a "1" and a "0" at the corresponding position in the first encoded data, that is, there is one C in the data to be encoded. Similarly, adding one to this indicates that there are two consecutive elements "C" in the data to be encoded, and the run number corresponding to element "C" is two.

[0113] Furthermore, the run count can be associated with the target element to obtain the target encoding result. For example, the target element can be associated with its corresponding run count using a tuple. Alternatively, both the target element and the run count can be converted into binary sequences, and these two binary sequences can be concatenated to form a binary stream.

[0114] Therefore, the run-length encoding device in this embodiment can first pre-encode the data to be encoded through the pre-encoding module to obtain a first encoding result, and then query a second encoding result corresponding to the first encoding result from a preset query table through the query module. Then, the second encoding result and the data to be encoded are associated through the association module to obtain the target encoding result. That is, when using the run-length encoding device in this embodiment for run-length encoding, there is no need to calculate and generate the run-length encoding result in real time. Instead, the complex logic of run-length encoding is preset in the query table, and the second encoding result is obtained directly from the query table based on the first encoding result. This avoids the long time consumption caused by real-time calculation and generation of run-length encoding results, greatly improves the efficiency of run-length encoding, and reduces the time consumption of run-length encoding.

[0115] Furthermore, compared to the serial query method, this embodiment can employ a parallel query method, further reducing the query time. Moreover, this embodiment uses hardware logic instead of traditional software coding, simplifying the run-length encoding logic based on a table lookup mechanism. This eliminates the need for additional complex computational units, significantly simplifying the hardware circuit structure. Furthermore, there are no long-sequence data paths between modules, resulting in excellent timing characteristics in hardware implementation.

[0116] Figure 6 This is a flowchart illustrating a run-length encoding method provided as an embodiment of this application. The following will be combined with... Figure 6 The run-length encoding method is described in detail, which includes S601 to S604, as follows.

[0117] S601, based on the elements included in the data to be encoded, pre-encode the data to be encoded to obtain the first encoding result.

[0118] S602, perform a base conversion on the first encoding result to obtain the index value.

[0119] S603, based on the index value, retrieve the target data corresponding to the index value from the preset lookup table, and use the target data as the second encoding result corresponding to the first encoding result. The lookup table consists of the index value, the valid bit marker code, and the invalid bit marker code. The valid bit marker code indicates the number of consecutive preset data in the pre-encoding result, and the invalid bit marker code indicates that the target data bit in the pre-encoding result is consecutive with the previous data bit and the counting result is invalid.

[0120] S604. Associate the second encoding result with the data to be encoded to obtain the target encoding result. The target encoding result is used to represent the consecutive number of the same element in the data to be encoded.

[0121] In the above run-length encoding method, the data to be encoded can be pre-encoded according to the elements included in the data to be encoded to obtain a first encoding result. By converting the first encoding result into a base, an index value is obtained. Based on the index value, a second encoding result corresponding to the first encoding result is obtained from a preset lookup table. The second encoding result and the data to be encoded are associated to obtain the target encoding result. Thus, there is no need to calculate and generate the run-length encoding result in real time. Instead, the complex logic of run-length encoding is pre-set in the lookup table. The second encoding result is directly obtained from the lookup table based on the first encoding result. This avoids the long time consumption caused by real-time calculation and generation of run-length encoding results, greatly improves the efficiency of run-length encoding, and reduces the time consumption of run-length encoding.

[0122] In some embodiments of this application, S601 is involved, and S601 specifically includes:

[0123] For an element in the data to be encoded, perform a bitwise AND operation between the element and every element in the data to be encoded, and determine the first bitwise AND result for the element.

[0124] For the first AND operation result of an element, perform a AND operation between the first AND operation result of the element and the first AND operation result of the element preceding it to obtain the second AND operation result of the element.

[0125] The first encoding result is determined based on the result of the second AND operation corresponding to each element in the data to be encoded.

[0126] In some embodiments of this application, S601 is involved, and S601 specifically includes:

[0127] For an element in the data to be encoded, perform a bitwise AND operation between the element and every element in the data to be encoded. If the elements participating in the bitwise AND operation are the same, determine that the first bitwise AND operation result for the element is 1.

[0128] For the first AND operation result of an element, perform an AND operation between the first AND operation result of the element and the first AND operation result of the element preceding it. If the first AND operation results are the same, determine that the second AND operation result of the element is 1; the second AND operation result of the first element in the data to be encoded is 0.

[0129] Based on the result of the second AND operation corresponding to each element in the data to be encoded, the original encoding result corresponding to the data to be encoded is determined, and the original encoding result is used as the first encoding result.

[0130] In some embodiments of this application, S601 is involved, and S601 specifically includes:

[0131] For an element in the data to be encoded, perform a bitwise AND operation between the element and every element in the data to be encoded. If the elements participating in the bitwise AND operation are the same, determine that the result of the first bitwise AND operation for the element is 0.

[0132] For the result of the first AND operation corresponding to an element, perform a AND operation between the result of the first AND operation corresponding to the element and the result of the first AND operation corresponding to the element preceding the element. If the results of the first AND operation are the same, determine that the result of the second AND operation corresponding to the element is 0; the result of the second AND operation corresponding to the first element in the data to be encoded is 1.

[0133] Based on the result of the second AND operation corresponding to each element in the data to be encoded, the complementary encoding result corresponding to the data to be encoded is determined, and the complementary encoding result is used as the first encoding result.

[0134] In some embodiments of this application, the first encoding result includes the original encoding result and the complementary encoding result; the second encoding result includes the original second encoding result corresponding to the original encoding result and the complementary second encoding result corresponding to the complementary encoding result; and the target encoding result includes the first target encoding result obtained by associating the original second encoding result and the data to be encoded, and the second target encoding result obtained by associating the complementary second encoding result and the data to be encoded.

[0135] The above run-length encoding method further includes: comparing the first target encoding result and the second target encoding result, and if the first target encoding result and the second target encoding result are the same, determining the first target encoding result or the second target encoding result as the target encoding result.

[0136] In some embodiments of this application, S603 is involved, and S603 specifically includes:

[0137] According to the preset length, split the first encoding result to obtain at least two first sub-encoding results;

[0138] For a given first sub-encoding result, perform a base conversion on the first sub-encoding result to obtain the index value;

[0139] Based on the index value, the target data corresponding to the index value is retrieved from the query table through the query path corresponding to the first sub-encoding result. The target data is used as the second sub-encoding result corresponding to the first sub-encoding result. One first sub-encoding result corresponds to one query path.

[0140] By concatenating the second sub-encoding results corresponding to each first sub-encoding result, we obtain the second encoding result corresponding to the first encoding result.

[0141] In some embodiments of this application, the above-described run-length encoding method further includes:

[0142] For a given first sub-encoding result, if the end marker code in the second sub-encoding result corresponding to the first sub-encoding result is an invalid marker code, and the start marker code in the second sub-encoding result corresponding to the next first sub-encoding result is a valid marker code, then correct the target encoding result.

[0143] In some embodiments of this application, S604 is involved, and S604 specifically includes:

[0144] Based on the first encoding result, determine the run-length marker interval in the second encoding result that corresponds to the target element. The target element is the same and continuous element in the data to be encoded.

[0145] Based on the information of the valid bit markers within the run marker interval, determine the number of runs corresponding to the target element;

[0146] By associating the number of runs with the target element, the target encoding result is obtained.

[0147] Embodiments of this application also provide a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the method described above.

[0148] Taking computer devices as terminals as an example, Figure 7 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. See also... Figure 7 Terminal 700 can be: a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Terminal 700 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.

[0149] Typically, terminal 700 includes a processor 701 and a memory 702.

[0150] In some embodiments of this application, processor 701 may include one or more processing cores, such as a quad-core processor, a penta-core processor, etc. Processor 701 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 701 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 701 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 701 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0151] The memory 702 may include one or more computer-readable storage media, which may be non-transitory. The memory 702 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 702 are used to store at least one program code, which is executed by the processor 701 to implement the process of terminal execution in the method embodiments of this application.

[0152] In some embodiments, the terminal 700 may also optionally include a peripheral device interface 703 and at least one peripheral device. The processor 701, memory 702, and peripheral device interface 703 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 703 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of a display screen 704, a camera assembly 705, an audio circuit 706, and a power supply 707.

[0153] Peripheral device interface 703 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 701 and memory 702. In some embodiments, processor 701, memory 702 and peripheral device interface 703 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 701, memory 702 and peripheral device interface 703 can be implemented on separate chips or circuit boards, and this application embodiment does not limit this.

[0154] Display screen 704 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 704 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 701 for processing. In this case, display screen 704 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 704, disposed on the front panel of terminal 700; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 700 or in a folded design; in other embodiments, display screen 704 may be a flexible display screen, disposed on a curved or folded surface of terminal 700. Furthermore, display screen 704 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 704 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0155] The camera assembly 705 is used to acquire images or videos. In some embodiments, the camera assembly 705 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 705 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash is a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.

[0156] The audio circuit 706 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals which are then input to the processor 701 for processing. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 700. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 701 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 706 may also include a headphone jack.

[0157] Power supply 707 is used to power the various components in terminal 700. Power supply 707 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 707 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0158] Those skilled in the art will understand that Figure 7 The structure shown does not constitute a limitation on terminal 700, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0159] Taking computer equipment as a server as an example, Figure 8 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 800 can vary significantly due to differences in configuration or performance. It may include one or more processors 801 (Central Processing Units, CPUs) and one or more memories 802. The one or more memories 802 store at least one computer program, which is loaded and executed by the one or more processors 801 to implement the aforementioned data decompression method. Of course, the server 800 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server 800 may also include other components for implementing device functions, which will not be elaborated upon here.

[0160] Embodiments of this application also provide a computer-readable storage medium, which includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the method described above. Optionally, the computer-readable storage medium may be read-only memory (ROM), random access memory (RAM), compact-disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0161] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0162] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A run-length encoding apparatus characterized by comprising: include: The module includes a precoding module, a query module, and a correlation module. The precoding module is used to precode the data to be encoded based on the elements in the data to be encoded, and obtain a first encoding result. The query module is used to perform a base conversion on the first encoding result to obtain an index value, and based on the index value, to query the target data corresponding to the index value from a preset query table, and to use the target data as the second encoding result corresponding to the first encoding result. The query table consists of an index value, a valid bit marker code, and an invalid bit marker code. The valid bit marker code indicates the number of consecutive preset data in the first encoding result, and the invalid bit marker code indicates that the target data bit in the first encoding result is consecutive to the previous data bit and the counting result is invalid. The association module is used to associate the second encoding result and the data to be encoded to obtain a target encoding result, wherein the target encoding result represents the number of consecutive identical elements in the data to be encoded.

2. The apparatus of claim 1, wherein, The precoding module is specifically used to perform a bitwise AND operation between an element in the data to be encoded and each element in the data to be encoded, and to determine the first bitwise AND result corresponding to the element. For the first AND operation result corresponding to an element, perform an AND operation between the first AND operation result corresponding to the element and the first AND operation result corresponding to the previous element to obtain the second AND operation result corresponding to the element. The first encoding result is determined based on the result of the second AND operation corresponding to each element in the data to be encoded.

3. The apparatus of claim 2, wherein, The precoding module includes a first precoding module; The first precoding module is used to perform a bitwise AND operation between an element in the data to be encoded and each element in the data to be encoded, and determine that the first bitwise AND operation result corresponding to the element is 1 when the elements participating in the bitwise AND operation are the same. For the first AND operation result corresponding to an element, the first AND operation result corresponding to the element is ANDed with the first AND operation result corresponding to the previous element. If the first AND operation results are the same, the second AND operation result corresponding to the element is determined to be 1; the second AND operation result corresponding to the first element in the data to be encoded is 0. Based on the result of the second AND operation corresponding to each element in the data to be encoded, the original encoding result corresponding to the data to be encoded is determined, and the original encoding result is used as the first encoding result.

4. The apparatus of claim 3, wherein, The precoding module further includes a second precoding module; The second precoding module is used to perform a bitwise AND operation between an element in the data to be encoded and each element in the data to be encoded, and if the elements participating in the bitwise AND operation are the same, determine that the first bitwise AND operation result corresponding to the element is 0. The first AND operation result corresponding to an element is ANDed with the first AND operation result corresponding to a previous element of the element, and in the case that the first AND operation results participating in the AND operation are the same, the second AND operation result corresponding to the element is determined as 0; the second AND operation result corresponding to the first element in the to-be-encoded data is 1; According to the second AND operation result corresponding to each element in the to-be-encoded data, a complementary encoding result corresponding to the to-be-encoded data is determined, and the complementary encoding result is taken as the first encoding result.

5. The apparatus of claim 4, wherein, The first encoding result includes the original encoding result and the complementary encoding result; The second encoding result includes an original second encoding result corresponding to the original encoding result and a complementary second encoding result corresponding to the complementary encoding result, and the target encoding result includes a first target encoding result obtained by associating the original second encoding result and the to-be-encoded data and a second target encoding result obtained by associating the complementary second encoding result and the to-be-encoded data; The device further includes a verification module; The verification module is configured to compare the first target encoding result and the second target encoding result, and in the case that the first target encoding result is the same as the second target encoding result, the first target encoding result or the second target encoding result is determined as the target encoding result.

6. The apparatus of claim 1, wherein, The query module is specifically configured to split the first encoding result according to a preset length to obtain at least two first sub-encoding results; For one first sub-encoding result, the first sub-encoding result is subjected to a base conversion to obtain an index value; Based on the index value, target data corresponding to the index value is queried from the query table through a query path corresponding to the first sub-encoding result, and the target data is taken as a second sub-encoding result corresponding to the first sub-encoding result; one first sub-encoding result corresponds to one query path; The second sub-encoding result corresponding to each first sub-encoding result is spliced to obtain a second encoding result corresponding to the first encoding result.

7. The apparatus of claim 6, wherein, The device further includes a correction module; The correction module is configured to, for one first sub-encoding result, in the case that a tail marker code in the second sub-encoding result corresponding to the first sub-encoding result is an invalid marker code, and a start marker code in the second sub-encoding result corresponding to a next first sub-encoding result of the first sub-encoding result is a valid marker code, correct the target encoding result.

8. The apparatus of claim 1, wherein, The association module is specifically configured to determine a run marker interval corresponding to a target element in the second encoding result according to the first encoding result, the target element being the same and continuous element in the to-be-encoded data; According to information of a valid bit marker code in the run marker interval, a run number corresponding to the target element is determined; The run number and the target element are associated to obtain a target encoding result.

9. A run-length encoding method, characterized by, The method includes: According to elements included in to-be-encoded data, the to-be-encoded data is pre-encoded to obtain a first encoding result; The first encoding result is subjected to a base conversion to obtain an index value; The index value is taken as a second encoding result corresponding to the to-be-encoded data. Based on the index value, a target data corresponding to the index value is queried from a preset query table, the target data is taken as a second encoding result corresponding to the first encoding result, the query table is composed of an index value, a valid bit marker code and an invalid bit marker code, the valid bit marker code represents a number of preset data continuous in the pre-encoding result, and the invalid bit marker code represents that a target data bit and a previous data bit are continuous in the pre-encoding result and a counting result is invalid; The second encoding result and the to-be-encoded data are associated to obtain a target encoding result, the target encoding result is used for representing a continuous number of same elements in the to-be-encoded data.

10. A computer device, comprising: The computer device comprises a processor and a memory, the memory is used for storing at least one program, the at least one program is loaded and executed by the processor, and the run-length encoding method is as claimed in claim 9.