CN115037981A - Data stream decoding method and device, electronic equipment and storage medium - Google Patents

Data stream decoding method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115037981A
CN115037981A CN202110244954.7A CN202110244954A CN115037981A CN 115037981 A CN115037981 A CN 115037981A CN 202110244954 A CN202110244954 A CN 202110244954A CN 115037981 A CN115037981 A CN 115037981A
Authority
CN
China
Prior art keywords
data
decoding
decoded
current
data stream
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.)
Granted
Application number
CN202110244954.7A
Other languages
Chinese (zh)
Other versions
CN115037981B (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
Priority date (The priority date 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 date listed.)
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
Priority claimed from CN202110244954.7A external-priority 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

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • H04N21/4392Processing of audio elementary streams involving audio buffer management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention provides a method and a device for decoding a data stream, electronic equipment and a storage medium, 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 cache space capacity; and determining the current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded. The invention can realize 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 flexibility of decoding.

Description

Data stream decoding method and device, 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 an 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 data stream is decoded, a complete data block or a data file to be decoded, which is transmitted by the data stream, is generally stored in a special decoding buffer storage space (hereinafter referred to as a decoding buffer space), and then the complete data block or the data file stored in the decoding buffer storage space is decoded.
Since the size of the data blocks or data files contained in the data stream is not fixed, some data blocks or data files to be decoded have a large data amount. Therefore, when a data block or a data file having a large data amount is decoded by using the decoding method of the prior art, a large amount of buffer space needs to be occupied for decoding the buffer space, which results in waste of the buffer space.
Disclosure of Invention
The invention provides a data stream decoding method, a data stream decoding device, electronic equipment and a storage medium, which are used for solving the defect that a cache space is wasted when a decoding method in the prior art decodes a data block or a data file with a large data volume, and realizing the efficient utilization of the cache space.
The invention provides a method for decoding 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and determining the current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded.
According to a data stream decoding method provided by the present invention, after the step of decoding the current data to be decoded, the method further includes:
and 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 volume of the current decoding operation at the preset execution time of the next decoding operation, and if so, ending the process.
According to the decoding method of the data stream provided by the present invention, the determining the data size of the current decoding operation according to the comparison relationship between the data size 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 preset capacity of a decoding cache space, taking the first data volume as the data volume of the current decoding operation; wherein, the first and the second end of the pipe are connected with each other,
the first data volume is less than or equal to the data volume of the current data to be decoded, and the first data volume is an integral 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 present invention, the calculation formula of the first data amount is:
Figure BDA0002963762020000021
wherein L2 represents the first data amount, 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,
Figure BDA0002963762020000022
direction of expressionAnd (6) taking the whole.
According to the decoding method of the data stream provided by the present invention, 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 comprises:
acquiring first data to be decoded; the first data to be decoded is data to be decoded of a target decoding object in a 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 cache space; 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 in the last decoding operation;
and combining the first data to be decoded and the second data to be decoded to obtain the current data to be decoded.
According to the decoding method of the data stream provided by the present invention, before the step of determining the data volume of the current decoding operation according to the comparison relationship between the data volume 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 larger than 4096.
According to a data stream decoding method provided by the present invention, after the step of decoding the current data to be decoded, the method further includes:
and splicing the decoding results according to the sequence to obtain the original content of the target decoding object.
The present invention also provides a data stream decoding apparatus, including:
the data stream receiving module is used for continuously receiving a data stream, and 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and the decoding module is used for determining the data to be decoded at the current time from the data to be decoded at the current time according to the data volume of the decoding operation at the current time and decoding the data to be decoded at the current time.
According to the decoding device of a data stream provided by the invention, the device also 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 volume of the current decoding operation at the preset execution time of the next decoding operation, and if so, ending the process.
According to the decoding device of the data stream provided by the invention, the device also 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 method for decoding a data stream as described when executing the program.
The invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of decoding a data stream as described.
The invention also provides a computer program product comprising computer executable instructions for implementing the steps of the method for decoding a data stream as described herein, when executed.
The invention provides a decoding method, a device, electronic equipment and a storage medium of data stream, which continuously receive 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 cache space capacity; determining current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded; the invention can realize 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 flexibility of decoding.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a decoding method for data streams provided by the present invention;
fig. 2 is a schematic structural diagram of a data stream decoding apparatus provided in the present invention;
fig. 3 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Those skilled in the art will appreciate that there are many forms of data decoding methods known in the art.
The decoding object aimed at by the first type of data decoding method is a whole, and the decoding object cannot be split and then each part can be decoded respectively. For example, a data file may be summarized by a hash calculation. 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 abstract can not obtain the original data file.
The decoding object aimed by the second data decoding method is detachable, and partial decoding objects obtained after the detachment can be decoded respectively.
For example, the basic principle of the Base64 encoding method is: every three 8-Bit bytes are converted into four 6-Bit bytes (3 × 8 ═ 4 × 6 ═ 24), and then the 6-Bit bytes are added with two more high bits of 0, so that four 8-Bit bytes are formed.
Based on the basic principle of the Base64 encoding method, it can be known that: in the encoding result obtained by the Base64 encoding method, every adjacent four bytes are an independent unit to be decoded from the beginning of the encoding result. When decoding, a unit to be decoded does not depend on other contents. Therefore, the encoding result obtained by the Base64 encoding method can be split when decoding.
The second type of data decoding methods are common ASCII, Base16, Base32, Base85, Base58, quantum-printable, Xxencode, uuenco, and the like, in addition to the aforementioned Base 64.
By adopting the data stream decoding method, the data stream decoding device, the electronic equipment and the storage medium, decoding of the decoding object aimed at by the second data decoding method can be realized, and occupation of a cache space can be reduced in the decoding process.
The following describes a decoding method, apparatus, electronic device and storage medium of data stream in conjunction with fig. 1-3.
Fig. 1 is a flowchart of a method for decoding a data stream provided by the present invention, and as shown in fig. 1, the method for decoding a data stream provided by the present invention is applied to an electronic device having a network communication function, and the method includes:
step 101, continuously receiving a data stream, wherein the data stream comprises data to be decoded of a target decoding object.
In this embodiment, the electronic device having a 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 data to be decoded of a 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 reception of the data stream lasts 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 several times. If the decoding operation is executed for multiple times, in this embodiment, multiple decoding operations in time sequence are distinguished according to the description modes of the previous 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 decoding operations specifically referred to by the previous 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 point, 0 point 02 point, and 0 point 03 point. If the current time is 0 point 02 min, the decoding operation of 0 point 01 min is regarded as the previous decoding operation, the decoding operation of 0 point 02 min is regarded as the current decoding operation, and the decoding operation of 0 point 03 min is regarded as the next decoding operation. If the current time is 0 point 03 point, the decoding operation of 0 point 02 point becomes the last decoding operation; the decoding operation of 0 point 03 becomes the current decoding operation.
The received data stream data is typically stored in a temporary buffer for subsequent further processing.
And 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 cache space capacity.
In this embodiment, the current data to be decoded refers to data that has not been decoded at the current time. The current data to be decoded may be the first data to be decoded, the second data to be decoded, or a collection 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 that has not been decoded at the last decoding operation. Obviously, when a certain object to be decoded is subjected to a decoding operation for the first time, the second data to be decoded is zero.
For example, a decoding operation of 0 point 01 is described as the last decoding operation, and a decoding operation of 0 point 02 is described as the current decoding operation. Before point 0, point 01, data blocks A, B and C are received over the network; between 0 point 01 and 0 point 02, data blocks D, E and F are received over the network. In the decoding operation at point 0 and point 01, data block A, B has been decoded, leaving data block C. Then for the current decoding operation of 0 point 02, the data block C is the aforementioned second data to be decoded. Data blocks D, E and F are the first data to be decoded. Data blocks C, D, E and F are the data currently to be decoded.
In the present invention, it is allowed to set the capacity of the decoding buffer space to a small value. Therefore, the data amount of the current data to be decoded is larger than the space capacity of the decoding buffer and is smaller than or equal to the space capacity of the decoding buffer. If the data volume of the current data to be decoded is smaller than or equal to the decoding cache space capacity, which indicates that the data volume of the target decoding object is smaller, the electronic device has received all the data to be decoded of the target decoding object through the data stream within a shorter time, so that the 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 cache space according to the prior art. And will not be described further in the present invention.
The invention mainly discusses the condition that the data volume of the current data to be decoded is larger than the space capacity of the decoding cache.
In the present invention, even if the data amount of the current data to be decoded is larger than the capacity of the decoding buffer space, the decoding operation can be performed. Before the decoding operation is performed, the data amount of the current decoding operation is determined.
The data amount of the current decoding operation refers to the data amount that can be processed by the current decoding operation. It has been mentioned in the foregoing description that, although a decoding object such as the Base64 method is detachable, a unit to be decoded still exists in the decoding object as an information representation basic unit, and the unit to be decoded is also a minimum unit of the amount of data that can be independently decoded. A unit to be decoded consisting of four adjacent 8-Bit 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 all complete, the data amount of the current decoding operation needs to be determined 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.
It is easily understood by those skilled in the art that the data amount of the current decoding operation is less than or equal to the data amount of the current data to be decoded. In this embodiment, the following formula can be used to calculate the data amount of the current decoding operation:
Figure BDA0002963762020000081
wherein 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,
Figure BDA0002963762020000082
meaning rounding down.
Taking the Base64 method as an example, the size of the unit to be decoded in this method is 4 bytes according to the basic principle of the Base64 method. The data amount of the data to be decoded in one decoding operation is 4097 bytes. 4097 cannot be divided exactly by 4, which means that there are incomplete units to be decoded in 4097 bytes. Due to the fact thatHere, the amount of data of the current decoding operation is
Figure BDA0002963762020000091
In this embodiment, the size of the decoding buffer space is preset. The size of the decoding buffer space can be determined according to the actual conditions of the electronic device, but should be generally larger than 4096 bytes.
And 103, determining current data to be decoded from the current data to be decoded according to the data volume 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 already been determined, and in this step, the current data to be decoded is determined in order from the current data to be decoded based on the data amount of the current decoding operation.
When the data volume of the current data to be decoded is possibly larger than that of the current decoding operation, the data which is not decoded at the current time can be 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 the data size of data to be decoded in one decoding operation is 4097 bytes, and the data size of the current decoding operation is 4096 bytes. And taking the top 4096 bytes of the data to be decoded as the current data to be decoded. The remaining 1 byte will be stored in the decode buffer space for the next decode operation.
As can be seen from the above description, in the method of the present invention, when the data amount of the current data to be decoded is greater than the capacity of the decoding buffer space, the decoding buffer space may also be used to store data that is not decoded at the time of the current decoding operation.
The specific implementation of decoding the current data to be decoded is related to the type of codec, which is common knowledge to those skilled in the art, and therefore will not be described repeatedly here.
As can be seen from the above description of the present embodiment, the current data to be decoded may be larger than the decoding buffer space capacity, which makes the capacity of the decoding buffer space not need to be set to be particularly large, and is helpful 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 cache space capacity; and determining the current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded. The invention can realize 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 flexibility of decoding.
Based on any one 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 the data to be decoded of the target decoding object are decoded, if not, re-executing the step of determining the data volume of the current decoding operation at the preset execution time of the next decoding operation, and if so, ending the process.
According to the difference of the data amount of the target decoding object, the operation of decoding the target decoding object may be completed once or may need to be completed many 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 decoded. If there is data to be decoded yet to be decoded, 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 every time 1 network data packet is newly received. The specific implementation of the next decoding operation is not substantially different from the aforementioned steps 102 and 103, and thus will not be repeated.
If all the data to be decoded of the target decoding object have been decoded after the current decoding operation, it indicates that the decoding of the target decoding object has been completed, and thus the process 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 cache space capacity; determining current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded; 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 volume of the current decoding operation at the preset execution time of the next decoding operation, and if so, ending the process; 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 caching 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 size of the current decoding operation according to the comparison relationship between the data size of the current data to be decoded and the preset decoding buffer space capacity, the method further includes:
acquiring first data to be decoded; the first data to be decoded is data to be decoded of a target decoding object in a 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 cache space; 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 in the last decoding operation;
and combining the first data to be decoded and the second data to be decoded to obtain the current data to be decoded.
In this embodiment, the determination process of the current data to be decoded is further explained.
In the previous embodiments, it has been mentioned that the decoding process for the target decoding object may be performed one or more times according to the size of the data amount of the target decoding object. When the decoding process is repeated many times, the data to be decoded currently needs to be determined before each decoding.
In general, the data to be currently decoded includes two portions of data. One part is newly received data, i.e., the aforementioned first data to be decoded, and the other part is the remaining data that has been received before and has not been decoded, i.e., the aforementioned second data to be decoded.
It has been mentioned before that the first data to be decoded is newly acquired from the data stream, and thus the first data to be decoded is acquired from the data stream. Optionally, since the data received from the data stream is generally 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, so that the second data to be decoded is obtained 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 to obtain the current data to be decoded.
Specifically, if the current decoding operation is the first decoding operation on the target decoding object, the second data to be decoded is empty; and 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 empty.
The decoding method of the data stream provided by the invention can realize 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 flexibility of decoding.
Based on any of the foregoing embodiments, in this embodiment, before the step of determining the data size of the current decoding operation according to the comparison relationship between the data size 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 larger than 4096.
In the previous embodiment, the size of the decoding buffer space has been set in advance. In this embodiment, a description is given of a setting process of the decoding buffer space capacity.
The size of the network data packet is generally 1460 bytes, and generally, the size of the decoding buffer space is larger than 1460 bytes to ensure that it 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 applicant finds that if the decoding buffer space is too small, frequent decoding may be caused, and the efficiency is reduced. Therefore, in the present embodiment, the minimum size of the decoding buffer space is set to 4096 bytes. The specific capacity value of the decoding buffer space can be determined according to actual needs, for example, set to 2 megabytes.
According to the foregoing steps of the method of the present invention, decoding can be implemented in the case that the data amount of the current data 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 one 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 according to the sequence to obtain the original content of the target decoding object.
After each part of the target decoding object is decoded respectively, 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 decoded separately and sequentially spliced in order to form a data file F1F2F3F 4.
The decoding method of the data stream provided by the invention can realize 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 flexibility of decoding.
The following describes a decoding apparatus for a data stream provided by the present invention, and the following described decoding apparatus for a data stream and the above described decoding method for a data stream can be referred to correspondingly.
Fig. 2 is a block diagram of a data stream decoding apparatus according to the present invention, and as shown in fig. 2, the data stream decoding apparatus 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;
a data amount determining module 202 of the current decoding operation, configured to determine 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and the decoding module 203 is configured to determine data to be decoded at the current time from the data to be decoded at the current time according to the data amount of the current decoding operation, and decode the data to be decoded at the current time.
The decoding device of the data stream can realize 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 flexibility of decoding.
Based on any one of the above embodiments, in this embodiment, the method 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 volume of the current decoding operation at the preset execution time of the next decoding operation, and if so, ending the process.
The decoding device of the data stream can realize 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 flexibility of decoding.
Based on any one of the above embodiments, in this embodiment, the method 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 provided by the invention can set a smaller decoding buffer space so as to save buffer resources.
Fig. 3 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 3: a processor (processor)310, a communication Interface (communication Interface)320, a memory (memory)330 and a communication bus 340, wherein the processor 310, the communication Interface 320 and the memory 330 communicate with each other via the communication bus 340. The processor 310 may call logic instructions in the 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and determining the current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded.
In addition, the logic instructions in the memory 330 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and 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 for decoding a data stream provided by the above methods, 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and determining the current data to be decoded from the current data to be decoded according to the data volume 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, on which a computer program is stored, the computer program being implemented by a processor to perform the method for decoding the data stream provided in the above aspects, 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and determining the current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (11)

1. A method for 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and determining the current data to be decoded from the current data to be decoded according to the data volume of the current decoding operation, and decoding the current data to be decoded.
2. The method for decoding data stream according to claim 1, wherein after the step of decoding the current data to be decoded, the method further comprises:
and 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 volume of the current decoding operation at the preset execution time of the next decoding operation, and if so, ending the process.
3. The method for decoding a data stream according to claim 1 or 2, wherein the determining the data size of the current decoding operation according to the comparison relationship between the data size of the current data to be decoded and the preset decoding buffer space capacity comprises:
if the data volume of the current data to be decoded is larger than the preset capacity of a decoding cache space, taking the first data volume as the data volume of the current decoding operation; wherein the content of the first and second substances,
the first data volume is less than or equal to the data volume of the current data to be decoded, and the first data volume is an integral 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.
4. The method for decoding a data stream according to claim 3, wherein the first amount of data is calculated by:
Figure FDA0002963762010000011
wherein L2 represents the first data amount, 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,
Figure FDA0002963762010000012
represents rounding down; wherein the unit to be decoded is used to represent a minimum unit of data amount that can be independently decoded.
5. The method for decoding data stream according to claim 1, wherein 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 comprises:
acquiring first data to be decoded; the first data to be decoded is data to be decoded of a target decoding object in a 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 cache space; 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 in the last decoding operation;
and combining the first data to be decoded and the second data to be decoded to obtain the current data to be decoded.
6. The method for decoding a data stream according to any one of claims 1 to 5, wherein before the step of determining the data size of the current decoding operation according to the comparison relationship between the data size 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 larger than 4096.
7. The method for decoding a data stream according to any one of claims 1 to 5, wherein after the step of decoding the data to be decoded at the current time, the method further comprises:
and splicing the decoding results according to the sequence to obtain the original content of the target decoding object.
8. An apparatus for decoding a data stream, comprising:
the data stream receiving module is used for continuously receiving a data stream, and 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 cache space capacity; the current data to be decoded refers to the data to be decoded of the target decoding object which is received at the execution moment of the current decoding operation;
and the decoding module is used for determining the data to be decoded at the current time from the data to be decoded at the current time according to the data volume of the decoding operation at the current time and decoding the data to be decoded at the current time.
9. An electronic device comprising a memory, a processor and a computer program stored on said memory and executable on said processor, characterized in that said processor, when executing said program, carries out the steps of a method for decoding a data stream according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for decoding a data stream according to any one of claims 1 to 7.
11. A computer program product comprising computer executable instructions, characterized in that said instructions, when executed, are adapted to implement the steps of a method for decoding a data stream according to any of claims 1 to 7.
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 true CN115037981A (en) 2022-09-09
CN115037981B CN115037981B (en) 2024-05-31

Family

ID=

Citations (4)

* 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
US20160020782A1 (en) * 2013-03-15 2016-01-21 Numbergun Llc Improvements for base64 encoding and decoding
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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160020782A1 (en) * 2013-03-15 2016-01-21 Numbergun Llc Improvements for base64 encoding and decoding
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实现", 电脑知识与技术, no. 02, pages 84 - 85 *

Similar Documents

Publication Publication Date Title
CN108009430B (en) Sensitive data rapid scanning method and device
CN110958024B (en) Method and device for encoding serial data, embedded equipment and communication system
CN107404654B (en) JPEG image decompression method, device and platform
CN109496418B (en) File downloading method and device, and equipment/terminal/server
CN108509272B (en) Method and device for copying GPU (graphics processing Unit) video memory texture to system memory and electronic equipment
CN112165331A (en) Data compression method and device, data decompression method and device, storage medium and electronic equipment
CN110545106B (en) Method and device for coding time series data
CN115086298A (en) File transmission method and device
CN108446300B (en) Data information scanning method and device
CN111541521B (en) Data packet length identification method and system
CN106874020B (en) Method and device for starting plug-in
CN113630125A (en) Data compression method, data encoding method, data decompression method, data encoding device, data decompression device, electronic equipment and storage medium
CN111414339B (en) File processing method, system, device, equipment and medium
CN115037981A (en) Data stream decoding method and device, electronic equipment and storage medium
CN110740138B (en) Data transmission method and device
CN116467235B (en) DMA-based data processing method and device, electronic equipment and medium
CN115037981B (en) Decoding method and device of data stream, electronic equipment and storage medium
CN114337678A (en) Data compression method, device, equipment and storage medium
US11475356B2 (en) Data processing method, electronic device and computer readable storage method for deduplication of a training dataset
CN116193160A (en) Digital watermark embedding method, device, equipment and medium
CN113314128B (en) Delayed access method, device and system for voice service and related products
CN114911525A (en) Binary instruction translation execution method and device
CN102891732A (en) Data sending method and device and data receiving method and device
CN113111040A (en) File decompression method and device
CN110896391B (en) Message processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
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.

CB02 Change of applicant information
GR01 Patent grant