Data coding method and device, electronic equipment, storage medium and chip
By analyzing the extension item information in the ASN.1 sequence data, determining whether there is filled data and removing unfilled extension items, the problem of increasing invalid data during the encoding process is solved, and encoding efficiency and memory utilization are improved.
Patent Information
- Application Number
- CN202311621254.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2025-05-30
AI Technical Summary
During the ASN.1 sequence data encoding process, unfilled extension terms are misjudged as having filled data, resulting in invalid data being encoded into the code stream, reducing encoding efficiency.
By analyzing the pointer type in the extension information, determine whether the extension contains fill data. If there are extensions that do not contain fill data, these extensions are removed to generate new sequence data to be encoded for encoding.
Accurately identify the actual existence of extension items, avoid the encoding and transmission of invalid data, improve encoding efficiency, and save memory space.
Smart Images

Figure CN120066513A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a data encoding method, apparatus, electronic device, storage medium, and chip. Background Art
[0002] Abstract Syntax Notation One (ASN.1) describes a data format for representing, encoding, transmitting, and decoding data. In actual use, developers need to convert the ASN.1 abstract syntax into a language recognizable by a computer (such as C / C++, Java, etc.). Currently, in the process of encoding sequence data based on ASN.1, it is mainly determined whether there are extension items through the flag bit information corresponding to the sequence data. If so, the extension items need to be encoded.
[0003] However, for extension items without filled data, the flag bit information will also indicate the existence of extension items in the sequence data, which will cause the encoding of extension items without data filling during the encoding process, resulting in the inclusion of invalid data in the data bitstream, increasing the invalid data in the bitstream and reducing the encoding efficiency. Summary of the Invention
[0004] In view of this, this application provides a data encoding method, apparatus, electronic device, storage medium, and chip, mainly aiming to improve the technical problem that currently, during the encoding process, extension items without data filling are encoded, resulting in the inclusion of invalid data in the data bitstream, increasing the invalid data in the bitstream, and reducing the encoding efficiency.
[0005] In a first aspect, this application provides a data encoding method, including:
[0006] Obtain first sequence data to be encoded containing extension item information, where the extension item information corresponds to a pointer type;
[0007] Analyze the extension item information to determine whether there is pointer information in at least one extension item included in the extension item information, where the pointer information is used to indicate the existence of filled data in the extension item;
[0008] If there is a target extension item in the at least one extension item that does not contain pointer information, encode the second sequence data to be encoded in the first sequence data to be encoded except for the target extension item.
[0009] Optionally, when obtaining the first sequence data to be encoded containing extension item information, the method further includes:
[0010] Obtain Abstract Syntax Notation One (ASN.1) data, and input the ASN.1 data into a data structure generator for conversion processing. Among them, the data structure generator is set to determine the extended item information as a pointer type if the extended item information is included in the ASN.1 data.
[0011] Optionally, if the extended item information is included in the ASN.1 data;
[0012] Obtain the first sequence data to be encoded that contains extended item information, including:
[0013] Based on the processing result of the conversion processing, obtain the first sequence data to be encoded that contains the extended item information.
[0014] Optionally, after obtaining the first sequence data to be encoded that contains extended item information, the method further includes:
[0015] Set the flag bit information of the first sequence data to be encoded to indicate that the extended item information exists in the first sequence data to be encoded; and,
[0016] Store the corresponding padding data in at least one extended item of the first sequence data to be encoded.
[0017] Optionally, if the extended item information is not included in the ASN.1 data;
[0018] After obtaining the Abstract Syntax Notation One (ASN.1) data and inputting the ASN.1 data into a data structure generator for conversion processing, it further includes:
[0019] Based on the processing result of the conversion processing, obtain the third sequence data to be encoded that does not contain the extended item information.
[0020] Optionally, after obtaining the third sequence data to be encoded that does not contain the extended item information based on the processing result of the conversion processing, the method further includes:
[0021] Set the flag bit information of the third sequence data to be encoded to indicate that the extended item information does not exist in the third sequence data to be encoded;
[0022] Encode the third sequence data to be encoded based on the flag bit information of the third sequence data to be encoded.
[0023] Optionally, before encoding the second sequence data to be encoded in the first sequence data to be encoded except for the target extension item, the method further includes:
[0024] If the target extension item in the at least one extension item contains no pointer information, mark the target extension item with a first identifier, where the first identifier is used to identify the extension item without padding data;
[0025] Determine at least one of the target extension items marked with the first identifier information.
[0026] Optionally, encoding the second sequence data to be encoded in the first sequence data to be encoded except for the target extension item includes:
[0027] Based on the at least one target extension item, process the first sequence data to be encoded to obtain the second sequence data to be encoded;
[0028] Set the flag bit information of the second sequence data to indicate that the extension item information exists in the second sequence data to be encoded;
[0029] Based on the flag bit information of the second sequence data to be encoded, encode the second sequence data to be encoded.
[0030] Optionally, after analyzing the extension item information to determine whether at least one extension item included in the extension item information has pointer information, the method further includes:
[0031] If at least one extension item included in the extension information has pointer information, set the flag bit information of the first sequence data to be encoded to indicate that the extension item information exists in the first sequence data to be encoded;
[0032] Based on the flag bit information of the first sequence data to be encoded, encode the first sequence data to be encoded.
[0033] In a second aspect, the present application provides a data encoding device, including:
[0034] An acquisition module, configured to acquire first sequence data to be encoded including extension item information, where the extension item information corresponds to a pointer type;
[0035] An analysis module, configured to analyze the extension item information to determine whether there is pointer information in at least one extension item included in the extension item information, where the pointer information is used to indicate that there is filled data in the extension item;
[0036] An encoding module, configured to, if there is a target extension item in the at least one extension item that does not include pointer information, encode second sequence data to be encoded in the first sequence data to be encoded except for the target extension item.
[0037] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the data encoding method described in the first aspect is implemented.
[0038] In a fourth aspect, the present application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, and when the processor executes the computer program, the data encoding method described in the first aspect is implemented.
[0039] In a fifth aspect, the present application provides a chip, including one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory of an electronic device and send the signal to the processor, and the signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device is caused to execute the data encoding method described in the first aspect.
[0040] With the above technical solution, a data encoding method, apparatus, electronic device, storage medium, and chip provided by the present application specifically first obtain first sequence data to be encoded including extended item information, where the extended item information corresponds to a pointer type; then analyze the extended item information to determine whether there is pointer information in at least one extended item included in the extended item information, where the pointer information is used to indicate that there is padding data in the extended item; if there is a target extended item in the at least one extended item that does not include pointer information, then encode the second sequence data to be encoded in the first sequence data to be encoded except for the target extended item. Compared with the current existing technologies, the present application determines the first sequence data to be encoded as a pointer type, specifically determines whether there is padding data in each extended item through the pointer information, and if there is an extended item that does not include padding data, then removes the extended item that does not include padding data from the first sequence data to be encoded to obtain the second sequence data and then encodes it, which can accurately identify whether the extended item actually exists, and avoids encoding invalid data such as the quantity, length field, and identification bit related to the extended item, reduces the transmission of invalid data between networks, and further avoids the decoder from decoding the invalid data, thereby improving the encoding efficiency.
[0041] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification, and in order to make the above and other purposes, features, and advantages of the present application more obvious and understandable, the specific embodiments of the present application are specifically exemplified below. Brief Description of the Drawings
[0042] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0044] Figure 1 Shows a schematic flowchart of a data encoding method provided by an embodiment of the present application;
[0045] Figure 2 Shows a schematic flowchart of a data encoding method provided by an embodiment of the present application;
[0046] Figure 3 Shows a schematic diagram of an example provided by an embodiment of the present application;
[0047] Figure 4 The structural schematic diagram of a data encoding device provided by an embodiment of the present application is shown. Detailed implementation manners
[0048] Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.
[0049] In order to improve the current technical problem that during the encoding process, an extension item without data filling is encoded, resulting in invalid data being incorporated into the data bitstream, increasing the invalid data in the bitstream and reducing the encoding efficiency. This embodiment provides a data encoding method, as Figure 1 shown, the method includes:
[0050] Step 101, obtain first sequence data to be encoded including extension item information.
[0051] Among them, the extension item information corresponds to the pointer type.
[0052] In the embodiments of the present application, a sequence is the most basic data type in a computer programming language (Python). Each element in the sequence has a number, that is, the position of the element or what is called the index. The index value of the first element is 0, the index value of the second element is 1, and so on. Lists, tuples, and strings in Python all belong to sequences. Among them, a list is mutable (the elements in it can be modified), and tuples and strings are immutable (once created, the content is fixed).
[0053] Optionally, a pointer is an object in a programming language. Using the address, its value directly points to the value in another place in the computer memory. Since the variable unit can be found through the address, it can be said that the address points to the variable unit. Therefore, the address is vividly called a "pointer", and through it, the memory unit with its address can be found. A pointer refers to a certain address in the memory. By an action called dereferencing the pointer, the value stored at that address can be retrieved.
[0054] In some instances, the extension item information may be other extended data information in the first sequence data to be encoded except for the basic data. For example, the first sequence data to be encoded includes data 1, data 2, data 3, and data 4. Among them, data 1 may be the basic data in the first sequence data to be encoded, and data 2, data 3, and data 4 may be the extended data in the first sequence data to be encoded.
[0055] Step 102: Analyze the extended item information to determine whether there is pointer information in at least one extended item included in the extended item information.
[0056] Among them, the pointer information is used to indicate that there is padding data in the extended item.
[0057] Optionally, the pointer information can be the address information of the extended item. For example, the first sequence data to be encoded contains data 1, data 2, data 3, and data 4. Among them, data 2, data 3, and data 4 can be the extended information in the first sequence data to be encoded. If data 2 corresponds to extended item 2, it can be determined whether there is corresponding pointer information in extended item 2. If so, it can be determined that there is padding data in extended item 2.
[0058] Correspondingly, if data 3 corresponds to extended item 3, it can be determined whether there is corresponding pointer information in extended item 3. If there is no corresponding pointer information in extended item 3, it can be determined that there is no padding data in extended item 3, and so on. Examples are not given one by one here.
[0059] Step 103: If there is a target extended item without pointer information in at least one extended item, encode the second sequence data to be encoded in the first sequence data to be encoded except for the target extended item.
[0060] In the embodiment of the present application, the second sequence data to be encoded is the second sequence data obtained after removing the extended items without padding data from the first sequence data to be encoded.
[0061] For this embodiment, the target extended item can be an extended item without pointer information. For example, if extended item 2 and extended item 4 do not contain pointer information, then extended item 2 and extended item 4 are target extended items.
[0062] Furthermore, when encoding the first sequence data to be encoded, it is necessary to remove the target extended item to obtain the second sequence data to be encoded, and then encode the second sequence data to be encoded.
[0063] For example, the first sequence data to be encoded contains data 1, data 2, data 3, and data 4. Among them, data 2 corresponds to extended item 2, data 3 corresponds to extended item 3, and data 4 corresponds to extended item 4. If extended item 2 and extended item 4 do not contain pointer information, then extended item 2 and extended item 4 are target extended items. When encoding data 1, data 2, data 3, and data 4, it is necessary to remove extended item 2 and extended item 4, that is, encode data 1 and data 3.
[0064] Compared with the current existing technologies, in this embodiment, the first sequence data to be encoded is determined as a pointer type, and the pointer information is used to specifically determine whether there is padding data in each extension item. If there is an extension item that does not contain padding data, the extension item that does not contain padding data is removed from the first sequence data to be encoded, and the second sequence data is obtained and then encoded. This can accurately identify whether the extension item actually exists, avoid encoding invalid data such as the quantity, length field, and identification bit related to the extension item, reduce the transmission of invalid data between networks, and further avoid the decoder from decoding the invalid data, thereby improving the encoding efficiency.
[0065] To further illustrate the specific implementation process of the method in this embodiment, this embodiment provides a specific method as shown in Figure 2 which includes:
[0066] Step 201: Obtain ASN.1 data and input the ASN.1 data into a data structure generator for conversion processing.
[0067] Among them, the data structure generator is set to determine the extension item information as a pointer type if the ASN.1 data contains extension item information.
[0068] In the embodiment of the present application, Abstract Syntax Notation One (ASN.1) describes a data format for representing, encoding, transmitting, and decoding data, provides a set of formal formats for describing the structure of objects, regardless of how they are implemented linguistically and what these data specifically refer to, and regardless of what kind of application program it is.
[0069] Optionally, the conversion processing is to convert the ASN.1 data into a language recognizable by a computer. For example, if the ASN.1 data corresponds to data 1 in format 1, it needs to be converted into data 1 in format 2 through the data structure generator.
[0070] In the embodiment of the present application, the ASN.1 data needs to be converted into sequence data.
[0071] It should be noted that if the ASN.1 data has extension item information, the extension item information needs to be determined as a pointer type during the conversion process.
[0072] For this embodiment, if the ASN.1 data does not contain extension item information; correspondingly, after step 201, the method in this embodiment further includes: obtaining the third sequence data to be encoded that does not contain extension item information based on the processing result of the conversion processing.
[0073] Exemplarily, if the third sequence data to be encoded does not contain extension item information, it is not necessary to determine the third sequence data to be encoded as a pointer type.
[0074] In the embodiment of the present application, after step 201, the method of this embodiment further includes: setting the flag bit information of the third sequence data to be encoded to indicate that there is no extension item information in the third sequence data to be encoded; encoding the third sequence data to be encoded based on the flag bit information of the third sequence data to be encoded.
[0075] For this embodiment, the flag bit information can be one bit (bit) indicating whether there is an extension item.
[0076] The third sequence data to be encoded without extension item information can be directly encoded.
[0077] Step 202: Obtain the first sequence data to be encoded that contains extension item information.
[0078] Among them, the extension item information corresponds to the pointer type.
[0079] Optionally, if the ASN.1 data contains the extension item information, correspondingly, step 202 may specifically include: obtaining the first sequence data to be encoded that contains extension item information based on the processing result of the conversion process.
[0080] Exemplarily, in the ASN.1 data, “...” can be used to indicate that the sequence data supports extensions, and there are 0 or more extension item data thereafter. The rate “[[ ]]” can be used to indicate that the data between them is an extended data of the same version extension.
[0081] For example, the extension item can be expressed as: “[[extention 1]]”, “[[extention 2]]” and so on, and no more examples are given here.
[0082] In some examples, after step 202, the method of this embodiment further includes: setting the flag bit information of the first sequence data to be encoded to indicate that there is extension item information in the first sequence data to be encoded; and storing corresponding padding data in at least one extension item of the first sequence data to be encoded.
[0083] For this embodiment, the first sequence data to be encoded includes Data 1, Data 2, Data 3, and Data 4. Among them, Data 2 corresponds to Extension Item 2, Data 3 corresponds to Extension Item 3, and Data 4 corresponds to Extension Item 4. By filling data into Extension Item 2, Extension Item 3, and Extension Item 4, the filled Extension Item 2, Extension Item 3, and Extension Item 4 can be obtained.
[0084] It should be noted that since there are extension item data in the first sequence data to be encoded, first, the length of the number of extension items is encoded, and then for each extension item, there is one bit as an indication to encode whether the extension item exists; finally, each "[[]]" extension item is encoded as an open type (including a data length field and data encoding).
[0085] Step 203: Analyze the extension item information to determine whether at least one extension item included in the extension item information has pointer information.
[0086] Among them, the pointer information is used to indicate that there is filled data in the extension item.
[0087] Exemplarily, based on Step 202, each of Extension Item 2, Extension Item 3, and Extension Item 4 is analyzed to determine whether there is corresponding indication information.
[0088] Step 204: If at least one extension item includes a target extension item without pointer information, then encode the second sequence data to be encoded in the sequence data to be encoded except for the target extension item.
[0089] Optionally, Step 204 may specifically include: if at least one extension item includes a target extension item without pointer information, mark the first identifier for the target extension item; determine at least one target extension item marked with the first identifier information.
[0090] Among them, the first identifier is used to identify the extension item without filled data.
[0091] In the embodiment of the present application, the first identifier may be an identifier for the extension item without filled data. Exemplarily, if there is no filled data in Extension Item 2, then mark the first identifier for Extension Item 2 and determine that Extension Item 2 is the extension item without filled data. If there is no filled data in Extension Item 4, then mark the first identifier for Extension Item 4 and determine that Extension Item 4 is the extension item without filled data, and so on. Examples are not given one by one here.
[0092] In some examples, step 204 specifically further includes: processing the first sequence data to be encoded based on at least one target extension item to obtain second sequence data to be encoded; setting the flag bit information of the second sequence data to indicate that there is extension item information in the second sequence data to be encoded; and encoding the second sequence data to be encoded based on the flag bit information of the second sequence data to be encoded.
[0093] Optionally, the flag bit information may be an indication flag indicating the existence or non-existence of an extension item. All IEs in a "[[]]" are recorded in a structure, and a pointer is used to record the extension item data, which not only simplifies the description of the extension item data of the same version but also makes it easier for the encoder to identify misplacement of the extension item indication bit.
[0094] Exemplarily, based on step 203, if it is determined that extension item 2 and extension item 4 are extension items without padding data, then extension item 2 and extension item 4 are removed from the first sequence data to be encoded to obtain second sequence data to be encoded, and encoding processing is performed on the second sequence data to be encoded.
[0095] In the embodiment of the present application, after step 204, the method of this embodiment further includes: if at least one extension item included in the extension information has pointer information, setting the flag bit information of the first sequence data to be encoded to indicate that there is extension item information in the first sequence data to be encoded; and encoding the first sequence data to be encoded based on the flag bit information of the first sequence data to be encoded.
[0096] It should be noted that if all extension items in the first sequence data to be encoded have padding data, then the first sequence data to be encoded is encoded.
[0097] In the current prior art, according to the asn.1 protocol, the extension item data enclosed by a "[[]]" should be encoded as an open type. The technology provided in 1 requires recording in the attribute record table which IEs belong to an extension item, increasing the complexity of data description and the consumption of the memory static storage area.
[0098] When there are extended items mis-set in the bit_mask but no data is filled in the actual extended items, complex logic is required to determine whether there is valid data in the extended items that needs to be encoded. At the same time, it is very difficult to determine whether the extended item data of types such as INTEGER and BOOLEAN is actually filled. Therefore, when an extended item IE in the bit_mask is mis-set but no actual data is filled, it may cause invalid data (invalid data such as the extended quantity field and length field) to be encoded into the data bitstream, increasing the transmission of data (part of which is invalid data) over the network. At the same time, the communication peer at the other end will decode the invalid bitstream, reducing the decoding efficiency.
[0099] Compared with the current existing technologies, in this embodiment, the data of the first sequence to be encoded is determined as a pointer type, and it is specifically determined whether there is filled data in each extended item through the pointer information. If there is an extended item that does not contain filled data, the extended item that does not contain filled data is removed from the data of the first sequence to be encoded, and the second sequence data is obtained and then encoded. It can accurately identify whether the extended item actually exists, and avoid the encoding of invalid data such as the quantity, length field, and identification bit related to the extended item, reducing the transmission of invalid data between networks. Furthermore, it can avoid the decoder from decoding invalid data. When there is no extended item data, it only occupies the size of a pointer, which can save the memory space of the device. It solves the problem that when the existence indication of the extended item in the sequence is set, but there is no extended item data, the bitstream of the sequence data will not encode the extended item quantity field bitstream that is useless to the user, the length field of the set extended item, or even the meaningless or incorrect data bitstream.
[0100] To illustrate the specific implementation process of this embodiment, the following specific application examples are given, such as Figure 3 shown, but not limited to this:
[0101] Design rules in the ASN.1 data structure generator to make the extended items in the sequence data structure be of pointer type; when there is extended item data in the sequence, in addition to setting the flag to TRUE, apply for memory to fill the data at the same time, and point the pointer corresponding to the extension to this block of memory; otherwise, set the pointer corresponding to the extended item to NULL.
[0102] During the encoding process of the sequence data, first determine whether there is an extended item with the flag set to TRUE. If there is no extended item with the flag set to TRUE, the encoder sets the flag indicating whether the extended item exists to 0 (indicating that there is no extended item data), and does not encode the extended item subsequently.
[0103] If there is an extended item marked as TRUE, continue to determine whether the corresponding extended item pointer is empty. If it is not empty, the encoder sets the flag indicating the existence of the extended item to 1 (indicating that there is extended item data), and subsequently encodes the identification field and data content of the extension; if there is an extended item marked as TRUE while the corresponding pointer is indeed empty, the encoder sets the flag indicating the existence of the extended item to 0 (indicating that there is no extended item data), and subsequently does not encode the extended item.
[0104] Compared with the current existing technologies, in this embodiment, by determining the first sequence data to be encoded as a pointer type, and specifically judging whether there is padding data in each extended item through the pointer information. If there is an extended item that does not contain padding data, the extended item that does not contain padding data is removed from the first sequence data to be encoded to obtain the second sequence data and then encoded. It can accurately identify whether the extended item actually exists, and avoid the encoding of invalid data such as the quantity, length field, and identification bit related to the extended item, reducing the transmission of invalid data between networks. Furthermore, it can avoid the decoder from decoding the invalid data; when there is no extended item data, it only occupies the size of one pointer, which can save the memory space of the device; it solves the problem that when the existence indication of the sequence extended item is set, but there is no extended item data, the bit code stream of the sequence data will not include the bit code stream of the extended item quantity field that is useless to the user, the length field of the set extended item, or even the meaningless or incorrect data bit code stream.
[0105] Further, as Figure 1 and Figure 2 a specific implementation of the method shown, this embodiment provides a data encoding device, as Figure 4 shown, the device includes: an acquisition module 31, an analysis module 32, and an encoding module 33.
[0106] The acquisition module 31 is configured to acquire the first sequence data to be encoded containing extended item information, and the extended item information corresponds to a pointer type;
[0107] The analysis module 32 is configured to analyze the extended item information to determine whether there is pointer information in at least one extended item included in the extended item information, where the pointer information is used to indicate that there is padding data in the extended item;
[0108] The encoding module 33 is configured to, if there is a target extended item in the at least one extended item that does not contain pointer information, encode the second sequence data to be encoded in the first sequence data to be encoded except the target extended item.
[0109] In some examples of this embodiment, the obtaining module 31 is further configured to obtain Abstract Syntax Notation One (ASN.1) data, and input the ASN.1 data into a data structure generator for conversion processing, where the data structure generator is configured to determine the extension item information as a pointer type if the ASN.1 data contains the extension item information.
[0110] In some examples of this embodiment, if the ASN.1 data contains the extension item information; correspondingly, the obtaining module 31 is specifically configured to obtain first sequence data to be encoded that contains the extension item information based on the processing result of the conversion processing.
[0111] In some examples of this embodiment, the obtaining module 31 is further configured to set the flag bit information of the first sequence data to be encoded to indicate that the extension item information exists in the first sequence data to be encoded; and store corresponding padding data in at least one of the extension items of the first sequence data to be encoded.
[0112] In some examples of this embodiment, if the ASN.1 data does not contain the extension item information; correspondingly, the obtaining module 31 is further configured to obtain third sequence data to be encoded that does not contain the extension item information based on the processing result of the conversion processing.
[0113] In some examples of this embodiment, the obtaining module 31 is further configured to set the flag bit information of the third sequence data to be encoded to indicate that the extension item information does not exist in the third sequence data to be encoded; and encode the third sequence data to be encoded based on the flag bit information of the third sequence data to be encoded.
[0114] In some examples of this embodiment, the encoding module 33 is further configured to, if a target extension item that does not contain pointer information exists in at least one of the extension items, mark the target extension item with a first identifier, where the first identifier is used to identify an extension item without padding data; and determine at least one of the target extension items marked with the first identifier information.
[0115] In some examples of this embodiment, the encoding module 33 is specifically configured to process the first sequence data to be encoded based on the at least one target extension item to obtain the second sequence data to be encoded; set the flag bit information of the second sequence data to indicate that the extension item information exists in the second sequence data to be encoded; and encode the second sequence data to be encoded based on the flag bit information of the second sequence data to be encoded.
[0116] In some examples of this embodiment, the encoding module 33 is further configured to, if pointer information exists for at least one extension item included in the extension information, set the flag bit information of the first sequence data to be encoded to indicate that the extension item information exists in the first sequence data to be encoded; and encode the first sequence data to be encoded based on the flag bit information of the first sequence data to be encoded.
[0117] It should be noted that for other corresponding descriptions of each functional unit involved in the data encoding device provided in this embodiment, reference can be made to Figure 1 and Figure 2 the corresponding descriptions therein, which will not be elaborated here.
[0118] Based on the above method as shown in Figure 1 and Figure 2 correspondingly, this embodiment further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above method as shown in Figure 1 and Figure 2 is implemented.
[0119] Based on such an understanding, the technical solution of this application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods in various implementation scenarios of this application.
[0120] Based on the above method as shown in Figure 1 and Figure 2 and Figure 4 the virtual device embodiment shown, for the purpose of achieving the above object, this embodiment of the application further provides an electronic device, such as intelligent terminals such as smartphones, tablets, drones, and intelligent robots. The device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to implement the above method as shown in Figure 1 and Figure 2 is implemented.
[0121] Optionally, the above-mentioned physical device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, sensors, an audio circuit, a WI-FI module, etc. The user interface may include a display and an input unit such as a keyboard, etc. Optionally, the user interface may further include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0122] Those skilled in the art can understand that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine some components, or have different component arrangements.
[0123] The storage medium may further include an operating system and a network communication module. The operating system is a program for managing the hardware and software resources of the above-mentioned physical device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to implement communication between components inside the storage medium, and communication between other hardware and software in the information processing physical device.
[0124] Based on the above methods as Figure 1 and Figure 2 shown, and the virtual device embodiment as Figure 4 shown, this embodiment further provides a chip, including one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, and the signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device is caused to execute the above methods as Figure 1 and Figure 2 shown.
[0125] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or can also be implemented by hardware. By applying the solution of this embodiment, compared with the current prior art, in this embodiment, the first sequence data to be encoded is determined as a pointer type, and whether there is padding data in each extension item is specifically judged through pointer information. If there is an extension item that does not contain padding data, the extension item that does not contain padding data is removed from the first sequence data to be encoded, and the second sequence data is obtained and then encoded. It can accurately identify whether the extension item actually exists, and avoid the encoding of invalid data such as the quantity, length field, and identification bit related to the extension item, reduce the transmission of invalid data between networks, and thus avoid the decoder from decoding the invalid data; when there is no extension item data, it only occupies the size of one pointer, which can save the memory space of the device; it solves the problem that when the existence indication of the sequence extension item is set, but there is no extension item data, the bit stream of the sequence data will not encode the bit stream of the extension item quantity field that is useless to the user, the length field of the set extension item, or even the meaningless or incorrect data bit stream.
[0126] It should be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0127] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments described herein, but will conform to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data encoding method, characterized in that, comprising: obtaining a first sequence data to be encoded containing extended item information, where the extended item information corresponds to a pointer type; analyzing the extended item information to determine whether there is pointer information in at least one extended item included in the extended item information, where the pointer information is used to indicate that there is padding data in the extended item; if there is a target extended item in the at least one extended item that does not contain pointer information, then encoding the second sequence data to be encoded in the first sequence data to be encoded except the target extended item.
2. The method according to claim 1, characterized in that, when obtaining the first sequence data to be encoded containing extended item information, the method further comprises: obtaining Abstract Syntax Notation One (ASN.1) data and inputting the ASN.1 data into a data structure generator for conversion processing, where the data structure generator is set to determine the extended item information as a pointer type if the ASN.1 data contains the extended item information.
3. The method according to claim 2, characterized in that, if the ASN.1 data contains the extended item information; obtaining the first sequence data to be encoded containing extended item information, comprising: obtaining the first sequence data to be encoded containing the extended item information based on the processing result of the conversion processing.
4. The method according to claim 3, characterized in that, after obtaining the first sequence data to be encoded containing extended item information, the method further comprises: setting the flag bit information of the first sequence data to be encoded to indicate that there is the extended item information in the first sequence data to be encoded; and, storing corresponding padding data in the at least one extended item of the first sequence data to be encoded.
5. The method according to claim 2, characterized in that, if the ASN.1 data does not contain the extended item information; after obtaining the Abstract Syntax Notation One (ASN.1) data and inputting the ASN.1 data into a data structure generator for conversion processing, it further comprises: obtaining a third sequence data to be encoded that does not contain the extended item information based on the processing result of the conversion processing.
6. The method according to claim 5, characterized in that, after obtaining the third sequence data to be encoded that does not contain the extended item information based on the processing result of the conversion processing, the method further comprises: setting the flag bit information of the third sequence data to be encoded to indicate that there is no extended item information in the third sequence data to be encoded; encoding the third sequence data to be encoded based on the flag bit information of the third sequence data to be encoded.
7. The method according to claim 1, characterized in that, Before encoding the second sequence data to be encoded in the first sequence data to be encoded except for the target extension item, the method further includes: If the target extension item without pointer information is included in the at least one extension item, mark the target extension item with a first identifier, where the first identifier is used to identify the extension item without padding data; Determine at least one of the target extension items marked with the first identifier information.
8. The method according to claim 7, wherein, The encoding of the second sequence data to be encoded in the first sequence data to be encoded except for the target extension item includes: Based on the at least one target extension item, process the first sequence data to be encoded to obtain the second sequence data to be encoded; Set the flag bit information of the second sequence data to indicate that the extension item information exists in the second sequence data to be encoded; Based on the flag bit information of the second sequence data to be encoded, encode the second sequence data to be encoded.
9. The method according to claim 8, wherein, After analyzing the extension item information to determine whether pointer information exists in at least one of the extension items included in the extension item information, the method further includes: If pointer information exists in at least one of the extension items included in the extension information, set the flag bit information of the first sequence data to be encoded to indicate that the extension item information exists in the first sequence data to be encoded; Based on the flag bit information of the first sequence data to be encoded, encode the first sequence data to be encoded.
10. A data encoding device, wherein, including: An acquisition module configured to acquire first sequence data to be encoded including extension item information, where the extension item information corresponds to a pointer type; An analysis module configured to analyze the extension item information to determine whether pointer information exists in at least one of the extension items included in the extension item information, where the pointer information is used to indicate that padding data exists in the extension item; An encoding module configured to, if the target extension item without pointer information is included in the at least one extension item, encode the second sequence data to be encoded in the first sequence data to be encoded except for the target extension item.
11. A computer-readable storage medium having a computer program stored thereon, wherein, The computer program, when executed by a processor, implements the method according to any one of claims 1 to 9.
12. An electronic device including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein, The processor, when executing the computer program, implements the method according to any one of claims 1 to 9.
13. A chip, wherein, Comprising one or more interface circuits and one or more processors; the interface circuits are used to receive signals from the memory of the electronic device and send the signals to the processors, and the signals include computer instructions stored in the memory; when the processors execute the computer instructions, the electronic device is caused to execute the method according to any one of claims 1 to 9.