Shuffling method and computing device

By using the shuffling method in the SOC on-chip system to adjust the encoding stream block length, the problem of high encoding rate is solved and a more efficient encoding and decoding process is achieved.

CN112631597BActive Publication Date: 2024-08-23CAMBRICON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910955639.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-10-09
Publication Date
2024-08-23
Estimated Expiration
2040-02-06

AI Technical Summary

Technical Problem

The encoding rate in the data encoding and decoding process in the SOC system on chip is high, resulting in low encoding and decoding efficiency, and the encoding and decoding rate needs to be reduced.

Method used

Using the shuffling method, the data blocks to be encoded or decoded are divided into multiple encoding streams, and divided into shuffling units and groups according to the preset shuffling levels, the output and input shuffling units are determined, and the encoding is adjusted through the shuffling algorithm The length of the flow block is kept close to avoid excessive complements and deadlock situations caused by alignment requirements.

Benefits of technology

The encoding rate is reduced, the encoding and decoding efficiency is improved, deadlock between encoding streams is avoided, and the encoding stream lengths are ensured to be close, thus optimizing the encoding and decoding process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112631597B
    Figure CN112631597B
Patent Text Reader

Abstract

The present application relates to a shuffling method and a computing device. The method comprises: determining at least one first shuffling group corresponding to a data block to be encoded according to a first shuffling level, wherein the first shuffling group comprises a plurality of first shuffling units, and the first shuffling unit comprises at least one coding stream; determining the coding length of each first shuffling unit; determining an output shuffling unit and an input shuffling unit in each first shuffling unit according to the coding length of each first shuffling unit; sending a first preset number of stream blocks to be shuffled in the output shuffling unit to the input shuffling unit as the first stream blocks to be coded in the input shuffling unit, so as to encode the first stream blocks to be coded by the input shuffling unit according to a preset coding algorithm. The present application can reduce the coding rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a shuffling method and a computing device. Background Art

[0002] At present, in the process of encoding and decoding data in SOC (System on a Chip), data padding is required, which leads to a high encoding and decoding rate. Therefore, a solution that can reduce the encoding and decoding rate is urgently needed. Summary of the invention

[0003] Based on this, it is necessary to provide a shuffling method and a computing device to address the above technical issues.

[0004] In a first aspect, a shuffling method is provided, the method comprising:

[0005] Obtain multiple encoding streams corresponding to the data block to be encoded;

[0006] According to a first shuffle level, the plurality of coded streams are divided into a plurality of first shuffle units, and the plurality of first shuffle units are divided into at least one first shuffle group, wherein the first shuffle unit includes at least one coded stream, and the first shuffle group includes a plurality of first shuffle units;

[0007] For each first shuffle unit in each first shuffle group, determining the total coding length of the to-be-coded stream blocks in the coded stream contained in the first shuffle unit as the coding length of the first shuffle unit;

[0008] According to the code length of each of the first shuffling units, determining an output shuffling unit and an input shuffling unit in each of the first shuffling units;

[0009] A first preset number of to-be-shuffled stream blocks in the output shuffling unit are sent to the input shuffling unit as first to-be-encoded stream blocks in the input shuffling unit, so that the first to-be-encoded stream blocks are encoded by the input shuffling unit according to a preset encoding algorithm.

[0010] In a second aspect, a shuffling method is provided, the method comprising:

[0011] Obtain multiple decoding streams corresponding to the data blocks to be decoded;

[0012] According to a first shuffle level, the plurality of decoded streams are divided into a plurality of first shuffle units, and the plurality of first shuffle units are divided into at least one first shuffle group, wherein the first shuffle unit includes at least one decoded stream, and the first shuffle group includes a plurality of first shuffle units;

[0013] For each first shuffle unit in each first shuffle group, determining the total coding length of the to-be-decoded stream blocks in the decoded stream contained in the first shuffle unit as the coding length of the first shuffle unit;

[0014] According to the code length of each of the first shuffling units, determining an output shuffling unit and an input shuffling unit in each of the first shuffling units;

[0015] A first preset number of to-be-shuffled stream blocks in the output shuffling unit are sent to the input shuffling unit as first to-be-decoded stream blocks in the input shuffling unit, so that the first to-be-decoded stream blocks are decoded by the input shuffling unit according to a preset decoding algorithm.

[0016] In a third aspect, a computing device is provided, the computing device comprising a processor;

[0017] The processor is used to receive source data and encode the source data using the method described in any one of the first aspects to obtain encoded data.

[0018] As an optional implementation, the processor includes a control module, an on-chip storage module and a computing module;

[0019] The control module is used to decode the machine instructions received by the processor into coded microinstructions, and use the coded microinstructions to control the operation module to operate the source data in the on-chip storage module and write the source data into the off-chip storage module;

[0020] The control module comprises an encoding unit, and the encoding unit is used for executing the encoding instructions and decoding the encoding instructions into encoding microinstructions.

[0021] In a fourth aspect, a computing device is provided, the computing device comprising a processor;

[0022] The processor is used to receive encoded data and decode the encoded data using the method described in any one of the second aspects to obtain source data.

[0023] As an optional implementation, the processor includes a control module, an on-chip storage module and a computing module;

[0024] The control module is used to decode the machine instructions received by the processor into decoded microinstructions, and use the decoded microinstructions to control the operation module to operate the encoded data in the off-chip storage module and write the encoded data into the on-chip storage module;

[0025] The control module comprises a decoding unit, and the decoding unit is used for executing a decoding instruction and decoding the decoding instruction into a decoding microinstruction.

[0026] The embodiment of the present application provides a shuffling method and a computing device. The codec determines at least one first shuffle group corresponding to the data block to be encoded according to the first shuffle level. The first shuffle group includes multiple first shuffle units, and the first shuffle unit includes at least one coding stream. Then, the codec determines the coding length of each first shuffle unit, and determines the output shuffle unit and the input shuffle unit in each first shuffle unit according to the coding length of each first shuffle unit. After that, the codec sends the first preset number of shuffled stream blocks in the output shuffle unit to the input shuffle unit as the first shuffled stream block in the input shuffle unit, so as to encode the first shuffled stream block according to the preset coding algorithm through the input shuffle unit. In this way, by shuffling the coding streams of the data block to be encoded, the coding lengths of the coding streams can be ensured to be similar, thereby avoiding excessive complements caused by the alignment requirements between the coding streams, thereby reducing the coding rate. At the same time, deadlock between the coding streams can also be avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A schematic diagram of the structure of a codec provided in an embodiment of the present application;

[0028] Figure 2 A schematic diagram of a flow chart of a method for generating a coding stream provided in an embodiment of the present application;

[0029] Figure 3 A schematic diagram of source data provided in an embodiment of the present application;

[0030] Figure 4A A schematic diagram of flow block division provided in an embodiment of the present application;

[0031] Figure 4B A schematic diagram of flow block division provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of a shuffling method provided in an embodiment of the present application;

[0033] Figure 6 A schematic diagram of a process for determining an output / input shuffle unit provided in an embodiment of the present application;

[0034] Fig. 7A A schematic diagram of a coded stream before shuffling provided in an embodiment of the present application;

[0035] Figure 7B A schematic diagram of another coded stream before shuffling provided in an embodiment of the present application;

[0036] Fig. 8A A schematic diagram of a shuffling process of a coded stream provided in an embodiment of the present application;

[0037] Figure 8B A schematic diagram of another shuffling process of a coded stream provided in an embodiment of the present application;

[0038] Fig. 9A A schematic diagram of shuffling of a coded stream provided in an embodiment of the present application;

[0039] Fig. 9B A schematic diagram of another shuffling of a coded stream provided in an embodiment of the present application;

[0040] Fig.10 A schematic diagram of encoding data provided in an embodiment of the present application;

[0041] Fig.11 A schematic diagram of splicing source data sub-blocks provided in an embodiment of the present application;

[0042] Fig. 12A A schematic diagram of splicing coded data sub-blocks provided in an embodiment of the present application;

[0043] Fig. 12B A schematic diagram of splicing coded data sub-blocks provided in an embodiment of the present application;

[0044] Fig. 12C A schematic diagram of splicing coded data sub-blocks provided in an embodiment of the present application;

[0045] Fig.12D A schematic diagram of splicing coded data sub-blocks provided in an embodiment of the present application;

[0046] Fig.13 A schematic diagram of a shuffling method provided in an embodiment of the present application;

[0047] Fig.14 A schematic diagram of a process for determining an output / input shuffle unit provided in an embodiment of the present application;

[0048] Fig.15 A schematic diagram of a decoding stream before shuffling provided in an embodiment of the present application;

[0049] Fig.16 A schematic diagram of a decoding stream shuffling process provided in an embodiment of the present application;

[0050] Fig.17 A schematic diagram of a decoding stream shuffling completed according to an embodiment of the present application;

[0051] Fig.18 A schematic diagram of encoding header data provided in an embodiment of the present application;

[0052] Fig.19A schematic diagram of data division for decoding provided in an embodiment of the present application;

[0053] Fig. 20 A schematic diagram of data division for decoding provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0055] It should be understood that the terms "first", "second", "third", and "fourth" etc. in the claims, specifications, and drawings of the present disclosure are used to distinguish different objects rather than to describe a specific order. The terms "comprise" and "comprising" used in the specifications and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.

[0056] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0057] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0058] An embodiment of the present application provides a shuffling method, which can be applied to a codec (codec). Figure 1 This is a system architecture diagram of a codec provided in an embodiment of the present application. Figure 1As shown, the codec adopts a general processor architecture, which includes at least one memory and a general processor. The at least one memory is used to store a computer program. The general processor is used to execute a shuffling method according to the computer program stored in the memory to ensure that the coding lengths of each coded stream are similar, thereby avoiding excessive complements caused by alignment requirements between each coded stream, thereby reducing the coding rate. Among them, the general processor can be an IPU (Intelligent Processing Unit) or a CPU (Central Processing Unit) or a GPU (Graphics Processing Unit).

[0059] For ease of understanding, the present application embodiment gives priority to a detailed description of a method for generating a coded stream provided by the present application embodiment. Figure 2 As shown, the specific steps are as follows:

[0060] Step 201: Obtain source data to be encoded.

[0061] In implementation, when the codec needs to encode source data, the codec can obtain the pre-stored source data to be encoded. Figure 3 As shown, the format of the source data is a two-dimensional format, the low dimension is X, the high dimension is Y, the starting address is the data address, the size of the source data is the low-dimensional data size (data size X) * the high-dimensional data size (data size Y), and the stride of the source data in the low dimension is the low-dimensional data stride (data stride X). The source data can be further evenly divided into multiple source data blocks in two dimensions, such as Figure 3 As shown, each block represents a source data block, the size of the source data block is the low-dimensional source data block size (block size X)*the high-dimensional source data block size (block size Y), the low-dimensional interval between two adjacent source data blocks is the low-dimensional source data block stride (block strideX), and the high-dimensional interval is the high-dimensional source data block stride (block stride Y).

[0062] Step 202: According to the received encoding instruction, a coding area corresponding to the encoding instruction is determined in the source data, where the encoding area includes at least one data block to be encoded, and the data block to be encoded is a source data block or a source data sub-block.

[0063] In implementation, after the codec obtains the source data to be encoded, it can determine the encoding area corresponding to the encoding instruction in the source data according to the received encoding instruction. The encoding area includes at least one data block to be encoded, and the data block to be encoded is a source data block or a source data sub-block. Figure 3 As shown, the dotted box is the coding area, which can be obtained by specifying the low-dimensional offset (offset X) in the low-dimensional direction and the high-dimensional offset (offset Y) in the high-dimensional direction in the source data. The coding area contains the number of low-dimensional source data blocks (block num X) in the low-dimensional direction and the number of high-dimensional source data blocks (block num Y) in the high-dimensional direction. The starting address (start address) of the coding area is the address of the starting source data block.

[0064] After the codec obtains the encoding area corresponding to the encoding instruction, it targets the central source data block (i.e. Figure 3 The codec can directly encode the source data block represented by the vertical square in the source data block. Figure 3 The codec may determine a source data sub-block in the source data block by specifying four parameters, namely, top, bottom, left, and right, and encode the determined source data sub-block.

[0065] It should be noted that, except for the coding area, the data in other areas of the source data do not need to be segmented, and the size of the data in other areas does not need to be aligned to the size of the source data block, and the low-dimensional offset, high-dimensional offset, low-dimensional source data block stride, high-dimensional source data block stride, low-dimensional source data size, high-dimensional source data size and low-dimensional source data stride do not need to be aligned with the low-dimensional source data block size or the high-dimensional source data block size. That is, the codec supports arbitrary segmentation in the source data, and arbitrarily extracts the coding area from the obtained source data block for encoding.

[0066] Step 203: for each data block to be encoded in at least one data block to be encoded, divide the data block to be encoded into multiple stream blocks, and send the multiple stream blocks to multiple encoding streams corresponding to the data block to be encoded as stream blocks to be shuffled in the multiple encoding streams.

[0067] In implementation, in order to improve the encoding throughput, the codec may encode the same data block to be encoded in parallel through multiple encoding streams. Similarly, when the codec performs shuffling, for each data block to be encoded, the codec may divide the data block to be encoded into multiple stream blocks, and send the multiple stream blocks to the multiple encoding streams corresponding to the data block to be encoded as stream blocks to be shuffled in the multiple encoding streams. Optionally, the codec may divide the data block to be encoded into multiple row sequences, each row sequence containing at least one data sub-block to be encoded. Then, for each data sub-block to be encoded in each row sequence, the codec may divide the data sub-block to be encoded into multiple stream blocks. In this way, it can be ensured that the number of stream blocks in each encoding stream is similar. For example, Figure 4A As shown, the codec divides the data block to be encoded into 4 row sequences. Among them, the first row sequence contains data sub-block 1 to be encoded, data sub-block 2 to be encoded, data sub-block 3 to be encoded and data sub-block 4 to be encoded; the second row sequence contains data sub-block 5 to be encoded, data sub-block 6 to be encoded, data sub-block 7 to be encoded and data sub-block 8 to be encoded; the third row sequence contains data sub-block 9 to be encoded, data sub-block 10 to be encoded, data sub-block 11 to be encoded and data sub-block 12 to be encoded; the fourth row sequence contains data sub-block 13 to be encoded, data sub-block 14 to be encoded, data sub-block 15 to be encoded and data sub-block 16 to be encoded, and the slashed squares in each row sequence represent non-encoded data in the data block to be encoded. Then, as shown Figure 4B As shown, for each data sub-block to be encoded in each row sequence, the codec can divide the data sub-block to be encoded into 4 stream blocks, and send them to the encoding stream (steam) 1 to the encoding stream 4 respectively as the stream blocks to be shuffled in each encoding stream. Among them, the encoding stream 1 and the encoding stream 2 contain 16 stream blocks to be shuffled, and the encoding stream 3 and the encoding stream 4 contain 12 stream blocks to be shuffled.

[0068] The following will be combined with a specific embodiment to describe in detail a shuffling method provided in an embodiment of the present application, and the shuffling method is applied to the encoding process. Figure 5 As shown, the specific steps are as follows:

[0069] Step 501: Acquire multiple encoding streams corresponding to the data block to be encoded.

[0070] In an implementation, when the codec needs to shuffle multiple coded streams corresponding to the data block to be encoded, the codec may obtain the multiple coded streams corresponding to the data block to be encoded.

[0071] Step 502: divide the plurality of coded streams into a plurality of first shuffle units according to the first shuffle level, and divide the plurality of first shuffle units into at least one first shuffle group, wherein the first shuffle unit includes at least one coded stream, and the first shuffle group includes a plurality of first shuffle units.

[0072] In implementation, the codec may select a corresponding shuffle level from the preset shuffle levels according to the difference in the number of stream blocks contained in each coded stream. For example, three shuffle levels may be preset in the codec, shuffle level 1, shuffle level 2, and shuffle level 3. After the codec selects a certain shuffle level (i.e., the first shuffle level), it may further determine at least one first shuffle group corresponding to the to-be-coded data block according to the first shuffle level. The first shuffle group includes a plurality of first shuffle units, and the first shuffle unit includes at least one coded stream.

[0073] After the codec obtains multiple coded streams corresponding to the data block to be encoded, the codec can divide the multiple coded streams into multiple first shuffle units according to the first shuffle level, and divide the multiple first shuffle units into at least one first shuffle group, wherein the first shuffle unit includes at least one coded stream, and the first shuffle group includes multiple first shuffle units. For example, the data block to be encoded corresponds to 32 encoding streams. When the first shuffle level is shuffle level 1, the codec can divide the 32 encoding streams into 32 first shuffle units, and divide the 32 first shuffle units into 8 first shuffle groups, that is, every 4 adjacent encoding streams are shuffled; when the first shuffle level is shuffle level 2, the codec can divide the 32 encoding streams into 8 first shuffle units, and divide the 8 first shuffle units into 2 first shuffle groups, that is, shuffle 4 encoding streams in every 16 adjacent encoding streams as one shuffle unit; when the first shuffle level is shuffle level 3, the codec can divide the 32 encoding streams into 2 first shuffle units, and divide the 2 first shuffle units into 1 first shuffle group, that is, shuffle 16 encoding streams in the 32 encoding streams as one shuffle unit.

[0074] Step 503: For each first shuffle unit in each first shuffle group, the codec may determine the total coding length of the to-be-coded stream blocks in the coded stream included in the first shuffle unit as the coding length of the first shuffle unit.

[0075] In implementation, after the codec determines the first shuffle group corresponding to the data block to be encoded, for each first shuffle unit in each first shuffle group, the codec may further determine the total encoding length of the stream blocks to be encoded in the coded stream contained in the first shuffle unit as the encoding length of the first shuffle unit. Optionally, in the case where the shuffle process and the encoding process are performed simultaneously, the codec may also determine the total encoding length of the stream blocks to be encoded and the encoded stream blocks in the coded stream contained in the first shuffle unit as the encoding length of the first shuffle unit.

[0076] Step 504: Determine output shuffling units and input shuffling units in each first shuffling unit according to the code length of each first shuffling unit.

[0077] In implementation, after the codec determines the coding length of each first shuffle unit, the output shuffle unit and the input shuffle unit can be determined in each first shuffle unit according to the coding length of each first shuffle unit. Figure 6 As shown, the codec determines the processing process of the output shuffle unit and the input shuffle unit in each first shuffle unit according to the coding length of each first shuffle unit as follows:

[0078] Step 601: Determine the shuffling type of each first shuffling unit according to the encoding length of each first shuffling unit.

[0079] In implementation, after the codec determines the coding length of each first shuffle unit, the codec can determine the shuffle type of each first shuffle unit according to the coding length of each first shuffle unit. There are various ways for the codec to determine the shuffle type of each first shuffle unit according to the coding length of each first shuffle unit. The embodiment of the present application provides two feasible ways, which are as follows:

[0080] Mode 1: For each first shuffle unit, the codec can determine the shuffle type of the first shuffle unit according to the first difference between the code length of the first shuffle unit and the code length of other first shuffle units. The specific processing process is as follows:

[0081] Step 1: for each first shuffle unit in each first shuffle unit, determine a first difference between a code length of the first shuffle unit and code lengths of other first shuffle units.

[0082] In implementation, after the codec determines the code length of each first shuffle unit, for each first shuffle unit, the codec may further determine a first difference between the code length of the first shuffle unit and the code lengths of other first shuffle units. Example 1: Fig. 7A As shown, taking 4 shuffling units as a shuffling group for shuffling, each shuffling unit containing a coding stream as an example, the coding length of coding stream 1 is N+5, the coding length of coding stream 2 is N+9, the coding length of coding stream 3 is N, and the coding length of coding stream 4 is N+3, where N is a positive integer, the first difference corresponding to coding stream 1 is {-4, 5, 2}, the first difference corresponding to coding stream 2 is {4, 9, 6}, the first difference corresponding to coding stream 3 is {-5, -9, -3}, and the first difference corresponding to coding stream 4 is {-2, -6, 3}.

[0083] Example 2: Figure 7BAs shown, taking 4 shuffling units as a shuffling group for shuffling, and each shuffling unit containing a coding stream as an example, the coding length of coding stream 1 is N+15, the coding length of coding stream 2 is N+10, the coding length of coding stream 3 is N+8, and the coding length of coding stream 4 is N, where N is a positive integer, the first difference corresponding to coding stream 1 is {5, 7, 15}, the first difference corresponding to coding stream 2 is {-5, 2, 10}, the first difference corresponding to coding stream 3 is {-7, -2, 8}, and the first difference corresponding to coding stream 4 is {-15, -10, -8}.

[0084] Step 2: Determine the shuffling type of the first shuffling unit according to the first difference corresponding to the first shuffling unit.

[0085] In implementation, a first preset difference threshold may be pre-stored in the codec. The first preset difference threshold may be set by a technician based on experience. After the codec obtains the first difference corresponding to the first shuffle unit, it may determine whether there is a target difference whose absolute value is greater than or equal to the first preset difference threshold in the first difference corresponding to the first shuffle unit, and whether the target difference values ​​are all positive numbers. If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold in the first difference corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, the codec executes step three. If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold in the first difference corresponding to the first shuffle unit, and there is a negative target difference in the target difference, the codec executes step four. If there is no target difference whose absolute value is greater than or equal to the first preset difference threshold in the first difference corresponding to the first shuffle unit. The codec executes step five.

[0086] Step three: determine that the shuffling type of the first shuffling unit is a high coding type.

[0087] In implementation, if there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, the codec can determine that the shuffle type of the first shuffle unit is a high coding type (hereinafter represented by H). For example, in the above example 1, if Fig. 7A As shown, the first preset difference threshold is 7, then the shuffle type of the coded stream 2 is H. In the above example 2, Figure 7B As shown, the first preset difference threshold is 7, and the shuffle type of the coding stream 1 and the coding stream 2 is H.

[0088] Step 4: determine that the shuffling type of the first shuffling unit is a low coding type.

[0089] In implementation, if there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, and there is a negative target difference value in the target difference value, the codec may determine that the shuffle type of the first shuffle unit is a low coding type (hereinafter represented by L). For example, in the above example 1, if Fig. 7A As shown, the first preset difference threshold is 7, then the shuffle type of the coded stream 3 is L. In the above example 2, Figure 7B As shown, the first preset difference threshold is 7, and the shuffle type of the coding stream 3 and the coding stream 4 is L.

[0090] Step 5: Determine that the shuffling type of the first shuffling unit is a medium coding type.

[0091] In implementation, if there is no target difference value whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, the codec may determine that the shuffle type of the first shuffle unit is a medium coding type (hereinafter represented by M). For example, in the above example 1, if Fig. 7A As shown, the first preset difference threshold is 7, and the shuffle type of the coding stream 1 and the coding stream 4 is M.

[0092] Mode 2: For each first shuffle unit, the codec can determine the shuffle type of the first shuffle unit according to the second difference between the code length of the first shuffle unit and the average code length. The specific processing process is as follows:

[0093] Step 1: Determine the average code length according to the code length of each first shuffle unit.

[0094] In implementation, after the codec determines the code length of each first shuffle unit, the average code length can be determined according to the code length of each first shuffle unit. Example 3: shuffle four shuffle units as a shuffle group, each shuffle unit contains a code stream, the code length of code stream 1 is N+5, the code length of code stream 2 is N+9, the code length of code stream 3 is N, and the code length of code stream 4 is N+3, where N is a positive integer, and the average code length is N+4.25.

[0095] Example 4: Taking 4 shuffling units as a shuffling group for shuffling, each shuffling unit contains a coding stream as an example, the coding length of coding stream 1 is N+15, the coding length of coding stream 2 is N+10, the coding length of coding stream 3 is N+8, and the coding length of coding stream 4 is N, where N is a positive integer, and the average coding length is N+8.25.

[0096] Step 2: for each first shuffle unit in each first shuffle unit, determine a second difference between the code length of the first shuffle unit and the average code length.

[0097] In implementation, after the codec determines the average code length, for each first shuffle unit, the codec may further determine a second difference between the code length of the first shuffle unit and the average code length. For example, in the above example 3, the second difference corresponding to code stream 1 is 0.75, the second difference corresponding to code stream 2 is 4.75, the second difference corresponding to code stream 3 is -4.25, and the second difference corresponding to code stream 4 is -1.25; in the above example 4, the second difference corresponding to code stream 1 is 6.75, the second difference corresponding to code stream 2 is 1.75, the second difference corresponding to code stream 3 is -0.25, and the second difference corresponding to code stream 4 is -8.25.

[0098] Step three: determining the shuffling type of the first shuffling unit according to the second difference corresponding to the first shuffling unit.

[0099] In implementation, a second preset difference threshold may be pre-stored in the codec. The second preset difference threshold may be set by a technician based on experience. After the codec obtains the second difference corresponding to the first shuffle unit, it may determine whether the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and whether the second difference is a positive number. If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, the codec executes step four. If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, the codec executes step five. If the absolute value of the second difference corresponding to the first shuffle unit is less than the second preset difference threshold, the codec executes step six.

[0100] Step 4: determine that the shuffling type of the first shuffling unit is a high coding type.

[0101] In an implementation, if the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, the codec may determine that the shuffle type of the first shuffle unit is a high coding type (i.e., H). For example, in the above example 3, the second preset difference threshold is 4, and the shuffle type of the coded stream 2 is H; in the above example 4, the second preset difference threshold is 6, and the shuffle type of the coded stream 1 is H.

[0102] Step 5: Determine that the shuffling type of the first shuffling unit is a low coding type.

[0103] In an implementation, if the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, the codec may determine that the shuffle type of the first shuffle unit is a low coding type (i.e., L). For example, in the above example 3, the second preset difference threshold is 4, and the shuffle type of the coded stream 3 is L; in the above example 4, the second preset difference threshold is 6, and the shuffle type of the coded stream 4 is L.

[0104] Step six, determining that the shuffling type of the first shuffling unit is a medium coding type.

[0105] In implementation, if the absolute value of the second difference corresponding to the first shuffle unit is less than the second preset difference threshold, the codec may determine that the shuffle type of the first shuffle unit is the medium coding type (i.e., M). For example, in the above example 3, the second preset difference threshold is 4, and the shuffle type of the coded stream 1 and the coded stream 4 is M; in the above example 4, the second preset difference threshold is 6, and the shuffle type of the coded stream 2 and the coded stream 3 is M.

[0106] Step 602: Determine, in each first shuffling unit, an output shuffling unit and an input shuffling unit corresponding to each output shuffling unit according to the shuffling type of each first shuffling unit and a preset shuffling rule.

[0107] In implementation, the codec may be pre-stored with shuffling rules. The shuffling rules may be set by a technician based on experience. After the codec obtains the shuffling type of each first shuffling unit, it may further determine the output shuffling unit and the input shuffling unit corresponding to each output shuffling unit in each first shuffling unit according to the shuffling type of each first shuffling unit and the preset shuffling rule. The process of the codec determining the output shuffling unit and the input shuffling unit corresponding to each output shuffling unit in each first shuffling unit according to the shuffling type of each first shuffling unit and the preset shuffling rule is as follows:

[0108] Step 1: If the first number of the first target shuffle units of the high coding type is less than or equal to the second number of the second target shuffle units of the low coding type, the first target shuffle unit is determined as the output shuffle unit, and for each output shuffle unit, at least one second target shuffle unit is determined in the second target shuffle unit as the input shuffle unit corresponding to the output shuffle unit.

[0109] In implementation, if the first number of the first target shuffle units of the high coding type is less than or equal to the second number of the second target shuffle units of the low coding type, the codec may determine the first target shuffle unit as the output shuffle unit. Then, for each output shuffle unit, the codec may determine at least one second target shuffle unit in the second target shuffle unit as the input shuffle unit corresponding to the output shuffle unit. Among them, a second target shuffle unit may be used only as an input shuffle unit corresponding to an output shuffle unit, or as an input shuffle unit corresponding to multiple output shuffle units, which is not limited in the embodiments of the present application. For example, taking 4 shuffle units as a shuffle group for shuffling, and each shuffle unit containing a coded stream as an example, when the shuffle type of coded streams 1 to 4 is HMML, the codec can determine coded stream 1 as the output shuffle unit, and determine coded stream 4 as the input shuffle unit of coded stream 1; when the shuffle type of coded streams 1 to 4 is HMLL, the codec can determine coded stream 1 as the output shuffle unit, and determine coded streams 3 and coded streams 4 as the input shuffle units of coded stream 1; when the shuffle type of coded streams 1 to 4 is HLLL, the codec can determine coded stream 1 as the output shuffle unit, and determine coded streams 2, 3 and 4 as the input shuffle units of coded stream 1. Stream 3 and coded stream 4 are determined as input shuffle units of coded stream 1; when the shuffle type of coded stream 1 to coded stream 4 is HHLL, the codec can determine coded stream 1 and coded stream 2 as output shuffle units, and determine coded stream 3 as the input shuffle unit of coded stream 1, and determine coded stream 4 as the input shuffle unit of coded stream 2. The codec can also determine coded stream 3 and coded stream 4 as the input shuffle unit of coded stream 1, and determine coded stream 3 and coded stream 4 as the input shuffle unit of coded stream 2. The codec can also determine coded stream 3 as the input shuffle unit of coded stream 1, and determine coded stream 3 and coded stream 4 as the input shuffle unit of coded stream 2.

[0110] Step 2: If the first number of first target shuffle units of the high coding type is greater than the second number of second target shuffle units of the low coding type, the second number of first target shuffle units are determined as output shuffle units, and for each output shuffle unit, at least one second target shuffle unit is determined in the second target shuffle unit as the input shuffle unit corresponding to the output shuffle unit.

[0111] In implementation, if the first number of first target shuffle units of the high coding type is greater than the second number of second target shuffle units of the low coding type, the codec may determine the second number of first target shuffle units as output shuffle units in each first target shuffle unit. Then, for each output shuffle unit, the codec may determine at least one second target shuffle unit in the second target shuffle unit as the input shuffle unit corresponding to the output shuffle unit. Among them, a second target shuffle unit may be used only as an input shuffle unit corresponding to an output shuffle unit, or as an input shuffle unit corresponding to multiple output shuffle units, which is not limited in the embodiments of the present application. For example, taking 4 shuffling units as a shuffling group for shuffling, and each shuffling unit containing a coding stream as an example, when the shuffling type of coding streams 1 to 4 is HHML, the codec can determine coding stream 2 as the output shuffling unit, and determine coding stream 4 as the input shuffling unit of coding stream 2; when the shuffling type of coding streams 1 to 4 is HHHL, the codec can determine coding stream 3 as the output shuffling unit, and determine coding stream 4 as the input shuffling unit of coding stream 1.

[0112] It should be noted that if the first number of first target shuffle units of high coding type is greater than the second number of second target shuffle units of low coding type, and there is a third target shuffle unit of medium coding type in each shuffle unit, the codec can further determine several first target shuffle units as output shuffle units (hereinafter referred to as second output shuffle units) in the first target shuffle units other than the output shuffle units (hereinafter referred to as first output shuffle units) determined as corresponding to the second target shuffle units, and for each second output shuffle unit, the codec can determine at least one third target shuffle unit in the third target shuffle unit as the input shuffle unit corresponding to the second output shuffle unit. For example, taking 4 shuffling units as a shuffling group for shuffling, and each shuffling unit containing a coding stream as an example, when the shuffling type of coding streams 1 to 4 is HHML, the codec can determine coding stream 2 as the first output shuffling unit, and determine coding stream 4 as the input shuffling unit of coding stream 2; at the same time, the codec can also determine coding stream 1 as the second output shuffling unit, and determine coding stream 3 as the input shuffling unit of coding stream 1.

[0113] In addition, for the third target shuffle unit of the medium coding type, for each third target shuffle unit, the codec can determine the third target shuffle unit as an output shuffle unit, and determine itself as an input shuffle unit corresponding to the third target shuffle unit. For example, taking 4 shuffle units as a shuffle group for shuffling, and each shuffle unit containing a coded stream as an example, when the shuffle type of coded streams 1 to 4 is MMMM, the codec can determine coded stream 1 as an output shuffle unit, and determine coded stream 1 as an input shuffle unit of coded stream 1, and coded streams 2 to 4 are similar, which will not be repeated here.

[0114] Step 505: Send the first preset number of stream blocks to be shuffled in the output shuffling unit to the input shuffling unit as the first stream block to be encoded in the input shuffling unit, so that the first stream block to be encoded is encoded by the input shuffling unit according to a preset encoding algorithm.

[0115] In implementation, a first preset number may be pre-stored in the codec. The first preset number may be set by a technician based on experience. After the codec determines the output shuffle unit and the input shuffle unit, the codec may send the first preset number of to-be-shuffled stream blocks in the output shuffle unit to the input shuffle unit as the first to-be-encoded stream block in the input shuffle unit, so that the first to-be-encoded stream block is encoded by the input shuffle unit according to a preset encoding algorithm. Among them, the first preset number may be greater than or equal to the number of input shuffle units; the to-be-shuffled stream blocks received by each input shuffle unit may be the same or different; for each input shuffle unit, the codec may also input the third preset number of to-be-shuffled units in the input shuffle unit into the to-be-encoded queue of the input shuffle unit as the first to-be-encoded stream block of the input shuffle unit.

[0116] Optionally, for each output shuffle unit, a second preset number of stream blocks to be shuffled in the output shuffle unit are sent to an input shuffle unit corresponding to the output shuffle unit as the first stream block to be encoded in the input shuffle unit.

[0117] In implementation, a second preset number may be pre-stored in the codec. The second preset number may be set by a technician based on experience. For the case where the output shuffle unit corresponds to the input shuffle unit, for each output shuffle unit, the codec may send the second preset number of stream blocks to be shuffled in the output shuffle unit to the input shuffle unit corresponding to the output shuffle unit as the first stream block to be encoded in the input shuffle unit. The second preset number may be greater than or equal to the number of input shuffle units corresponding to the output shuffle unit, and the number of stream blocks to be shuffled received by each input shuffle unit may be the same or different. In this way, the coding lengths of each shuffle unit can be guaranteed to be similar. For example, Fig. 8A As shown, 4 shuffle units are used as a shuffle group for shuffling, and each shuffle unit contains a code stream. For example, the shuffle type of code streams 1 to 4 is MHLM, then code stream 2 is the output shuffle unit, and code stream 3 is the input shuffle unit of code stream 2. Code stream 1 can output one to-be-shuffled stream block to code stream 1, code stream 2 can output one to-be-shuffled stream block to code stream 3, and code stream 4 can output one to-be-shuffled stream block to code stream 4. In this way, Fig. 9A As shown, after the shuffling is completed, the code length of code stream 1 is N+8, the code length of code stream 2 is N+9, the code length of code stream 3 is N+3, and the code length of code stream 4 is N+6. The shuffling type of code streams 1 to 4 is MMMM. For another example, Figure 8B As shown in the figure, shuffling is performed using four shuffling units as a shuffling group, and each shuffling unit contains one code stream. The shuffling type of code streams 1 to 4 is HHLL, then code stream 1 and code stream 2 are output shuffling units, code stream 3 and code stream 4 are input shuffling units of code stream 1, and code stream 4 is the input shuffling unit of code stream 2. Code stream 1 can output one to-be-shuffled stream block to code stream 3 and code stream 4 respectively, and code stream 2 can output two to-be-shuffled stream blocks to code stream 4. In this way, Fig. 9B As shown, after the shuffling is completed, the code length of code stream 1 is N+15, the code length of code stream 2 is N+10, the code length of code stream 3 is N+11, and the code length of code stream 4 is N+9. The shuffling type of code stream 1 to code stream 4 is MMMM.

[0118] As an optional implementation, the codec may determine at least one second shuffle group corresponding to the data block to be encoded according to the second shuffle level. The second shuffle group includes a plurality of second shuffle units, and the second shuffle unit includes at least one coded stream. Then, the codec may re-shuffle the stream blocks to be encoded in each second shuffle unit as the stream blocks to be shuffled until the code length of each second shuffle unit meets the preset proximity condition.

[0119] In implementation, after the codec shuffles the coded stream corresponding to the data block to be coded according to the first shuffle level, the codec may further determine at least one second shuffle group corresponding to the data block to be coded according to the second shuffle level. The second shuffle group includes a plurality of second shuffle units, and the second shuffle unit includes at least one coded stream. The process of the codec determining at least one second shuffle group corresponding to the data block to be coded according to the second shuffle level is similar to step 502, and will not be repeated here. Then, the codec may re-shuffle the stream blocks to be coded in each second shuffle unit as the stream blocks to be shuffled until the coding length of each second shuffle unit meets the preset proximity condition.

[0120] It should be noted that after the codec shuffles the coded stream corresponding to the data block to be coded according to the second shuffle level, it can further shuffle the coded stream corresponding to the data block to be coded according to the third shuffle level. For example, the codec can shuffle the coded stream corresponding to the data block to be coded according to shuffle level 1-shuffle level 2-shuffle level 3, or shuffle the coded stream corresponding to the data block to be coded according to shuffle level 1-shuffle level 3-shuffle level 2, or shuffle the coded stream corresponding to the data block to be coded according to shuffle level 2-shuffle level 3-shuffle level 1.

[0121] As an optional implementation, when the codec detects that the encoding of a first encoded stream among multiple encoded streams is completed, a third preset number of to-be-encoded stream blocks in a second encoded stream that has not been fully encoded among the multiple encoded streams are sent to the first encoded stream as to-be-encoded stream blocks in the first encoded stream.

[0122] In implementation, in order to further balance the coding length of each coded stream and improve the coding rate when encoding small data blocks. A third preset number may be pre-stored in the codec. The third preset number may be set by a technician based on experience. When the codec detects that the first coded stream in multiple coded streams is encoded (that is, the first coded stream outputs the coded stream end (StreamFinish) mark), the third preset number of stream blocks to be encoded in the second coded stream that has not been encoded in the multiple coded streams can be sent to the first coded stream as the stream blocks to be encoded in the first coded stream. Among them, the second coded stream can be all the coded streams that have not been encoded in the multiple coded streams, or it can be part of the coded streams that have not been encoded in the multiple coded streams.

[0123] As an optional implementation manner, the codec encodes the first to-be-encoded stream block through the input shuffling unit according to a preset encoding algorithm as follows:

[0124] Step 1: Encode the preset characters contained in the first to-be-encoded stream block according to a first encoding rule corresponding to the preset characters to obtain first encoded data.

[0125] In implementation, the codec may pre-store a first encoding rule corresponding to a preset character. The first encoding rule corresponding to the preset character may be set by a technician based on experience. The codec may encode the preset character contained in the first to-be-encoded stream block according to the first encoding rule corresponding to the preset character to obtain first encoded data. Since the neural network data has a sparse characteristic, the technician may set a number of consecutive all-zero characters as preset characters. Table 1 shows the preset characters, as shown in Table 1:

[0126] Table 1

[0127]

[0128]

[0129] Step 2: Encode the first coded data according to a preset second coding rule.

[0130] In implementation, the codec may pre-store a second encoding rule. The second encoding rule may be a prefix code encoding algorithm or other encoding algorithms, which is not limited in the embodiment of the present application. After the codec obtains the first encoded data, it may encode the first encoded data according to the preset second encoding rule.

[0131] As an optional implementation, the codec encodes the data blocks to be encoded, and after obtaining the encoded data blocks, it can generate encoding header blocks for the encoded data blocks corresponding to the data blocks to be encoded. The encoding header blocks contain the storage addresses of the encoded data blocks corresponding to the encoding header blocks. Then, the codec can store the encoding header blocks and store the encoded data blocks after the encoding header blocks.

[0132] In implementation, for the coded data block corresponding to the to-be-coded data block, such as Fig.10 As shown, the codec is stored in the form of header-data block mapping. The mapping form is divided into two parts, namely the coding header part and the coding data block part. The starting address of the coding header part is the coding header address; the space occupied by the coding header part is the size of the total number of coding headers (head total number) coding header blocks, and the total number of coding headers can be greater than or equal to the number of valid coding header blocks. Among them, the size of each coding header block is 16 bits (byte), and each coding header block stores the starting address and actual size of the coding data block corresponding to the coding header block, and each coding header block is stored continuously in the storage device. The coding data block part is stored next to the end address of the coding header part. Each coding data block part contains a number of coding data blocks, and each coding data block corresponds to the h coding header block one by one. Among them, the storage format of the coding data block is divided into two types: packing format and unpacking format.

[0133] Optionally, for the packing format, the coded data block consists of coded data, and the size of the coded data is equal to the size of the to-be-coded data in the to-be-coded data block after being encoded.

[0134] In implementation, Fig.10As shown, in the packing format, the coded data blocks are stored closely, each coded data block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the coded data block after being coded. That is, the space occupied by the coded data block is the actual size of the coded data block after being coded.

[0135] Optionally, for a non-packed format, the coded data block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be coded.

[0136] In implementation, Fig.10 As shown, in the non-packed format, each coded data block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be coded. That is, each coded data block occupies the same space and is equal to the size of a complete data block to be coded before encoding. Among them, the first part is the coded data, and the second part is the reserved padding data.

[0137] As an optional implementation, the coded data block is composed of coded data sub-blocks corresponding to multiple source data sub-blocks belonging to the same source data block. In a packed format, the coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the to-be-coded data in the source data sub-block after being encoded. In a non-packed format, the coded data sub-block is composed of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block.

[0138] In practice, when the codec determines multiple coding areas in the source data according to different coding instructions, it may split a complete source data block into multiple source data sub-blocks. The coding areas corresponding to the coding instructions are on the adjacent side, and either they all encode the complete source data block, and the source data blocks do not overlap each other; or they each encode a part of the same source data block (that is, the source data sub-block), and the boundaries of the source data sub-blocks in the source data block just overlap. Fig.11As shown, the four coding regions determined by the four coding instructions in the source data divide part of the source data block (represented by gray oblique line blocks) into multiple source data sub-blocks, and the boundaries of each source data sub-block in the same source data block just overlap. The codec encodes each source data sub-block in the same source data block according to different coding instructions to obtain coded data sub-blocks. When the codec stores the coded data sub-blocks corresponding to multiple source data sub-blocks in the same source data block, the coded data sub-blocks can be stored in the same coded data block. In this way, multiple coding instructions can be coordinated to complete the splicing of specific coding regions, and the effect is exactly the same as encoding through one coding instruction, and the execution order of these coding instructions can be arbitrary or even concurrently executed, so that the coding task can be divided in the case of multi-core source data division and block division for pipeline execution within a single core.

[0139] like Fig. 12A As shown in , a source data block is divided into two parts in both low-dimensional and high-dimensional dimensions, so that the source data block is divided into four source data sub-blocks, namely TL (top-left), TR (top-right), BL (bottom-left) and BR (bottom-right). The size of each source data sub-block is as follows: Fig. 12A As shown, the codec can be specified by four parameters: block left, block right, block top, and block bottom inside the source data block. Each source data sub-block can be coded data or non-coded data. In the coded data block in the non-packed format, the above 4 source data sub-blocks corresponding to the 4 coded data sub-blocks can be stored in a fixed order of TL-TR-BL-BR, and each coded data sub-block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block. That is, the space occupied by each coded data sub-block is the size of the source data sub-block corresponding to the coded data sub-block before encoding. In this way, the space of the coded data block is the same as the size of the source data block, thereby ensuring that if each source data sub-block of the source data block is encoded by different encoding instructions, each encoding instruction can calculate the address of the coded data sub-block it is responsible for based on the partition information (which can be calculated through the instruction field), thereby realizing the splicing of the results of multiple encoding instructions.

[0140] like Fig. 12AAs shown, the codec can convert the coded data block in the non-packed format into the coded data block in the packed format by means of coding move (Move) and the like. In the coded data block in the packed format, each coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the source data sub-block after being encoded. Among them, the coded data sub-blocks are stored closely, and the starting address of each coded data sub-block needs to be accumulated according to the actual size of the previous coded data sub-block, and the space occupied by the entire coded data block is the sum of the sizes of all coded data sub-blocks.

[0141] like Fig. 12B As shown, a source data block is divided into two parts in high dimension, so that the source data block is divided into two source data sub-blocks, namely TL and BL, or BL and BR. Fig. 12C As shown, a source data block is divided into two parts in a low dimension, so that the source data block is divided into two source data sub-blocks, namely TL and TR, or TR and BR.

[0142] A source data block is not divided in low dimension or high dimension, and has only one source data sub-block, which can be TL, TR, BL or BR. Fig.12D As shown, a source data block has only one source data sub-block TL.

[0143] In order to support the splicing of different coding areas, the format of the coding header corresponding to the coding data block containing multiple coding data sub-blocks is shown in Table 2.

[0144] Table 2

[0145]

[0146]

[0147] As an optional implementation, if the total encoding length of the to-be-encoded stream blocks in each first shuffle group is greater than the original length of the to-be-encoded data block, the encoding process of the to-be-encoded data block is terminated.

[0148] In implementation, in order to ensure that the coded data block can be stored in a non-packed format, it is necessary to ensure that the size of the coded data block cannot exceed the size of the data block to be encoded. When the codec performs shuffling processing on the data block to be encoded, if it detects that the total coding length of the stream blocks to be encoded in each first shuffle group is greater than the original length of the data block to be encoded, the encoding processing of the data block to be encoded is terminated. Then the codec can resend a request to read the data block to be encoded, and the read data block to be encoded does not need to be encoded and can be directly stored. Optionally, the codec can also terminate the encoding processing of the data block to be encoded if it detects that the coding length output by the encoding processing is greater than the size of the data block to be encoded when encoding the data block to be encoded.

[0149] The embodiment of the present application provides a shuffling method. The codec determines at least one first shuffle group corresponding to the data block to be encoded according to the first shuffle level. The first shuffle group includes multiple first shuffle units, and the first shuffle unit includes at least one coding stream. Then, the codec determines the coding length of each first shuffle unit, and determines the output shuffle unit and the input shuffle unit in each first shuffle unit according to the coding length of each first shuffle unit. After that, the codec sends the first preset number of stream blocks to be shuffled in the output shuffle unit to the input shuffle unit as the first stream block to be encoded in the input shuffle unit, so that the first stream block to be encoded is encoded by the input shuffle unit according to the preset coding algorithm. In this way, by shuffling the coding streams of the data block to be encoded, the coding lengths of the coding streams can be guaranteed to be similar, thereby avoiding excessive complements caused by the alignment requirements between the coding streams, thereby reducing the coding rate. At the same time, deadlock between the coding streams can also be avoided.

[0150] The present application also provides a shuffling method, which is applied to the decoding process. Fig.13 As shown, the specific steps are as follows:

[0151] Step 1301: Acquire multiple decoding streams corresponding to the data block to be decoded.

[0152] The processing process of step 1301 is similar to the processing process of step 501 and will not be repeated here.

[0153] Step 1302: divide the plurality of decoded streams into a plurality of first shuffle units according to the first shuffle level, and divide the plurality of first shuffle units into at least one first shuffle group, wherein the first shuffle unit includes at least one decoded stream, and the first shuffle group includes a plurality of first shuffle units.

[0154] The processing of step 1302 is similar to that of step 502 and will not be described again here.

[0155] Step 1303: For each first shuffle unit in each first shuffle group, the total coding length of the to-be-decoded stream blocks in the decoded stream contained in the first shuffle unit is determined as the coding length of the first shuffle unit.

[0156] Optionally, in the case where the shuffling process and the decoding process are performed synchronously, the codec may also determine the total coding length of the to-be-decoded stream blocks and the decoded stream blocks in the decoded stream contained in the first shuffling unit as the coding length of the first shuffling unit.

[0157] The processing process of step 1303 is similar to the processing process of step 503 and will not be repeated here.

[0158] Step 1304: Determine an output shuffle unit and an input shuffle unit in each first shuffle unit according to the code length of each first shuffle unit.

[0159] The processing of step 1304 is similar to that of step 504 and will not be described again here.

[0160] Optional, such as Fig.14 As shown, the codec determines the processing process of the output shuffle unit and the input shuffle unit in each first shuffle unit according to the coding length of each first shuffle unit as follows:

[0161] Step 1401, determining the shuffling type of each first shuffling unit according to the coding length of each first shuffling unit. The codec can determine the shuffling type of each first shuffling unit according to the coding length of each first shuffling unit in various ways. The embodiment of the present application provides two feasible ways, which are as follows:

[0162] Mode 1: For each first shuffle unit, the codec can determine the shuffle type of the first shuffle unit according to the first difference between the code length of the first shuffle unit and the code length of other first shuffle units. The specific processing process is as follows:

[0163] Step 1: for each first shuffle unit in each first shuffle unit, determine a first difference between a code length of the first shuffle unit and code lengths of other first shuffle units.

[0164] Example 5: Fig.15 As shown, taking 4 shuffling units as a shuffling group for shuffling, each shuffling unit containing a decoding stream as an example, the coding length of decoding stream 1 is N+5, the coding length of decoding stream 2 is N+9, the coding length of decoding stream 3 is N, and the coding length of decoding stream 4 is N+3, where N is a positive integer, the first difference corresponding to decoding stream 1 is {-4, 5, 2}, the first difference corresponding to decoding stream 2 is {4, 9, 6}, the first difference corresponding to decoding stream 3 is {-5, -9, -3}, and the first difference corresponding to decoding stream 4 is {-2, -6, 3}.

[0165] Step 2: Determine the shuffling type of the first shuffling unit according to the first difference corresponding to the first shuffling unit.

[0166] Step three: if there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, then determine that the shuffle type of the first shuffle unit is a high coding type.

[0167] For example, in Example 5 above, if Fig.15 As shown, the first preset difference threshold is 7, and the shuffle type of the decoded stream 2 is H.

[0168] Step 4: If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, and there is a negative target difference in the target difference values, then determine that the shuffle type of the first shuffle unit is a low coding type.

[0169] For example, in Example 5 above, if Fig.15 As shown, the first preset difference threshold is 7, and the shuffle type of the decoded stream 3 is L.

[0170] Step 5: If there is no target difference value whose absolute value is greater than or equal to the first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, it is determined that the shuffle type of the first shuffle unit is a medium coding type.

[0171] For example, in Example 5 above, if Fig.15 As shown, the first preset difference threshold is 7, and the shuffle type of the decoded stream 1 and the decoded stream 4 is M.

[0172] Mode 2: For each first shuffle unit, the codec can determine the shuffle type of the first shuffle unit according to the second difference between the code length of the first shuffle unit and the average code length. The specific processing process is as follows:

[0173] Step 1: Determine the average code length according to the code length of each first shuffle unit.

[0174] Step 2: for each first shuffle unit in each first shuffle unit, determine a second difference between the code length of the first shuffle unit and the average code length.

[0175] Step three: determining the shuffling type of the first shuffling unit according to the second difference corresponding to the first shuffling unit.

[0176] Step 4: If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, determine that the shuffle type of the first shuffle unit is a high coding type.

[0177] Step 5: If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, determine that the shuffle type of the first shuffle unit is a low coding type.

[0178] Step six: if the absolute value of the second difference corresponding to the first shuffling unit is less than the second preset difference threshold, determine that the shuffling type of the first shuffling unit is the medium coding type.

[0179] The processing process of step 1401 is similar to that of step 601 and will not be repeated here.

[0180] Step 1402: According to the shuffling type of each first shuffling unit and a preset shuffling rule, in each first shuffling unit, an output shuffling unit and an input shuffling unit corresponding to each output shuffling unit are determined.

[0181] Optionally, the codec determines the processing of the output shuffle unit and the input shuffle unit corresponding to each output shuffle unit in each first shuffle unit according to the shuffle type of each first shuffle unit and the preset shuffle rule as follows:

[0182] Step 1: If the first number of the first target shuffle units of the high decoding type is greater than the second number of the second target shuffle units of the low decoding type, the second target shuffle unit is determined as the output shuffle unit, and for each output shuffle unit, at least one first target shuffle unit is determined in the first target shuffle unit as the input shuffle unit corresponding to the output shuffle unit.

[0183] Step 2: If the first number of first target shuffle units of the high decoding type is less than or equal to the second number of second target shuffle units of the low decoding type, the first number of second target shuffle units are determined as output shuffle units, and for each output shuffle unit, at least one first target shuffle unit is determined in the first target shuffle unit as the input shuffle unit corresponding to the output shuffle unit.

[0184] The processing process of step 1402 is similar to the processing process of step 602 and will not be repeated here.

[0185] Step 1305 , sending a first preset number of to-be-shuffled stream blocks in the output shuffling unit to the input shuffling unit as the first to-be-decoded stream blocks in the input shuffling unit, so that the first to-be-decoded stream blocks are decoded by the input shuffling unit according to a preset decoding algorithm.

[0186] Optionally, for each output shuffle unit, a second preset number of to-be-shuffled stream blocks in the output shuffle unit are sent to an input shuffle unit corresponding to the output shuffle unit as the first to-be-decoded stream block in the input shuffle unit.

[0187] For example, Fig.16 As shown, shuffling is performed using 4 shuffle units as a shuffle group, and each shuffle unit contains a decoding stream. The shuffle type of decoding streams 1 to 4 is MHLM, then decoding stream 3 is the output shuffle unit, and decoding stream 2 is the input shuffle unit of decoding stream 3. Then decoding stream 1 can output 1 to-be-shuffled stream block to decoding stream 1, decoding stream 3 can output 1 to-be-shuffled stream block to decoding stream 2, and decoding stream 4 can output 1 to-be-shuffled stream block to decoding stream 4. In this way, Fig.17As shown, after the shuffling is completed, the encoding length of the decoding stream 1 is N+8, the encoding length of the decoding stream 2 is N+9, the encoding length of the decoding stream 3 is N+3, and the encoding length of the decoding stream 4 is N+6. The shuffling type of the decoding stream 1 to the decoding stream 4 is MMMM.

[0188] The processing process of step 1305 is similar to the processing process of step 505 and will not be repeated here.

[0189] As an optional implementation, the codec determines at least one second shuffle group corresponding to the data block to be decoded according to the second shuffle level. The second shuffle group includes a plurality of second shuffle units, and the second shuffle unit includes at least one decoding stream. Then, the codec re-shuffles the stream blocks to be decoded in each second shuffle unit as the stream blocks to be shuffled until the encoding length of each second shuffle unit meets the preset proximity condition.

[0190] In implementation, after the codec shuffles the decoding stream corresponding to the data block to be decoded according to the first shuffling level, the codec may further determine at least one second shuffling group corresponding to the data block to be decoded according to the second shuffling level. The second shuffling group includes a plurality of second shuffling units, and the second shuffling unit includes at least one decoding stream. The process of the codec determining at least one second shuffling group corresponding to the data block to be decoded according to the second shuffling level is similar to step 1301, and will not be repeated here. Then, the codec may re-shuffle the stream blocks to be decoded in each second shuffling unit as the stream blocks to be shuffled until the coding length of each second shuffling unit meets the preset proximity condition.

[0191] It should be noted that after the codec shuffles the decoded stream corresponding to the data block to be decoded according to the second shuffle level, it can further shuffle the decoded stream corresponding to the data block to be decoded according to the third shuffle level. For example, the codec can shuffle the decoded stream corresponding to the data block to be decoded according to shuffle level 1-shuffle level 2-shuffle level 3, or shuffle the decoded stream corresponding to the data block to be decoded according to shuffle level 1-shuffle level 3-shuffle level 2, or shuffle the decoded stream corresponding to the data block to be decoded according to shuffle level 2-shuffle level 3-shuffle level 1.

[0192] As an optional implementation, when the codec detects that decoding of a first decoded stream among multiple decoded streams is completed, a second preset number of to-be-decoded stream blocks in a second decoded stream that has not been decoded among the multiple decoded streams are sent to the first decoded stream as to-be-decoded stream blocks in the first decoded stream.

[0193] In implementation, in order to further balance the coding length of each decoding stream and improve the decoding rate when decoding small data blocks. A third preset number may be pre-stored in the codec. The third preset number may be set by a technician based on experience. When the codec detects that the decoding of the first decoding stream among multiple decoding streams is completed (that is, the first decoding stream outputs the decoding stream end (StreamFinish) mark), the third preset number of to-be-decoded stream blocks in the second decoding stream that has not been decoded in the multiple decoding streams may be sent to the first decoding stream as the to-be-decoded stream blocks in the first decoding stream. Among them, the second decoding stream may be all the decoding streams that have not been decoded in the multiple decoding streams, or may be some of the decoding streams that have not been decoded in the multiple decoding streams.

[0194] As an optional implementation, the process of the codec obtaining the decoded stream is as follows:

[0195] Step 1: Obtain the encoding header data corresponding to the data to be decoded.

[0196] In implementation, for a coded data block, such as Fig.10 As shown, the codec uses the header-datablock mapping form for storage. When the codec needs to obtain the data to be decoded, the codec needs to first obtain the encoding header data corresponding to the data to be decoded. Fig.18 As shown, the format of the encoding header data is a two-dimensional format, with the low dimension being X and the high dimension being Y, and the size of the encoding header data is the low-dimensional encoding header size (head size X)*the high-dimensional encoding header size (head size Y). The encoding header data can be further evenly divided into multiple encoding header blocks in two dimensions.

[0197] Step 2: According to the received decoding instruction, in the encoding header data, a decoding area corresponding to the decoding instruction and including at least one encoding header block is determined, and at least one to-be-decoded data block corresponding to the at least one encoding header block is obtained. The encoding header block includes a storage address of an encoding data block corresponding to the encoding header block.

[0198] In implementation, after the codec obtains the coding header data, it can determine the decoding area corresponding to the decoding instruction and including at least one coding header block in the coding header data according to the received decoding instruction. Fig.18As shown, the starting address of the decoding area is the starting position of the coding head (head start), which can be obtained by the low-dimensional coding head offset (head offset X) and the high-dimensional coding head offset (head offset Y). The decoding area contains the number of low-dimensional coding heads (head number X) coding head blocks in the low-dimensional direction, and the number of high-dimensional coding heads (head number Y) coding head blocks in the high-dimensional direction. Among them, the coding head block contains the storage address of the coded data block corresponding to the coding head block. After the codec obtains the decoding area, for each coding head block in the decoding area, the codec can obtain the data block to be decoded according to the storage address of the coded data block stored in the coding head block.

[0199] Step three: for each data block to be decoded in at least one data block to be decoded, divide the data block to be decoded into multiple stream blocks, and send the multiple stream blocks to multiple decoding streams corresponding to the data block to be decoded as stream blocks to be shuffled in the multiple decoding streams.

[0200] In implementation, in order to improve the decoding throughput, the codec can decode the same data block to be decoded in parallel through multiple decoding streams. Similarly, when the codec performs shuffling, for each data block to be decoded, the codec can divide the data block to be decoded into multiple stream blocks, and send the multiple stream blocks to the multiple decoding streams corresponding to the data block to be decoded as the stream blocks to be shuffled in the multiple decoding streams. Optionally, the codec can divide the data block to be decoded into multiple row sequences, each row sequence containing at least one data sub-block to be decoded. Then, for each data sub-block to be decoded in each row sequence, the codec can divide the data sub-block to be decoded into multiple stream blocks. In this way, it can be ensured that the number of stream blocks in each decoding stream is similar.

[0201] Optionally, in the packaged format, the data block to be decoded consists of encoded data, and the size of the encoded data is equal to the size of the encoded data in the data block to be encoded.

[0202] In implementation, Fig.10 As shown, in the packing format, the decoded data blocks are stored closely, each decoded data block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the coded data block after being coded. That is, the space occupied by the decoded data block is the actual size of the coded data block after being coded.

[0203] Optionally, in a non-packed format, the data block to be decoded consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be encoded.

[0204] In implementation, Fig.10As shown, in the non-packed format, each decoded data block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be encoded. That is, each decoded data block occupies the same space and is equal to the size of a complete data block to be encoded before encoding. Among them, the first part is the coded data, and the second part is the reserved padding data.

[0205] Optionally, the data block to be decoded is composed of coded data sub-blocks corresponding to multiple source data sub-blocks belonging to the same source data block. In a packed format, the coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the source data sub-block after encoding. In a non-packed format, the coded data sub-block is composed of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block.

[0206] In practice, when the codec determines multiple coding areas in the source data according to different coding instructions, it may split a complete source data block into multiple source data sub-blocks. The coding areas corresponding to the coding instructions are on the adjacent side, and either they all encode the complete source data block, and the source data blocks do not overlap each other; or they each encode a part of the same source data block (that is, the source data sub-block), and the boundaries of the source data sub-blocks in the source data block just overlap. Fig.11 As shown, the four coding regions determined by the four coding instructions in the source data divide part of the source data block (represented by gray oblique line blocks) into multiple source data sub-blocks, and the boundaries of each source data sub-block in the same source data block just overlap. The codec encodes each source data sub-block in the same source data block according to different coding instructions to obtain coded data sub-blocks. When the codec stores the coded data sub-blocks corresponding to multiple source data sub-blocks in the same source data block, the coded data sub-blocks can be stored in the same coded data block. In this way, multiple coding instructions can be coordinated to complete the splicing of specific coding regions, and the effect is exactly the same as encoding through one coding instruction, and the execution order of these coding instructions can be arbitrary or even concurrently executed, so that the coding task can be divided in the case of multi-core source data division and block division for pipeline execution within a single core.

[0207] like Fig. 12A As shown in , a source data block is divided into two parts in both low-dimensional and high-dimensional dimensions, so that the source data block is divided into four source data sub-blocks, namely TL (top-left), TR (top-right), BL (bottom-left) and BR (bottom-right). The size of each source data sub-block is as follows: Fig. 12AAs shown, the codec can be specified by four parameters: block left, block right, block top, and block bottom inside the source data block. Each source data sub-block can be coded data or non-coded data. In the coded data block in the non-packed format, the above 4 source data sub-blocks corresponding to the 4 coded data sub-blocks can be stored in a fixed order of TL-TR-BL-BR, and each coded data sub-block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block. That is, the space occupied by each coded data sub-block is the size of the source data sub-block corresponding to the coded data sub-block before encoding. In this way, the space of the coded data block is the same as the size of the source data block, thereby ensuring that if each source data sub-block of the source data block is encoded by different encoding instructions, each encoding instruction can calculate the address of the coded data sub-block it is responsible for based on the partition information (which can be calculated through the instruction field), thereby realizing the splicing of the results of multiple encoding instructions.

[0208] like Fig. 12A As shown, the codec can convert the coded data block in the non-packed format into the coded data block in the packed format by means of coding move (Move) and the like. In the coded data block in the packed format, each coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the source data sub-block after being encoded. Among them, the coded data sub-blocks are stored closely, and the starting address of each coded data sub-block needs to be accumulated according to the actual size of the previous coded data sub-block, and the space occupied by the entire coded data block is the sum of the sizes of all coded data sub-blocks.

[0209] like Fig. 12B As shown, a source data block is divided into two parts in high dimension, so that the source data block is divided into two source data sub-blocks, namely TL and BL, or BL and BR. Fig. 12C As shown, a source data block is divided into two parts in a low dimension, so that the source data block is divided into two source data sub-blocks, namely TL and TR, or TR and BR.

[0210] A source data block is not divided in low dimension or high dimension, and has only one source data sub-block, which can be TL, TR, BL or BR. Fig.12D As shown, a source data block has only one source data sub-block TL.

[0211] Optionally, the data division during decoding may be different from that during encoding. When the data division of the decoding instruction is not aligned with the division of the encoded data block, there will be a boundary data block during encoding. For the boundary data block, if it only has the TL part, then if this part is in the form of unencoded source data, then only the required part can be read out. If it is in the form of encoded data, then the entire encoded data block needs to be decompressed and only the required part is written to the destination address. If the boundary data block itself contains four parts and is different from the division during encoding, then there will be a further division of the four encoded data sub-blocks. Fig.19 As shown, the solid-line box represents the data division during encoding, and the dotted-line box represents the data division during decoding. Their division points are different, so that the data block to be decoded during decoding may be a part of an encoded data block, such as the TL block represented by the left-slashed square, or it may be a part of up to 4 sub-data blocks, such as the BR block represented by the vertical-lined square.

[0212] This division has Fig. 20 The four cases shown correspond to different positional relationships between the intersection points of the decoding partitions and the encoding partitions. Considering that four different data blocks (TL, TR, BL, BR) need to be taken for decoding in each case, there are a total of 16 different data blocks for decoding. Only the most general case is considered here. Other cases where the partitions are less than 4 blocks or the partitions are aligned during encoding and decoding can be regarded as special cases of these four cases.

[0213] The embodiment of the present application provides a shuffling method. The codec determines at least one first shuffle group corresponding to the data block to be decoded according to the first shuffle level. The first shuffle group includes multiple first shuffle units, and the first shuffle unit includes at least one decoding stream. Then, the codec determines the coding length of each first shuffle unit, and determines the output shuffle unit and the input shuffle unit in each first shuffle unit according to the coding length of each first shuffle unit. After that, the codec sends the first preset number of stream blocks to be shuffled in the output shuffle unit to the input shuffle unit as the first stream block to be decoded in the input shuffle unit, so that the first stream block to be decoded is decoded by the input shuffle unit according to a preset decoding algorithm. In this way, by shuffling the decoding streams of the data block to be decoded, the coding lengths of the decoding streams can be ensured to be similar, thereby avoiding excessive complements caused by the alignment requirements between the decoding streams, thereby reducing the decoding stream. At the same time, deadlock between the decoding streams can also be avoided.

[0214] The embodiment of the present application also provides a computing device, the computing device comprising a processor;

[0215] The processor is used to receive source data and encode the source data using the above method to obtain encoded data.

[0216] As an optional implementation, the processor includes a control module, an on-chip storage module and a computing module;

[0217] The control module is used to decode the machine instructions received by the processor into coded microinstructions, and use the coded microinstructions to control the operation module to operate the source data in the on-chip storage module and write the source data into the off-chip storage module;

[0218] The control module comprises an encoding unit, and the encoding unit is used for executing the encoding instructions and decoding the encoding instructions into encoding microinstructions.

[0219] The embodiment of the present application also provides a computing device, the computing device comprising a processor;

[0220] The processor is used to receive the encoded data and decode the encoded data using the above method to obtain source data.

[0221] As an optional implementation, the processor includes a control module, an on-chip storage module and a computing module;

[0222] The control module is used to decode the machine instructions received by the processor into decoded microinstructions, and use the decoded microinstructions to control the operation module to operate the encoded data in the off-chip storage module and write the encoded data into the on-chip storage module;

[0223] The control module comprises a decoding unit, and the decoding unit is used for executing a decoding instruction and decoding the decoding instruction into a decoding microinstruction.

[0224] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0225] It should be further explained that although Figure 2 The steps in the flowchart of -4 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-At least part of the steps in 4 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0226] It should be understood that the above-mentioned device embodiments are only illustrative, and the device disclosed herein may also be implemented in other ways. For example, the division of units / modules described in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components may be combined, or may be integrated into another system, or some features may be ignored or not executed.

[0227] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present disclosure may be integrated into one unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0228] If the integrated unit / module is implemented in the form of hardware, the hardware can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the artificial intelligence processor can be any appropriate hardware processor, such as CPU, GPU, FPGA, DSP, and ASIC, etc. If not specifically stated, the storage unit can be any appropriate magnetic storage medium or magneto-optical storage medium, such as resistive random access memory RRAM (Resistive Random Access Memory), dynamic random access memory DRAM (Dynamic Random Access Memory), static random access memory SRAM (Static Random-Access Memory), enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), high-bandwidth memory HBM (High-Bandwidth Memory), hybrid memory cube HMC (Hybrid Memory Cube), etc.

[0229] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution disclosed herein is essentially or partly contributed to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and contains several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the disclosure. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0230] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0231] The foregoing content can be better understood in accordance with the following terms:

[0232] Clause A1, corresponding right 1; Clause A2, corresponding right 2; Clause A3, corresponding right 3; Clause A4, corresponding right 4; Clause A5, corresponding right 5; Clause A6, corresponding right 6; Clause A7, corresponding right 7; Clause A8, corresponding right 8; Clause A9, corresponding right 9; Clause A10, corresponding right 10; Clause A11, corresponding right 11; Clause A12, corresponding right 12; Clause A13, corresponding right 13; Clause A14, corresponding right 14; Clause A15, corresponding right 15; Clause A16, corresponding right 16; Clause A17, corresponding right 17; Clause A18, corresponding right 18; Clause A 19, corresponding right 19; clause A20, corresponding right 20; clause A21, corresponding right 21; clause A22, corresponding right 22; clause A23, corresponding right 23; clause A24, corresponding right 24; clause A25, corresponding right 25; clause A26, corresponding right 26; clause A27, corresponding right 27; clause A28, corresponding right 28; clause A29, corresponding right 29; clause A30, corresponding right 30; clause A31, corresponding right 31; clause A32, corresponding right 32; clause A33, corresponding right 33; clause A34, corresponding right 34; clause A35, corresponding right 35.

[0233] For example, clause A1, a shuffling method, the method being applied to a general-purpose processor, the method comprising:

[0234] Obtain multiple encoding streams corresponding to the data block to be encoded;

[0235] According to a first shuffle level, the plurality of coded streams are divided into a plurality of first shuffle units, and the plurality of first shuffle units are divided into at least one first shuffle group, wherein the first shuffle unit includes at least one coded stream, and the first shuffle group includes a plurality of first shuffle units;

[0236] For each first shuffle unit in each first shuffle group, determining the total coding length of the to-be-coded stream blocks in the coded stream contained in the first shuffle unit as the coding length of the first shuffle unit;

[0237] According to the code length of each of the first shuffling units, determining an output shuffling unit and an input shuffling unit in each of the first shuffling units;

[0238] A first preset number of to-be-shuffled stream blocks in the output shuffling unit are sent to the input shuffling unit as first to-be-encoded stream blocks in the input shuffling unit, so that the first to-be-encoded stream blocks are encoded by the input shuffling unit according to a preset encoding algorithm.

[0239] Clause A2. The method according to clause A1, wherein the step of determining an output shuffle unit and an input shuffle unit in each of the first shuffle units according to the encoding length of each of the first shuffle units comprises:

[0240] Determining a shuffling type of each of the first shuffling units according to the code length of each of the first shuffling units;

[0241] According to the shuffling types of the first shuffling units and the preset shuffling rules, in the first shuffling units, an output shuffling unit and an input shuffling unit corresponding to each output shuffling unit are determined;

[0242] The step of sending the first preset number of to-be-shuffled stream blocks in the output shuffling unit to the input shuffling unit as the first to-be-encoded stream blocks in the input shuffling unit comprises:

[0243] For each output shuffle unit, a second preset number of to-be-shuffled stream blocks in the output shuffle unit are sent to an input shuffle unit corresponding to the output shuffle unit as the first to-be-encoded stream block in the input shuffle unit.

[0244] Clause A3. The method according to clause A2, wherein determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises:

[0245] For each of the first shuffling units, determining a first difference between a code length of the first shuffling unit and code lengths of other first shuffling units;

[0246] A shuffling type of the first shuffling unit is determined according to a first difference value corresponding to the first shuffling unit.

[0247] Clause A4. The method according to clause A3, wherein determining the shuffle type of the first shuffle unit according to the first difference corresponding to the first shuffle unit comprises:

[0248] If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, then determining that the shuffle type of the first shuffle unit is a high coding type;

[0249] If there is a target difference whose absolute value is greater than or equal to a first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, and there is a negative target difference in the target difference values, it is determined that the shuffle type of the first shuffle unit is a low coding type.

[0250] Clause A5. The method according to clause A4, further comprising:

[0251] If there is no target difference value whose absolute value is greater than or equal to the first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, it is determined that the shuffle type of the first shuffle unit is the medium coding type.

[0252] Clause A6. The method according to clause A2, wherein determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises:

[0253] Determining an average code length according to the code lengths of the first shuffle units;

[0254] For each of the first shuffling units, determining a second difference between a code length of the first shuffling unit and the average code length;

[0255] A shuffling type of the first shuffling unit is determined according to the second difference value corresponding to the first shuffling unit.

[0256] Clause A7. The method according to clause A6, wherein determining the shuffle type of the first shuffle unit according to the second difference corresponding to the first shuffle unit comprises:

[0257] If the absolute value of the second difference corresponding to the first shuffling unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, determining that the shuffling type of the first shuffling unit is a high coding type;

[0258] If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, it is determined that the shuffle type of the first shuffle unit is a low coding type.

[0259] Clause A8. The method according to clause A7, further comprising:

[0260] If the absolute value of the second difference corresponding to the first shuffling unit is less than the second preset difference threshold, it is determined that the shuffling type of the first shuffling unit is the medium coding type.

[0261] Clause A9. The method according to clause A2, wherein, according to the shuffling type of each of the first shuffling units and the preset shuffling rule, in each of the first shuffling units, an output shuffling unit and an input shuffling unit corresponding to each of the output shuffling units are determined, comprising:

[0262] If the first number of the first target shuffle units of the high coding type is less than or equal to the second number of the second target shuffle units of the low coding type, the first target shuffle unit is determined as the output shuffle unit, and for each output shuffle unit, at least one second target shuffle unit is determined in the second target shuffle unit as the input shuffle unit corresponding to the output shuffle unit;

[0263] If the first number of first target shuffle units of the high coding type is greater than the second number of second target shuffle units of the low coding type, the second number of first target shuffle units are determined as output shuffle units, and for each output shuffle unit, in the second target shuffle unit, at least one second target shuffle unit is determined as the input shuffle unit corresponding to the output shuffle unit.

[0264] Clause A10. The method according to clause A1, further comprising:

[0265] Obtain source data to be encoded;

[0266] According to the received encoding instruction, determining, in the source data, an encoding region corresponding to the encoding instruction, the encoding region comprising at least one data block to be encoded, the data block to be encoded being a source data block or a source data sub-block;

[0267] For each data block to be encoded in the at least one data block to be encoded, the data block to be encoded is divided into multiple stream blocks, and the multiple stream blocks are sent to multiple encoding streams corresponding to the data block to be encoded as stream blocks to be shuffled in the multiple encoding streams.

[0268] Clause A11. The method according to clause A1, further comprising:

[0269] When it is detected that the encoding of a first encoded stream among multiple encoded streams is completed, a fourth preset number of to-be-encoded stream blocks in a second encoded stream that has not been completely encoded among the multiple encoded streams are sent to the first encoded stream as to-be-encoded stream blocks in the first encoded stream.

[0270] Clause A12. The method according to clause A1, further comprising:

[0271] If the total encoding length of the to-be-encoded stream blocks in each first shuffle group is greater than the original length of the to-be-encoded data block, the encoding process of the to-be-encoded data block is terminated.

[0272] Clause A13. A method according to clause A1, comprising:

[0273] Determine, according to the second shuffling level, at least one second shuffling group corresponding to the to-be-encoded data block, wherein the second shuffling group includes a plurality of second shuffling units, and the second shuffling unit includes at least one encoding stream;

[0274] The to-be-encoded stream blocks in each second shuffling unit are used as to-be-shuffled stream blocks and shuffled again until the encoding length of each second shuffling unit meets a preset proximity condition.

[0275] Clause A14. The method according to clause A1, wherein encoding the first to-be-encoded stream block according to a preset encoding algorithm by the input shuffling unit comprises:

[0276] Encoding the preset characters contained in the first to-be-encoded stream block according to a first encoding rule corresponding to the preset characters to obtain first encoded data;

[0277] The first coded data is encoded according to a preset second coding rule.

[0278] Clause A15. The method according to clause A10, further comprising:

[0279] Generate a coding header block for a coded data block corresponding to each to-be-coded data block, wherein the coding header block contains a storage address of the coded data block corresponding to the coding header block;

[0280] Each encoding header block is stored, and each encoding data block is stored after each encoding header block.

[0281] Clause A16. The method according to clause A15, wherein the coded data block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the coded data block after being coded; or

[0282] The coded data block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be coded.

[0283] Clause A17. A method according to clause A15, wherein the coded data block is composed of coded data sub-blocks corresponding to multiple source data sub-blocks belonging to the same source data block;

[0284] The coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the to-be-coded data in the source data sub-block after being coded; or

[0285] The coded data sub-block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block.

[0286] Clause A18. A shuffling method, the method comprising:

[0287] Obtain multiple decoding streams corresponding to the data blocks to be decoded;

[0288] According to a first shuffle level, the plurality of decoded streams are divided into a plurality of first shuffle units, and the plurality of first shuffle units are divided into at least one first shuffle group, wherein the first shuffle unit includes at least one decoded stream, and the first shuffle group includes a plurality of first shuffle units;

[0289] For each first shuffle unit in each first shuffle group, determining the total coding length of the to-be-decoded stream blocks in the decoded stream contained in the first shuffle unit as the coding length of the first shuffle unit;

[0290] According to the code length of each of the first shuffling units, determining an output shuffling unit and an input shuffling unit in each of the first shuffling units;

[0291] A first preset number of to-be-shuffled stream blocks in the output shuffling unit are sent to the input shuffling unit as first to-be-decoded stream blocks in the input shuffling unit, so that the first to-be-decoded stream blocks are decoded by the input shuffling unit according to a preset decoding algorithm.

[0292] Clause A19. The method according to clause A18, wherein the step of determining, in each of the first shuffle units, an output shuffle unit and an input shuffle unit according to the encoding length of each of the first shuffle units comprises:

[0293] Determining a shuffling type of each of the first shuffling units according to the code length of each of the first shuffling units;

[0294] According to the shuffling types of the first shuffling units and the preset shuffling rules, in the first shuffling units, an output shuffling unit and an input shuffling unit corresponding to each output shuffling unit are determined;

[0295] The step of sending the first preset number of to-be-shuffled stream blocks in the output shuffling unit to the input shuffling unit as the first to-be-decoded stream blocks in the input shuffling unit comprises:

[0296] For each output shuffle unit, a second preset number of to-be-shuffled stream blocks in the output shuffle unit are sent to an input shuffle unit corresponding to the output shuffle unit as the first to-be-decoded stream blocks in the input shuffle unit.

[0297] Clause A20. The method according to clause A19, wherein determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises:

[0298] For each of the first shuffling units, determining a first difference between a code length of the first shuffling unit and code lengths of other first shuffling units;

[0299] A shuffling type of the first shuffling unit is determined according to a first difference value corresponding to the first shuffling unit.

[0300] Clause A21. The method according to clause A20, wherein determining the shuffle type of the first shuffle unit according to the first difference corresponding to the first shuffle unit comprises:

[0301] If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, then determining that the shuffle type of the first shuffle unit is a high coding type;

[0302] If there is a target difference whose absolute value is greater than or equal to a first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, and there is a negative target difference in the target difference values, it is determined that the shuffle type of the first shuffle unit is a low coding type.

[0303] Clause A22. A method according to clause A21, further comprising:

[0304] If there is no target difference value whose absolute value is greater than or equal to the first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, it is determined that the shuffle type of the first shuffle unit is the medium coding type.

[0305] Clause A23. The method according to clause A19, wherein determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises:

[0306] Determining an average code length according to the code lengths of the first shuffle units;

[0307] For each of the first shuffling units, determining a second difference between a code length of the first shuffling unit and the average code length;

[0308] A shuffling type of the first shuffling unit is determined according to the second difference value corresponding to the first shuffling unit.

[0309] Clause A24. The method according to clause A23, wherein determining the shuffle type of the first shuffle unit according to the second difference corresponding to the first shuffle unit comprises:

[0310] If the absolute value of the second difference corresponding to the first shuffling unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, determining that the shuffling type of the first shuffling unit is a high coding type;

[0311] If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, it is determined that the shuffle type of the first shuffle unit is a low coding type.

[0312] Clause A25. A method according to clause A24, further comprising:

[0313] If the absolute value of the second difference corresponding to the first shuffling unit is less than the second preset difference threshold, it is determined that the shuffling type of the first shuffling unit is the medium coding type.

[0314] Clause A26. The method according to clause A19, wherein, according to the shuffling type of each of the first shuffling units and the preset shuffling rule, in each of the first shuffling units, an output shuffling unit and an input shuffling unit corresponding to each of the output shuffling units are determined, comprising:

[0315] If the first number of the first target shuffle units of the high decoding type is greater than the second number of the second target shuffle units of the low decoding type, the second target shuffle units are determined as output shuffle units, and for each output shuffle unit, at least one first target shuffle unit is determined in the first target shuffle unit as an input shuffle unit corresponding to the output shuffle unit;

[0316] If the first number of first target shuffle units of the high decoding type is less than or equal to the second number of second target shuffle units of the low decoding type, the first number of second target shuffle units are determined as output shuffle units, and for each output shuffle unit, in the first target shuffle unit, at least one first target shuffle unit is determined as the input shuffle unit corresponding to the output shuffle unit.

[0317] Clause A27. A method according to clause A18, further comprising:

[0318] Obtain the encoding header data corresponding to the data to be decoded;

[0319] According to the received decoding instruction, in the encoding header data, determining a decoding area corresponding to the decoding instruction and including at least one encoding header block, and obtaining at least one to-be-decoded data block corresponding to the at least one encoding header block, wherein the encoding header block includes a storage address of an encoding data block corresponding to the encoding header block;

[0320] For each data block to be decoded in the at least one data block to be decoded, the data block to be decoded is divided into multiple stream blocks, and the multiple stream blocks are sent to multiple decoding streams corresponding to the data block to be decoded as stream blocks to be shuffled in the multiple decoding streams.

[0321] Clause A28. A method according to clause A27, wherein the data block to be decoded is composed of coded data, and the size of the coded data is equal to the size of the coded data in the data block to be encoded; or

[0322] The data block to be decoded consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be encoded.

[0323] Clause A29. A method according to clause A27, wherein the to-be-decoded data block is composed of coded data sub-blocks corresponding to a plurality of source data sub-blocks belonging to the same source data block;

[0324] The coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the to-be-coded data in the source data sub-block after being coded; or

[0325] The coded data sub-block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block.

[0326] Clause A30. The method according to clause A18, further comprising:

[0327] When it is detected that decoding of a first decoded stream among multiple decoded streams is completed, a second preset number of to-be-decoded stream blocks in a second decoded stream that has not been decoded among the multiple decoded streams are sent to the first decoded stream as to-be-decoded stream blocks in the first decoded stream.

[0328] Clause A31. A method according to clause A18, further comprising:

[0329] Determine, according to the second shuffling level, at least one second shuffling group corresponding to the to-be-decoded data block, wherein the second shuffling group includes a plurality of second shuffling units, and the second shuffling unit includes at least one decoding stream;

[0330] The to-be-decoded stream blocks in each second shuffling unit are used as to-be-shuffled stream blocks and shuffled again until the encoding length of each second shuffling unit meets a preset proximity condition.

[0331] Clause A32. A computing device comprising a processor;

[0332] The processor is used to receive source data and encode the source data using a method as described in any one of clauses A1-17 to obtain encoded data.

[0333] Clause A33. The computing device according to clause A32, wherein the processor comprises a control module, an on-chip storage module, and a computing module;

[0334] The control module is used to decode the machine instructions received by the processor into coded microinstructions, and use the coded microinstructions to control the operation module to operate the source data in the on-chip storage module and write the source data into the off-chip storage module;

[0335] The control module comprises an encoding unit, and the encoding unit is used for executing the encoding instructions and decoding the encoding instructions into encoding microinstructions.

[0336] Clause A34. A computing device comprising a processor;

[0337] The processor is used to receive encoded data and decode the encoded data using a method as described in any one of clauses A18-31 to obtain source data.

[0338] Clause A35. The computing device according to clause A34, wherein the processor comprises a control module, an on-chip storage module, and a computing module;

[0339] The control module is used to decode the machine instructions received by the processor into decoded microinstructions, and use the decoded microinstructions to control the operation module to operate the encoded data in the off-chip storage module and write the encoded data into the on-chip storage module;

[0340] The control module comprises a decoding unit, and the decoding unit is used for executing a decoding instruction and decoding the decoding instruction into a decoding microinstruction.

[0341] The embodiments of the present disclosure are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of ​​the present disclosure. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present disclosure, the specific implementation methods and the scope of application of the present disclosure, all belong to the scope of protection of the present disclosure. In summary, the content of this specification should not be understood as a limitation on the present disclosure.

Claims

1. A shuffling method, characterized in that: The method is applied to a general-purpose processor, and the method comprises: Obtain multiple encoding streams corresponding to the data block to be encoded; According to a first shuffle level, the plurality of coded streams are divided into a plurality of first shuffle units, and the plurality of first shuffle units are divided into at least one first shuffle group, wherein the first shuffle unit includes at least one coded stream, and the first shuffle group includes a plurality of first shuffle units; For each first shuffle unit in each first shuffle group, determining the total coding length of the to-be-coded stream blocks in the coded stream contained in the first shuffle unit as the coding length of the first shuffle unit; According to the code length of each of the first shuffling units, determining an output shuffling unit and an input shuffling unit in each of the first shuffling units; Sending a first preset number of to-be-shuffled stream blocks in the output shuffling unit to the input shuffling unit as first to-be-encoded stream blocks in the input shuffling unit, so that the first to-be-encoded stream blocks are encoded by the input shuffling unit according to a preset encoding algorithm; Determining the output shuffle unit and the input shuffle unit in each of the first shuffle units according to the encoding length of each of the first shuffle units includes: determining the shuffle type of each of the first shuffle units according to the encoding length of each of the first shuffle units; determining the output shuffle unit and the input shuffle unit corresponding to each of the output shuffle units in each of the first shuffle units according to the shuffle type of each of the first shuffle units and a preset shuffle rule; The sending of the first preset number of to-be-shuffled stream blocks in the output shuffle unit to the input shuffle unit as the first to-be-encoded stream block in the input shuffle unit comprises: for each output shuffle unit, sending the second preset number of to-be-shuffled stream blocks in the output shuffle unit to the input shuffle unit corresponding to the output shuffle unit as the first to-be-encoded stream block in the input shuffle unit; Determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises: For each first shuffling unit among the first shuffling units, determining a first difference between a code length of the first shuffling unit and code lengths of other first shuffling units; and determining a shuffling type of the first shuffling unit according to the first difference corresponding to the first shuffling unit; The method further comprises: If the total encoding length of the to-be-encoded stream blocks in each first shuffle group is greater than the original length of the to-be-encoded data block, the encoding process of the to-be-encoded data block is terminated.

2. The method according to claim 1, characterized in that Determining the shuffling type of the first shuffling unit according to the first difference corresponding to the first shuffling unit includes: If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, then determining that the shuffle type of the first shuffle unit is a high coding type; If there is a target difference whose absolute value is greater than or equal to a first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, and there is a negative target difference in the target difference values, it is determined that the shuffle type of the first shuffle unit is a low coding type.

3. The method according to claim 2, characterized in that The method further comprises: If there is no target difference value whose absolute value is greater than or equal to the first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, it is determined that the shuffle type of the first shuffle unit is the medium coding type.

4. The method according to claim 2, characterized in that: Determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises: Determining an average code length according to the code lengths of the first shuffle units; For each of the first shuffling units, determining a second difference between a code length of the first shuffling unit and the average code length; A shuffling type of the first shuffling unit is determined according to the second difference value corresponding to the first shuffling unit.

5. The method according to claim 1, characterized in that Determining the shuffling type of the first shuffling unit according to the second difference corresponding to the first shuffling unit includes: If the absolute value of the second difference corresponding to the first shuffling unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, determining that the shuffling type of the first shuffling unit is a high coding type; If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, it is determined that the shuffle type of the first shuffle unit is a low coding type.

6. The method according to claim 5, characterized in that The method further comprises: If the absolute value of the second difference corresponding to the first shuffling unit is less than the second preset difference threshold, it is determined that the shuffling type of the first shuffling unit is the medium coding type.

7. The method according to claim 1, characterized in that The step of determining, in each of the first shuffling units, an output shuffling unit and an input shuffling unit corresponding to each output shuffling unit according to the shuffling type of each of the first shuffling units and a preset shuffling rule comprises: If the first number of the first target shuffle units of the high coding type is less than or equal to the second number of the second target shuffle units of the low coding type, the first target shuffle unit is determined as the output shuffle unit, and for each output shuffle unit, at least one second target shuffle unit is determined in the second target shuffle unit as the input shuffle unit corresponding to the output shuffle unit; If the first number of first target shuffle units of the high coding type is greater than the second number of second target shuffle units of the low coding type, the second number of first target shuffle units are determined as output shuffle units, and for each output shuffle unit, in the second target shuffle unit, at least one second target shuffle unit is determined as the input shuffle unit corresponding to the output shuffle unit.

8. The method according to claim 1, characterized in that The method further comprises: Obtain source data to be encoded; According to the received encoding instruction, determining, in the source data, an encoding region corresponding to the encoding instruction, the encoding region comprising at least one data block to be encoded, the data block to be encoded being a source data block or a source data sub-block; For each data block to be encoded in the at least one data block to be encoded, the data block to be encoded is divided into multiple stream blocks, and the multiple stream blocks are sent to multiple encoding streams corresponding to the data block to be encoded as stream blocks to be shuffled in the multiple encoding streams.

9. The method according to claim 1, characterized in that: The method further comprises: When it is detected that the encoding of a first encoded stream among multiple encoded streams is completed, a fourth preset number of to-be-encoded stream blocks in a second encoded stream that has not been completely encoded among the multiple encoded streams are sent to the first encoded stream as to-be-encoded stream blocks in the first encoded stream.

10. The method according to claim 1, characterized in that The method comprises: Determine, according to the second shuffling level, at least one second shuffling group corresponding to the to-be-encoded data block, wherein the second shuffling group includes a plurality of second shuffling units, and the second shuffling unit includes at least one encoding stream; The to-be-encoded stream blocks in each second shuffling unit are used as to-be-shuffled stream blocks and shuffled again until the encoding length of each second shuffling unit meets a preset proximity condition.

11. The method according to claim 1, characterized in that: The step of encoding the first to-be-encoded stream block according to a preset encoding algorithm by the input shuffling unit includes: Encoding the preset characters contained in the first to-be-encoded stream block according to a first encoding rule corresponding to the preset characters to obtain first encoded data; The first coded data is encoded according to a preset second coding rule.

12. The method according to claim 8, characterized in that The method further comprises: Generate a coding header block for a coded data block corresponding to each to-be-coded data block, wherein the coding header block includes a storage address of the coded data block corresponding to the coding header block; Each encoding header block is stored, and each encoding data block is stored after each encoding header block.

13. The method according to claim 12, characterized in that The coded data block is composed of coded data, and the size of the coded data is equal to the size of the coded data in the coded data block after being coded; or The coded data block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be coded.

14. The method according to claim 12, characterized in that The coded data block is composed of coded data sub-blocks corresponding to a plurality of source data sub-blocks belonging to the same source data block; The coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the to-be-coded data in the source data sub-block after being encoded; or, The coded data sub-block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block.

15. A shuffling method, characterized in that: The method comprises: Obtain multiple decoding streams corresponding to the data blocks to be decoded; According to a first shuffle level, the plurality of decoded streams are divided into a plurality of first shuffle units, and the plurality of first shuffle units are divided into at least one first shuffle group, wherein the first shuffle unit includes at least one decoded stream, and the first shuffle group includes a plurality of first shuffle units; For each first shuffle unit in each first shuffle group, determining the total coding length of the to-be-decoded stream blocks in the decoded stream contained in the first shuffle unit as the coding length of the first shuffle unit; According to the code length of each of the first shuffling units, determining an output shuffling unit and an input shuffling unit in each of the first shuffling units; Sending a first preset number of to-be-shuffled stream blocks in the output shuffling unit to the input shuffling unit as first to-be-decoded stream blocks in the input shuffling unit, so that the first to-be-decoded stream blocks are decoded by the input shuffling unit according to a preset decoding algorithm; Determining the output shuffle unit and the input shuffle unit in each of the first shuffle units according to the encoding length of each of the first shuffle units includes: determining the shuffle type of each of the first shuffle units according to the encoding length of each of the first shuffle units; determining the output shuffle unit and the input shuffle unit corresponding to each of the output shuffle units in each of the first shuffle units according to the shuffle type of each of the first shuffle units and a preset shuffle rule; The sending of the first preset number of to-be-shuffled stream blocks in the output shuffle unit to the input shuffle unit as the first to-be-decoded stream blocks in the input shuffle unit comprises: for each output shuffle unit, sending the second preset number of to-be-shuffled stream blocks in the output shuffle unit to the input shuffle unit corresponding to the output shuffle unit as the first to-be-decoded stream block in the input shuffle unit; Determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises: For each first shuffling unit among the first shuffling units, determining a first difference between a code length of the first shuffling unit and code lengths of other first shuffling units; and determining a shuffling type of the first shuffling unit according to the first difference corresponding to the first shuffling unit; The method further comprises: When it is detected that decoding of a first decoded stream among multiple decoded streams is completed, a second preset number of to-be-decoded stream blocks in a second decoded stream that has not been decoded among the multiple decoded streams are sent to the first decoded stream as to-be-decoded stream blocks in the first decoded stream.

16. The method according to claim 15, characterized in that Determining the shuffling type of the first shuffling unit according to the first difference corresponding to the first shuffling unit includes: If there is a target difference whose absolute value is greater than or equal to the first preset difference threshold value in the first difference value corresponding to the first shuffle unit, and the target difference values ​​are all positive numbers, then determining that the shuffle type of the first shuffle unit is a high coding type; If there is a target difference whose absolute value is greater than or equal to a first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, and there is a negative target difference in the target difference values, it is determined that the shuffle type of the first shuffle unit is a low coding type.

17. The method according to claim 16, characterized in that The method further comprises: If there is no target difference value whose absolute value is greater than or equal to the first preset difference threshold value in the first difference values ​​corresponding to the first shuffle unit, it is determined that the shuffle type of the first shuffle unit is the medium coding type.

18. The method according to claim 15, characterized in that Determining the shuffling type of each of the first shuffling units according to the encoding length of each of the first shuffling units comprises: Determining an average code length according to the code lengths of the first shuffle units; For each of the first shuffling units, determining a second difference between a code length of the first shuffling unit and the average code length; A shuffling type of the first shuffling unit is determined according to the second difference value corresponding to the first shuffling unit.

19. The method according to claim 15, characterized in that Determining the shuffling type of the first shuffling unit according to the second difference corresponding to the first shuffling unit includes: If the absolute value of the second difference corresponding to the first shuffling unit is greater than or equal to the second preset difference threshold, and the second difference is a positive number, determining that the shuffling type of the first shuffling unit is a high coding type; If the absolute value of the second difference corresponding to the first shuffle unit is greater than or equal to the second preset difference threshold, and the second difference is a negative number, it is determined that the shuffle type of the first shuffle unit is a low coding type.

20. The method according to claim 19, characterized in that The method further comprises: If the absolute value of the second difference corresponding to the first shuffling unit is less than the second preset difference threshold, it is determined that the shuffling type of the first shuffling unit is the medium coding type.

21. The method according to claim 15, characterized in that The step of determining, in each of the first shuffling units, an output shuffling unit and an input shuffling unit corresponding to each output shuffling unit according to the shuffling type of each of the first shuffling units and a preset shuffling rule comprises: If the first number of the first target shuffle units of the high decoding type is greater than the second number of the second target shuffle units of the low decoding type, the second target shuffle units are determined as output shuffle units, and for each output shuffle unit, at least one first target shuffle unit is determined in the first target shuffle unit as an input shuffle unit corresponding to the output shuffle unit; If the first number of first target shuffle units of the high decoding type is less than or equal to the second number of second target shuffle units of the low decoding type, the first number of second target shuffle units are determined as output shuffle units, and for each output shuffle unit, in the first target shuffle unit, at least one first target shuffle unit is determined as the input shuffle unit corresponding to the output shuffle unit.

22. The method according to claim 15, characterized in that The method further comprises: Obtain the encoding header data corresponding to the data to be decoded; According to the received decoding instruction, in the encoding header data, determining a decoding area corresponding to the decoding instruction and including at least one encoding header block, and obtaining at least one to-be-decoded data block corresponding to the at least one encoding header block, wherein the encoding header block includes a storage address of an encoding data block corresponding to the encoding header block; For each data block to be decoded in the at least one data block to be decoded, the data block to be decoded is divided into multiple stream blocks, and the multiple stream blocks are sent to multiple decoding streams corresponding to the data block to be decoded as stream blocks to be shuffled in the multiple decoding streams.

23. The method according to claim 22, characterized in that The data block to be decoded is composed of coded data, and the size of the coded data is equal to the size of the coded data in the data block to be encoded; or The data block to be decoded consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the data block to be encoded.

24. The method according to claim 22, characterized in that The to-be-decoded data block is composed of coded data sub-blocks corresponding to a plurality of source data sub-blocks in the same source data block; The coded data sub-block is composed of coded data, and the size of the coded data is equal to the size of the to-be-coded data in the source data sub-block after being encoded; or, The coded data sub-block consists of coded data and padding data, and the sum of the size of the coded data and the size of the padding data is equal to the size of the source data sub-block.

25. The method according to claim 15, characterized in that The method further comprises: Determine, according to the second shuffling level, at least one second shuffling group corresponding to the to-be-decoded data block, wherein the second shuffling group includes a plurality of second shuffling units, and the second shuffling unit includes at least one decoding stream; The to-be-decoded stream blocks in each second shuffling unit are used as to-be-shuffled stream blocks and shuffled again until the encoding length of each second shuffling unit meets a preset proximity condition.

26. A computing device, characterized in that: The computing device includes a processor; The processor is used to receive source data and encode the source data using the method according to any one of claims 1 to 14 to obtain encoded data.

27. The computing device according to claim 26, characterized in that The processor includes a control module, an on-chip storage module and a computing module; The control module is used to decode the machine instructions received by the processor into coded microinstructions, and use the coded microinstructions to control the operation module to operate the source data in the on-chip storage module and write the source data into the off-chip storage module; The control module comprises an encoding unit, and the encoding unit is used for executing the encoding instructions and decoding the encoding instructions into encoding microinstructions.

28. A computing device, characterized in that: The computing device includes a processor; The processor is used to receive encoded data and decode the encoded data using the method described in any one of claims 15-25 to obtain source data.

29. The computing device according to claim 28, characterized in that The processor includes a control module, an on-chip storage module and a computing module; The control module is used to decode the machine instructions received by the processor into decoded microinstructions, and use the decoded microinstructions to control the operation module to operate the encoded data in the off-chip storage module and write the encoded data into the on-chip storage module; The control module comprises a decoding unit, and the decoding unit is used for executing a decoding instruction and decoding the decoding instruction into a decoding microinstruction.