CN115037981B - Decoding method and device of data stream, electronic equipment and storage medium - Google Patents

Decoding method and device of data stream, electronic equipment and storage medium Download PDF

Info

Publication number
CN115037981B
CN115037981B CN202110244954.7A CN202110244954A CN115037981B CN 115037981 B CN115037981 B CN 115037981B CN 202110244954 A CN202110244954 A CN 202110244954A CN 115037981 B CN115037981 B CN 115037981B
Authority
CN
China
Prior art keywords
data
decoding
decoded
current
decoding operation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110244954.7A
Other languages
Chinese (zh)
Other versions
CN115037981A (en
Inventor
王利新
刘洪亮
刘诗源
黄海军
冉利楠
于凯民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qianxin Technology Group Co Ltd
Secworld Information Technology Beijing Co Ltd
Original Assignee
Qianxin Technology Group Co Ltd
Secworld Information Technology Beijing Co Ltd
Filing date
Publication date
Application filed by Qianxin Technology Group Co Ltd, Secworld Information Technology Beijing Co Ltd filed Critical Qianxin Technology Group Co Ltd
Priority to CN202110244954.7A priority Critical patent/CN115037981B/en
Publication of CN115037981A publication Critical patent/CN115037981A/en
Application granted granted Critical
Publication of CN115037981B publication Critical patent/CN115037981B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a decoding method, a decoding device, electronic equipment and a storage medium of a data stream, wherein the method comprises the following steps: continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object; determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; and determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded. The invention can realize the dynamic decoding of the target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves the buffer space and improves the decoding flexibility.

Description

Decoding method and device of data stream, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and apparatus for decoding a data stream, an electronic device, and a storage medium.
Background
In the field of data processing, it is often necessary to perform decoding operations on a data stream received over a network.
In the prior art, when a decoding operation is performed on a data stream, a complete data block or a data file to be decoded, which is transmitted by the data stream, is generally stored in a dedicated decoding buffer storage space (hereinafter referred to as a decoding buffer space), and then the decoding operation is performed on the complete data block or the data file stored in the decoding buffer space.
Since the size of the data blocks or data files contained in the data stream is not fixed, some of the data blocks or data files to be decoded have a larger data volume. Therefore, when a data block or a data file having a large data amount is decoded by the decoding method of the related art, a large amount of buffer space is required for decoding the buffer space, resulting in waste of the buffer space.
Disclosure of Invention
The invention provides a decoding method, a decoding device, electronic equipment and a storage medium for data streams, which are used for solving the defect that the cache space is wasted when a decoding method in the prior art decodes data blocks or data files with larger data quantity, and realizing the efficient utilization of the cache space.
The invention provides a decoding method of a data stream, which comprises the following steps:
continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
Determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
And determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded.
According to the method for decoding a data stream provided by the invention, after the step of decoding the data to be decoded at the current time, the method further comprises the following steps:
And judging whether all data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data amount of the current decoding operation at the execution time of the preset next decoding operation, and if so, ending the flow.
According to the method for decoding a data stream provided by the present invention, the determining the data amount of the current decoding operation according to the comparison relation between the data amount of the current data to be decoded and the preset decoding buffer space capacity includes:
If the data volume of the current data to be decoded is larger than the capacity of a preset decoding buffer space, taking the first data volume as the data volume of the current decoding operation; wherein,
The first data volume is smaller than or equal to the data volume of the current data to be decoded, and the first data volume is an integer multiple of a unit to be decoded of a target decoding object; wherein the unit to be decoded is a minimum unit that can be independently decoded in the target decoding object.
According to the decoding method of the data stream provided by the invention, the calculation formula of the first data volume is as follows:
Wherein L2 represents a first data amount, L1 represents a data amount of the current data to be decoded, N represents the number of bytes contained in the unit to be decoded, Representing a rounding down.
According to the method for decoding a data stream provided by the invention, before the step of determining the data amount of the current decoding operation according to the comparison relation between the data amount of the current data to be decoded and the preset decoding buffer space capacity, the method further comprises:
acquiring first data to be decoded; wherein the first data to be decoded is the target decoding object data in the data stream received between the execution time of the last decoding operation and the execution time of the current decoding operation;
Acquiring second data to be decoded from the decoding buffer space; wherein the second data to be decoded refers to data which has been received before the execution time of the last decoding operation and is not decoded at the time of the last decoding operation;
and combining the first data to be decoded and the second data to be decoded to obtain current data to be decoded.
According to the method for decoding a data stream provided by the invention, before the step of determining the data amount of the current decoding operation according to the comparison relation between the data amount of the current data to be decoded and the preset decoding buffer space capacity, the method further comprises:
the capacity of the decoding buffer space is set to any value greater than 4096.
According to the method for decoding a data stream provided by the invention, after the step of decoding the data to be decoded at the current time, the method further comprises the following steps:
And splicing the decoding results in sequence to obtain the original content of the target decoding object.
The invention also provides a decoding device of the data stream, which comprises:
the data stream receiving module is used for continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
The data volume determining module of the current decoding operation is used for determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
and the decoding module is used for determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation and decoding the current data to be decoded.
According to the decoding device of the data stream provided by the invention, the device further comprises:
And the judging module is used for judging whether all the data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data amount of the current decoding operation at the execution time of the preset next decoding operation, and if so, ending the flow.
According to the decoding device of the data stream provided by the invention, the device further comprises:
And the decoding buffer space capacity setting module is used for setting the capacity of the decoding buffer space to be any numerical value larger than 4096.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the decoding method of the data stream when executing the program.
The invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the decoding method of the data stream as described.
The invention also provides a computer program product comprising computer executable instructions for implementing the steps of a decoding method for a data stream as described.
The invention provides a decoding method, a decoding device, electronic equipment and a storage medium for data streams, wherein the data streams are continuously received; determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; determining current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded; the invention can realize the dynamic decoding of the target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves the buffer space and improves the decoding flexibility.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a decoding method of a data stream according to the present invention;
Fig. 2 is a schematic structural diagram of a decoding device for a data stream according to the present invention;
Fig. 3 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Those skilled in the art will appreciate that there are many forms of data decoding methods in the prior art.
The decoding object aimed by the first type of data decoding method is a whole, and each part cannot be decoded after the decoding object is split. For example, a message digest of a data file may be obtained by a hash calculation method. The information abstract is a whole, and only the whole information abstract can be decoded during decoding to obtain an original data file. Decoding any part of the information summary will not result in the original data file.
The decoding object aimed by the second type of data decoding method is detachable, and the partial decoding objects obtained after detachment can be respectively decoded.
For example, the basic principle of the Base64 coding method is: every three 8Bit bytes are converted into four 6Bit bytes (3*8 = 4*6 =24), and then the 6Bit bytes are added with two more high-order 0 bits before the 6Bit bytes, so that four 8Bit bytes are formed.
Based on the basic principle of the Base64 coding method, it can be known that: in the coding result obtained by the Base64 coding method, from the beginning part of the coding result, every adjacent four bytes are an independent unit to be decoded. One unit to be decoded is independent of other contents when decoding. Thus, the encoding result obtained by the Base64 encoding method can be split at the time of decoding.
In addition to the aforementioned Base64, the second type of data decoding method is commonly known as ASCII, base16, base32, base85, base58, quoted-printable, xxencode, uuencode, and the like.
The decoding method, the device, the electronic equipment and the storage medium for the data stream can realize decoding of the decoding object aimed at by the second-class data decoding method, and can reduce the occupation of a buffer space in the decoding process.
The decoding method, apparatus, electronic device and storage medium of the data stream of the present invention are described below with reference to fig. 1 to 3.
Fig. 1 is a flowchart of a method for decoding a data stream according to the present invention, where as shown in fig. 1, the method for decoding a data stream according to the present invention is applied to an electronic device having a network communication function, and includes:
Step 101, continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object.
In the present embodiment, the electronic device having the network communication function includes a firewall device, a data collector device, a sensor device, and the like.
The method is applied to the field of network communication, and the electronic equipment with the network communication function can continuously receive the data stream from the outside in the working process. The received data stream contains the data to be decoded of the target decoding object.
The target decoding object refers to an independent object to be decoded, such as a data file to be decoded, a data block to be decoded, and the like.
When the data amount of the target decoding object is large, the received data stream may last for a long time. In such a case, the process of receiving the data stream and the process of decoding the data to be decoded of the target decoding object may be performed in parallel.
When the data amount of the target decoding object is large, the decoding operation on the target decoding object may be performed in multiple times. If the decoding operation is performed multiple times, in this embodiment, multiple decoding operations with chronological order are distinguished according to the description modes of the last decoding operation, the current decoding operation, and the next decoding operation. Those skilled in the art will readily appreciate that as the current time varies, the last decoding operation, the current decoding operation, and the next decoding operation may also vary correspondingly.
For example, three decoding operations occur at 0 point 01, 0 point 02, and 0 point 03. If the current time is 0 point 02 point, the decoding operation of 0 point 01 point is referred to as the last decoding operation, the decoding operation of 0 point 02 point is referred to as the current decoding operation, and the decoding operation of 0 point 03 point is referred to as the next decoding operation. If the current time is 0 point 03 minutes, the decoding operation of 0 point 02 minutes becomes the last decoding operation; the decoding operation of 0 point 03 minutes becomes the current decoding operation.
The received data stream data is typically stored in a temporary buffer awaiting further processing.
Step 102, determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity.
In this embodiment, the data to be decoded currently refers to data that has not been decoded yet at the current time. The current data to be decoded may be first data to be decoded, second data to be decoded, or a combination of the first data to be decoded and the second data to be decoded. The first data to be decoded refers to data to be decoded of a target decoding object in a data stream received from the execution time of the last decoding operation to the execution time of the current decoding operation. The second data to be decoded refers to data that has been received before the execution time of the last decoding operation and has not been decoded at the time of the last decoding operation. Obviously, when a decoding operation is performed on a certain object to be decoded for the first time, the second data to be decoded is zero.
For example, a decoding operation of 0 point 01 is referred to as the last decoding operation, and a decoding operation of 0 point 02 is referred to as the current decoding operation. Before point 0, 01 minutes, data blocks A, B and C are received over the network; between point 01 and point 02, data blocks D, E and F are received over the network. In the decoding operation of 0 point 01 minutes, the data block A, B is decoded, and the remaining data block C. Then for the current decoding operation at point 0, 02 min, the data block C is the aforementioned second data to be decoded. Data blocks D, E and F are first data to be decoded. Data blocks C, D, E and F are the current data to be decoded.
In the present invention, the capacity of the decoding buffer space is allowed to be set to a small value. There are cases where the data amount of the current data to be decoded is greater than the decoding buffer space capacity, and cases where it is less than or equal to the decoding buffer space capacity. If the data size of the current data to be decoded is smaller than or equal to the decoding buffer space capacity, the electronic device receives all the data to be decoded of the target decoding object through the data stream in a shorter time, so that decoding of the current data to be decoded (including all the data to be decoded of the target decoding object) can be realized in the decoding buffer space according to the prior art. Not further described in the present invention.
The present invention mainly discusses the case that the data size of the current data to be decoded is larger than the decoding buffer space capacity.
In the present invention, even if the data amount of the data currently to be decoded is larger than the capacity of the decoding buffer space, the decoding operation can be performed. Before performing the decoding operation, the data amount of the current decoding operation is first determined.
The data amount of the current decoding operation refers to the data amount that can be processed by the current decoding operation. In the foregoing description, it has been mentioned that although a decoding object such as the Base64 method is detachable, a unit to be decoded, which is a minimum unit of the amount of data that can be independently decoded, still exists in the decoding object as an information representing a basic unit. The unit to be decoded, which consists of four adjacent 8Bit bytes, as referred to in the Base64 method. Since the units to be decoded included in the current data to be decoded are not necessarily complete, it is necessary to determine the data amount of the current decoding operation from the current data to be decoded so that the data determined according to the data amount of the current decoding operation includes the complete units to be decoded.
Those skilled in the art will readily appreciate that the amount of data of the current decoding operation is less than or equal to the amount of data of the current data to be decoded. In this embodiment, the data amount of the current decoding operation can be calculated using the following formula:
where L2 represents the data amount of the current decoding operation, L1 represents the data amount of the current data to be decoded, N represents the number of bytes contained in the unit to be decoded, Representing a rounding down.
Taking the Base64 method as an example, according to the basic principle of the Base64 method, the size of a unit to be decoded in the method is 4 bytes. In one decoding operation, the data amount of the data to be decoded is 4097 bytes. 4097 cannot be divided by 4, which means that there are incomplete units to be decoded in 4097 bytes. Therefore, the data amount of the current decoding operation is
In this embodiment, the capacity of the decoding buffer space is preset. The capacity of the decoding buffer space can be determined according to the practical situation of the electronic device, but should be generally greater than 4096 bytes.
And step 103, determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded.
In the previous step, the data amount of the current decoding operation has been determined, and in the present step, the current-time data to be decoded is sequentially determined from the current-time data to be decoded according to the data amount of the current-time decoding operation.
The data size of the current data to be decoded may be larger than the data size of the current decoding operation, and when such a situation occurs, the data which is not decoded at the current time is stored in the decoding buffer space for the next decoding operation.
Still taking the example of the Base64 method as an example, it is known that in one decoding operation, the data amount of the data to be decoded is 4097 bytes, and the data amount of the current decoding operation is 4096 bytes. The first 4096 bytes in the data to be decoded are taken as the data to be decoded at the current time. The remaining 1 byte will be saved in the decoding buffer space for the next decoding operation.
As can be seen from the above description, in the method of the present invention, when the data amount of the data currently to be decoded is greater than the capacity of the decoding buffer space, the decoding buffer space can also be used to store data that was not decoded at the time of the current decoding operation.
The specific implementation of decoding the data to be decoded at the present time is related to the type of codec, which is common knowledge to a person skilled in the art, and thus a description thereof will not be repeated here.
As can be seen from the above description of the present embodiment, the current data to be decoded can be larger than the decoding buffer space, which makes the capacity of the decoding buffer space not required to be set to be particularly large, and helps to save the buffer space.
The decoding method of the data stream provided by the invention continuously receives the data stream; determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; and determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded. The invention can realize the dynamic decoding of the target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves the buffer space and improves the decoding flexibility.
Based on any of the foregoing embodiments, in this embodiment, after the step of decoding the current data to be decoded, the method further includes:
And judging whether all data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data amount of the current decoding operation at the execution time of the preset next decoding operation, and if so, ending the flow.
According to the difference of the data amounts of the target decoding objects, the operation of decoding the target decoding objects may be completed once or may need to be completed multiple times. Therefore, in this step, it is necessary to determine whether or not all the data to be decoded of the target decoding object have been completely decoded. If there is still data to be decoded, then the next decoding operation is performed.
The execution time of the next decoding operation is preset, for example, the interval time between two decoding operations is preset to be 10 seconds apart, and for example, the next decoding operation is preset to be performed once 1 network data packet is received. The implementation of the next decoding operation is not essentially different from the previous steps 102 and 103 and is therefore not repeated.
If all the data to be decoded of the target decoding object has been decoded after the current decoding operation, it is indicated that the decoding work on the target decoding object has been completed, and thus the flow may be ended. And restarting the decoding work when the data stream transmits the next target decoding object.
The decoding method of the data stream provided by the invention continuously receives the data stream; determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; determining current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded; judging whether all data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data amount of the current decoding operation at the execution time of the preset next decoding operation, and if so, ending the flow; the dynamic decoding of the target decoding object in the data stream can be realized, a large amount of data does not need to be cached in the decoding process, the cache space is saved, and the decoding flexibility is improved.
Based on any of the foregoing embodiments, in this embodiment, before the step of determining the data amount of the current decoding operation according to the comparison relationship between the data amount of the current data to be decoded and the preset decoding buffer space capacity, the method further includes:
acquiring first data to be decoded; wherein the first data to be decoded is the target decoding object data in the data stream received between the execution time of the last decoding operation and the execution time of the current decoding operation;
Acquiring second data to be decoded from the decoding buffer space; wherein the second data to be decoded refers to data which has been received before the execution time of the last decoding operation and is not decoded at the time of the last decoding operation;
and combining the first data to be decoded and the second data to be decoded to obtain current data to be decoded.
In this embodiment, a determination process of the current data to be decoded is further described.
It has been mentioned in the previous embodiment that the decoding process of the target decoding object may be performed one or more times depending on the size of the data amount of the target decoding object. When the decoding process is performed a plurality of times, the current data to be decoded needs to be determined before each decoding.
In general, the current data to be decoded includes two parts of data. One part is the newly received data, namely the first data to be decoded, and the other part is the residual data which is received before and not decoded, namely the second data to be decoded.
It has been mentioned before that the first data to be decoded is newly obtained from the data stream, and thus the first data to be decoded is obtained from the data stream. Alternatively, since the data received from the data stream is typically stored in the temporary buffer, the first data to be decoded may also be obtained from the temporary buffer.
The second data to be decoded is stored in the decoding buffer space, and thus the second data to be decoded is acquired from the decoding buffer space. And after the first data to be decoded and the second data to be decoded are obtained, combining the first data to be decoded and the second data to be decoded, and obtaining the current data to be decoded.
Particularly, if the current decoding operation is the first decoding operation on the target decoding object, the second data to be decoded is empty; if the data stream does not transmit the data to be decoded of the target decoding object any more in the time period between the execution time of the current decoding operation and the execution time of the last decoding operation, the first data to be decoded is null.
The decoding method of the data stream can realize the dynamic decoding of the target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves the buffer space and improves the decoding flexibility.
Based on any of the foregoing embodiments, in this embodiment, before the step of determining the data amount of the current decoding operation according to the comparison relationship between the data amount of the current data to be decoded and the preset decoding buffer space capacity, the method further includes:
the capacity of the decoding buffer space is set to any value greater than 4096.
In the previous embodiment, the capacity of the decoding buffer space has been set in advance. In this embodiment, a description will be given of a setting procedure of the decoding buffer space capacity.
The size of the network data packet is generally 1460 bytes, and generally, the capacity of the decoding buffer space is larger than 1460 bytes, so that the network data packet can store the remaining data (i.e., L1-L2) between the data to be decoded currently and the data processed by the decoding operation currently. However, the present inventors have found that if the decoding buffer space is too small, frequent decoding may result, which may reduce the efficiency. Thus, in the present embodiment, the capacity minimum value of the decoding buffer space is set to 4096 bytes. The specific capacity value of the decoding buffer space can be determined according to practical needs, such as being set to 2 megabytes.
According to the foregoing steps of the method of the present invention, decoding can be achieved in the case where the data amount of the data currently to be decoded is greater than the decoding buffer space capacity. Therefore, in this embodiment, a smaller decoding buffer space may be set to save buffer resources.
Based on any of the foregoing embodiments, in this embodiment, after the step of decoding the current data to be decoded, the method further includes:
And splicing the decoding results in sequence to obtain the original content of the target decoding object.
After each part of the target decoding object is decoded, the decoding results can be spliced in sequence, so that the original content of the target decoding object is obtained.
For example, the target decoding object is a data file which is divided into data blocks F1, F2, F3, and F4 at the time of decoding, and these data blocks are sequentially spliced in order after being decoded respectively, to form a data file F1F2F3F4.
The decoding method of the data stream can realize the dynamic decoding of the target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves the buffer space and improves the decoding flexibility.
The decoding device of the data stream provided by the present invention will be described below, and the decoding device of the data stream described below and the decoding method of the data stream described above may be referred to correspondingly to each other.
Fig. 2 is a block diagram of a decoding device for a data stream according to the present invention, and as shown in fig. 2, the decoding device for a data stream according to the present invention includes:
A data stream receiving module 201, configured to continuously receive a data stream, where the data stream includes data to be decoded of a target decoding object;
The data amount determining module 202 of the current decoding operation is configured to determine, according to a comparison relationship between the data amount of the data to be decoded and a preset decoding buffer space capacity, the data amount of the current decoding operation; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
And the decoding module 203 is configured to determine current data to be decoded from the current data to be decoded according to the data amount of the current decoding operation, and decode the current data to be decoded.
The decoding device of the data stream can realize dynamic decoding of a target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves buffer space and improves the decoding flexibility.
Based on any of the foregoing embodiments, in this embodiment, further includes:
And the judging module is used for judging whether all the data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data amount of the current decoding operation at the execution time of the preset next decoding operation, and if so, ending the flow.
The decoding device of the data stream can realize dynamic decoding of a target decoding object in the data stream, does not need to buffer a large amount of data in the decoding process, saves buffer space and improves the decoding flexibility.
Based on any of the foregoing embodiments, in this embodiment, further includes:
And the decoding buffer space capacity setting module is used for setting the capacity of the decoding buffer space to be any numerical value larger than 4096.
The decoding device of the data stream can be provided with a smaller decoding buffer space so as to save buffer resources.
Fig. 3 illustrates a physical schematic diagram of an electronic device, as shown in fig. 3, where the electronic device may include: processor 310, communication interface (Communications Interface) 320, memory 330 and communication bus 340, wherein processor 310, communication interface 320 and memory 330 communicate with each other via communication bus 340. Processor 310 may invoke logic instructions in memory 330 to perform a method of decoding a data stream, the method comprising:
continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
Determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
And determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded.
Further, the logic instructions in the memory 330 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform a method of decoding a data stream provided by the methods described above, the method comprising:
continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
Determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
And determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the above-described decoding method of each provided data stream, the method comprising:
continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
Determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
And determining the current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A method of decoding a data stream, comprising:
continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
Determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
Determining current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation, and decoding the current data to be decoded;
The determining the data amount of the current decoding operation according to the comparison relation between the data amount of the current data to be decoded and the preset decoding buffer space capacity comprises the following steps:
If the data volume of the current data to be decoded is larger than the capacity of a preset decoding buffer space, taking the first data volume as the data volume of the current decoding operation; wherein,
The first data volume is smaller than or equal to the data volume of the current data to be decoded, and the first data volume is an integer multiple of a unit to be decoded of a target decoding object; wherein the unit to be decoded is a minimum unit which can be independently decoded in a target decoding object;
The calculation formula of the first data volume is as follows:
Wherein L2 represents a first data amount, L1 represents a data amount of the current data to be decoded, N represents the number of bytes contained in the unit to be decoded, Representing a downward rounding; wherein the unit to be decoded is used for representing the minimum unit of the data amount which can be independently decoded.
2. The method of decoding a data stream according to claim 1, wherein after said step of decoding said current time of data to be decoded, the method further comprises:
And judging whether all data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data amount of the current decoding operation at the execution time of the preset next decoding operation, and if so, ending the flow.
3. The method of decoding a data stream according to claim 1, wherein before the step of determining the data amount of the current decoding operation according to a comparison relationship between the data amount of the current data to be decoded and a preset decoding buffer space capacity, the method further comprises:
acquiring first data to be decoded; wherein the first data to be decoded is the target decoding object data in the data stream received between the execution time of the last decoding operation and the execution time of the current decoding operation;
Acquiring second data to be decoded from the decoding buffer space; wherein the second data to be decoded refers to data which has been received before the execution time of the last decoding operation and is not decoded at the time of the last decoding operation;
and combining the first data to be decoded and the second data to be decoded to obtain current data to be decoded.
4. A method of decoding a data stream according to any one of claims 1 to 3, wherein prior to the step of determining the data amount of the current decoding operation based on a comparison between the data amount of the current data to be decoded and a preset decoding buffer space capacity, the method further comprises:
the capacity of the decoding buffer space is set to any value greater than 4096.
5. A method of decoding a data stream according to any one of claims 1 to 3, wherein after the step of decoding the current data to be decoded, the method further comprises:
And splicing the decoding results in sequence to obtain the original content of the target decoding object.
6. A decoding device for a data stream, comprising:
the data stream receiving module is used for continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object;
The data volume determining module of the current decoding operation is used for determining the data volume of the current decoding operation according to the comparison relation between the data volume of the current data to be decoded and the preset decoding buffer space capacity; the current data to be decoded refers to the data to be decoded of a target decoding object which is received at the execution time of the current decoding operation;
The decoding module is used for determining current data to be decoded from the current data to be decoded according to the data quantity of the current decoding operation and decoding the current data to be decoded;
the data volume determining module is specifically configured to:
If the data volume of the current data to be decoded is larger than the capacity of a preset decoding buffer space, taking the first data volume as the data volume of the current decoding operation; wherein,
The first data volume is smaller than or equal to the data volume of the current data to be decoded, and the first data volume is an integer multiple of a unit to be decoded of a target decoding object; wherein the unit to be decoded is a minimum unit which can be independently decoded in a target decoding object;
The calculation formula of the first data volume is as follows:
Wherein L2 represents a first data amount, L1 represents a data amount of the current data to be decoded, N represents the number of bytes contained in the unit to be decoded, Representing a downward rounding; wherein the unit to be decoded is used for representing the minimum unit of the data amount which can be independently decoded.
7. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method for decoding a data stream according to any of claims 1 to 5 when the program is executed by the processor.
8. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the decoding method of a data stream according to any of claims 1 to 5.
9. A computer program product comprising computer executable instructions which, when executed, are adapted to carry out the steps of the method of decoding a data stream according to any one of claims 1 to 5.
CN202110244954.7A 2021-03-05 Decoding method and device of data stream, electronic equipment and storage medium Active CN115037981B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110244954.7A CN115037981B (en) 2021-03-05 Decoding method and device of data stream, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110244954.7A CN115037981B (en) 2021-03-05 Decoding method and device of data stream, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115037981A CN115037981A (en) 2022-09-09
CN115037981B true CN115037981B (en) 2024-05-31

Family

ID=

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104601177A (en) * 2014-12-30 2015-05-06 飞天诚信科技股份有限公司 Decoding extension implementation method based on base 64 encoding
CN106066843A (en) * 2016-06-02 2016-11-02 北京赛思信安技术股份有限公司 A kind of parallel coding and decoding device of high speed Base64
CN107026711A (en) * 2016-12-23 2017-08-08 阿里巴巴集团控股有限公司 Base64 coding/decoding methods and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104601177A (en) * 2014-12-30 2015-05-06 飞天诚信科技股份有限公司 Decoding extension implementation method based on base 64 encoding
CN106066843A (en) * 2016-06-02 2016-11-02 北京赛思信安技术股份有限公司 A kind of parallel coding and decoding device of high speed Base64
CN107026711A (en) * 2016-12-23 2017-08-08 阿里巴巴集团控股有限公司 Base64 coding/decoding methods and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Base64编码算法的研究及Delphi实现;刘华;;电脑知识与技术(第02期);第84-85页 *

Similar Documents

Publication Publication Date Title
JP6149076B2 (en) Method and apparatus for palette index signaling for image and video encoding
CN108009430B (en) Sensitive data rapid scanning method and device
EP3518100B1 (en) Quick loading method for kernel image file, and apparatus
CN111262876B (en) Data processing method, device and equipment based on block chain and storage medium
CN110958024B (en) Method and device for encoding serial data, embedded equipment and communication system
CN108777606B (en) Decoding method, apparatus and readable storage medium
CN112165331A (en) Data compression method and device, data decompression method and device, storage medium and electronic equipment
CN111967244A (en) FAST protocol decoding method, device and equipment based on FPGA
JP2016076924A (en) Method of pulse-code modulation and pallet coding for video coding
CN110545106B (en) Method and device for coding time series data
CN111131403A (en) Message coding and decoding method and device for Internet of things equipment
CN108446300B (en) Data information scanning method and device
CN112333186A (en) Data communication method, device, equipment and storage medium
CN115086298A (en) File transmission method and device
CN113630125A (en) Data compression method, data encoding method, data decompression method, data encoding device, data decompression device, electronic equipment and storage medium
CN114337678A (en) Data compression method, device, equipment and storage medium
CN115037981B (en) Decoding method and device of data stream, electronic equipment and storage medium
CN111414339B (en) File processing method, system, device, equipment and medium
CN108933599B (en) Huffman coding implementation method, system, equipment and computer storage medium
US10477245B2 (en) Methods and devices for coding and decoding depth information, and video processing and playing device
CN115037981A (en) Data stream decoding method and device, electronic equipment and storage medium
CN110620635A (en) Decoding method, apparatus and readable storage medium
CN106326310B (en) Resource encryption updating method for mobile phone client software
CN102891732A (en) Data sending method and device and data receiving method and device
CN113111040A (en) File decompression method and device

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Country or region after: China

Address after: Room 332, 3 / F, Building 102, 28 xinjiekouwei street, Xicheng District, Beijing 100088

Applicant after: Qianxin Technology Group Co.,Ltd.

Applicant after: Qianxin Wangshen information technology (Beijing) Co.,Ltd.

Address before: Room 332, 3 / F, Building 102, 28 xinjiekouwei street, Xicheng District, Beijing 100088

Applicant before: Qianxin Technology Group Co.,Ltd.

Country or region before: China

Applicant before: LEGENDSEC INFORMATION TECHNOLOGY (BEIJING) Inc.

GR01 Patent grant