CN111324587A - Compression method, analysis method and system for data of OBJ file - Google Patents

Compression method, analysis method and system for data of OBJ file Download PDF

Info

Publication number
CN111324587A
CN111324587A CN201811532504.2A CN201811532504A CN111324587A CN 111324587 A CN111324587 A CN 111324587A CN 201811532504 A CN201811532504 A CN 201811532504A CN 111324587 A CN111324587 A CN 111324587A
Authority
CN
China
Prior art keywords
data
compressed
type
binary
floating point
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
CN201811532504.2A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201811532504.2A priority Critical patent/CN111324587A/en
Publication of CN111324587A publication Critical patent/CN111324587A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a compression method, an analysis method and a system of data of an OBJ file, wherein the compression method comprises the following steps of identifying the OBJ file and acquiring the data in the OBJ file; and carrying out binary conversion on the default binary category of the data to obtain compressed data, wherein the compressed data has a converted control category, and the number of bytes of the converted binary category is less than that of the default binary category. The technical scheme of the invention can improve the data transmission speed and the analysis speed of the OBJ file in the 3D model and can effectively reduce the volume of the 3D model resource package.

Description

Compression method, analysis method and system for data of OBJ file
Technical Field
The invention relates to the technical field of data processing, in particular to a compression method, an analysis method and a system for data of an OBJ file.
Background
The OBJ file is a standard file format of a commonly used 3D Model developed by Alias | wave front corporation for workstation-based modeling of 3D models (3-Dimensions models) and animation software "Advanced Visualizer". OBJ files are typically used for file transfer and mutual import between 3D model software. The OBJ file may store information such as vertices, normals, texture coordinates, and textures of the 3D model in plain text.
In order to save transmission and analysis time of the OBJ file, a third-party tool is generally used in the prior art to compress data in the OBJ file. The third tool may be zip (zone information protocol), fbx (feedback media analyzer), etc.
However, compressing and parsing the OBJ file by using the third-party tool generally requires adding the third-party tool to the 3D model resource package in advance, which not only increases the volume of the 3D model resource package, but also increases the cost of data processing.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present invention is to provide a method, a method and a system for compressing and analyzing data of an OBJ file, so as to overcome the defects that in the prior art, a third-party tool needs to be added to a 3D model resource package in order to compress the OBJ file, the volume of the 3D model resource package is increased, and the data processing cost is increased.
The embodiment of the invention solves the technical problems through the following technical scheme:
a method of compressing data of an OBJ file, the method comprising:
identifying the OBJ file and acquiring the data in the OBJ file;
and carrying out binary conversion on the default binary category of the data to obtain compressed data, wherein the compressed data has a converted control category, and the number of bytes of the converted binary category is less than that of the default binary category.
Preferably, the data comprises integer type data, the integer type data having a first default carry category;
the performing a binary conversion on the default binary category of the data to obtain compressed data includes:
and carrying out scale conversion on the first default scale type of the integer type data to obtain first compressed data, wherein the first compressed data has a first converted scale type.
Preferably, the integer data includes face composition index data and/or smooth group data.
Preferably, the data comprises floating point type data, the floating point type data having a second default binary class;
the performing a binary conversion on the default binary category of the data to obtain compressed data includes:
and carrying out binary conversion on the second default binary type of the floating-point data to obtain second compressed data, wherein the second compressed data has a second post-conversion processing type.
Preferably, the binary converting the second default binary class of the floating-point data to obtain second compressed data includes:
converting the floating-point type data into intermediate integer type data and a floating-point scaling factor, wherein the conversion formula is as follows:
a=±m×10^e
wherein a represents floating point type data, m represents intermediate integer type data, e represents a floating point scaling factor, m is a positive integer, and e is an integer;
and carrying out binary conversion on the intermediate integer type data and the second default binary type of the floating point scaling factor to obtain compressed intermediate integer type data and a compressed floating point scaling factor, wherein the compressed intermediate integer type data and the compressed floating point scaling factor form the second compressed data.
Preferably, the compressed floating point scaling factor is stored in the compressed OBJ file in a single row, wherein the row storing the compressed floating point scaling factor precedes the row storing the compressed intermediate integer data.
Preferably, the floating point type data includes one or more of vertex coordinate data, normal data, and map coordinate data.
Preferably, the compression method further comprises:
and deleting the word header of the compressed data, and adding only one word header for a plurality of compressed data of the same type.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
In order to solve the above technical problem, an embodiment of the present invention further provides an analysis method for data of an OBJ file, where the analysis method includes:
identifying a compressed OBJ file, and acquiring compressed data in the OBJ file;
and carrying out binary conversion on the converted binary category of the compressed data to obtain analysis data, wherein the analysis data has a default binary category, and the number of bytes of the default binary category is greater than that of the converted binary category.
Preferably, the compressed data comprises compressed integer type data, the compressed integer type data having a first converted binary class;
the performing the binary conversion on the converted binary type of the compressed data to obtain the analysis data includes:
and carrying out scale conversion on the first converted scale type of the compressed integer type data to obtain first analytic data, wherein the first analytic data has a first default scale type.
Preferably, the compressed integer data comprises face composition index data and/or smooth group data.
Preferably, the compressed data comprises compressed floating point type data, the compressed floating point type data having a second post-conversion classification;
the performing the binary conversion on the converted binary type of the compressed data to obtain the analysis data includes:
and carrying out binary conversion on the second converted binary type of the compressed floating point type data to obtain second analytic data, wherein the second analytic data has a second default binary type.
Preferably, the compressed floating point type data comprises compressed intermediate integer type data and a compressed floating point scaling factor;
performing a binary conversion on the second converted binary class of the compressed floating-point type data to obtain second analytic data includes:
carrying out binary conversion on the second converted binary type of the compressed intermediate integer type data to obtain analyzed intermediate integer type data;
performing a binary conversion on the second converted binary class of the compressed floating point scaling factor to obtain an resolved floating point scaling factor:
combining the resolved intermediate integer type data and the resolved floating point scaling factor into resolved floating point type data, wherein the combined formula is as follows:
a1=±m1×10^e1
where a1 denotes resolved floating point type data, m1 denotes resolved intermediate integer type data, e1 denotes resolved floating point scaling factor, m1 is positive integer, and e1 is integer.
Preferably, the compressed floating point type data includes one or more of vertex coordinate data, normal data, and map coordinate data.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
In order to solve the above technical problem, an embodiment of the present invention further provides a compression system for data of an OBJ file, where the compression system includes:
the first data acquisition module is used for identifying the OBJ file and acquiring the data in the OBJ file;
the first system conversion module is used for carrying out system conversion on the default system type of the data to obtain compressed data, the compressed data has a converted control type, and the byte number of the converted system type is smaller than that of the default system type.
Preferably, the data comprises integer type data, the integer type data having a first default carry category;
the first system conversion module comprises a first compression submodule, and the first compression submodule is used for performing system conversion on the first default system type of the integer type data to obtain first compressed data, wherein the first compressed data has a first converted system type.
Preferably, the integer data includes face composition index data and/or smooth group data.
Preferably, the data comprises floating point type data, the floating point type data having a second default binary class;
the first system conversion module comprises a second compression submodule, the second compression submodule is used for carrying out system conversion on the second default system type of the floating point type data to obtain second compressed data, and the second compressed data has a post-second-conversion control type.
Preferably, the second compression sub-module comprises:
a decomposition unit, configured to convert the floating-point type data into intermediate integer type data and a floating-point scaling factor, where the conversion formula is:
a=±m×10^e
wherein a represents floating point type data, m represents intermediate integer type data, e represents a floating point scaling factor, m is a positive integer, and e is an integer;
and the conversion unit is used for carrying out binary conversion on the intermediate integer type data and the second default binary type of the floating point scaling factor to obtain compressed intermediate integer type data and a compressed floating point scaling factor, wherein the compressed intermediate integer type data and the compressed floating point scaling factor form second compressed data.
Preferably, the compression system further comprises a storage module, and the storage module is configured to store the compressed floating point scaling factor in a compressed OBJ file in a single row, where the row storing the compressed floating point scaling factor precedes the row storing the compressed intermediate integer data.
Preferably, the floating point type data includes one or more of vertex coordinate data, normal data, and map coordinate data.
Preferably, the compression system further comprises:
and the storage structure adjusting module is used for deleting the word heads of the compressed data and only adding one word head for a plurality of compressed data of the same type.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
In order to solve the above technical problem, an embodiment of the present invention further provides an analysis system for data of an OBJ file, where the analysis system includes:
the second data acquisition module is used for identifying the compressed OBJ file and acquiring compressed data in the OBJ file;
and the second binary system conversion module is used for carrying out binary system conversion on the converted binary system type of the compressed data to obtain analysis data, wherein the analysis data has a default binary system type, and the byte number of the default binary system type is greater than the byte number of the converted binary system type.
Preferably, the compressed data comprises compressed integer type data, the compressed integer type data having a first converted binary class;
the second system conversion module comprises a first analysis submodule, and the first analysis submodule is used for carrying out system conversion on the first converted system type of the compressed integer type data to obtain first analysis data, wherein the first analysis data has a first default system type.
Preferably, the compressed integer data comprises face composition index data and/or smooth group data.
Preferably, the compressed data comprises compressed floating point type data, the compressed floating point type data having a second post-conversion classification;
the second binary conversion module comprises a second analysis submodule, and the second analysis submodule is used for carrying out binary conversion on the second converted binary category of the compressed floating point type data to obtain second analysis data, wherein the second analysis data has a second default binary category.
Preferably, the compressed floating point type data comprises compressed intermediate integer type data and a compressed floating point scaling factor;
the second parsing sub-module includes:
a decompression unit, configured to perform binary conversion on the second converted binary class of the compressed intermediate integer data to obtain parsed intermediate integer data; performing a binary conversion on the second converted binary class of the compressed floating point scaling factor to obtain an resolved floating point scaling factor:
a combining unit, configured to combine the parsed intermediate integer type data and the parsed floating point scaling factor into parsed floating point type data, where the combining formula is:
a1=±m1×10^e1
where a1 denotes resolved floating point type data, m1 denotes resolved intermediate integer type data, e1 denotes resolved floating point scaling factor, m1 is positive integer, and e1 is integer.
Preferably, the compressed floating point type data includes one or more of vertex coordinate data, normal data, and map coordinate data.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
In order to solve the above technical problem, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the step of compressing the data of the OBJ file when executing the computer program, or implements the step of parsing the data of the OBJ file when executing the computer program.
In order to solve the above technical problem, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method for compressing data of an OBJ file, or the computer program, when executed by the processor, implements the steps of the method for parsing data of an OBJ file.
The positive progress effects of the invention are as follows:
according to the technical scheme of the embodiment of the invention, the compressed data can be obtained by converting the default system type of the data of the OBJ file into the system type with less byte number without intervention of a third-party compression tool. Therefore, data accuracy is not affected, the volume of the OBJ file can be effectively reduced, the volume of the compressed OBJ file is 50% -60% of the volume of the original OBJ file, and the data transmission speed and the model analysis speed of the OBJ file in the 3D model are improved. In addition, a third-party tool does not need to be pre-installed in the 3D model software, the volume of the 3D model resource package is effectively reduced, and the application range of the 3D model software is expanded.
Furthermore, according to the technical scheme of the embodiment of the invention, a plurality of compressed data with the same type in the OBJ file are identified by one word, so that the storage structure of the data of the OBJ file can be optimized, and the volume of the OBJ file is further reduced.
Drawings
Fig. 1 is a flowchart of a data compression method for an OBJ file according to embodiment 1 of the present invention;
fig. 2 is a flowchart of a data compression method for an OBJ file according to embodiment 2 of the present invention;
fig. 3 is a schematic diagram of a specific application scenario of embodiment 2 of the present invention;
fig. 4 is a block diagram showing a configuration of a data compression system of an OBJ file according to embodiment 3 of the present invention;
fig. 5 is a block diagram showing a configuration of a data compression system of an OBJ file according to embodiment 4 of the present invention;
fig. 6 is a flowchart of a method for parsing data of an OBJ file according to embodiment 5 of the present invention;
fig. 7 is a block diagram showing a system for parsing data of an OBJ file according to embodiment 6 of the present invention;
fig. 8 is a schematic structural diagram of an electronic device implementing a method for compressing and/or parsing data of an OBJ file according to embodiment 7 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
A compression method of data of an OBJ file, as shown in fig. 1, may include the steps of:
step S11: identifying the OBJ file and acquiring the data in the OBJ file;
step S12: and carrying out binary conversion on the default binary category of the data to obtain compressed data, wherein the compressed data has a converted control category, and the number of bytes of the converted binary category is less than that of the default binary category.
In this embodiment, the OBJ file may be composed of a plurality of lines of text, which is a readable text format encoded in universal code (Unicode).
The default binary class may be preset by a program developer. Preferably, the default binary category is decimal.
As a non-limiting implementation of example 1, the data may include integer type data having a first default binary class;
the performing a binary conversion on the default binary class of the data to obtain compressed data may include: and carrying out scale conversion on the first default scale type of the integer type data to obtain first compressed data, wherein the first compressed data has a first converted scale type.
In particular, the integer type data may include face composition index data and/or smooth group data.
As another non-limiting implementation of embodiment 1, the data may also include floating point type data, the floating point type data having a second default binary class;
the performing a binary conversion on the default binary class of the data to obtain compressed data may include:
and carrying out binary conversion on the second default binary type of the floating-point data to obtain second compressed data, wherein the second compressed data has a second post-conversion processing type.
In particular, the floating point type data may include one or more of vertex coordinate data, normal data, map coordinate data.
Further, the first default binary category and the second default binary category may be the same or different; the first converted binary class and the second converted binary class may be the same or different. For example: the first default binary class of integer type data may be decimal and the second default binary class of floating point type data may be decimal; after the binary conversion, the first converted binary category may be thirty-two binary, and the second converted binary category may be sixty-four binary.
It should be noted that, a person skilled in the art may select the first converted binary class and the second converted binary class according to specific requirements on the OBJ file volume in different application scenarios, as long as the number of bytes corresponding to the converted control class is smaller than the number of bytes corresponding to the default binary class, which is not limited in this embodiment.
According to the method and the device, under the condition that a third-party compression tool is not involved, the default system type of the data of the OBJ file is converted into the system type with the small number of bytes, so that the compressed data can be obtained, the size of the OBJ file can be effectively reduced, and the data transmission and analysis speed of the OBJ file in the 3D model is improved. In addition, a third-party compression tool does not need to be pre-installed in the 3D model software, so that the volume of the 3D model resource package is effectively reduced, and the 3D model software can be suitable for occasions with strict requirements on the volume of the resource package.
Example 2
The present embodiment is a further improvement on embodiment 1. Referring to fig. 2, after step S12, the following steps may be further included:
step S13: and deleting the word header of the compressed data, and adding only one word header for a plurality of compressed data of the same type.
In this embodiment, the type of data in the OBJ file may be distinguished according to the meaning represented by the data in the OBJ file, for example, data representing vertices of a model may be regarded as a vertex coordinate data type, data representing a normal may be regarded as a normal data type, and the like.
Further, the plurality of compressed data may be a plurality of data vectors. The headers may be flags used to distinguish between different types of data.
In particular, the header may be a letter or symbol written before all bytes of the data vector, such as: v, s, t, @, vt, etc. The same type of data may be identified by the same letter or symbol, whereas different types of data may be identified by different letters or symbols.
It is understood that those skilled in the art can select suitable letters or symbols as the headers adaptively according to the programming habit and the consideration of the specific application, as long as the headers of different categories of data are not ambiguous and can be clearly distinguished from each other, which is not limited in this embodiment.
Please refer to fig. 3. Fig. 3 is a schematic diagram of a specific application scenario of embodiment 2.
In the specific application scenario, the OBJ file includes vertex coordinate data, normal data, map coordinate data, face composition index data, and smooth group data. The vertex coordinate data is a floating point type data vector, and a letter v is used as an identifier; the normal data is a floating-point data vector and takes a letter vn as an identifier; the mapping coordinate data is a floating-point data vector and takes a letter vt as an identifier; the face formation index data is an integer data vector and takes a letter f as an identifier; the smooth group data is an integer type data vector and takes a letter s as a mark.
In the application scenario, the data in the OBJ file to be compressed includes integer type data and floating point type data, and the default binary categories of the integer type data and the floating point type data are both decimal.
In the specific implementation process, when the integer data is converted, only the decimal integer data is directly converted into a sexagesimal character string; when converting floating point data, the decimal floating point data is converted into intermediate integer data with preserved sign and floating point scaling factor, and the intermediate integer data and the floating point scaling factor are converted into sixty-four system character string.
More specifically, the correspondence between the floating-point type data and the intermediate integer type data and the floating-point scaling factor can be expressed as:
a=±m×10^e
wherein a represents floating point type data, m represents intermediate integer type data, e represents a floating point scaling factor, m is a positive integer, and e is an integer.
Next, the intermediate integer data m and the floating point scaling factor e are converted into a sixty-four system character string.
In this particular application scenario, the vertex coordinate data, normal data, and map coordinate data may be uniform precision decimal floating point type data. Therefore, the floating point scaling factor e is the same for the vertex coordinate data, the normal data, and the map coordinate data, and the intermediate integer data m is different from each other.
For example: the decimal data vector (-1.096600.000001.05044) is converted into sixty-four system to obtain (-qNs 0pFk), wherein the intermediate integer type data corresponding to-1.09660 can be represented as-109660, and the sixty-four system corresponding to-109660 can be represented as-qNs; 1.05044 may be represented by 105044, and the sixty-four may be represented by pFk for 105044. The floating point scaling factors e for data-1.09660 and 1.05044 are the same and are both-5, and after-5 is converted to sixty-four, it still gets-5.
By using the compression method, other decimal data vectors (including integer data and floating point data) in the OBJ file can be sequentially and correspondingly converted into sixty-four systems and stored, which is not described herein again.
Next, the compressed floating point scaling factor may be stored in the compressed OBJ file in a single row, where the row storing the compressed floating point scaling factor is before the row storing the compressed intermediate integer data, so as to be called when the compressed OBJ file is parsed.
As a variation, the floating-point scaling factor e may also be separately stored in another independent file, in which case, the original OBJ file may be subjected to data scale conversion to obtain two files, one is the converted OBJ file, and the other is the file that separately stores the floating-point scaling factor e. Correspondingly, in the parsing process, the converted OBJ file and the file storing the floating point scaling factor e need to be imported into parsing software at the same time to obtain the data of the OBJ file before compression.
Further, in order to optimize a data storage structure in the OBJ file, headers of the compressed data may be deleted, and only one header may be added to a plurality of the compressed data of the same type.
Taking the vertex coordinate data as an example, in fig. 3, the vertex coordinate data includes data vectors in rows 5 to 10, each data vector includes the same header v, and the data vectors in rows 5 to 10 include 6 headers v in total. When the data storage structure is optimized, a uniform header @ v representing the coordinate data of the whole vertex is written in the 4 th line, and 6 identification headers v of the data vectors from the 5 th line to the 10 th line are deleted, so that the byte number of the data in the OBJ file can be effectively reduced.
The normal data, the mapping coordinate data, the surface composition index data and the smooth group data can be sequentially optimized in a storage structure by using the same optimization mode, so that the byte number of the OBJ file is further reduced.
Example 3
A compression system of data of an OBJ file, as shown in fig. 4, the compression system 1 may include:
the first data acquisition module 2 is configured to identify the OBJ file and acquire the data in the OBJ file;
the first system conversion module 3 is configured to perform system conversion on the default system type of the data to obtain compressed data, where the compressed data has a converted control type, and the number of bytes of the converted system type is smaller than the number of bytes of the default system type.
Further, the data may include integer type data, the integer type data having a first default carry category; the first binary conversion module 3 may include a first compression submodule 31, where the first compression submodule 31 is configured to perform binary conversion on the first default binary class of the integer data to obtain first compressed data, and the first compressed data has a first converted binary class.
In particular, the integer type data may include face composition index data and/or smooth group data.
Further, the data may also include floating point type data, the floating point type data having a second default binary class; the first binary conversion module 3 may include a second compression submodule 32, where the second compression submodule 32 is configured to perform binary conversion on the second default binary class of the floating-point data to obtain second compressed data, and the second compressed data has a second post-conversion modulation class.
Further, the second compression submodule 32 may include:
the decomposition unit 321 is configured to convert the floating-point data into intermediate integer data and a floating-point scaling factor, where the conversion formula is:
a=±m×10^e
wherein a represents floating point type data, m represents intermediate integer type data, e represents a floating point scaling factor, m is a positive integer, and e is an integer;
the conversion unit 322 is configured to perform binary conversion on the intermediate integer type data and the second default binary type of the floating point scaling factor to obtain compressed intermediate integer type data and a compressed floating point scaling factor, where the compressed intermediate integer type data and the compressed floating point scaling factor form second compressed data.
Further, the compression system 1 may further include a storage module 4, where the storage module 4 is configured to store the compressed floating point scaling factor in a compressed OBJ file in a single row, and the row storing the compressed floating point scaling factor is before the row storing the compressed intermediate integer data.
In particular, the floating point type data may include one or more of vertex coordinate data, normal data, map coordinate data.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
For more contents of the working principle and the working mode of the compression system in embodiment 3, reference may be made to the description about the compression method in embodiment 1, and details are not repeated here.
Example 4
Embodiment 4 discloses another compression system of data of an OBJ file, and as shown in fig. 5, the compression system 6 is further improved on the basis of embodiment 3. The structures and operating principles of the first data obtaining module 2, the first system conversion module 3, and the storage module 4 are the same as those of the corresponding modules in embodiment 3.
The compression system 6 may further include a storage structure adjusting module 5, configured to delete headers of the compressed data, and add only one header to a plurality of compressed data of the same type.
For more contents of the working principle and the working mode of the compression system in embodiment 4, reference may be made to the description about the compression method in embodiment 2, and details are not repeated here.
Example 5
A parsing method of data of an OBJ file, as shown in fig. 6, may include the following steps:
step S21: identifying a compressed OBJ file, and acquiring compressed data in the OBJ file;
step S22: and carrying out binary conversion on the converted binary category of the compressed data to obtain analysis data, wherein the analysis data has a default binary category, and the number of bytes of the default binary category is greater than that of the converted binary category.
Further, the compressed data may include compressed integer type data having a first converted binary class;
the performing a binary conversion on the converted binary class of the compressed data to obtain parsed data may include: and carrying out scale conversion on the first converted scale type of the compressed integer type data to obtain first analytic data, wherein the first analytic data has a first default scale type.
In particular, the compressed integer data may include face composition index data and/or smooth group data.
Further, the compressed data may further include compressed floating point type data, the compressed floating point type data having a second post-conversion processing category;
the performing a binary conversion on the converted binary class of the compressed data to obtain parsed data may include: and carrying out binary conversion on the second converted binary type of the compressed floating point type data to obtain second analytic data, wherein the second analytic data has a second default binary type.
In particular, the compressed floating-point type data may include compressed intermediate integer type data and a compressed floating-point scaling factor;
performing a binary conversion on the second converted binary class of the compressed floating-point type data to obtain second resolution data may include: carrying out binary conversion on the second converted binary type of the compressed intermediate integer type data to obtain analyzed intermediate integer type data; performing a binary conversion on the second converted binary class of the compressed floating point scaling factor to obtain an resolved floating point scaling factor:
combining the resolved intermediate integer type data and the resolved floating point scaling factor into resolved floating point type data, wherein the combined formula is as follows:
a1=±m1×10^e1
where a1 denotes resolved floating point type data, m1 denotes resolved intermediate integer type data, e1 denotes resolved floating point scaling factor, m1 is positive integer, and e1 is integer.
In particular, the compressed floating point type data may include one or more of vertex coordinate data, normal data, map coordinate data.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
In the process of analyzing the data, whether the compressed data should be restored to floating point type data or integer type data is judged by identifying the word heads of different types of compressed data.
Please refer to fig. 3 and fig. 6. In one non-limiting application scenario, for example: the compressed data in the embodiment shown in fig. 3 is parsed. When the data in a certain line is recognized as the word head @ v, the data in the same type identified by the word head @ v can be determined after the line data is recognized as the word head @ v, until another word head @ vn is recognized, at this time, the data in the next type is counted, until the next word head @ vt is recognized, and the like, and the data in a plurality of types can be recognized and counted. The data type with @ v, @ vn and @ vt as prefixes may be recognized as floating-point data, and the data type with @ s and @ f as prefixes may be recognized as integer data.
In specific implementation, for compressed data with @ v, @ vn and @ vt as headers, the floating point scaling factor should be applied to the parsing process in the process of parsing floating point type data. For example, for the compressed sixty-four system data pFk, which is converted to decimal data 105044, the floating point scaling factor is applied to the parsing process, i.e., 105044 and 10-5The multiplication results in resolved floating point data 1.05044. For compressed data with @ s and @ f as headers, the compressed data can be recognized as integer data during the parsing process, and therefore, the floating point scaling factor is not applied to the parsing process.
It is to be understood that a person skilled in the art may use the parsing method in this embodiment to parse the compressed data obtained by the compression method in embodiment 1 or embodiment 2. It can also be said that the process of data parsing can restore the default binary class of the original data. In general, for data after parsing, a plurality of data of the same type are still identified by only one header.
Example 6
A parsing system of data of an OBJ file, as shown in fig. 7, the parsing system 7 may include:
the second data acquisition module 8 is configured to identify a compressed OBJ file and acquire compressed data in the OBJ file;
the second binary conversion module 9 performs binary conversion on the converted binary type of the compressed data to obtain analysis data, where the analysis data has a default binary type, and the number of bytes of the default binary type is greater than the number of bytes of the converted binary type.
Further, the compressed data may include compressed integer type data having a first converted binary class;
the second binary conversion module 9 may include a first parsing submodule 91, where the first parsing submodule 91 is configured to perform binary conversion on the first converted binary class of the compressed integer data to obtain first parsed data, and the first parsed data has a first default binary class.
In particular, the compressed integer data may include face composition index data and/or smooth group data.
Further, the compressed data may further include compressed floating point type data, the compressed floating point type data having a second post-conversion processing category;
the second binary conversion module 9 may include a second parsing submodule 92, where the second parsing submodule 92 is configured to perform binary conversion on the second converted binary class of the compressed floating-point data to obtain second parsed data, and the second parsed data has a second default binary class.
Further, the compressed floating point type data may include compressed intermediate integer type data and a compressed floating point scaling factor;
the second parsing submodule 92 may include:
a decompression unit 921, configured to perform binary conversion on the second converted binary class of the compressed intermediate integer data to obtain parsed intermediate integer data; performing a binary conversion on the second converted binary class of the compressed floating point scaling factor to obtain an resolved floating point scaling factor:
a combining unit 922, configured to combine the parsed intermediate integer type data and the parsed floating point scaling factor into parsed floating point type data, where the combining formula is:
a1=±m1×10^e1
where a1 denotes resolved floating point type data, m1 denotes resolved intermediate integer type data, e1 denotes resolved floating point scaling factor, m1 is positive integer, and e1 is integer.
In particular, the compressed floating point type data may include one or more of vertex coordinate data, normal data, map coordinate data.
Preferably, the default decimal category is decimal and the post-conversion decimal category is sixty-four.
For more details about the working principle and working manner of the analysis system in embodiment 6, reference may be made to the description about the analysis method in embodiment 5, which is not described herein again.
Example 7
Fig. 8 is a schematic structural diagram of an electronic device according to embodiment 7 of the present invention. The electronic device may include a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements a compression method of data of an OBJ file in any one of embodiments 1 to 2 or a parsing method of data of an OBJ file in embodiment 5 when executing the computer program.
It should be understood that the electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments of the present invention.
As shown in FIG. 8, the electronic device 10 may take the form of a general purpose computing device such as: which may be a server device. The components of the electronic device 10 may include, but are not limited to: the at least one processor 11, the at least one memory 12, and a bus 13 connecting the various system components (including the memory 12 and the processor 11).
The bus 13 may include a data bus, an address bus, and a control bus.
The memory 12 may include volatile memory, such as Random Access Memory (RAM)121 and/or cache memory 122, and may further include Read Only Memory (ROM) 123.
The memory 12 may also include a program tool 125 (or utility tool) having a set (at least one) of program modules 124, such program modules 124 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The processor 11 executes a computer program stored in the memory 12 to execute various functional applications and data processing, such as a method for compressing data of an OBJ file provided in embodiment 1 or embodiment 2 of the present invention or a method for parsing data of an OBJ file in embodiment 5.
The electronic device 10 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, etc.). Such communication may be via an input/output (I/O) interface 15. Moreover, the model-generated electronic device 10 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network) via the network adapter 16.
As shown in FIG. 8, the network adapter 16 may communicate with other modules of the model-generated electronic device 10 via the bus 13. It will be appreciated by those skilled in the art that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the model-generated electronic device 10, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the electronic device are mentioned, such division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Example 8
The present embodiment provides a computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the steps of the method for compressing data of an OBJ file in any one of embodiments 1 to 2 or the method for parsing data of an OBJ file in embodiment 5.
More specific ways in which the computer-readable storage medium may be employed may include, but are not limited to: a portable disk, a hard disk, random access memory, read only memory, erasable programmable read only memory, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
In a possible implementation, the present invention can also be implemented in the form of a program product including program code for causing a terminal device to perform the steps of implementing the method for compressing data of an OBJ file in any one of embodiments 1 to 2 or the method for parsing data of an OBJ file in embodiment 5, when the program product is run on the terminal device.
Where program code for carrying out the invention is written in any combination of one or more programming languages, the program code may execute entirely on the user device, partly on the user device, as a stand-alone software package, partly on the user device and partly on a remote device or entirely on the remote device.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.

Claims (34)

1. A method of compressing data of an OBJ file, the method comprising:
identifying the OBJ file and acquiring the data in the OBJ file;
and carrying out binary conversion on the default binary category of the data to obtain compressed data, wherein the compressed data has a converted control category, and the number of bytes of the converted binary category is less than that of the default binary category.
2. The method of compressing data of an OBJ file according to claim 1, wherein the data comprises integer-type data having a first default binary class;
the performing a binary conversion on the default binary category of the data to obtain compressed data includes:
and carrying out scale conversion on the first default scale type of the integer type data to obtain first compressed data, wherein the first compressed data has a first converted scale type.
3. The method of compressing data of an OBJ file according to claim 2, wherein the integer type data includes face composition index data and/or smooth group data.
4. The method of compressing data of an OBJ file according to claim 1 or 2, wherein the data comprises floating point type data, the floating point type data having a second default binary class;
the performing a binary conversion on the default binary category of the data to obtain compressed data includes:
and carrying out binary conversion on the second default binary type of the floating-point data to obtain second compressed data, wherein the second compressed data has a second post-conversion processing type.
5. The method of compressing data of an OBJ file according to claim 4, wherein binary converting the second default binary class of the floating-point type data to obtain second compressed data comprises:
converting the floating-point type data into intermediate integer type data and a floating-point scaling factor, wherein the conversion formula is as follows:
a=±m×10^e
wherein a represents floating point type data, m represents intermediate integer type data, e represents a floating point scaling factor, m is a positive integer, and e is an integer;
and carrying out binary conversion on the intermediate integer type data and the second default binary type of the floating point scaling factor to obtain compressed intermediate integer type data and a compressed floating point scaling factor, wherein the compressed intermediate integer type data and the compressed floating point scaling factor form the second compressed data.
6. The method of compressing data of an OBJ file according to claim 5, further comprising:
and storing the compressed floating point scaling factor in an OBJ file in a single row, wherein the row storing the compressed floating point scaling factor is before the row storing the compressed intermediate integer data.
7. The method of compressing data of an OBJ file according to claim 4, wherein the floating point type data includes one or more of vertex coordinate data, normal data, and map coordinate data.
8. The method of compressing data of an OBJ file according to claim 1, further comprising:
and deleting the word header of the compressed data, and adding only one word header for a plurality of compressed data of the same type.
9. The method of compressing data of an OBJ file as claimed in claim 1, wherein the default bin class is decimal and the post-conversion bin class is sixty-four.
10. A method for parsing data of an OBJ file, the method comprising:
identifying a compressed OBJ file, and acquiring compressed data in the OBJ file;
and carrying out binary conversion on the converted binary category of the compressed data to obtain analysis data, wherein the analysis data has a default binary category, and the number of bytes of the default binary category is greater than that of the converted binary category.
11. The method for parsing data of an OBJ file according to claim 10, wherein the compressed data comprises compressed integer-type data having a first converted binary class;
the performing the binary conversion on the converted binary type of the compressed data to obtain the analysis data includes:
and carrying out scale conversion on the first converted scale type of the compressed integer type data to obtain first analytic data, wherein the first analytic data has a first default scale type.
12. The method for parsing data of an OBJ file according to claim 11, wherein the compressed integer data comprises face composition index data and/or smooth group data.
13. The method for parsing data of an OBJ file according to claim 10 or 11, wherein the compressed data comprises compressed floating point type data having a second post-conversion classification;
the performing the binary conversion on the converted binary type of the compressed data to obtain the analysis data includes:
and carrying out binary conversion on the second converted binary type of the compressed floating point type data to obtain second analytic data, wherein the second analytic data has a second default binary type.
14. The method for parsing data of an OBJ file according to claim 13,
the compressed floating point type data comprises compressed intermediate integer type data and a compressed floating point scaling factor;
performing a binary conversion on the second converted binary class of the compressed floating-point type data to obtain second analytic data includes:
carrying out binary conversion on the second converted binary type of the compressed intermediate integer type data to obtain analyzed intermediate integer type data;
performing a binary conversion on the second converted binary class of the compressed floating point scaling factor to obtain an resolved floating point scaling factor:
combining the resolved intermediate integer type data and the resolved floating point scaling factor into resolved floating point type data, wherein the combined formula is as follows:
a1=±m1×10^e1
where a1 denotes resolved floating point type data, m1 denotes resolved intermediate integer type data, e1 denotes resolved floating point scaling factor, m1 is positive integer, and e1 is integer.
15. The method for parsing data of an OBJ file according to claim 13, wherein the compressed floating point type data includes one or more of vertex coordinate data, normal data, and map coordinate data.
16. The method for parsing data of an OBJ file according to claim 10, wherein the default scale category is decimal and the post-conversion scale category is sixty-four.
17. A compression system of data of an OBJ file, the compression system comprising:
the first data acquisition module is used for identifying the OBJ file and acquiring the data in the OBJ file;
the first system conversion module is used for carrying out system conversion on the default system type of the data to obtain compressed data, the compressed data has a converted control type, and the byte number of the converted system type is smaller than that of the default system type.
18. The system of compressing data of an OBJ file according to claim 17, wherein the data comprises integer-type data having a first default binary class;
the first system conversion module comprises a first compression submodule, and the first compression submodule is used for performing system conversion on the first default system type of the integer type data to obtain first compressed data, wherein the first compressed data has a first converted system type.
19. The system of compressing data of an OBJ file according to claim 18, wherein the integer data comprises face composition index data and/or smooth group data.
20. The system of compression of data of an OBJ file according to claim 17 or 18, wherein the data comprises floating point type data, the floating point type data having a second default binary class;
the first system conversion module comprises a second compression submodule, the second compression submodule is used for carrying out system conversion on the second default system type of the floating point type data to obtain second compressed data, and the second compressed data has a post-second-conversion control type.
21. The system of compressing data of an OBJ file according to claim 20, wherein the second compression submodule comprises:
a decomposition unit, configured to convert the floating-point type data into intermediate integer type data and a floating-point scaling factor, where the conversion formula is:
a=±m×10^e
wherein a represents floating point type data, m represents intermediate integer type data, e represents a floating point scaling factor, m is a positive integer, and e is an integer;
and the conversion unit is used for carrying out binary conversion on the intermediate integer type data and the second default binary type of the floating point scaling factor to obtain compressed intermediate integer type data and a compressed floating point scaling factor, wherein the compressed intermediate integer type data and the compressed floating point scaling factor form second compressed data.
22. The system of compressing data of an OBJ file according to claim 21, further comprising a storage module configured to store the compressed floating point scaling factor in a compressed OBJ file in separate rows, wherein the row storing the compressed floating point scaling factor precedes the row storing the compressed intermediate integer data.
23. The system of compressing data of an OBJ file according to claim 20, wherein the floating point type data includes one or more of vertex coordinate data, normal data, map coordinate data.
24. The system of compressing data of an OBJ file according to claim 17, further comprising:
and the storage structure adjusting module is used for deleting the word heads of the compressed data and only adding one word head for a plurality of compressed data of the same type.
25. The system of compressing data of an OBJ file as claimed in claim 17, wherein the default bin class is decimal and the post-conversion bin class is sixty-four.
26. A parsing system for data of an OBJ file, said parsing system comprising:
the second data acquisition module is used for identifying the compressed OBJ file and acquiring compressed data in the OBJ file;
and the second binary system conversion module is used for carrying out binary system conversion on the converted binary system type of the compressed data to obtain analysis data, wherein the analysis data has a default binary system type, and the byte number of the default binary system type is greater than the byte number of the converted binary system type.
27. The parsing system of data for an OBJ file according to claim 26, wherein the compressed data comprises compressed integer-type data having a first converted binary class;
the second system conversion module comprises a first analysis submodule, and the first analysis submodule is used for carrying out system conversion on the first converted system type of the compressed integer type data to obtain first analysis data, wherein the first analysis data has a first default system type.
28. The system for parsing data of an OBJ file according to claim 27, wherein the compressed integer data comprises face composition index data and/or smooth group data.
29. The parsing system of data of an OBJ file according to claim 26 or 27, wherein the compressed data comprises compressed floating point type data having a second post-conversion classification;
the second binary conversion module comprises a second analysis submodule, and the second analysis submodule is used for carrying out binary conversion on the second converted binary category of the compressed floating point type data to obtain second analysis data, wherein the second analysis data has a second default binary category.
30. The system for parsing data of an OBJ file according to claim 29,
the compressed floating point type data comprises compressed intermediate integer type data and a compressed floating point scaling factor;
the second parsing sub-module includes:
a decompression unit, configured to perform binary conversion on the second converted binary class of the compressed intermediate integer data to obtain parsed intermediate integer data; performing a binary conversion on the second converted binary class of the compressed floating point scaling factor to obtain an resolved floating point scaling factor:
a combining unit, configured to combine the parsed intermediate integer type data and the parsed floating point scaling factor into parsed floating point type data, where the combining formula is:
a1=±m1×10^e1
where a1 denotes resolved floating point type data, m1 denotes resolved intermediate integer type data, e1 denotes resolved floating point scaling factor, m1 is positive integer, and e1 is integer.
31. The system for parsing data for an OBJ file according to claim 29, wherein the compressed floating point type data comprises one or more of vertex coordinate data, normal data, map coordinate data.
32. The system for parsing data for an OBJ file according to claim 26, wherein the default bin class is decimal and the post-conversion bin class is sixty-four.
33. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method for compressing data of an OBJ file according to any one of claims 1 to 9, or the processor executes the computer program to implement the steps of the method for parsing data of an OBJ file according to any one of claims 10 to 16.
34. A computer readable storage medium, having stored thereon a computer program, characterized in that the computer program, when being executed by a processor, carries out the steps of the method for compressing data of an OBJ file according to any one of claims 1 to 9, or the computer program, when being executed by a processor, carries out the steps of the method for parsing data of an OBJ file according to any one of claims 10 to 16.
CN201811532504.2A 2018-12-14 2018-12-14 Compression method, analysis method and system for data of OBJ file Pending CN111324587A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811532504.2A CN111324587A (en) 2018-12-14 2018-12-14 Compression method, analysis method and system for data of OBJ file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811532504.2A CN111324587A (en) 2018-12-14 2018-12-14 Compression method, analysis method and system for data of OBJ file

Publications (1)

Publication Number Publication Date
CN111324587A true CN111324587A (en) 2020-06-23

Family

ID=71170479

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811532504.2A Pending CN111324587A (en) 2018-12-14 2018-12-14 Compression method, analysis method and system for data of OBJ file

Country Status (1)

Country Link
CN (1) CN111324587A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115549862A (en) * 2022-12-05 2022-12-30 大方智造(天津)科技有限公司 MES system concurrency performance test data receiving method based on dynamic analysis

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080270497A1 (en) * 2007-04-26 2008-10-30 International Business Machines Corporation Convert significand of decimal floating point data to/from packed decimal format
CN103325138A (en) * 2013-07-11 2013-09-25 乐淘(中国)有限公司 Method for 3D (Three-Dimensional) scene decoration and rendering through webpage
CN103401561A (en) * 2013-07-25 2013-11-20 百度在线网络技术(北京)有限公司 Methods and devices for compressing and decompressing map data
CN105931279A (en) * 2016-04-18 2016-09-07 邱友龙 Three-dimensional model data compression method and system
CN107592116A (en) * 2017-09-21 2018-01-16 咪咕文化科技有限公司 A kind of data compression method, device and storage medium
CN107818594A (en) * 2017-09-06 2018-03-20 北京矩阵空间科技有限公司 Threedimensional model file format system and read method
CN107918646A (en) * 2017-11-08 2018-04-17 珠海百丰网络科技有限公司 A kind of three-dimensional modeling data processing method and processing device based on protocol mode

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080270497A1 (en) * 2007-04-26 2008-10-30 International Business Machines Corporation Convert significand of decimal floating point data to/from packed decimal format
CN103325138A (en) * 2013-07-11 2013-09-25 乐淘(中国)有限公司 Method for 3D (Three-Dimensional) scene decoration and rendering through webpage
CN103401561A (en) * 2013-07-25 2013-11-20 百度在线网络技术(北京)有限公司 Methods and devices for compressing and decompressing map data
CN105931279A (en) * 2016-04-18 2016-09-07 邱友龙 Three-dimensional model data compression method and system
CN107818594A (en) * 2017-09-06 2018-03-20 北京矩阵空间科技有限公司 Threedimensional model file format system and read method
CN107592116A (en) * 2017-09-21 2018-01-16 咪咕文化科技有限公司 A kind of data compression method, device and storage medium
CN107918646A (en) * 2017-11-08 2018-04-17 珠海百丰网络科技有限公司 A kind of three-dimensional modeling data processing method and processing device based on protocol mode

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
黄鸿;赵志鹏;张磊;: "一种面向规则建筑物的OBJ文件无损压缩方法", 测绘通报, no. 10 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115549862A (en) * 2022-12-05 2022-12-30 大方智造(天津)科技有限公司 MES system concurrency performance test data receiving method based on dynamic analysis

Similar Documents

Publication Publication Date Title
CN104008064B (en) The method and system compressed for multi-level store
CN110597900B (en) Method for generating vector slice by GDB data in real time according to needs
US6396420B1 (en) Delta compression of floating point coordinate data
CN110769002A (en) LabVIEW-based message analysis method, system, electronic device and medium
CN110569230A (en) Method, system and equipment for interconversion between database design model and design document
CN114281876A (en) Data processing method, device, equipment and storage medium
CN112035401A (en) Model data processing method and device, electronic equipment and readable medium
CN111324587A (en) Compression method, analysis method and system for data of OBJ file
JP5549177B2 (en) Compression program, method and apparatus, and decompression program, method and apparatus
US9471246B2 (en) Data sharing using difference-on-write
CN113760894A (en) Data calling method and device, electronic equipment and storage medium
CN116302218B (en) Function information adding method, device, equipment and storage medium
CN109684207B (en) Method and device for packaging operation sequence, electronic equipment and storage medium
US20200133583A1 (en) Method, apparatus and computer program product for storing data
US8463759B2 (en) Method and system for compressing data
CN115904240A (en) Data processing method and device, electronic equipment and storage medium
CN111143461A (en) Mapping relation processing system and method and electronic equipment
CN114722781B (en) Method and device for converting streaming document into OFD document
CN115639966A (en) Data writing method and device, terminal equipment and storage medium
CN101553800B (en) Migration apparatus which convert SAM/VSAM files of mainframe system into SAM/VSAM files of open system and method for thereof
US20230005474A1 (en) Method and device for compressing finite-state transducers data
CN112100453A (en) Method, system, equipment and computer storage medium for character string distribution statistics
CN114595670B (en) Method, device, medium and equipment for editing dwg file format based on B/S architecture
Hernández-Hernández et al. A Byte Pattern Based Method for File Compression
US11979174B1 (en) Systems and methods for providing simulation data compression, high speed interchange, and storage

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