CN112035706A - Encoding method, decoding method, computer device, and readable storage medium - Google Patents

Encoding method, decoding method, computer device, and readable storage medium Download PDF

Info

Publication number
CN112035706A
CN112035706A CN201910482037.5A CN201910482037A CN112035706A CN 112035706 A CN112035706 A CN 112035706A CN 201910482037 A CN201910482037 A CN 201910482037A CN 112035706 A CN112035706 A CN 112035706A
Authority
CN
China
Prior art keywords
target data
type
key
data
file
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.)
Pending
Application number
CN201910482037.5A
Other languages
Chinese (zh)
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.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology 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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN201910482037.5A priority Critical patent/CN112035706A/en
Publication of CN112035706A publication Critical patent/CN112035706A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses an encoding method, a decoding method, computer equipment and a readable storage medium, and belongs to the field of multimedia file structures. The encoding method of the invention encodes each target data and the corresponding type according to the target data and the corresponding type in the scalable vector graphics file to generate the binary file marked with the target data type, thereby improving the compression rate of the data, saving the storage space of the data and facilitating the transmission of the data. In the decoding method, decoding each key value pair in the binary file marked with the target data type one by one; according to the type of the key in the key value pair, the value corresponding to the key is effectively converted into the target data corresponding to the type of the key, so that the scalable vector graphics file is restored, and the integrity of the data is ensured.

Description

Encoding method, decoding method, computer device, and readable storage medium
Technical Field
The present invention relates to the field of multimedia file structures, and more particularly, to encoding and decoding methods, computer devices, and readable storage media.
Background
Most Scalable Vector Graphics (SVG) currently use Extensible Markup Language (XML) to describe two-dimensional Vector Graphics. SVG graphics are scalable, maintaining their graphics quality in the event of changing sizes. SVG can use some predefined shape elements to describe graphics, such as: rectangles, lines, paths, etc. XML, a subset of the standard universal markup language, is a markup language for marking electronic documents to be structured. XML, which can be used to mark data, define data types, is a source language that allows users to define their own markup language. XML is a cross-platform, content-dependent technology in the Internet environment and is today an efficient tool for handling distributed structural information. However, because the compression efficiency of the XML serialized data is low and the network bandwidth resource is limited, the data in the SVG format is compressed and then transmitted, and the occupied network bandwidth is relatively large.
Disclosure of Invention
Aiming at the problem of low compression rate of an XML-based SVG file, an encoding and decoding method, a computer device and a readable storage medium aiming at improving the compression rate are provided.
The invention provides a coding method, which comprises the following steps:
identifying all target data in a scalable vector graphics file and a type corresponding to each target data, wherein the type corresponding to the target data comprises a meta information type and a path information type;
and coding each target data and the corresponding type to generate a binary file marked with the target data type.
Preferably, the scalable vector graphics file is in an extensible markup language format.
Preferably, each of said target data types corresponds to a respective key.
Preferably, the step of encoding each target data and the corresponding type to generate a binary file with a target data type identifier includes:
coding keys corresponding to the types of the target data and the target data one by one to generate key value pairs;
and combining all the key-value pairs to generate the binary file.
Preferably, the step of encoding the key corresponding to each type of the target data and the target data one by one to generate a key-value pair includes:
each key corresponds to a positive integer;
converting the target data of the negative integer into the target data of the positive integer by adopting a zigzag coding method;
and binary coding is carried out on the target data of the positive integer and the positive integer corresponding to the key by adopting a varint coding method, and the target data of the decimal is coded by adopting a single-precision mode in an IEEE754 standard to generate a key value pair.
The invention also provides a decoding method, which comprises the following steps:
decoding each key value pair in the binary file marked with the target data type one by one;
converting the value corresponding to the key into target data corresponding to the type of the key according to the type of the key in the pair of key values;
combining all of the target data to generate a scalable vector graphics file.
Preferably, the scalable vector graphics file is in an extensible markup language format.
Preferably, the type corresponding to the target data includes a corresponding key for each type of the target data of the meta information type and the path information type.
The invention also provides a computer 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 encoding method when executing the computer program.
The present invention also provides a computer-readable storage medium having stored thereon a computer program characterized in that: which when executed by a processor implements the steps of the encoding method described above.
The present invention also provides a computer 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 when executing the computer program.
The present invention also provides a computer-readable storage medium having stored thereon a computer program characterized in that: which computer program, when being executed by a processor, carries out the steps of the above-mentioned decoding method.
The beneficial effects of the above technical scheme are that:
in the technical scheme, the scalable vector graphics file is coded and compressed into a binary file, so that the scalable vector graphics file is effectively compressed to facilitate data transmission; decoding the binary file based on the target data type ensures the accuracy of decoding.
In the encoding method, each target data and corresponding type are encoded according to the target data and the corresponding type in the scalable vector graphics file to generate a binary file marked with the target data type, so that the compression rate of the data is improved, the storage space of the data is saved, and the data transmission is facilitated;
in the decoding method, decoding each key value pair in the binary file marked with the target data type one by one; according to the type of the key in the key value pair, the value corresponding to the key is effectively converted into the target data corresponding to the type of the key, so that the scalable vector graphics file is restored, and the integrity of the data is ensured.
Drawings
FIG. 1 is a block diagram of an embodiment of an encoding and decoding system according to the present invention;
FIG. 2 is a flow chart of an embodiment of the encoding method according to the present invention;
FIG. 3 is a flow chart of another embodiment of the encoding method according to the present invention;
FIG. 4 is a flowchart of an embodiment of a decoding method according to the present invention;
FIG. 5 is a block diagram of one embodiment of an encoding system according to the present invention;
FIG. 6 is a block diagram of one embodiment of a decoding system according to the present invention;
fig. 7 is a hardware architecture diagram of one embodiment of the computer apparatus of the present invention.
Detailed Description
The advantages of the invention are further illustrated in the following description of specific embodiments in conjunction with the accompanying drawings.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present disclosure. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the description of the present invention, it should be understood that the numerical references before the steps do not identify the order of performing the steps, but merely serve to facilitate the description of the present invention and to distinguish each step, and thus should not be construed as limiting the present invention.
The video of the embodiment of the application may be presented on clients such as large-scale video playing devices, game machines, desktop computers, smart phones, tablet computers, MP3(movingpicture expeerpercgroupandioudiolayer iii) players, MP4(movingpicture expeerpercgroupandioudiolayer rlv) players, laptop portable computers, e-book readers, and other display terminals.
The encoding and decoding method of the embodiment of the application can be applied to scenes such as games, drama playing, live broadcasting and the like, can also be applied to any application scene capable of presenting videos, and can be applied to on-demand resource playing of movie dramas, documentaries, animations, comprehensive arts (such as kindergarten programs and entertainment programs of multi-party confrontation) and the like, various types of live broadcasting playing of games, fashions, news, entertainment, lives (such as live broadcasting programs of match types) and the like, and playing of interactive videos and interactive games of audiences and main broadcasting/visual broadcasting parties (such as black glasses or invisible guardians in the industry). The embodiment of the present application takes the application of video to comedy play as an example, but is not limited to this.
In the embodiment of the present application, please refer to fig. 1, and fig. 1 is a block diagram of an encoding and decoding system provided in the embodiment of the present application. The server W processes pre-stored video information to generate mask data and carries out compression coding on the mask data, and then forwards streaming media data carrying masks and corresponding barrage data to the user A, the user B, the user C, the user D and the user E through a network, wherein the user A, the user B, the user C, the user D and the user E decode the data to watch videos with the mask barrages, and user experience is improved. Only one server W is shown here, and the application scenario here may also include multiple servers in communication with each other. The server W may be a cloud server or a local server. In the embodiment of the present application, the server W is placed on the cloud side. The device of the mobile terminal A, B, C is not limited to the illustrated mobile device, and all smart terminals that can perform streaming are applicable.
The invention provides an encoding method with high compression ratio for solving the defects of low compression ratio and unfavorable transmission of the existing SVG file. Referring to fig. 2, which is a schematic flow chart of an encoding method according to a preferred embodiment of the present invention, it can be seen that the encoding method provided in the present embodiment mainly includes the following steps:
A1. identifying all target data in a scalable vector graphics file and a type corresponding to each target data, wherein the type corresponding to the target data comprises a meta information type and a path information type;
it should be noted that: the scalable vector graphics file is in an extensible markup language format. The target data is SVG graphics, and the SVG graphics are telescopic and can keep the graphics quality under the condition of changing the size. SVG can use some predefined shape elements to describe graphics, such as: rectangles, lines, paths, etc.
In this embodiment, the target data corresponding to the meta information type is meta information, and the target data corresponding to the path information type is path information.
The path information includes the types: and at least one type of absolute coordinate or relative coordinate information of the vertex required by the closing path and the SVG path in various commands (such as moveto, lineto, curveto and the like). The meta information may include: the width and the height occupied during SVG drawing, information required by SVG translation and scaling and the like.
Taking an SVG file with the following format as an example:
Figure BDA0002084153870000061
the path information is a standard element path (path data) of the SVG. The path data is formed by arranging a group of continuously arranged expressions $ { path _ key }, $ { path _ value }, and the explanation of $ { path _ value } is determined according to $ { path _ key }; $ path _ key represents the type of path information; $ path _ value represents the content of the path information. Meta information, i.e. data other than path (< path >) tags, such as: $ width }, $ { height }, $ { trans _ x }, $ { trans _ y }, $ { scale _ x }, and $ scale _ y }, which may be stored according to the IEEE754 single precision floating point number standard because there may be fractions of the information.
In this embodiment, the types of the target data may further include: version information;
a respective key for each of said types of target data.
It should be noted that: the number of the key can be adaptively defined according to different application scenes, and the corresponding relation between the key and the value can be freely defined. value may be any type of data that is easier to store.
By way of example and not limitation, taking a scalable vector graphics file as mask data, the key numbers are as follows:
1, and the corresponding target data type is coded version information;
2, the corresponding target data type is meta-information, and the meta-information can consist of six decimal parts;
3, the corresponding target data type is a closed path;
4, the corresponding target data type is the absolute coordinate of a vertex required by the SVG path moveto command and consists of two integers;
5, the corresponding target data type is the relative coordinate of a vertex required by the SVG path moveto command and consists of two integers;
6, the corresponding target data type is the absolute coordinate of a vertex required by the SVG path lineto command and consists of two integers;
7, the corresponding target data type is the relative coordinate of a vertex required by the SVG path lineto command and consists of two integers;
the key is 8, the corresponding target data type is the absolute coordinates of three vertexes required by the SVG path curveto command, and the absolute coordinates consist of 6 integers;
and key is 9, and the corresponding target data type is the relative coordinates of three vertexes required by the SVG path curveto command and consists of 6 integers.
A2. And coding each target data and the corresponding type to generate a binary file marked with the target data type. Therefore, the scalable vector graphics file is effectively compressed, and the storage space of the data is saved, so that the data can be conveniently transmitted.
Further, referring to fig. 3, the step a2 of encoding each target data and corresponding type, and generating a binary file with a target data type identifier may specifically include:
A21. coding keys corresponding to the types of the target data and the target data one by one to generate key value pairs;
further, step a21 may specifically include:
each key corresponds to a positive integer;
converting the target data of the negative integer into the target data of the positive integer by adopting a zigzag coding method;
and binary coding is carried out on the target data of the positive integer and the positive integer corresponding to the key by adopting a varint coding method, and the target data of the decimal is coded by adopting a single-precision mode in an IEEE754 standard to generate a key value pair.
The key value pair in this embodiment takes the form of a key-value, where the key represents a key for representing the type of the target data; value represents a value for representing the content of the target data. The key value pair has the advantages of high compression efficiency and high transmission speed. The compression efficiency can be greatly improved through binary coding, so that the target data can be rapidly transmitted. The keys can be used for effectively distinguishing the meanings of the binary data representations corresponding to the keys.
A22. And combining all the key-value pairs to generate the binary file.
In actual application, the encoding end adopts an encoding method to extract data needing encoding in the SVG file by utilizing the SVG template. The SVG template is used for extracting target data in the SVG file, fixed data are preset in the SVG template, and the target data needing to be extracted from the SVG file are identified. And the encoding end encodes the data to be encoded and stored by using the zig-zag and varint encoding technologies in Protocol Buffers.
It should be noted that the encoding end may be any one of a push stream end or a server.
In this embodiment, each target data and corresponding type are encoded according to the target data and corresponding type in the scalable vector graphics file to generate a binary file with the target data type identified, so as to improve the data compression rate, save the data storage space, and facilitate data transmission.
Compared with an original SVG file, the encoding method of the embodiment only needs to store data such as meta information and path information, and the data are encoded by using a zig-zag encoding method and a varint encoding method in Protocol Buffers, so that very high data compression efficiency is obtained. In practical application, an original SVG file (i.e. SVG image) with the size of 1500 bytes can be compressed into binary data with the size of 350 bytes after being encoded by the encoding method provided by the invention, and about 77% of data storage space is saved.
It should be noted that: protocol Buffers are a data description language developed by Google corporation, and can be used in the aspects of data storage, transmission, communication protocols and the like. Compared with XML, Protocol Buffers are the biggest differences: XML uses a text format, while Protocol Buffers uses a binary format. Thus, one of the most significant advantages of Protocol Buffers in terms of serializing data is: the data compression rate is very high. For example, the number 124 requires 3 bytes for storage in the XML file, and only 1 byte is needed for storage of the representation after the Protocol Buffers serialization. Typically, for the same piece of structured data, the data size after serialization using Protocol buffers is much smaller than the data size after serialization using XML.
As shown in fig. 4, a decoding method includes the steps of:
B1. decoding each key value pair in the binary file marked with the target data type one by one;
it should be noted that: the scalable vector graphics file is in an extensible markup language format file.
In this embodiment, the types corresponding to the target data include a meta information type and a path information type. The target data corresponding to the meta-information type is meta-information, and the target data corresponding to the path information type is path information.
The path information includes the types: and at least one type of absolute coordinate or relative coordinate information of the vertex required by the closing path and the SVG path in various commands (such as moveto, lineto, curveto and the like). The meta information may include: the width and the height occupied during SVG drawing, information required by SVG translation and scaling and the like.
In this embodiment, the types of the target data may further include: a version information type;
a respective key for each of said types of target data.
B2. Converting the value corresponding to the key into target data corresponding to the type of the key according to the type of the key in the pair of key values;
the key value pair in this embodiment takes the form of a key-value, where the key represents a key for representing the type of the target data; value represents a value for representing the content of the target data. The keys can be used for effectively distinguishing the meanings of the binary data representation corresponding to the keys, so that the integrity of the data can be ensured in the decoding process.
B3. Combining all of the target data to generate a scalable vector graphics file.
It should be noted that: the scalable vector graphics file is in an extensible markup language format.
In practical application, the decoding end adopts a decoding method to decode the binary file according to the SVG template (namely, decode according to the appointed binary data format and the encoding mode), and restores the original SVG file.
It should be noted that the decoding end may be any one of the stream end or the server.
In this embodiment, each key-value pair in the binary file identified with the target data type is decoded one by one; according to the type of the key in the key value pair, the value corresponding to the key is effectively converted into the target data corresponding to the type of the key, so that the scalable vector graphics file is restored, and the integrity of the data is ensured.
As shown in fig. 5, an encoding system 1 includes: a recognition unit 11 and an encoding unit 12;
an identifying unit 11, configured to identify all target data in a scalable vector graphics file and a type corresponding to each target data, where the type corresponding to the target data includes a meta information type and a path information type;
it should be noted that: the scalable vector graphics file is in an extensible markup language format. The target data is SVG graphics, and the SVG graphics are telescopic and can keep the graphics quality under the condition of changing the size. SVG can use some predefined shape elements to describe graphics, such as: rectangles, lines, paths, etc.
In this embodiment, the target data corresponding to the meta information type is meta information, and the target data corresponding to the path information type is path information.
The path information includes the types: and at least one type of absolute coordinate or relative coordinate information of the vertex required by the closing path and the SVG path in various commands (such as moveto, lineto, curveto and the like). The meta information may include: the width and the height occupied during SVG drawing, information required by SVG translation and scaling and the like.
In this embodiment, the types of the target data may further include: a version information type;
a respective key for each of said types of target data.
It should be noted that: the number of the key can be adaptively defined according to different application scenes, and the corresponding relation between the key and the value can be freely defined. value may be any type of data that is easier to store.
And an encoding unit 12, configured to encode each target data and the corresponding type, and generate a binary file with a target data type identified. Therefore, the scalable vector graphics file is effectively compressed, and the storage space of the data is saved, so that the data can be conveniently transmitted.
Further, referring to fig. 3, the encoding unit 12 encodes each target data and the corresponding type, and the step of generating the binary file with the target data type may specifically include:
coding keys corresponding to the types of the target data and the target data one by one to generate key value pairs; each key corresponds to a positive integer;
the method specifically comprises the following steps:
converting the target data of the negative integer into the target data of the positive integer by adopting a zigzag coding method;
and binary coding is carried out on the target data of the positive integer and the positive integer corresponding to the key by adopting a varint coding method, and the target data of the decimal is coded by adopting a single-precision mode in an IEEE754 standard to generate a key value pair.
The key value pair in this embodiment takes the form of a key-value, where the key represents a key for representing the type of the target data; value represents a value for representing the content of the target data. The key value pair has the advantages of high compression efficiency and high transmission speed. The compression efficiency can be greatly improved through binary coding, so that the target data can be rapidly transmitted. The keys can be used for effectively distinguishing the meanings of the binary data representations corresponding to the keys.
And combining all the key-value pairs to generate the binary file.
In practical application, the coding system 1 adopts a coding method to extract data to be coded in the SVG file by using the SVG template. The SVG template is used for extracting target data in the SVG file, fixed data are preset in the SVG template, and the target data needing to be extracted from the SVG file are identified. And the encoding end encodes the data to be encoded and stored by using the zig-zag and varint encoding technologies in Protocol Buffers.
It should be noted that the encoding system 1 may be any one of a push stream terminal or a server.
In this embodiment, each target data and corresponding type are encoded according to the target data and corresponding type in the scalable vector graphics file to generate a binary file with the target data type identified, so as to improve the data compression rate, save the data storage space, and facilitate data transmission.
As shown in fig. 6, a decoding system 2 includes: a decoding unit 21, a conversion unit 22, and a synthesis unit 23; wherein:
a decoding unit 21 for decoding each key-value pair in the binary file identified with the target data type one by one;
in this embodiment, the types corresponding to the target data include a meta information type and a path information type. The target data corresponding to the meta-information type is meta-information, and the target data corresponding to the path information type is path information.
The path information includes the types: and at least one type of absolute coordinate or relative coordinate information of the vertex required by the closing path and the SVG path in various commands (such as moveto, lineto, curveto and the like). The meta information may include: the width and the height occupied during SVG drawing, information required by SVG translation and scaling and the like.
In this embodiment, the types of the target data may further include: a version information type;
a respective key for each of said types of target data.
A conversion unit 22, configured to convert, according to a type of a key in the key-value pair, a value corresponding to the key into target data corresponding to the type of the key;
the key value pair in this embodiment takes the form of a key-value, where the key represents a key for representing the type of the target data; value represents a value for representing the content of the target data. The keys can be used for effectively distinguishing the meanings of the binary data representation corresponding to the keys, so that the integrity of the data can be ensured in the decoding process.
A composition unit 23 for combining all the target data to generate a scalable vector graphics file.
It should be noted that: the scalable vector graphics file is in an extensible markup language format.
In practical application, the decoding end adopts a decoding method to decode the binary file according to the SVG template (namely, decode according to the appointed binary data format and the encoding mode), and restores the original SVG file.
It should be noted that the decoding end may be any one of the stream end or the server.
In this embodiment, each key-value pair in the binary file identified with the target data type is decoded one by one; according to the type of the key in the key value pair, the value corresponding to the key is effectively converted into the target data corresponding to the type of the key, so that the scalable vector graphics file is restored, and the integrity of the data is ensured.
The present invention also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. The computer device 3 of the present embodiment includes at least, but is not limited to: a memory 31, a processor 31, which may be communicatively coupled to each other via a system bus, as shown in FIG. 7. It is noted that fig. 7 only shows the computer device 3 with components 21-22, but it is to be understood that not all shown components are required to be implemented, and that more or less components may be implemented instead.
In the present embodiment, the memory 31 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 31 may be an internal storage unit of the computer device 3, such as a hard disk or a memory of the computer device 3. In other embodiments, the memory 31 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device 3. Of course, the memory 31 may also comprise both an internal storage unit of the computer device 3 and an external storage device thereof. In this embodiment, the memory 31 is generally used for storing an operating system and various types of application software installed in the computer device 3, such as the program code of the encoding system 1 of the above-described embodiment, or the program code of the decoding system 2 of the above-described embodiment, and the like, and furthermore, the memory 31 may also be used for temporarily storing various types of data that have been output or are to be output.
Processor 31 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 31 is typically used to control the overall operation of the computer device 3. In this embodiment, the processor 31 is configured to run the program code stored in the memory 31 or process data, such as: the encoding system 1 is operated to implement the encoding method in the above embodiment; the decoding system 2 is operated to implement the decoding method in the above-described embodiment.
The present invention also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of the present embodiment is used for storing the encoding system 1, and when executed by a processor, implements the encoding method of the above-described embodiment.
The present invention also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of the present embodiment is used for storing a decoding system, and when being executed by a processor, the decoding system implements the decoding method of the above embodiment.
The first embodiment,
In practical application, for example, a server side encodes mask data by using an encoding method, a stream push end transmits video information to a server through a wireless network, a stream pull end watches live video through the wireless network or a wired network, a user at the stream pull end transmits transmitted barrage information to the server, the server processes the video information by using the encoding method of the embodiment to generate the mask data, the stream media data with the mask and corresponding barrage data are transmitted to the stream pull end through the network, and the stream pull end decodes the barrage data by using the decoding method, so that the user at a client can watch the video with the mask barrage, and user experience is improved.
Example II,
In practical application of the coding method, taking the example that a client side adopts a coding method to code a mask data file, the client side extracts mask data in an online or offline video file, adopts the coding method to code the mask data, packs the mask data into streaming media data and sends the streaming media data to a server; after receiving the streaming media data carrying the mask data, the server decodes and restores the mask data file by using the decoding method in the above embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (12)

1. An encoding method, comprising the steps of:
identifying all target data in a scalable vector graphics file and a type corresponding to each target data, wherein the type corresponding to the target data comprises a meta information type and a path information type;
and coding each target data and the corresponding type to generate a binary file marked with the target data type.
2. The encoding method according to claim 1, wherein: the scalable vector graphics file is in an extensible markup language format.
3. The encoding method according to claim 1, wherein:
each type of the target data corresponds to a corresponding key.
4. The encoding method according to claim 3, wherein: encoding each target data and the corresponding type to generate a binary file marked with the target data type, wherein the step comprises the following steps:
coding keys corresponding to the types of the target data and the target data one by one to generate key value pairs;
and combining all the key-value pairs to generate the binary file.
5. The encoding method according to claim 4, wherein: coding the keys corresponding to the types of the target data and the target data one by one to generate key value pairs, wherein the key value pairs comprise the following steps:
each key corresponds to a positive integer;
converting the target data of the negative integer into the target data of the positive integer by adopting a zigzag coding method;
and binary coding is carried out on the target data of the positive integer and the positive integer corresponding to the key by adopting a varint coding method, and the target data of the decimal is coded by adopting a single-precision mode in an IEEE754 standard to generate a key value pair.
6. A method of decoding, characterized by: the method comprises the following steps:
decoding each key value pair in the binary file marked with the target data type one by one;
converting the value corresponding to the key into target data corresponding to the type of the key according to the type of the key in the pair of key values;
combining all of the target data to generate a scalable vector graphics file.
7. The decoding method according to claim 6, wherein: the scalable vector graphics file is in an extensible markup language format.
8. The decoding method according to claim 6, wherein: the type corresponding to the target data comprises a meta information type and a path information type
A respective key for each of said types of target data.
9. A computer 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 encoding method of any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program, when being executed by a processor, realizes the steps of the encoding method of any one of claims 1 to 5.
11. A computer 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 any one of claims 6 to 8 when executing the computer program.
12. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when executed by a processor implements the steps of the decoding method of any one of claims 6 to 8.
CN201910482037.5A 2019-06-04 2019-06-04 Encoding method, decoding method, computer device, and readable storage medium Pending CN112035706A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910482037.5A CN112035706A (en) 2019-06-04 2019-06-04 Encoding method, decoding method, computer device, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910482037.5A CN112035706A (en) 2019-06-04 2019-06-04 Encoding method, decoding method, computer device, and readable storage medium

Publications (1)

Publication Number Publication Date
CN112035706A true CN112035706A (en) 2020-12-04

Family

ID=73575997

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910482037.5A Pending CN112035706A (en) 2019-06-04 2019-06-04 Encoding method, decoding method, computer device, and readable storage medium

Country Status (1)

Country Link
CN (1) CN112035706A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112801081A (en) * 2021-01-18 2021-05-14 王玉宏 Computer identification method of answer sheet
CN113610937A (en) * 2021-07-13 2021-11-05 河北省地矿局第二地质大队 Universal path drawing data feature coding and decoding method, terminal and medium
CN113949438A (en) * 2021-09-24 2022-01-18 成都飞机工业(集团)有限责任公司 Unmanned aerial vehicle communication method, device, equipment and storage medium
CN115567589A (en) * 2022-09-29 2023-01-03 上海顺舟智能科技股份有限公司 Compression transmission method, device, equipment and storage medium of JSON data
CN115834736A (en) * 2022-11-14 2023-03-21 四川启睿克科技有限公司 Declaration type message decoding method for binary message

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1984336A (en) * 2005-12-05 2007-06-20 华为技术有限公司 Binary method and device
CN101223699A (en) * 2005-07-21 2008-07-16 易斯普维 Methods and devices for compressing and decompressing structured documents
US20100318896A1 (en) * 2009-06-16 2010-12-16 Canon Kabushiki Kaisha Methods and devices for binary coding and decoding of structured documents comprising a plurality of data
CN105427353A (en) * 2015-11-12 2016-03-23 小米科技有限责任公司 Compression and drawing method and device of scalable vector graphic

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101223699A (en) * 2005-07-21 2008-07-16 易斯普维 Methods and devices for compressing and decompressing structured documents
CN1984336A (en) * 2005-12-05 2007-06-20 华为技术有限公司 Binary method and device
US20100318896A1 (en) * 2009-06-16 2010-12-16 Canon Kabushiki Kaisha Methods and devices for binary coding and decoding of structured documents comprising a plurality of data
CN105427353A (en) * 2015-11-12 2016-03-23 小米科技有限责任公司 Compression and drawing method and device of scalable vector graphic

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
401: "深入 ProtoBuf - 编码", pages 5, Retrieved from the Internet <URL:https://www.jianshu.com/p/73c9ed3a4877> *
SKILUCIS: "浅析 Protocol Buffer 编码格式", pages 1 - 6, Retrieved from the Internet <URL:https://blog.csdn.net/skILucis/article/details/43649309> *
STEFANLI: "深入了解google protocol buffer", pages 4, Retrieved from the Internet <URL:https://www.jianshu.com/p/6dd2fd0362b8> *
量子MAGIC: "Protocol Buffers 的技术优势详述", pages 2, Retrieved from the Internet <URL:https://www.jianshu.com/p/8d786dc33a86> *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112801081A (en) * 2021-01-18 2021-05-14 王玉宏 Computer identification method of answer sheet
CN113610937A (en) * 2021-07-13 2021-11-05 河北省地矿局第二地质大队 Universal path drawing data feature coding and decoding method, terminal and medium
CN113610937B (en) * 2021-07-13 2023-09-08 河北省地矿局第二地质大队 Universal path drawing data feature coding and decoding method, terminal and medium
CN113949438A (en) * 2021-09-24 2022-01-18 成都飞机工业(集团)有限责任公司 Unmanned aerial vehicle communication method, device, equipment and storage medium
CN115567589A (en) * 2022-09-29 2023-01-03 上海顺舟智能科技股份有限公司 Compression transmission method, device, equipment and storage medium of JSON data
CN115567589B (en) * 2022-09-29 2023-06-13 上海顺舟智能科技股份有限公司 Compression transmission method, device and equipment of JSON data and storage medium
CN115834736A (en) * 2022-11-14 2023-03-21 四川启睿克科技有限公司 Declaration type message decoding method for binary message

Similar Documents

Publication Publication Date Title
CN112035706A (en) Encoding method, decoding method, computer device, and readable storage medium
US11581903B2 (en) Data compression method and apparatus, computer-readable storage medium, and electronic device
CN111510718B (en) Method and system for improving compression ratio through inter-block difference of image file
CN104079950A (en) Video output processing method, device and system and video receiving processing method, device and system
CN115358911B (en) Screen watermark generation method, device, equipment and computer readable storage medium
CN112995721A (en) Video delivery method, delivery method and device of rich media content and storage medium
CN110662080B (en) Machine-oriented universal coding method
CN109189389A (en) Data processing method and device, server
EP2482230B1 (en) Apparatus and method for decoding matrix code symbol
US20100161523A1 (en) Generation and use of specific probability tables for arithmetic coding in data compression systems
CN105791832B (en) Data-encoding scheme and data decoding method and its system
CN111211787A (en) Industrial data compression method, system, storage medium and terminal
US10515092B2 (en) Structured record compression and retrieval
CN106937127B (en) Display method and system for intelligent search preparation
CN113163198A (en) Image compression method, decompression method, device, equipment and storage medium
CN111510716B (en) Method and system for improving compression rate through pixel transformation of image file
CN112651449A (en) Method and device for determining content characteristics of video, electronic equipment and storage medium
CN116846600A (en) File transmission method, apparatus, computer device, storage medium, and program product
EP4294021A1 (en) Data processing method and apparatus, computer device and storage medium
CN112069549B (en) Method and system for downloading picture when Bootstrap-table plug-in exports table
CN114511445A (en) Image processing method and device, electronic equipment and storage medium
CN105469433B (en) Picture compression method and equipment thereof
CN109344941B (en) Big data secure sharing method and device
CN112100453B (en) Character string distribution statistical method, system, equipment and computer storage medium
CN113360930A (en) Encryption method for realizing front-end and back-end character dissimilarity and processing terminal

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