Animation data encoding, decoding method, device, storage medium and computer equipment
By introducing the data structure of dynamic attribute data blocks in animation data encoding, the problem of excessive volume of animation files in the prior art is solved, and more efficient storage space utilization is achieved.
Patent Information
- Application Number
- CN201910502932.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-11
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2039-11-14
AI Technical Summary
The prior art requires a large number of additional identifier fields when encoding animation data, resulting in excessive size of animation files and wasting storage space.
The data structure of the dynamic attribute data block is adopted, and the attribute type is obtained through the attribute structure table corresponding to the animation tag code, the attribute identification information is determined, and the animation data is encoded according to the attribute identification information to generate the dynamic attribute data block.
It significantly reduces the footprint of animation files and avoids file volume bloating caused by the introduction of a large number of identifier fields.
Smart Images

Figure CN112150587B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an animation data encoding and decoding method, device, computer-readable storage medium and computer equipment. Background Art
[0002] In order to make the video or picture content more vivid and interesting, users will add animation effects when editing the video or picture content. In fact, the animation effect is presented based on the animation file. An animation file can also be called a sticker. The more complex the animation effect, the more animation attribute data the corresponding animation file includes, and the larger the file size of the animation file.
[0003] The traditional process of making animation files is: first, an animation designer designs an animation project file, which includes animation special effects data, and then a development engineer implements various complex animation special effects through native code.
[0004] However, the above method requires a large number of additional identifier fields to identify the attribute status of each attribute during the encoding process, resulting in a large size of the obtained animation file and a waste of storage space. Summary of the invention
[0005] Based on this, it is necessary to provide an animation data encoding method, apparatus, computer-readable storage medium and computer device to address the technical problem that in the process of encoding animation data in the prior art, a large number of additional identifier fields are required to identify each attribute, resulting in the resulting animation file being too large.
[0006] An animation data encoding method, comprising:
[0007] Obtain animation data corresponding to each animation tag code from the animation project file;
[0008] When there is an attribute type in the attribute structure table corresponding to the animation tag code,
[0009] Determine the attribute identification information corresponding to each of the attributes;
[0010] According to the attribute identification information, the attribute value corresponding to each attribute in the animation data is encoded to obtain the attribute content corresponding to each attribute;
[0011] According to the attribute sorting corresponding to each of the attributes in the attribute structure table, the attribute identification information and the attribute content corresponding to each of the attributes are stored in sequence to obtain the dynamic attribute data block corresponding to the animation tag code.
[0012] An animation data encoding device, comprising:
[0013] Animation data acquisition module, used to acquire animation data corresponding to each animation tag code from the animation project file;
[0014] An attribute identification information determination module, used for determining the attribute identification information corresponding to each attribute when an attribute type exists in the attribute structure table corresponding to the animation tag code;
[0015] An attribute content encoding module, used for encoding the attribute value corresponding to each attribute in the animation data according to the attribute identification information, to obtain the attribute content corresponding to each attribute;
[0016] The data block generation module is used to sort the attributes corresponding to each attribute in the attribute structure table, store the attribute identification information and the attribute content corresponding to each attribute in sequence, and obtain the dynamic attribute data block corresponding to the animation tag code.
[0017] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned animation data encoding method.
[0018] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned animation data encoding method.
[0019] In the above-mentioned animation data encoding method, device, computer-readable storage medium and computer equipment, the animation tag code can be used to identify a group of attributes, and the attribute structure table is used to describe the data structure of a group of attributes identified by the animation tag code. When the attribute values of this group of attributes are uncertain in terms of type or quantity, or when there is a large amount of redundancy in the attribute values of the attributes, in order to avoid the problem of introducing a large number of identifier fields for describing the type or quantity of the attributes, which leads to a large volume of the animation file, a data structure of a dynamic attribute data block is introduced, which can maximize the compression of these identifiers and greatly reduce the volume occupied by the target animation file. Specifically, after obtaining the animation project file, according to a group of attributes included in the attribute structure table corresponding to the animation tag code, the attribute values of this group of attributes are obtained from the animation project file, and the attribute identification information in the dynamic attribute data block is used to describe the attribute state of the attribute. When there is an attribute type in the attribute structure table, the attribute identification information corresponding to each attribute can be determined according to the animation data, and then the attribute values corresponding to each attribute can be dynamically encoded according to the attribute identification information to obtain the corresponding attribute content, and the dynamic attribute data block corresponding to the animation tag code is obtained by combining the attribute identification information and the attribute content of each attribute in the attribute structure table, which can significantly reduce the space occupied by the animation file.
[0020] A method for decoding animation data, comprising:
[0021] Get the animation tag code;
[0022] When there is an attribute type in the attribute structure table corresponding to the animation tag code,
[0023] According to the attribute type corresponding to each attribute in the attribute structure table, parsing the attribute identification information corresponding to each attribute from the dynamic attribute data block corresponding to the animation tag code;
[0024] The attribute content corresponding to each of the attributes is parsed from the dynamic attribute data block according to the attribute identification information corresponding to each of the attributes.
[0025] An animation data decoding device, the device comprising:
[0026] Acquisition module, used to obtain animation tag code;
[0027] An attribute identification information parsing module, for parsing attribute identification information corresponding to each attribute from the dynamic attribute data block corresponding to the animation tag code according to the attribute type corresponding to each attribute in the attribute structure table when there is an attribute type in the attribute structure table corresponding to the animation tag code;
[0028] The attribute content parsing module is used to parse the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute.
[0029] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned animation data decoding method.
[0030] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above animation data decoding method.
[0031] In the above-mentioned animation data decoding method, device, computer-readable storage medium and computer equipment, the animation tag code can be used to identify a group of attributes, and the attribute structure table is used to describe the data structure of the group of attributes identified by the animation tag code. When the attribute values of this group of attributes are uncertain in terms of type or quantity, or when there is a large amount of redundancy in the attribute values of the attributes, in order to avoid the problem of too large animation file size caused by the additional introduction of a large number of identifier fields for describing the type or quantity of the attributes, a data structure of a dynamic attribute data block is introduced, which can maximize the compression of these identifiers and greatly reduce the volume occupied by the target animation file. Specifically, during decoding, after reading the animation tag code, when the attribute type exists in the attribute structure table corresponding to the animation tag code, it means that the attribute value of the group of attributes identified by the animation tag code is encoded in the form of a dynamic attribute data block, and the attribute identification information corresponding to each attribute can be parsed from the dynamic attribute data block corresponding to the animation tag code in combination with the attribute type corresponding to each attribute, and then based on the attribute identification information, the attribute content corresponding to each of the attributes can be parsed from the dynamic attribute data block to achieve decoding of the animation file. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A diagram showing an application environment of an animation data encoding method in one embodiment;
[0033] Figure 2 A schematic diagram of adding animated stickers to video content when capturing a video in one embodiment;
[0034] Figure 3 is a schematic diagram of a 48-bit data stream;
[0035] Figure 4 A schematic diagram of the encoding structure of data of a continuous unsigned integer type in one embodiment;
[0036] Figure 5 A schematic diagram of the encoding structure of path information in one embodiment;
[0037] Figure 6 A schematic diagram of the file organization structure of a PAG file in one embodiment;
[0038] Figure 7 A schematic diagram of a node element organization structure of a node element in an embodiment;
[0039] Figure 8 A schematic diagram of a flow chart of an animation data encoding method in one embodiment;
[0040] Fig. 9 A schematic diagram of the structure of an attribute structure table and a dynamic attribute data block corresponding to mask information in one embodiment;
[0041] Fig.10Schematic diagram of the encoding structure of the time easing parameter array in one embodiment;
[0042] Fig.11 Schematic diagram of the encoding structure of a spatial easing parameter array in one embodiment;
[0043] Fig.12 A diagram showing the coding structure of animation data corresponding to a bitmap sequence frame coding method in an embodiment;
[0044] Fig.13 A diagram showing the coding structure of animation data corresponding to a video sequence frame coding method in an embodiment;
[0045] Fig.14 A schematic diagram of a flow chart of an animation data decoding method in one embodiment;
[0046] Fig.15 A file data structure corresponding to a vector export method in an embodiment;
[0047] Fig.16 is a structural block diagram of an animation data encoding device in one embodiment;
[0048] Fig.17 is a structural block diagram of an animation data decoding device in one embodiment;
[0049] Fig.18 FIG. 4 is a structural block diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] The following is an introduction to some of the terms involved in this application:
[0052] AE: Short for Adobe After Effects, Adobe After Effects is a graphics and video processing software that can be used to design complex video effects. Designers use this software to design complex animation effects, and the resulting animation files are AE project files (file suffix aep), which are also referred to as animation project files in the following text. AE project files are used to store compositions and all source files and animation feature parameters used in the compositions. Compositions are a collection of layers.
[0053] PAG: Portable Animated Graphics, a self-developed binary animation file format proposed by this application. PAG files can be attached to videos as an animation effect, called animation stickers.
[0054] PAGExporter: A self-developed animation export plug-in for PAG files, which can be used to read the animation special effects data in the AE project file, and export the read animation special effects data in any of the vector export mode, bitmap sequence frame export mode or video sequence frame export mode to obtain a PAG file. PAGExpoter can be loaded as a plug-in of the AE software to export the AE project file to a PAG file.
[0055] PAGViewer: A self-developed animation preview software for previewing PAG files. It can be used to preview PAG files and write performance parameters to PAG files so that when the PAG file is uploaded to the server, the PAG file can be verified according to the performance parameters.
[0056] Figure 1 FIG. 1 is an application environment diagram of an animation data encoding method in an embodiment. Figure 1 , the animation data encoding method is applied to terminal 110.
[0057] The terminal 110 is installed and running with software that supports graphics and video processing, and an animation project file is generated by the software. The software may be, for example, AE software. The terminal 110 is also installed with an animation export plug-in, and the animation export plug-in may be, for example, PAGExporter. When the terminal 110 runs the software to open an animation project file, the terminal may read the animation data of the animation project file through the animation export plug-in, and load the animation export plug-in to encode the animation data to obtain a target animation file, and the target animation file may be, for example, a PAG file. The terminal 110 may specifically be a desktop terminal or a mobile terminal, and the mobile terminal may specifically be at least one of a mobile phone, a tablet computer, a laptop computer, and the like.
[0058] In one embodiment, PAGExporter running on terminal 110 processes the animation data in the animation project file and exports it to obtain a PAG file. During the process of playing the PAG file, PAGViewer counts the performance parameters of the PAG file and writes the calculated performance parameters into the PAG file. Finally, the performance parameters carried by the PAG file can be verified by the verification server. The PAG file that has been successfully verified can be published to the network and played after being downloaded by the user. The animation effect presented by the PAG file can be attached to the video as an animation sticker, such as Figure 2, which is a schematic diagram of adding animated stickers 202 to video content when capturing video in one embodiment.
[0059] The following introduces the basic data types used in the binary animation file format, namely PAG files. The data types describe the format in which the data is saved in the file.
[0060] When encoding animation data to obtain a PAG file, the basic data types used include integer type, Boolean type, floating point type, array type, bit type, time type, and string type. The data length of these data types is usually constant, and they are also called fixed-length data types.
[0061] The basic data types also include new data structures that are customized based on the arrangement and combination of these data types. As a new data type, it can be called a combination type. These combination types can be used to describe animation data, including variable-length coded integer types, coordinate types, ratio types, color types, font types, transparency change information types, color change information types, text types, path types, byte stream types, bitmap information types, and video frame information types.
[0062] The following is a detailed description of the above basic data types:
[0063] 1. Integer Type
[0064]
[0065]
[0066] All integer values are stored in binary form in the PAG file. As can be seen from the table above, integer data can be stored in signed and unsigned 8-bit, 16-bit, 32-bit, and 64-bit formats. Data in the PAG format can be stored in "little endian" format, that is, low-order byte data is stored at the low address of the memory, and high-order byte data is stored at the high address of the memory. Integer data is a data type that requires byte alignment, that is, the value of the first bit of an integer value is stored at the first bit of a byte in the PAG file.
[0067] 2. Boolean Type
[0068] Data Types Remark Bool 0 represents false; 1 represents true
[0069] Refer to the table above. In the PAG file, Boolean data is represented by one bit. Compared with one byte, it can save storage space. Boolean data does not require byte alignment.
[0070] 3. Floating point types
[0071] Data Types Remark Float Single precision 32 bits
[0072] In the PAG file, the data type of decimals is represented by a single-precision floating-point type.
[0073] 4. Array Types
[0074] For data of the same data type stored continuously, you can add the [n] symbol after the data type to represent this group of data, where n represents the length of the array. For example, Uint8
[10] represents a one-dimensional array of type Uint8 with a length of 10. For another example, Int8[n][m] is a two-dimensional array, where m represents the length of the array, indicating that there are m data of the data type Int8[n].
[0075] 5. Bit Type
[0076]
[0077]
[0078] Unlike data types that occupy a fixed number of bits, bit types are variable-length data types that can be used to represent both signed and unsigned integer data. For example, SB[5] can be used to represent a 5-bit signed integer data type, and UB[2] can be used to represent a 2-bit unsigned integer data type. SB is the abbreviation for Signed Bits, and UB is the abbreviation for Unsigned Bits.
[0079] Unlike data types that require byte alignment (such as Int8 and Uint16), bit type data does not require byte alignment. Specifically, when data of a data type that requires byte alignment is encoded after bit type data, the last byte of the bit type needs to be byte aligned, that is, the extra bits in the last byte except for the bit type data need to be padded with zeros for byte alignment.
[0080] Reference Figure 3, take a 48-bit (6-byte) binary data stream as an example. The binary data stream includes 6 values of different bit lengths. The first 5 values are bit type, and the last value is Uint16 type. Each cell represents a byte. The first value (010110) of the bit stream occupies 6 bits, and the second value (10100) occupies 5 bits. This value spans the first and second bytes. The third value (100100) occupies 6 bits. The third value also spans two bytes. The fourth value (1011) occupies 4 bits. All the bits of this value belong to the third byte. The fifth value (1101001) occupies 7 bits. The sixth value after the fifth value is a byte-aligned value (010011001010101), so the remaining 4 bits in the byte occupied by the fifth value (the fourth byte) are padded with zeros.
[0081] In order to compress the space occupied by the PAG file as much as possible, a continuous data encoding method can be used to encode a group of continuous data of the same type. Specifically, a header area is added in front of this group of continuous data of the same type. The value in the header area is used to represent the number of bits nBits occupied by this group of continuous data of the same type. In other words, the group of continuous data of the same type after the header area is stored according to this number of bits. The specific value of nBits is determined based on the maximum value in this group of data. For other smaller data in this group of data, the high-bit zero padding method is used for encoding.
[0082] like Figure 4 As shown, it is a schematic diagram of the encoding structure for encoding continuous unsigned integer type data, refer to Figure 4 The header area stores the number of bits nBits occupied by each data in this group of consecutive integer data, followed by the UB[nBits] type to encode this group of consecutive integer data. Taking the storage of consecutive 32-bit unsigned integers as an example, the header area occupies a maximum of 5 bits to store nBits.
[0083] For example, a group of 16-bit unsigned integers: 50, 100, 200, 300, 350, 400, if encoded according to the Uint16 data type, each value occupies 16 bits, and this group of values occupies a total of 96 bits. If encoded according to the continuous data encoding method, each data occupies 10 bits according to the maximum value 400, so it is encoded according to UB
[10] , and a UB[4] type header area is added in front of this group of data to store the value "10", that is, the header area occupies 4 bits, and the group of continuous data following the header area occupies 60 bits, so this group of data only occupies 64 bits, which can occupy 32 bits (4 bytes) less than the traditional method.
[0084] It should be noted that the encoding of continuous signed integers is the same as that of unsigned integers. The difference is that the data after the header area of the unsigned integer is all numerical content, while the first bit after the header area of the signed integer represents the sign bit (0 for positive numbers, 1 for negative numbers), and the next continuous nBits-1 bits represent the numerical content. For continuous floating-point data, the above continuous data encoding method can also be used for encoding.
[0085] Furthermore, for some continuous floating-point data that allow loss of precision, they can be converted into integer data and then encoded in the above-mentioned continuous integer type. Specifically, for coordinate data representing points in space, such as spatial easing parameters that are of floating-point type, the floating-point data can be divided by the spatial precision coefficient (SPATIAL_PRECISION=0.05) and converted into an integer; for coordinate data representing Bezier curve easing parameters, the floating-point data can be divided by the Bezier precision coefficient (BEZIER_PRECISION=0.005) and converted into an integer and then encoded; for coordinate data representing gradient information, the floating-point data can be divided by the gradient precision coefficient (GRADIENT_PRECISION=0.00002) and converted into an integer and then encoded.
[0086] 6. Time Type
[0087] The data of time type (Time) in the PAG file is uniformly described using Int64. The time type can be used to represent the frame number. The frame number of each frame divided by the frame rate can be converted into the external time in seconds.
[0088] 7. String Type
[0089]
[0090]
[0091] In the PAG file, the data of the string type (String) uses the null character to mark the end of the string.
[0092] 8. Variable-length encoded integer types
[0093] Data Types Remark EncodedInt32 Variable-length encoded 32-bit integer EncodedUint32 Variable-length encoded 32-bit unsigned integer EncodedInt64 Variable-length encoded 64-bit integer EncodedUint64 Variable-length encoded 64-bit unsigned integer
[0094] The variable-length coded integer type uses bytes as the minimum storage unit to represent an integer. The integer value occupies a minimum of one byte and a maximum of 4 bytes or 8 bytes. When encoding the value of the variable-length coded integer type, the first 7 bits of the byte represent the value, and the 8th bit is used to indicate whether there is a value behind it. The 8th bit is 0, indicating that the next byte does not belong to the content of the value, and the 8th bit is 1, indicating that the next byte still belongs to the content of the value. Therefore, when decoding, if the 8th bit of each byte is 0, it means that the value has been read. If the 8th bit is 1, it means that the value has not been read. It is necessary to read one more byte until the length is read (32 bits or 64 bits). For the variable-length coded integer type with a signed bit, the value of the unsigned coded integer type is read first, and then the sign bit is determined.
[0095] For example, if the data type of the data value 14 is EncodedInt32, the corresponding binary is: 0011100, which occupies 24 bits less than the data type Int32.
[0096] 9. Coordinate Type
[0097] Fields Field Type Remark x Float X-axis coordinate y Float Y-axis coordinate
[0098] The coordinate type (Point) is used to represent the coordinates of a location, that is, the values of the x-axis and y-axis. When encoding a value belonging to the coordinate type, first use 32 bits to encode the x value, and then use 32 bits to encode the y value.
[0099] 10. Ratio Type
[0100]
[0101]
[0102] The ratio type (Ratio) is used to represent a ratio. When encoding a value belonging to the ratio type, the value of the numerator that occupies a variable length of bits is encoded first, and then the value of the denominator that occupies a variable length of bits is encoded.
[0103] 11. Color Type
[0104] Fields Field Type Remark Red Uint8 Red value (0 to 255) Green Uint8 Green value (0 to 255) Blue Uint8 Blue value (0 to 255)
[0105] The color type (Color) is used to represent a color value, which is usually composed of three colors: red, green, and blue. When encoding a value belonging to the color type, first use one byte to encode the red value, the second byte to encode the green value, and the third byte to encode the blue value. The data type of each color value is Uint8.
[0106] 12. Font Type
[0107] Fields Field Type Remark id EncodedUint32 Unique ID fontFamily String Font Family fontStyle String Font Style
[0108] The font type (FontData) is used to identify the font. When encoding a numerical value belonging to the font type, first encode the variable-length font identifier, and then use the String data type to encode the font family series and font style to which the font belongs. The number of bits occupied by the font family series and font style is determined by the character length. fontFamily represents the name of the font, which can be the name of a font or the name of a type of font. fontStyle is used to define the degree of inclination of the font, including italic, tilted or normal font.
[0109] 13. Transparency Change Information Type
[0110]
[0111]
[0112] The transparency change information type (AlphaStop) is used to describe the gradual change information of transparency.
[0113] The floating point type needs to be encoded as Unit16 type according to the precision and then stored. When decoding, the value of Unit16 read needs to be multiplied by the precision to get the floating point number. For example, the precision is 0.00002f.
[0114] 14. Color change information type
[0115] Fields Field Type Remark position Uint16 Starting point location midpoint Uint16 Midpoint color Color Color Value
[0116] The color change information type (ColorStop) is used to describe the color gradient information.
[0117] 15. Color gradient change information type
[0118] Fields Field Type Remark alphaCount EncodedUint32 Transparency gradient information array length colorCount EncodedUint32 Color gradient information array length alphaStopList AlphaStop[alphaCount] Consecutive alphaCount AlphaStops colorStopList ColorStop[colorCount] Consecutive colorCount ColorStops
[0119] The color gradient change information type (GradientColor) is a data type that combines the transparency change information type and the color change information type to obtain the color gradient change information. An alphaStopList (transparency change information list) includes multiple transparency change information, and one transparency change information includes: the starting point position, the middle point position and the transparency value. A colorStopList (color change information list) includes multiple color change information, and one color change information includes: the starting point position, the middle point position and the color value.
[0120] When encoding data belonging to the color gradient change information type, first use the variable length coded integer type EncodedUint32 to encode alphaCount and colorCount in sequence, and then encode each transparency change information in the transparency change information list according to the number of bits occupied by the transparency change information type, and then encode each color change information in the color change information list according to the number of bits occupied by the color change information type.
[0121] 16. Text Type
[0122]
[0123]
[0124] The text type (Text) is used to describe text information, including text, font, size, color and other text information. Since the types and quantities of text information in different layers are uncertain, the identification bit is used to identify whether this data exists during encoding, and each identification bit is represented by a bit type that only occupies one bit, which can save storage space. As can be seen from the above table, the text type includes a total of 19 identification bits, occupying 3 bytes. The last byte of these 3 bytes is padded with zeros during encoding. When encoding text type data, if the value of a certain identification bit is 0, it means that the text information corresponding to the identification bit does not exist, then the text information corresponding to the next identification bit with a value of 1 can be directly encoded. Then, when decoding, the next byte of data read is the text information corresponding to the next identification bit with a value of 1.
[0125] 17. Path Type
[0126]
[0127] The path type (Path) is used to represent the drawing path information that describes a shape. The path information is determined by a set of actions. In a PAG file, it usually includes 8 actions:
[0128]
[0129] When encoding path information, first you need to determine numVerbs based on the number of all actions in the path drawing information and the corresponding action value for each action. You also need to determine the floatNum float type values that need to be encoded based on the coordinate data of each action. Before encoding, you need to multiply these floatNum float type values by SPATIAL_PRECISION to convert the floating point number to an integer type, and then calculate the maximum value of these floatNum float type values. Get numBits based on the number of bits occupied by the maximum value. Since each value in floatlist occupies no more than 31 bits, that is, numBits≤31, you need to encode numBits according to UB[5], and then encode each float type value according to UB[numBits].
[0130] For example, to draw a rectangle of (x:5, y:0, r:15, b:20), the data structure of the path type (Path) is as follows: execute the Move action to the point (5,0), and record the action "1" and two Float values (5,0). Then execute HLine to the point (15,0), and record the action "3" and a Float value (15). Then execute VLine to the point (15,20), and record the action "4" and a Float value (20). Then execute HLine to the point (5,20), and record the action "3" and a Float value (5). Then execute Close to close the rectangle and return to the starting point (5,0). Record the action "0".
[0131] Reference Figure 5 , which is a schematic diagram of the encoding structure of the path information in the above example. When encoding the above path information, firstly, numVerbs, i.e., the number of actions "5", is encoded according to EncodedUint32, and then the five actions "1, 3, 4, 3, 0" are encoded in sequence according to the UB[3] type. The above five actions include 5 float values, namely 5, 0, 15, 20, and 5. After converting these five floating point numbers into integer types according to the precision parameter, they are 100, 0, 300, 400, and 100, respectively. The maximum value is 400, and 400 needs to be represented by 10 bits, so numBits = 10. After encoding numBits according to UB[5], the header area of this group of continuous floating point type data is obtained. Finally, 100, 0, 300, 400, and 100 are encoded in sequence according to SB
[10] to obtain the encoded data of the entire path information.
[0132] 18. Byte stream type
[0133] Fields Data Types Remark data Byte Address Starting address of bytes length Uint64 Byte length
[0134] The byte stream type (ByteData) is used to indicate the starting address and length of the byte stream. When encoding a string of byte streams, first encode the starting address of the bytes in the string of byte streams, and then encode the length of the entire byte stream, so that when decoding, data can be read from the starting address in the memory according to the length of the byte stream to obtain the entire byte stream. The byte address can also be an offset address. After the computer allocates the corresponding memory for the PAG file, the starting address of the byte stream can be determined based on the starting address of the allocated memory and the offset address.
[0135] 19. Bitmap Information Type
[0136] Fields Field Type Remark x Int32 X coordinate of the starting point of the difference pixel area y Int32 The Y coordinate of the starting point of the difference pixel area fileBytes ByteData Image Data
[0137] The bitmap information type (BitmapRect) is used to represent the binary image data obtained by compressing and encoding the difference pixel area corresponding to each bitmap image in the bitmap image sequence according to the image encoding method. Among them, x and y represent the X coordinate and Y coordinate of the starting position of the difference pixel area respectively. When encoding the bitmap information, it is necessary to find the starting position in the difference pixel area, and then encode the image data corresponding to the starting position and the difference pixel area in turn according to the byte stream type to obtain the encoded data of each bitmap image.
[0138] 20. Video frame information type
[0139] Fields Field Type Remark frame Time Frame number fileBytes ByteData Video frame data
[0140] The video frame information type (VideoFrame) is used to represent the binary image data obtained by compressing the synthetic bitmap corresponding to each bitmap image in the bitmap image sequence according to the video encoding method. Among them, frame represents the frame number of the current frame, and the frame number divided by the frame rate can be converted into time in seconds. The Time type is encoded using Int64. When encoding the video frame information, the frame number is first encoded according to Int64, and then the video frame data corresponding to the video frame is encoded according to the byte stream type to obtain the encoded data of each video frame.
[0141] The following describes the file organization structure of the PAG file.
[0142] like Figure 6As shown, the file organization structure of the PAG file consists of a file header (FileHeader) and a node element (Tag). The file header is a data structure located at the beginning of the PAG file and used to describe the file header information. The file header information at least includes the file version number, file length, and file compression method. The file header information can be organized according to the file header organization structure in the following table:
[0143] Fields Data Types Field meaning sign Unit8 Signature byte, used to store "P" sign Unit8 Signature byte, used to store "A" sign Unit8 Signature byte, used to store "G" File version number Unit32 File version number, for example, 0X04 means the "4th" version File Length Unit32 The file length of the entire file, including the length of the file header File compression method Int8 How to compress the file
[0144] Node elements all have the same data structure, such as Figure 7 As shown, the node elements include a node element header (TagHeader) and a node element content (TagBody), so that when encountering a node element that cannot be parsed during decoding, the current node element can be directly skipped. The node terminator (End) is a special node element, which is used to indicate that all node elements at this level have been read and there are no more node elements to be read. Node elements can also be nested node elements. A node element can include one or more child node elements. Similarly, End is used at the end to indicate that all child node elements have been read and there are no more child node elements to be read.
[0145] Reference Figure 7 , the node element header (TagHeader) is used to record the animation tag code (TagCode) and the byte stream length (Length) of the node element content. The animation tag code can be used to indicate which type of animation information is recorded in the node element. Different animation tag codes indicate different animation information is recorded. The byte stream length can be used to indicate the length of the node element content in the node element.
[0146] Since the data recorded by TagBody may be very small or very large, some data only occupies one byte, then the value of Length is 1, and some data occupies 100 bytes, then the value of Length is 100. Therefore, in order to minimize the storage space occupied by the file, the TagHeader can be divided into short type and long type structures for storage.
[0147] TagHeader short type
[0148]
[0149] TagHeader long type
[0150]
[0151] The short-type TagHeader uses 16 bits to record the animation tag code and the length of the node element content. In the short-type TagHeader, the maximum value of the length of the node element content can be 62 (when the last 6 bits of TagCodeAndLength are 111110), which means that the TagBody can store up to 62 bytes of data. In the long-type TagHeader, the data type of length is Uint32, so the maximum value of the length of the node element content can be 4G, which means that the TagBody can store up to 4G of data.
[0152] That is to say, when the length of TagBody is 62 bytes or less, the data type of TagHeader is Uint16, the first 10 bits are used to store the animation tag code, and the last 6 bits are used to store the Length. When the length of TagBody is 63 bytes or longer, TagHeader contains a Uint16 TagCodeAndLength field and a Uint32 Length field. In the Uint16 TagCodeAndLength, the first 6 bits are used to store the animation tag code, and the last 6 bits are fixed to 0x3f. That is, when the last 6 bits are "111111", it means that the current TagHeader is stored in a long type structure. In this case, the TagCodeAndLength field is followed by a 32-bit unsigned integer to represent the length of TagBody. During decoding, first read the first 10 bits of the TagCodeAndLength field to get the animation tag code, and then read the last 6 bits. If the value of the last 6 bits is not "111111", the value of the read 6 bits is the length of TagBody. If the value of the last 6 bits is "111111", continue to read the next 32 bits (4 bytes) of data, and the read 4 bytes of data are the length of TagBody.
[0153] In the above method, if the TagBody contains more data and needs to occupy more bits, an unsigned 64-bit integer can be used to record the value of Length in the long-type TagHeader.
[0154] Furthermore, the value of Length read from the TagCodeAndLength field can also be 0, indicating that the length of TagBody is 0. In this case, TagBody does not exist. For example, the node end (End) mentioned above is a special node element, and the value of Length recorded in the TagHeader of the node element is 0.
[0155] Of course, in the data structure of the node element header provided above, the data type of each field can be adjusted according to actual conditions, and each field can occupy more bits or fewer bits according to actual conditions.
[0156] PAG files provide a large number of animation tag codes to represent rich animation information. The data structure of the animation information corresponding to each animation tag code is represented by an attribute structure table. When encoding a PAG file, first encode the file header information according to the file header organization structure, and then encode the animation tag code (TagCode), the byte stream length (Length) of the node element content, and the node element content (TagBody) in sequence according to the animation data according to the data structure of the node element.
[0157] When encoding the node element content (TagBody), it is necessary to encode according to the attribute structure table corresponding to the animation tag code. The attribute structure table defines the data structure of the animation information corresponding to the animation tag code.
[0158] If the attributes included in the animation information represented by the animation tag code are fixed in type and quantity, then the data type corresponding to each attribute in the attribute structure table corresponding to the animation tag code is a basic type, and the animation data corresponding to the animation tag code can be directly encoded according to these basic data types to obtain the node element content. At this time, the data structure used to encode the node element can be called the basic data structure.
[0159] If the types and quantities of attributes included in the animation information recorded by TagBody are uncertain, for example, the drawing path information of the mask, the action types and number of actions included in the drawing path information of different masks may be different, then a large number of additional identifier fields will be required. At this time, defining the data structure in the above way will waste a lot of file space. In order to compress the file space as much as possible, for the animation information corresponding to this animation tag code, it is necessary to redefine its corresponding attribute structure table and provide corresponding encoding rules to encode the node element content. The data structure represented by this newly defined attribute structure table can be called a dynamic attribute data structure (AttributeBlock).
[0160] The following describes a specific method for encoding the animation data corresponding to each animation tag code according to the above basic data structure or dynamic attribute data structure to obtain the node element content (TagBody).
[0161] like Figure 8 As shown, in one embodiment, a method for encoding animation data is provided. This embodiment mainly applies this method to the above Figure 1 The terminal 110 in FIG. Figure 8 , the animation data encoding method specifically includes the following steps:
[0162] S802, acquiring animation data corresponding to each animation tag code from the animation project file.
[0163] Among them, the animation project file can be, for example, the AE project file mentioned above, with an extension of .aep. The animation tag code is used to indicate which type of animation information the node element content after the node element header corresponding to the animation tag code specifically represents. Before encoding, it is necessary to pre-set a one-to-one correspondence between the animation tag code and the corresponding animation information, so that the animation tag code and the corresponding animation information are encoded in accordance with the pre-set one-to-one correspondence. Animation data is data describing the animation information corresponding to the animation tag code. For example, the animation tag code is 14, which represents MaskBlock, indicating a mask information in the animation project file. The mask information includes the following attributes: mask identification, whether the mask is inverted, the blending mode of the mask, the vector path of the mask, the transparency of the mask, and the edge extension parameters of the mask. The animation data corresponding to the animation tag code is the attribute values corresponding to these attributes. For another example, the animation tag code is 13, which represents Transform2D, indicating a 2D transformation information in the animation project file. The 2D transformation information includes the following attributes: anchor point coordinates, position information, X-axis offset, Y-axis offset, scaling information, rotation information, and transparency information.
[0164] An animation project file can be a file created by a designer using AE software. The animation project file stores all the parameters used for the entire animation synthesis. Animation synthesis (Composition) is a collection of layers. After obtaining the animation project file, the terminal can extract the animation data from the animation project file, and according to the predefined animation tag code, these animation data correspond to each animation tag code one by one to obtain the animation data corresponding to each animation tag code. For example, a set of 2D transformation information is obtained, and the predefined animation tag code representing the 2D transformation information is "13", then the animation data corresponding to the animation tag code "13" is this set of 2D transformation information. Of course, there may be multiple sets of different 2D transformation information in the animation project file, and each set of 2D transformation information needs to be identified by the animation tag code "13".
[0165] From the content of the node element header described in the previous text, we can know that the PAG file uses 10 bits to store the animation tag code, and can store up to 1024 different animation tag codes. Since the animation data is encoded based on the animation tag code and the corresponding data block (including the basic data block or the dynamic attribute data block), when the PAG file continues to support new animation features, backward compatibility with the previous old file format can continue to be guaranteed. Currently, PAG files only use 37 animation tag codes, of which 0-29 are animation tag codes supported by the vector export method, and 45-51 are 7 animation tag codes extended for the bitmap sequence frame export method and the video sequence frame export method. If subsequent PAG files can support more animation features, new animation tag codes can continue to be extended to represent the animation information corresponding to the newly added animation features.
[0166] The following table describes the animation information represented by each animation tag code:
[0167]
[0168]
[0169] The attribute structure table corresponding to each type of animation information mentioned above will be listed later.
[0170] S804: When there is an attribute type in the attribute structure table corresponding to the animation tag code, attribute identification information corresponding to each attribute is determined.
[0171] Among them, the attribute structure table defines the data structure of the animation information corresponding to the animation tag code. When encoding the node element content, it is necessary to encode according to the attribute structure table corresponding to the animation tag code. The attribute structure table of each animation tag code is pre-defined, and the attribute structure table corresponding to each animation tag code is given later. In order to clarify the encoding method and decoding rules, when more animation features need to be supported, new animation tag codes need to be expanded, and the attribute structure table corresponding to the newly added animation tag code also needs to be defined.
[0172] When the attributes included in the animation information represented by the animation tag code are uncertain from the type to the quantity, the attribute structure table corresponding to the defined animation tag code contains the attribute type of each attribute, and the data structure presented by the attribute structure table can be called a dynamic attribute data structure. For example, for the animation tag code "14" representing mask information, the attribute type exists in its corresponding attribute structure table. Furthermore, if the attribute values of some attributes in the attribute structure table are usually equal to the default values, in order to reduce the file size, the attribute values of the attributes do not need to be stored, and only one bit is needed to indicate that the attribute value of the attribute is equal to the default value. Therefore, the attribute structure table also includes the default values corresponding to each attribute. The default values of each attribute and the corresponding attribute type can be hard-coded in the decoding code of the animation file, so that the default value can be directly obtained when it is determined as the default value according to the identification bit during parsing.
[0173] The attribute type (AttributeType) is required to encode animation data according to the dynamic attribute data structure and parse the dynamic attribute data block (AttributeBlock). When an attribute type exists in the attribute structure table corresponding to a certain animation tag code, it indicates that the node element content after the node element header corresponding to the animation tag code needs to be encoded according to the dynamic attribute data structure. In the encoding stage, the attribute type is used to determine the number of bits occupied by the attribute identification information. In the decoding stage, the attribute type is used to determine the number of bits occupied by the attribute identification information and the corresponding reading rules.
[0174] The dynamic attribute data block mainly consists of two parts: the attribute identification area composed of the attribute identification information (AttributeFlag) corresponding to each attribute and the attribute content area composed of the attribute content (AttributeContent) corresponding to each attribute. Fig. 9 , Fig. 9 The attribute structure table corresponding to the mask information is given on the left, which includes 6 attributes: Fig. 9 The specific structure of the dynamic attribute data block corresponding to the attribute structure table is given on the right. Fig. 9 It can be seen that each attribute has corresponding attribute identification information (when the attribute type corresponding to the attribute is a fixed attribute, the attribute identification information does not exist) and attribute content. The arrangement order of each attribute identification information corresponds to the arrangement order of the attribute content. Each time an attribute structure table is given, the attribute identification information and attribute content corresponding to each attribute are determined according to the attribute structure table, and then stored in order. For example, AttributeFlag 0 and AttributeContent 0 here are the first ID attribute of the attribute structure table corresponding to the mask information. From Fig. 9As can be seen from the figure, the data structure stores all the attribute identification information first and then starts to store all the attribute contents. This is because each item in the attribute identification information area is usually represented by bits. Storing them together can avoid frequent byte alignment, which will result in a lot of space waste. After the attribute identification information area is read, a unified byte alignment will be performed. The extra bits generated by byte alignment will be padded with 0, and then the attribute contents will continue to be stored from the integer byte position.
[0175] Since the number of attributes defined in the attribute structure table corresponding to each animation tag code is fixed and will not change, in order to compress the size of the animation file, the number of attributes included in the attribute structure table corresponding to each animation tag code will not be written into the animation file, but will be hard-coded in the parsing code. In this way, the number of attributes included in the animation information identified by the animation tag code can be directly obtained during parsing.
[0176] As mentioned above, when the attributes of the animation information represented by the animation tag code are uncertain in both type and quantity, the attribute structure table corresponding to the defined animation tag code contains the attribute types of each attribute. For example, the situation where the type or quantity of the attribute is uncertain includes the following characteristics:
[0177] 1. The data type corresponding to some attributes is a Boolean type, which takes up one byte. However, in fact, only one bit is needed to identify the value of the attribute, that is, 0 represents false and 1 represents true. Therefore, we can use the attribute type to identify the attribute value of the attribute as a Boolean value that takes up one bit. It only takes up one bit during encoding, and the attribute value corresponding to the attribute can be parsed according to the attribute type during decoding.
[0178] 2. The attribute values corresponding to some attributes are usually default values. In order to compress the file size, the actual value may not be stored in this case. When encoding, one bit may be directly used to indicate that the attribute value corresponding to the attribute is equal to the default value, and then the default value may be implanted into the parsing code.
[0179] 3. The attribute value corresponding to some attributes may be an animation interval characteristic data, but the animation interval characteristic data does not include spatial easing parameters, so the data related to spatial easing parameters may not be stored. The attribute value corresponding to some attributes may not include animation interval characteristic data and is a fixed value. In this case, only one value needs to be stored. If the value is still equal to the default value, 1 bit can be used to indicate that it is equal to the default value.
[0180] According to the characteristics of each attribute in the above dynamic attribute data structure, each attribute may have many different states. Making full use of these states can significantly reduce the file size in most cases. Therefore, according to the characteristics of the above attributes, the data structure of the defined attribute identification information is shown in the following table:
[0181]
[0182]
[0183] The terminal can determine the attribute identification information corresponding to each attribute based on the attribute type and animation data of each attribute in the attribute structure table corresponding to the animation tag code. During decoding, the attribute content corresponding to the attribute can be read from the attribute content area based on the attribute identification information. However, the number of bits occupied by the attribute identification information corresponding to each attribute is dynamic, and the value range is 0-3 bits. The specific number of bits occupied by each attribute needs to be determined based on the attribute type, that is, the attribute type can be used to determine the number of bits (0-3 bits) that the attribute identification information may occupy. The PAG file divides attribute types into the following 8 types, as shown in the following table:
[0184]
[0185] As can be seen from the above table, the attribute identification information of ordinary attributes may only occupy 1 bit at most, and only the content identification bit needs to be read during decoding. The attribute identification information of spatial slow-motion animation attributes will occupy up to 3 bits to store the attribute identification information. For example, when a spatial slow-motion animation attribute does not contain animation interval characteristic data and the attribute value is equal to the default value, only 1 bit is needed to represent the attribute identification information, and the attribute identification information only includes the attribute content flag bit, whose value is 0, indicating that the corresponding attribute content is the default value. When decoding, the content identification bit is read as 0, which means that the attribute identification information of the attribute has been read and the value of the next bit will not be read. In the extreme case, each attribute in the attribute structure table does not contain animation interval characteristic data and is equal to the default value, then only the number of attribute bits will be used to store the attribute identification information corresponding to each attribute, and each attribute identification information only includes the content identification bit, whose value is 0, and the entire attribute content area is empty, which can significantly reduce the size of the animation file. In addition, the attribute identification information of fixed attributes is empty, the attribute identification information of Boolean attributes only occupies 1 bit, and the attribute identification information of simple animation attributes, discrete animation attributes, and multi-dimensional time easing animation attributes occupies 1 or 2 bits.
[0186] From the above content, it can be known that the attribute identification information can be used to represent the status information of each attribute in the attribute structure table corresponding to the animation tag code, and the attribute type can be used to determine the number of bits that the attribute identification information may occupy. When encoding, the attribute identification information corresponding to each attribute can be determined according to the attribute type corresponding to each attribute and the animation data. When decoding, the number of bits that the attribute identification information corresponding to each attribute may occupy can be determined first according to the attribute type of each attribute, and then further parsed according to the parsing rules of the attribute identification information to obtain the attribute identification information corresponding to each attribute, thereby determining how to read the attribute content corresponding to each attribute.
[0187] It should be noted that the number of attributes in the attribute structure table corresponding to each animation tag code, the data type of each attribute, the attribute type, the order of the attributes, and the default value corresponding to the attributes are all embedded in the parsing code, that is, hard-coded in the parsing code, and do not need to be written into the animation file during encoding, which can reduce the size of the animation file. Or, it can be said that the attribute structure table corresponding to the animation tag code is hard-coded in the parsing code. For example, the terminal can parse the animation file through the PAG SDK and then render and play it. The above information corresponding to the attribute structure table corresponding to each animation tag code can be hard-coded in the PAG SDK.
[0188] Specifically, when it is necessary to encode the animation data corresponding to a certain animation tag code, the terminal can first query the attribute structure table corresponding to the animation tag code. When the attribute type exists in the attribute structure table, it is necessary to first determine the attribute identification information corresponding to each attribute, and then encode the animation data corresponding to each attribute according to the attribute identification information and the dynamic attribute data structure presented by the attribute structure table to obtain the attribute content, and use the dynamic attribute data block composed of each pair of attribute identification information and attribute content as the node element content corresponding to the animation tag code. Furthermore, the attribute identification information of each attribute in the dynamic attribute data structure presented by the attribute structure table can be determined according to the corresponding attribute type and the animation data itself.
[0189] In one embodiment, the animation data encoding method further includes:
[0190] When the attribute type does not exist in the attribute structure table corresponding to the animation tag code, the attribute values corresponding to each attribute in the animation data are encoded in turn according to the data type and attribute order corresponding to each attribute in the attribute structure table to obtain the basic attribute data block corresponding to the animation tag code.
[0191] Specifically, when the attributes included in the animation information represented by the animation tag code are determined from type to quantity, the attribute structure table corresponding to the defined animation tag code does not contain the attribute type of each attribute, and the data type of each attribute is a basic data type. The data structure presented by the attribute structure table is also called the basic data structure. For example, for the animation tag code "7" representing the size and color information of the border, the corresponding attribute structure table does not contain the attribute type, nor does it contain the default value corresponding to each attribute. When encoding, the node element content after the node element header corresponding to the animation tag code only needs to be encoded according to the basic data structure presented by the attribute structure table. The basic data structure here is determined based on the data type and attribute order corresponding to each attribute in the attribute structure table.
[0192] S806, encoding the attribute value corresponding to each attribute in the animation data according to the attribute identification information to obtain the attribute content corresponding to each attribute.
[0193] As mentioned above, the attribute identification information is used to represent the status information of each attribute in the attribute structure table corresponding to the animation tag code. Therefore, after determining the attribute identification information corresponding to each attribute, we can determine whether the attribute content corresponding to each attribute exists, that is, whether it is the default value. If it is the default value, the corresponding attribute content is empty. If not, it is necessary to encode the attribute value corresponding to the attribute in the animation data according to the attribute type and data structure corresponding to the attribute to obtain the attribute content corresponding to the attribute. It is also possible to determine whether the attribute value corresponding to the attribute includes animation interval characteristic data and whether it includes spatial easing parameter information based on the attribute identification information. If so, the attribute value corresponding to the attribute can be encoded according to the data structure corresponding to the animation interval characteristic data to obtain the corresponding attribute content.
[0194] In one embodiment, the attribute type corresponding to the attribute is a common attribute or a Boolean attribute, and the attribute identification information corresponding to the attribute only includes a content identification bit; the attribute identification information corresponding to each attribute is determined, including: if the attribute value corresponding to the attribute in the animation data is not a default value, then the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the attribute value corresponding to the attribute in the animation data is a default value, then the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
[0195] Specifically, if the attribute type corresponding to the attribute is a common attribute (Value), the attribute identification information corresponding to the attribute only includes the content identification bit. The content identification bit is used to identify whether the attribute content corresponding to the attribute exists. If it exists, that is, when the attribute value corresponding to the attribute is not the default value, the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block, and the value can be 1; when the attribute content corresponding to the attribute is the default value, the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, and the value can be 0. In other words, if the attribute type corresponding to the attribute is a common type, the attribute identification information corresponding to the attribute is either 1 or 0. In fact, the content identification bit is used to determine whether the attribute value corresponding to the attribute is the default value. The value of the identification bit is specifically encoded as 1 or 0 according to the set identification bit encoding rules. If the attribute value corresponding to the attribute is the default value, then a identification bit (for example, when the content identification is 0) is used to directly indicate that the attribute value corresponding to the attribute is the default value. There is no need to store the actual value in the attribute content area, which can reduce the size of the animation file. If the attribute value corresponding to the attribute is not the default value, then it is necessary to encode the attribute value corresponding to the attribute in the content area corresponding to the attribute in the attribute content area to obtain the attribute content corresponding to the attribute.
[0196] In the decoding stage, when parsing the attribute value corresponding to the attribute, the attribute type corresponding to the attribute is first determined according to the attribute structure table. If it is a common attribute, it means that the attribute identification information corresponding to the attribute in the dynamic attribute data block only occupies 1 bit. When the attribute identification information corresponding to the attribute read from the dynamic attribute data block is 0, it means that the attribute value corresponding to the attribute is the default value. When 1 is read, the attribute content corresponding to the attribute is continued to be read from the dynamic attribute data block to obtain the attribute value corresponding to the attribute.
[0197] If the attribute type corresponding to the attribute is a Boolean type (BitFlag), the corresponding attribute value is true or false. As mentioned above, one bit can be used to represent the value of the attribute. When encoding, the corresponding attribute value can be directly represented by the content identifier. When the corresponding attribute value is true, the content identifier corresponding to the attribute can be encoded into a value representing true, which can be 1, for example; when the corresponding attribute value is false, the content identifier corresponding to the attribute can be encoded into a value representing false, which can be 0, for example. Accordingly, when parsing the attribute value corresponding to the attribute in the decoding stage, the attribute type corresponding to the attribute is first determined according to the attribute structure table, which is a Boolean attribute, indicating that the attribute identification information corresponding to the attribute in the dynamic attribute data block only occupies 1 bit, and the value of the bit is the attribute value corresponding to the attribute. That is to say, for a Boolean attribute, when parsing the attribute, the value of the content identifier read is directly used as the corresponding attribute value, and there is no need to parse the attribute content area of the dynamic attribute data block.
[0198] In one embodiment, the attribute type corresponding to the attribute is a fixed attribute, and the attribute identification information is empty; according to the attribute identification information, the attribute value corresponding to each attribute in the animation data is encoded to obtain the attribute content corresponding to each attribute, including: directly encoding the attribute value corresponding to the attribute in the animation data according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
[0199] Specifically, when the attribute type of an attribute is a fixed attribute (FixedValue), it means that the attribute value corresponding to the attribute is fixed and does not need to be identified by attribute identification information. When encoding, the attribute value corresponding to the attribute needs to be encoded according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute. For example, in the attribute structure table representing mask information, the first attribute represents the mask identifier (id) of the mask, and the attribute type corresponding to the attribute is a fixed attribute, which means that the mask identifier needs to be encoded according to the corresponding data type to obtain the corresponding attribute content.
[0200] In one embodiment, the attribute type corresponding to the attribute is a simple animation attribute, a discrete animation attribute, a multi-dimensional time-delayed animation attribute, or a space-delayed animation attribute, and the attribute identification information at least includes a content identification bit; the attribute identification information corresponding to each attribute is determined, including: if the attribute value corresponding to the attribute in the animation data is not a default value, then the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the attribute value corresponding to the attribute in the animation data is a default value, then the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
[0201] Specifically, when the property type corresponding to the property is a simple animation property (SimpleProperty), a discrete animation property (DiscreteProperty), a multi-dimensional time slow-motion animation property (MultiDimensionProperty) or a spatial slow-motion animation property (SpatialProperty), the property identification information corresponding to the property at least includes a content identification bit. Similarly, when the property value corresponding to the property in the animation data is a default value, the actual property value does not need to be stored in the dynamic property data block, and it is only necessary to encode the content identification bit into a value indicating that the property value is a default value, which can be 0. When this value is parsed in the decoding stage, it means that there is no property content corresponding to the property in the dynamic property data block, and it is only necessary to use the default value corresponding to the property as the corresponding property content.
[0202] When the attribute value corresponding to the attribute in the animation data is not the default value, the actual attribute value needs to be stored in the dynamic attribute data block, and the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block, and the value can be 1. When the content identification bit is 1, the attribute identification information also includes at least the animation interval identification bit, that is, the attribute identification information occupies at least 2 bits. The animation interval identification bit is used to indicate whether the attribute value corresponding to the attribute includes animation interval special effects data. In the decoding stage, when the value of the content identification bit is read to indicate that the attribute content corresponding to the attribute exists in the dynamic attribute data block, the value of the next bit of the content identification bit is read as the value of the animation interval identification bit.
[0203] In one embodiment, the attribute identification information also includes an animation interval identification bit; when the value of the content identification bit indicates that there is attribute content corresponding to the attribute in the dynamic attribute data block, the method also includes: if the attribute value includes animation interval characteristic data, then the animation interval identification bit is encoded into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the animation interval characteristic data; if the attribute value does not include the animation interval characteristic data, then the animation interval identification bit is encoded into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the animation interval characteristic data.
[0204] Among them, animation interval characteristic data is the basic unit of animation data, and most of the attributes of animation data include animation interval characteristic data. If the attribute value corresponding to the attribute includes animation interval characteristic data, the animation interval characteristic data describes the animation data corresponding to multiple animation intervals on the attribute, and each animation interval corresponds to a time axis. The animation characteristic data of each animation interval describes the change relationship of the attribute on a certain time axis, which actually describes the change relationship of each animation frame corresponding to the time axis corresponding to the attribute. The relationship can be a linear relationship, a Bezier curve relationship, or a static relationship (that is, the attribute value corresponding to the attribute in a time axis remains unchanged).
[0205] In one embodiment, the attribute value corresponding to each attribute in the animation data is encoded according to the attribute identification information to obtain the attribute content corresponding to each attribute, including: if the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the animation interval characteristic data, then the attribute value corresponding to the attribute in the animation data is encoded directly according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
[0206] Specifically, the number of animation intervals in the attribute value corresponding to the attribute can be 0 or more. When the number is 0, it means that the attribute only includes one valid value, indicating that the attribute value corresponding to the attribute does not include animation interval characteristic data. Then, the animation interval identification bit needs to be encoded into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include animation interval characteristic data. The value can be 0. In this case, the attribute identification information corresponding to the attribute is determined to be "10". When encoding the attribute value corresponding to the attribute, the attribute value is directly encoded according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
[0207] In one embodiment, the attribute values corresponding to each attribute in the animation data are encoded according to the attribute identification information to obtain the attribute content corresponding to each attribute, including: if the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data corresponding to the attribute is encoded to obtain the attribute content corresponding to the attribute.
[0208] Specifically, when the number of animation intervals in the attribute value corresponding to the attribute is 1 or more, the animation interval identification bit needs to be encoded into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the animation interval characteristic data, and the value can be 1. In this case, it is necessary to record the characteristic data corresponding to each animation interval according to the data structure of the animation interval, and encode the characteristic data of each animation interval according to the data storage structure (property storage structure) of multiple animation interval characteristic data to obtain the attribute content corresponding to the attribute. The following table gives the information to be recorded for an animation interval:
[0209]
[0210] An animation interval includes the start and end time of each interval, as well as the attribute value corresponding to the start time, the attribute value corresponding to the end time, the interpolator type that identifies the attribute value calculation method, time easing parameters, etc. For attributes whose attribute type is a multi-dimensional time easing attribute, its animation interval may also contain multi-dimensional time easing parameters; for attributes whose attribute type is a spatial easing animation attribute, the animation interval may also contain spatial easing parameters. startValue and endValue represent the start and end values of this animation interval, and the corresponding startTime and endTime represent the start and end times of this animation interval. Therefore, when the time value is equal to startTime, the corresponding attribute value is startValue, and when the time value is equal to endTime, the corresponding attribute value is endValue. At the time between startTime and endTime, the value of the attribute is determined by the interpolator type. According to the characteristics of the animation feature data in the animation file, the defined interpolator types are shown in the following table:
[0211]
[0212] Combined with the data structure of the animation interval, it can be seen that when the value of the interpolator type is not equal to 2 (Bezier), it is not necessary to store the time easing parameters bezierOut and bezierIn of the animation interval. When the attribute type is a discrete easing animation attribute, it means that the value of the interpolator type must be 3 (Hold), or the default is 3, so there is no need to store the value of the interpolator type. This usually occurs when the basic data type of the attribute is a Boolean type or an enumeration type. Its data is discrete, either true or false, and there is no possibility of intermediate interpolation between true and false. When the attribute type is a multi-dimensional time easing animation attribute, it means that the time easing parameters are composed of multiple Bezier curves, and each Bezier curve controls the easing of a component of the data value separately. Dimensionality indicates the dimension of the time easing parameter array for each animation interval, and specifically how many Bezier curves there are. This is determined based on the data types of startValue and endValue. For example, when the data type is Point, the time easing parameter is a 2D array, and dimensionality is 2. The two Bezier curves control the independent easing of the x-axis and y-axis respectively, which means that the value of the x-axis coordinate in the Point data type is controlled by two Bezier curves, and the value of the y-axis coordinate is also controlled by two Bezier curves. For most cases that are not multi-dimensional time easing animation attributes, there is no need to determine the dimension based on the basic data type. By default, only one-dimensional time easing parameters are stored, that is, dimensionality is always 1. When the attribute type is a spatial easing animation attribute, it means that there may be spatial easing parameters in the animation interval. At this time, it is necessary to determine whether these parameters exist in the actual current animation interval based on the spatial easing parameter flag.
[0213] When the animation interval identification bit corresponding to the attribute is 1, the attribute identification information also includes at least the spatial easing parameter identification bit, that is, the attribute identification information occupies 3 bits. The spatial easing parameter identification bit is used to indicate whether the attribute value corresponding to the attribute includes spatial easing parameters. In the decoding stage, when the value of the animation interval identification bit is read to indicate that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, the value of the next bit of the animation interval identification bit is read as the value of the spatial easing parameter identification bit.
[0214] In one embodiment, the attribute type corresponding to the attribute is a spatial easing animation attribute, and the attribute identification information also includes a spatial easing parameter identification bit; when the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, the method also includes: if the animation interval characteristic data includes the spatial easing parameter, then the spatial easing parameter identification bit is encoded into the attribute content corresponding to the attribute stored in the dynamic attribute data block including the value of the spatial easing parameter; if the animation interval characteristic data does not include the spatial easing parameter, then the spatial easing parameter identification bit is encoded into the attribute content corresponding to the attribute stored in the dynamic attribute data block not including the value of the spatial easing parameter.
[0215] Among them, the spatial easing parameter is a parameter used to describe complex animation effects. Only when the attribute type corresponding to the attribute is a spatial easing animation attribute, the attribute identification information corresponding to the attribute may occupy three bits, and the premise for the existence of the spatial easing parameter identification bit is that the content identification bit and the animation interval identification bit are both 1. For other attribute types, there is no need to determine whether there is a third identification bit, nor is there a need to store the spatial easing parameter.
[0216] In one embodiment, the attribute values corresponding to each attribute in the animation data are encoded according to the attribute identification information to obtain the attribute content corresponding to each attribute, including: when the value of the spatial easing parameter identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the spatial easing parameter, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data corresponding to the attribute is encoded to obtain the attribute content corresponding to the attribute including the spatial easing parameter.
[0217] Specifically, if the animation interval characteristic data includes a spatial easing parameter, the spatial easing parameter identification bit is encoded into the attribute content corresponding to the attribute stored in the dynamic attribute data block, including the value of the spatial easing parameter, which may be 1. In this case, the attribute identification information corresponding to the attribute is determined to be "111", and when encoding the attribute value corresponding to the attribute, the animation interval characteristic data corresponding to the attribute needs to be encoded according to the data storage structure corresponding to the animation interval characteristic data to obtain the attribute content corresponding to the attribute.
[0218] In one embodiment, the attribute values corresponding to each attribute in the animation data are encoded according to the attribute identification information to obtain the attribute content corresponding to each attribute, including: when the value of the spatial easing parameter identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the spatial easing parameters, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data corresponding to the attribute is encoded to obtain the attribute content corresponding to the attribute that does not include the spatial easing parameters.
[0219] Specifically, if the animation interval characteristic data does not include the spatial easing parameter, the spatial easing parameter identification bit is encoded into a value in which the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the spatial easing parameter, and the value may be 0. In this case, the attribute identification information corresponding to the attribute is determined to be "110", and when encoding the attribute value corresponding to the attribute, the animation interval characteristic data corresponding to the attribute needs to be encoded according to the data storage structure corresponding to the animation interval characteristic data, and the obtained attribute content does not include the spatial easing parameter.
[0220] In one embodiment, the fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the corresponding attribute of each animation interval.
[0221] The data storage structure corresponding to the animation interval characteristic data is shown in the following table:
[0222]
[0223]
[0224] From the data storage structure (also called Property storage structure) of the animation interval characteristic data given in the table above, it can be seen that when storing the animation characteristic data of multiple animation intervals, one type of data for each animation interval is stored in turn and then the next type of data is stored in a centralized manner, rather than storing all the data of one animation interval first and then storing all the data of the next animation interval. The advantage of this is that similar data can be stored and compressed in a centralized manner, reducing storage space. For example, the value of the interpolator type usually only occupies 2 bits. Centralized storage can reduce the extra space waste caused by byte alignment. For another example, the startValue and startTime of the next animation interval are always equal to the endValue and endTime of the previous animation interval. Centralized storage can also skip the repeated data between animation intervals that do not need to be stored, which can further compress the storage space.
[0225] It should be noted that when decoding data stored in the data storage structure corresponding to the animation characteristic data, byte alignment must be performed after reading the data value of each field, skipping the remaining bits that have not been read, starting from the next integer byte position, and then reading the data value corresponding to the next field.
[0226] As mentioned in the table above, the start value and end value (PropertyValue) of the animation interval in the animation interval property data can have different data types, and different data types correspond to different storage methods. In the PAG file, there are 15 types of start value and end value of the animation interval, and the encoding method of each type is shown in the following table:
[0227]
[0228]
[0229] As can be seen from the table above, the data types of the start and end values of the animation interval can be any of the 15 types mentioned above. In the storage structure corresponding to the animation interval characteristic data given above, valueList stores the start and end values of multiple animation intervals, and its data type is PropertyValueList. For PropertyValueList, it is actually converted into PropertyValue for storage. For example: Value <float>The storage structure of [] is a continuous Value <float>, and Value <float>The data type is Float, so Value <float>[] is actually a group of consecutive Float values. It can also be converted to other types of storage, such as: Value <uint8>The data type of [] is converted to a continuous unsigned integer encoding (UB[nBits][]) for storage. The storage method of PropertyValueList is shown in the following table:
[0230]
[0231]
[0232] In the storage structure corresponding to the animation interval characteristic data given above, timeEaseList stores the time easing parameters of multiple animation intervals, and its data type is TimeEaseValueList. The data structure of TimeEaseValueList is shown in the following table:
[0233]
[0234] Since the time easing parameter of each animation interval is a pair of control points, and the data type of each control point is Point type, the encoding method of the time easing parameters of multiple animation intervals can be as follows Fig.10 See Fig.10 In the storage method of TimeEaseValueList, the number of bits occupied by the elements in the time easing parameter array (timeEaseNumBits) is stored first, and then the time easing parameters of each animation interval are encoded in turn. Dimensionality indicates the dimensions of the bezierIn and bezierOut arrays of each animation interval. When the value of dimensionality is equal to 1, the time easing parameter of each animation interval is a pair of bezierOut(x,y) and bezierIn(x,y), which are two Point type values (4 Float types), and each Float value is encoded according to SB[timeEaseNumBits]. When the value of dimensionality is equal to 2, it includes 2 pairs of bezierOut and bezierIn values, a total of 8 Float type values. In addition to the value of timeEasenumBits, the entire TimeEaseValueList needs to store numFrames*dimensionality*4 data values.
[0235] It should be noted that when decoding, if the interpolator type of the key frame is not Bezier, then the reading of TimeEase related data is skipped directly. The bezierOut and bezierIn coordinates are stored in pairs continuously, and the bezierOut coordinates are encoded first, and then the bezierIn coordinates are encoded.
[0236] When decoding the value of timeEaseList, first read 5 bits to get timeEaseNumBits, then read the values every timeEaseNumBits bits as the coordinates of bezierOut and bezierIn of each animation interval, read numFrames*dimensionality*4 times, and get the time easing parameter array corresponding to this attribute.
[0237] Similarly, in the storage structure corresponding to the animation interval characteristic data given above, spatialEaseList stores the spatial easing parameters of multiple animation intervals, and its data type is SpatialEaseValueList. The data structure of SpatialEaseValueList is shown in the following table:
[0238]
[0239] Since the spatial easing parameter of each animation interval is a pair of control points, and the data type of each control point is Point type, the encoding method of the spatial easing parameters of multiple animation intervals can be as follows: Fig.11 See Fig.11 In the storage method of SpatialEaseValueList, consecutive bits are first used to identify whether each animation interval contains spatial easing parameters, and then the number of bits occupied by the elements in the encoding spatial easing parameter array is spatialEaseNumBits, and then the spatial easing parameters of each animation interval are encoded in turn. In the decoding stage, the reading of spatial easing parameters depends on the read spatialFlagList list and spatialEaseNumBits. The length of spatialFlagList is twice the number of animation intervals, because the spatial easing parameters of each animation interval contain two Point type data. The values in the spatialFlagList list indicate whether spatialIn and spatialOut of each animation interval exist in turn. If not, the coordinate values of spatialIn and spatialOut use the default value (0, 0). In addition, the read data is an integer, which needs to be multiplied by SPATIAL_PRECISION to convert to Float as the x and y values of Point.
[0240] It should be noted that spatialInFlag and spatialOutFlag are stored in pairs, first storing spatialInFlag and then storing spatialOutFlag. The value of floatNum, that is, the length of the spatial easing parameter array, depends on the spatialInFlag and spatialOutFlag flags. If spatialInFlag is 1, then continue to read the x, y coordinates of spatialInPoint. If spatialInFlag is 0, the x, y coordinates of the coordinate Point are the default values and do not need to be read. SpatialIn and spatialOut are stored in order, first storing the spatialIn coordinates and then storing the spatialOut coordinates.
[0241] When decoding the value of spatialEaseList, first read numFrames*2 bits to get the value of spatialFlagList, then read 5 bits to get the value of spatialEaseNumBits, and then read data every spatialEaseNumBits bits according to the value of spatialFlagList to get the spatial easing parameters of the animation interval where the spatial easing parameters exist.
[0242] S808, according to the attribute sorting corresponding to each attribute in the attribute structure table, the attribute identification information and attribute content corresponding to each attribute are stored in sequence to obtain a dynamic attribute data block corresponding to the animation tag code.
[0243] The following conclusions can be drawn from the previous analysis:
[0244] The attribute type is a common attribute. When the attribute identification information corresponding to the attribute is "1", the corresponding attribute value is directly encoded according to the data type corresponding to the attribute to obtain the attribute content; when the attribute identification information corresponding to the attribute is "0", the corresponding attribute value is the default value, and there is no need to encode the corresponding attribute value. The corresponding attribute content does not exist in the dynamic attribute data block.
[0245] The attribute type is a Boolean attribute. When the attribute identification information corresponding to the attribute is "1", it means that the attribute value corresponding to the attribute is "true". There is no need to encode the corresponding attribute value, and the corresponding attribute content does not exist in the dynamic attribute data block. Similarly, when the attribute identification information corresponding to the attribute is "0", it means that the attribute value corresponding to the attribute is "false".
[0246] The attribute type is a fixed attribute, and there is no corresponding attribute identification information. The attribute content is obtained by directly encoding the corresponding attribute value according to the corresponding data type.
[0247] The attribute type is simple animation attribute, discrete animation attribute, multi-dimensional time easing animation attribute. When the attribute identification information corresponding to the attribute is "0", the corresponding attribute value is the default value, and there is no need to encode the corresponding attribute value. The corresponding attribute content does not exist in the dynamic attribute data block; when the attribute identification information corresponding to the attribute is "10", the corresponding attribute value is not the default value and does not include animation interval characteristic data. It is necessary to obtain the attribute content after normal encoding according to the data type corresponding to the attribute; when the attribute identification information corresponding to the attribute is "11", the corresponding attribute value is not the default value and includes animation interval characteristic data. It is necessary to obtain the attribute content after encoding according to the data storage structure of the animation interval characteristic data.
[0248] The attribute type is a spatial easing animation attribute. When the attribute identification information corresponding to the attribute is "0", the corresponding attribute value is the default value, and there is no need to encode the corresponding attribute value. The corresponding attribute content does not exist in the dynamic attribute data block; when the attribute identification information corresponding to the attribute is "10", the corresponding attribute value is not the default value and does not include animation interval characteristic data. It is necessary to encode it normally according to the data type corresponding to the attribute to obtain the attribute content; when the attribute identification information corresponding to the attribute is "110", the corresponding attribute value is not the default value, and includes animation interval characteristic data, and does not include spatial easing parameters. It is necessary to encode it according to the data storage structure of animation interval characteristic data to obtain the attribute content that does not include spatial easing parameters; when the attribute identification information corresponding to the attribute is "111", the corresponding attribute value is not the default value, and includes animation interval characteristic data and spatial easing parameters. It is necessary to encode it according to the data storage structure of animation interval characteristic data to obtain the attribute content that includes spatial easing parameters.
[0249] The attribute structure table corresponding to the animation tag code includes multiple attributes. For each attribute, the attribute value corresponding to each attribute in the animation data can be encoded, that is, the attribute identification information and attribute type of each attribute are encoded to obtain the corresponding attribute content. Finally, the attribute identification information of each attribute is stored together in attribute order to obtain the attribute identification area, and the attribute content of each attribute is stored together in attribute order to obtain the attribute content area. The attribute identification area and attribute content area corresponding to the animation tag code constitute the dynamic attribute data block corresponding to the entire animation tag code. In essence, the dynamic attribute data block is the value of the node element content (TagBody) of the node element (Tag) where the animation tag code (TagCode) is located.
[0250] In the above-mentioned animation data encoding method, the animation tag code can be used to identify a group of attributes, and the attribute structure table is used to describe the data structure of a group of attributes identified by the animation tag code. When the attribute values of this group of attributes are uncertain in terms of type or quantity, or when there is a large amount of redundancy in the attribute values of the attributes, in order to avoid the problem of introducing a large number of identifier fields for describing the type or quantity of the attributes, which leads to a large volume of the animation file, a data structure of a dynamic attribute data block is introduced, which can maximize the compression of these identifiers and greatly reduce the volume occupied by the target animation file. Specifically, after obtaining the animation project file, according to a group of attributes included in the attribute structure table corresponding to the animation tag code, the attribute values of this group of attributes are obtained from the animation project file, and the attribute identification information in the dynamic attribute data block is used to describe the attribute state of the attribute. When there is an attribute type in the attribute structure table, the attribute identification information corresponding to each attribute can be determined according to the animation data, and then the attribute values corresponding to each attribute can be dynamically encoded according to the attribute identification information to obtain the corresponding attribute content, and the dynamic attribute data block corresponding to the animation tag code is obtained by combining the attribute identification information and the attribute content of each attribute in the attribute structure table, which can significantly reduce the space occupied by the animation file.
[0251] In one embodiment, the animation tag code is a bitmap synthesis tag code; the animation data corresponding to each animation tag code is obtained from the animation project file, including: playing the animation project file; taking screenshots of the playback screens corresponding to the animation project file in sequence to obtain a bitmap image sequence corresponding to the animation project file; processing the bitmap image sequence according to the bitmap sequence frame export method to obtain image binary data corresponding to the bitmap synthesis tag code.
[0252] Specifically, when the animation project file is exported by the bitmap sequence frame method to obtain the animation file, the terminal can capture the playback screen corresponding to the animation project file frame by frame into a bitmap image during the process of playing the animation project file to obtain the corresponding bitmap image sequence. In one embodiment, each frame of the animation project file can be captured by the screenshot function of the AE SDK to obtain the bitmap image corresponding to each frame, thereby obtaining the bitmap image sequence corresponding to the entire animation project file. Among them, the bitmap image sequence is processed according to the bitmap sequence frame export method to obtain the image binary data corresponding to the bitmap synthesis label code, including: comparing the bitmap image in the bitmap image sequence with the corresponding key bitmap image pixel by pixel to obtain the difference pixel area in the bitmap image; when the bitmap image is a non-key bitmap image, the difference pixel area is encoded according to the image encoding method to obtain the encoded image corresponding to the bitmap image. The encoded image is the image binary data corresponding to each bitmap image.
[0253] In essence, when the animation project file is exported by bitmap sequence frame export method to obtain the animation file, it is necessary to obtain the animation data corresponding to the bitmap composition tag code (BitmapCompositionBlock). In addition to the above-mentioned image binary data, the animation data also includes some basic attribute data of the animation. For this purpose, the attribute structure table of the defined bitmap composition tag code is shown in the following table:
[0254] Fields Data Types Remark CompositionID EncodedUint32 Logo CompositionAttributes CompositionAttributes Tag Synthetic basic properties bitmapsequences BitmapSequence Tag[] Bitmap image sequence
[0255] In the above table, CompositionAttributes is also an animation tag code, and its corresponding attribute structure table is shown in the following table:
[0256]
[0257]
[0258] BitmapSequence is also an animation tag code, and its corresponding attribute structure table is shown in the following table:
[0259]
[0260] As can be seen from the above three tables, the node element where the bitmap composition tag code is located is a nested node element, in which the node element where CompositionAttributes is located and the node element where bitmapsequence is located are nested. In addition to the image binary data obtained according to the image encoding method, the animation data corresponding to the bitmap composition tag code also includes the composition identifier (CompositionID), the basic composition attributes (CompositionAttributes), and the bitmap image sequence (sequence). The basic composition attributes include the playback duration, frame rate, and background color of the composition. The bitmap image sequence includes the width, height, number, key frame identifier, and image binary data sequence (bitmapRect[frameCount]) of the bitmap image. The image binary sequence includes the width and height of the difference pixel area corresponding to each bitmap image, the coordinates (x, y) of the starting pixel point in the difference pixel area, and the image binary data stream (fileBytes) corresponding to each difference pixel area.
[0261] like Fig.12 The following is a diagram showing the encoding structure of animation data corresponding to the bitmap sequence frame encoding method. Fig.12 When encoding, first encode the value of CompositionID according to the data type of the composition identifier in the attribute structure table corresponding to the bitmap composition tag code, and then encode the basic attribute data in sequence according to the attribute structure table of CompositionAttributes, and then encode the width, height, and frame rate framerate of the entire animation playback, and then use nBits bits to record whether each of the following frames is a key frame, and then encode the total number of bitmap images bitmapCount, and finally encode the image binary data corresponding to each bitmap image in the bitmap image sequence (bitmapsequences), that is, the coordinate value (x, y) of the starting pixel point in the difference pixel area and the corresponding image binary data fileBytes.
[0262] In one embodiment, the animation tag code is a video synthesis tag code; the animation data corresponding to each animation tag code is obtained from the animation project file, including: playing the animation project file; taking screenshots of the playback screens corresponding to the animation project file in turn to obtain a bitmap image sequence corresponding to the animation project file; processing the bitmap image sequence according to the video sequence frame export method to obtain image binary data corresponding to the video synthesis tag code.
[0263] The bitmap image sequence is processed according to the video sequence frame export method to obtain the image binary data corresponding to the video synthesis label code, including: dividing the bitmap image into a color channel bitmap and a transparency channel bitmap; synthesizing the color channel bitmap and the transparency channel bitmap to obtain a synthesized bitmap; encoding the synthesized bitmap according to the video encoding method to obtain an encoded image corresponding to the bitmap image. The encoded image is the image binary data corresponding to each bitmap image.
[0264] When the animation project file is exported to obtain the animation file by using the video sequence frame export method, it is necessary to obtain the animation data corresponding to the video composition tag code (VideoCompositionBlock).
[0265] Fields Field Type Remark CompositionID EncodedUint32 Unique ID hasAlpha Bool Is there an alpha channel? CompositionAttributes CompositionAttributes Tag videosequences VideoSequenceTag[]
[0266] VideoSequence is also an animation tag code, and the corresponding attribute structure table is shown in the following table:
[0267]
[0268]
[0269] From the attribute structure table of the video composition tag code given above, it can be seen that the node element where the video composition tag code is located is a nested node element, which nests the node element where CompositionAttributes is located and the node element where videoSequence is located. In addition to the image binary data obtained according to the video encoding method, the animation data corresponding to the video composition tag code also includes the composition identifier (CompositionID), whether a transparent channel is included (hasAlpha), the basic composition attributes (CompositionAttributes), and the video frame sequence (videoSequence). The basic composition attributes include the playback duration, frame rate, and background color of the composition. The video frame sequence includes the width, height, and transparent channel position information of the bitmap image, the parameters of the video encoding method, the key frame identifier, and the image binary data sequence (videoFrames). The image binary sequence includes the timestamp and image binary data stream (fileBytes) corresponding to each video frame.
[0270] like Fig.13 As shown in FIG. 1 , it is a coding structure diagram of animation data corresponding to the video sequence frame coding method. Fig.13 When encoding, first encode the value of CompositionID according to the data type of the composition identifier in the attribute structure table corresponding to the video composition tag code, encode the value of hasAlpha to indicate whether there is a transparent channel according to the Boolean type, and then encode the basic attribute data in sequence according to the attribute structure table of CompositionAttributes, and then encode the width, height, and frame rate framerate during the entire animation playback, followed by the transparent channel starting position information alphaStartX and alphaStartY, and then encode the video encoding parameters sps and pps, and then encode the total number of bitmap images Count, and finally encode the frame number frame and image binary data fileBytes corresponding to each composite bitmap in the video frame sequence (videoSequence) in sequence.
[0271] In one embodiment, the above-mentioned animation data encoding method also includes: encoding the file header information in sequence according to the file header organization structure to obtain file header encoding information; encoding the animation tag code, data block length and data block in sequence according to the node element organization structure to obtain node element encoding data; the data block includes a dynamic attribute data block and a basic attribute data block; organizing the file header encoding information and each node element encoding data according to the target file structure to obtain the target animation file.
[0272] The target animation file here is a PAG file, and the file organization structure of the PAG file includes a file header (FileHeader) and a node element (Tag). Therefore, when encoding the data of the entire animation file, the file header information is encoded according to the organization structure of the file header to obtain the file header encoding information. The node element organization structure includes the animation tag code, the data block length, and the data block. Therefore, for the animation data corresponding to each animation tag code obtained from the animation project file, the node element encoding data is obtained after being encoded in sequence according to the node element organization structure. The data block here includes a dynamic attribute data block and a basic attribute data block. After obtaining the file header encoding information and the node element encoding data, they are organized according to the file structure of the target animation file to obtain the target animation file.
[0273] Dynamic attribute data blocks are obtained only when the animation project file is exported in vector export mode. Basic attribute data blocks may be used when exporting in vector export mode, bitmap sequence frame export mode, and video sequence frame export mode. Different animation tag codes have different corresponding attribute structure tables. Different attributes in the attribute structure table have different attribute types. They may be encoded in basic attribute data blocks or dynamic attribute data blocks.
[0274] The following is an introduction to the attribute structure table of the 37 animation tag codes listed above.
[0275] End
[0276] Fields Data Types Remark End Unit16 Tag end mark
[0277] End is a special animation tag code that marks the end of a node element. When this tag is read during the decoding process, it indicates that the content of the node element corresponding to this End has been read. If the node element contains nested elements, that is, it includes child node elements, then if it is necessary to jump out of the current node element and continue reading, read the content from the outer byte element.
[0278] FontTables
[0279] Fields Data Types Remark count EncodedUint32 Number of fonts fontData FontData[] Font Array
[0280] FontTables is a collection of font information.
[0281] VectorCompositionBlock
[0282]
[0283]
[0284] VectorCompositionBlock is a collection of animation data derived in vector format. It can contain simple vector graphics data or one or more VectorCompositions.
[0285] Fields Data Types Remark width EncodedInt32 The width of the layer height EncodedInt32 Layer height duration EncodedUint64 Duration frameRate Float Frame rate backgroundColor Color Background Color
[0286] CompositionAttributes is the basic attribute information of composition.
[0287] ImageTables
[0288] Fields Data Types Remark count EncodedInt32 Number of pictures images ImageBytesTag[] Array of images
[0289] ImageTables is a collection of image information.
[0290] LayerBlock
[0291]
[0292]
[0293] LayerBlock is a collection of layer information.
[0294] LayerAttributes
[0295]
[0296] LayerAttributes represents information related to layer attributes.
[0297] Fields Data Types Remark solidColor Color Color Value width EncodedInt32 Width height EncodedInt32 high
[0298] LayerAttributes is the attribute information of the layer.
[0299] TextSource
[0300]
[0301]
[0302] TextSource represents text information, including basic information such as text, font, size, color, etc.
[0303] TextPathOption Tag
[0304] Fields Field Type Property Type default value Remark path Mask Tag Value null Path information reversedPath Bool Discrete Property false Whether to reverse the path perpendicularToPath Bool Discrete Property false Vertical Path forceAlignment Bool Discrete Property false Force alignment firstMargin Float SimpleProperty 0.0f Start leaving blank space lastMargin Float SimpleProperty 0.0f Final blank
[0305] TextPathOption represents text drawing information, including the drawing path, front, back, left, and right spacing, etc.
[0306] TextMoreOption Tag
[0307]
[0308] TextMoreOption indicates additional information about the text.
[0309] ImageReference Tag
[0310] Fields Data Types Remark id EncodedUint32 Image Logo
[0311] ImageReference represents an image index, which stores the image ID and indexes the actual image information through the ID.
[0312] CompositionReference Tag
[0313] Fields Data Types Remark id EncodedUint32 Logo compositionStartTime Int64 Start time
[0314] CompositionReference represents a layer combination index, which stores the ID of the layer combination and indexes the actual layer combination through the ID.
[0315] Transform2D Tags
[0316] Fields Data Types Property Type default value Remark anchorPoint Point Value (0.0) Anchor Point position Point Value (0.0) Location Information xPosition Float Value 0.0 x-axis offset yPosition Float Value 0.0 Y-axis offset scale Point Value (0.0) Zoom rotation Float Value 0.0 Rotation opacity unit8 Value 255 Transparency (0-255)
[0317] Transform2D represents 2D transformation information, including: anchor point, scale, rotation, x-axis offset, y-axis offset and other information.
[0318] Mask Tag
[0319]
[0320]
[0321] Mask represents mask information.
[0322] ShapeGroup Tags
[0323] Fields Data Types Property Type default value Remark blendMode Enumeration (Unit8) Value BlendMode::Normal Image blending modes transform ShapeTransform Value none Transform elements Shape[] Value none element
[0324] ShapeGroup represents projection information.
[0325] Rectangle Tags
[0326] Fields Data Types Property Type default value Remark reversed Bool BitFlag false Whether to flip the rectangle's logo size Point MultiDimensionProperty (100,100) Rectangle Width and Height position Point SpatialProperty (0,0) Rectangle Position roundness Float SimpleProperty 0.0f Round Corners
[0327] Rectangle represents rectangle information.
[0328] Ellipse Tags
[0329] Fields Data Types Property Type default value Remark reversed Bool BitFlag false Whether to flip the ellipse logo size Point MultiDimensionProperty (100,100) Width and Height position Point SpatialProperty (0,0) Location
[0330] Ellipse represents ellipse information.
[0331] PolyStar Tags
[0332]
[0333] PolyStar indicates information about a polygonal star.
[0334] ShapePath Tags
[0335] Fields Data Types Property Type default value Remark shapePath Path SimpleProperty none Path shape
[0336] ShapePath represents the path information of a shape.
[0337] Fill Tag
[0338]
[0339] Fill represents information related to filling.
[0340] Stroke Tags
[0341]
[0342]
[0343] Stroke represents information related to the stroke.
[0344] GradientFill Tags
[0345]
[0346]
[0347] GradientFill represents color gradient fill information.
[0348] GradientStroke Tags
[0349]
[0350] GradientStroke represents the transparency gradient information of the stroke.
[0351] MergePaths Tags
[0352] Fields Data Types Property Type default value Remark mode Enumeration (Unit8) Value MergePathsMode::Add Merge Mode
[0353] MergePaths represents information related to merge paths.
[0354] TrimPaths Tags
[0355]
[0356] TrimPaths represents information related to the path generation effect.
[0357] Repeater Tags
[0358]
[0359] Repeater represents information related to the repeater.
[0360] RoundCorners Tags
[0361] Fields Data Types Property Type default value Remark radius Float SimpleProperty 10.0f radius
[0362] RoundCorners represents information related to rounded corners.
[0363] Performance Tags
[0364] Fields Data Types Property Type default value Remark renderingTime Int64 Value 0 Rendering time imageDecodingTime Int64 Value 0 Image decoding time presentingTime Int64 Value 0 Time consumption for displaying the screen graphicsMemory Int64 Value 0 Rendering Memory
[0365] Performance represents the performance parameters of the animation.
[0366] DropShadowStyle Tags
[0367] Fields Data Types Property Type default value Remark blendMode Enumeration (Unit8) Discrete Property BlendMode::Normal Image blending modes color Color SimpleProperty Black color opacity unit8 SimpleProperty 191 Transparency (0-255) angle Float SimpleProperty 120.0f angle distance Float SimpleProperty 5.0f distance size Float Discrete Property 5.0f Size
[0368] DropShadowStyle indicates adding shadow related information.
[0369] StrokeStyle Tags
[0370]
[0371] StrokeStyle is information related to the stroke style.
[0372] TintEffect Tags
[0373]
[0374]
[0375] TintEffect is information related to the tinting effect.
[0376] FillEffect Tags
[0377] Fields Data Types Property Type default value Remark allMasks Bool BitFlag false All Masks fillMask Mask Tag Value null The mask to fill color Color SimpleProperty Red color invert Bool Discrete Property false Whether to flip the mask horizontalFeather Float SimpleProperty 0.0f Horizontal edge feathering verticalFeather Float SimpleProperty 0.0f Vertical edge feathering opacity unit8 SimpleProperty 255 Transparency (0-255)
[0378] FillEffect is information related to the fill effect.
[0379] StrokeEffect Tags
[0380]
[0381]
[0382] StrokeEffect is information related to the stroke effect.
[0383] TritoneEffect Tags
[0384]
[0385] TritoneEffect represents highlight, midtone, and shadow effects.
[0386] DropShadowEffect Tags
[0387]
[0388] DropShadowEffect represents fill shadow effect information.
[0389] FillRadialWipeEffect Tags
[0390]
[0391]
[0392] FillRadialWipeEffect represents filling radial wipe effect information.
[0393] DisplacementMapEffect Tags
[0394]
[0395] DisplacementMapEffect represents the displacement layer information.
[0396] BitmapCompositionBlock
[0397]
[0398]
[0399] BitmapCompositionBlock represents the composition exported as a bitmap sequence frame.
[0400] CompositionAttributes
[0401] Fields Data Types Remark duration EncodedUint64 Playing time frameRate Float Frame rate backgroundColor Color Background Color
[0402] CompositionAttributes represents the basic attribute information of the composition exported in the bitmap sequence frame mode.
[0403] BitmapSequence
[0404]
[0405] A BitmapSequence represents a sequence of bitmap images.
[0406] ImageBytes
[0407] Fields Field Type Remark id EncodedUint32 Logo width EncodedInt32 Image width width EncodedInt32 Image width anchorX EncodedInt32 x-axis coordinate anchorY EncodedInt32 y-axis coordinate fileBytes ByteData Image byte stream
[0408] ImageBytes represents the encoded image attribute information.
[0409] ImageBytes2
[0410] Fields Field Type Remark id EncodedUint32 Logo width EncodedInt32 Image width width EncodedInt32 Image width anchorX EncodedInt32 x-axis coordinate anchorY EncodedInt32 y-axis coordinate fileBytes ByteData Image byte stream scaleFactor Float Scaling ratio (0~1.0)
[0411] ImageBytes2 stores image-related attribute information, and has an additional scaleFactor attribute compared to ImageBytes.
[0412] Compared with ImageBytes2, ImageBytes3 only removes the transparent border, and the attribute value remains unchanged.
[0413] VideoCompositionBlock
[0414] Fields Field Type Remark CompositionID EncodedUint32 Unique ID hasAlpha Bool Is there an alpha channel? CompositionAttributes CompositionAttributes Tag Synthetic basic properties videosequences VideoSequenceTag[] Video frame sequence
[0415] VideoCompositionBlock represents the composition exported in the same way as the video sequence frames are exported.
[0416] VideoSequence
[0417]
[0418]
[0419] VideoSequence represents a sequence of frames.
[0420] like Fig.14 As shown, in one embodiment, a method for decoding animation data is provided. This embodiment mainly applies this method to the above Figure 1 The terminal 110 in FIG. Fig.14 , the animation data decoding method specifically includes the following steps:
[0421] S1402, obtaining an animation tag code.
[0422] When parsing a PAG file, in addition to the file header information that needs to be decoded according to the file header organization structure, the remaining node elements need to be decoded according to the node element organization structure. The node end character (End) is a special node element that is used to indicate that all node elements at this level have been read and there are no more node elements to be read. Therefore, when the node end character (0) is read, it indicates that the content of the current node element has been read, and the data obtained by continuing to read is the content of the next node element. Of course, if the node element is a nested node element, including multiple child node elements, the data obtained by continuing to read after the node end character is the content of the outer node element, until the node end character corresponding to the outermost node element is obtained or the byte stream length of the outermost node element content is read, it indicates that there is no more content to be read in the outermost node element.
[0423] According to the node element organization structure described above, node elements include node element header (TagHeader) and node element content (TagBody). The node element header includes the animation tag code (TagCode) and the byte stream length (Length) of the node element content. The node element header is divided into short type and long type. Regardless of the short type or long type, the first 10 bits of the first 2 bytes of the node element header represent the animation tag code. Therefore, after reading the animation tag code (0) corresponding to END, continue to read 2 bytes. The first 10 bits of these 2 bytes represent the animation tag code included in the next node element. If the last 6 bits of the first 2 bytes are not "0x3f", it means that the node element header of the node element is of short type. According to the organization structure of the short type node element header, the value of the last 6 bits represents the byte stream length (Length) of the node element content (TagBody). If the last 6 bits of the first 2 bytes are "0x3f", it means that the node element header of the node element is of long type. According to the organizational structure of the node element header of long type, continue to read the 4 bytes after these 2 bytes, and the data value obtained represents the byte stream length (Length) of the node element content (TagBody). The value of the byte stream length represents the number of bytes occupied by the node element content. After parsing the byte stream length, it can be determined how many bytes of data after the node element header belong to the node element content of the current node element.
[0424] The animation tag code is used to indicate which type of animation information is recorded in the node element. Different animation tag codes indicate different animation information. After parsing a certain animation tag code, it is possible to determine what animation information the node element content of the current node element represents. The node element content of different animation information has different encoding structures. Therefore, obtaining the animation tag code in each node element is a prerequisite for accurately parsing each node element, especially the node element content.
[0425] As mentioned above, PAG files use 10 bits to store animation tag codes, and can store up to 1024 different animation tag codes. Currently, PAG files only use 37 animation tag codes, of which 0-29 are animation tag codes supported by the vector export method, and 45-51 are 7 animation tag codes extended for the bitmap sequence frame export method and the video sequence frame export method. If subsequent PAG files can support more animation features, new animation tag codes can be further extended to represent the animation information corresponding to the newly added animation features.
[0426] Furthermore, after parsing an animation tag code, it is necessary to parse the node element content of the current node element according to the attribute structure table corresponding to the animation information represented by the animation tag code. There are mainly two situations. When the attribute type does not exist in the attribute structure table corresponding to the parsed animation tag code, the data in the node element content is stored in the form of a basic attribute data block. When the attribute type exists in the attribute structure table corresponding to the parsed animation tag code, the data in the node element content is stored in the form of a dynamic attribute data block.
[0427] S1404, when there is an attribute type in the attribute structure table corresponding to the animation tag code, the attribute identification information corresponding to each attribute is parsed from the dynamic attribute data block corresponding to the animation tag code according to the attribute type corresponding to each attribute in the attribute structure table.
[0428] Among them, the attribute structure table defines the data structure of the animation information corresponding to the animation tag code. When an attribute type exists in the attribute structure table corresponding to a certain animation tag code, it indicates that the node element content after the node element header corresponding to the animation tag code needs to be decoded according to the dynamic attribute data structure. The dynamic attribute data block mainly consists of two parts: an attribute identification area composed of attribute identification information (AttributeFlag) corresponding to each attribute and an attribute content area composed of attribute content (AttributeContent) corresponding to each attribute. The attribute type (AttributeType) is used to determine the number of bits occupied by the attribute identification information and the corresponding attribute content reading rules. Attribute types include common attributes, Boolean attributes, fixed attributes, simple animation attributes, discrete animation attributes, multi-dimensional time easing animation attributes, and space easing animation attributes.
[0429] Taking mask information as an example, when the animation tag code "14" representing the mask information is read, since the attribute type exists in the attribute structure table corresponding to the mask information, the node element content of the current node element needs to be parsed according to the dynamic attribute data structure. In general, the attribute identification area in the dynamic attribute data block is parsed first, and then a unified byte alignment is performed and the attribute content area is read from the integer byte position, and the attribute content corresponding to each attribute in the attribute structure table corresponding to the mask information is obtained in turn.
[0430] The attribute identification information may be empty. The attribute identification information may include at least a content identification bit, and may also include an animation interval identification bit and a spatial easing parameter identification bit. The content identification bit (exist) is used to indicate whether the attribute content corresponding to the attribute exists in the dynamic attribute data block or is equal to the default value. The animation interval identification bit (animatable) is used to indicate whether the attribute value corresponding to the attribute includes animation interval special effects data. The spatial easing parameter identification bit (hasSpatial) is used to indicate whether the attribute value corresponding to the attribute includes spatial easing parameters. The number of bits occupied by the attribute identification information corresponding to attributes of different attribute types is dynamic, and the value range is 0-3 bits. The specific number of bits occupied by each attribute needs to be determined according to the attribute type. In other words, the attribute type can be used to determine the number of bits (0-3 bits) that the attribute identification information may occupy. Ordinary attributes may only occupy 1 bit at most, and only the content identification bit needs to be read during decoding. The spatial easing animation attribute will occupy up to 3 bits to store the attribute identification information. For example, when a spatial easing animation attribute does not contain animation interval characteristic data and the attribute value is equal to the default value, only 1 bit is needed to represent the attribute identification information. The attribute identification information only includes the attribute content flag bit, whose value is 0, indicating that the corresponding attribute content is the default value. When decoding, the content identification bit read is 0, which means that the attribute identification information of the attribute has been read and the value of the next bit will not be read. In the extreme case, each attribute in the attribute structure table does not contain animation interval characteristic data and is equal to the default value. In this case, only attribute number bits will be used to store the attribute identification information corresponding to each attribute, and each attribute identification information only includes the content identification bit, whose value is 0.
[0431] The following are the parsing rules for attribute identification information corresponding to different attribute types:
[0432] The attribute identification information of a common attribute occupies only one bit. When reading the attribute identification information corresponding to the attribute, only the value of one bit needs to be read.
[0433] The attribute identification information of a Boolean attribute occupies only one bit. When reading the attribute identification information corresponding to the attribute, only one bit needs to be read, and the value of the bit is the attribute value corresponding to the attribute.
[0434] The attribute identification information of the fixed attribute does not occupy any bit, so there is no need to read the attribute identification information corresponding to the attribute from the dynamic attribute data block.
[0435] The attribute identification information of simple animation attributes, discrete animation attributes, and multi-dimensional time easing animation attributes occupies 1-2 bits. When the value of the first bit is 1, it means that the attribute value corresponding to the attribute is not the default value, and the second bit needs to be read to obtain the attribute identification information "11" or "10" corresponding to the attribute. When the value of the first bit is 0, it means that the attribute value corresponding to the attribute is the default value and the attribute identification information only occupies 1 bit, that is, "1".
[0436] The attribute identification information of the spatial easing animation attribute occupies 1-3 bits. When the value of the first bit is read as 1, it means that the attribute value corresponding to the attribute is not the default value, and the second bit needs to be read; if the value of the second bit is 0, the attribute content corresponding to the attribute does not include the animation interval characteristic data, thereby obtaining the attribute identification information "10" corresponding to the attribute, and the subsequent data cannot be read as the attribute identification information corresponding to the attribute; if the value of the second bit is 1, the attribute content corresponding to the attribute includes the animation interval characteristic data, and the third bit needs to be read; if the value of the third bit is 0, the attribute content corresponding to the attribute does not include the spatial easing parameters, and the attribute identification information "110" corresponding to the attribute is determined; if the value of the third bit is 1, the attribute content corresponding to the attribute includes the spatial easing parameters, and the attribute identification information "111" corresponding to the attribute is determined; if the value of the first bit is read as 0, it means that the attribute value corresponding to the attribute is the default value and the attribute identification information only occupies 1 bit, that is, "1", and the subsequent data cannot be read as the attribute identification information corresponding to the attribute.
[0437] In one embodiment, according to the attribute type corresponding to each attribute in the attribute structure table, the attribute identification information corresponding to each attribute is parsed from the dynamic attribute data block corresponding to the animation tag code, including: querying the attribute structure table to obtain the attribute sorting corresponding to each attribute; determining the number of bits occupied by the attribute identification information corresponding to each attribute according to the attribute type corresponding to each attribute; reading data starting from the first bit in the dynamic attribute data block corresponding to the animation tag code; and determining the attribute identification information corresponding to each attribute from the data read sequentially according to the attribute sorting based on the number of bits occupied by the attribute identification information corresponding to each attribute.
[0438] In fact, the number of attributes included in the attribute structure table, attribute order, attribute types corresponding to the attributes, and default values corresponding to the attributes are all hard-coded in the parsing code. When a certain animation tag code is parsed, the corresponding attribute structure table information can be directly determined based on the parsing code, including attribute order, attribute types corresponding to the attributes, data types, quantity, and default values.
[0439] Specifically, when parsing the attribute identification information corresponding to each attribute from the dynamic attribute data block, the number of bits that may be occupied by the attribute identification information corresponding to each attribute is first determined based on the attribute type corresponding to each attribute. In addition, data is read from the attribute identification area of the dynamic attribute data block in sequence according to the attribute sorting corresponding to each attribute, and the read data is also parsed according to the encoding rules of the attribute identification information of different attribute types to accurately determine the attribute identification information corresponding to each attribute.
[0440] In one embodiment, when the attribute type does not exist in the attribute structure table corresponding to the animation tag code, the attribute values corresponding to each attribute are read from the basic attribute data block corresponding to the animation tag code in sequence according to the data type and attribute sorting corresponding to each attribute in the attribute structure table.
[0441] Specifically, when the attribute type does not exist in the attribute structure table corresponding to the animation tag code, it indicates that the node element content after the node element header corresponding to the animation tag code needs to be decoded according to the basic attribute data structure. In essence, the node element content is parsed according to the data type and attribute order corresponding to each attribute in the attribute structure table corresponding to the animation tag code, and the attribute value corresponding to each attribute is obtained in turn.
[0442] For example, when the parsed animation tag code value is "7", it means that the current node element represents the size and color information of the border, but the attribute type does not exist in the attribute structure table corresponding to this information. The attribute structure table only includes three fields, namely solidColor, width and height. The data type of solidColor is Color, and the Color type needs to occupy three bytes, which represent the values of red, green and blue respectively. The data types of width and height are EncodedInt32. When decoding the node element content of the node element where the animation tag code is located, it is necessary to read 24 bits first to obtain the value of solidColor, and then read the values of width and height in turn according to the encoding rules of EncodedInt32 to obtain the various attribute values of the animation information to be represented by the current node element.
[0443] S1406: parse the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute.
[0444] Since the attribute identification information identifies the state of each attribute, the states can be divided into the following types, such as whether the attribute value is the default value or exists in the attribute content area of the dynamic attribute data block, and if the attribute value exists in the attribute content area of the dynamic attribute data block, whether the attribute content includes animation interval characteristic data, and whether the attribute content includes spatial easing parameters. Since the encoding methods of the corresponding attribute values under different states are different, the state of each attribute is determined according to the attribute identification information corresponding to each attribute, which also determines what data structure should be used to parse the attribute content from the dynamic attribute data block, or how to parse the corresponding attribute value.
[0445] Specifically, after obtaining the attribute identification information corresponding to each attribute, the attribute content corresponding to each attribute can be parsed from the dynamic attribute data block according to the state of the attribute identified by the attribute identification information, using the parsing method corresponding to each state. Each attribute type and the parsing method corresponding to different values of the attribute identification information of each attribute type are different, which are described in detail below.
[0446] In one embodiment, the attribute type is a common attribute, and the attribute identification information only includes a content identification bit; the attribute content corresponding to each attribute is parsed from the dynamic attribute data block according to the attribute identification information corresponding to each attribute, including: if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, then the attribute content corresponding to the attribute is read from the dynamic attribute data block according to the data type corresponding to the attribute; if the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, then the default value corresponding to the attribute is queried from the attribute structure table.
[0447] When the attribute type is a common attribute, the attribute identification information only includes the content identification bit, that is, the attribute identification information only occupies one bit. If the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, the value of the content identification bit can be 1, for example, that is, when the attribute content corresponding to the attribute is not the default value, it is necessary to parse the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute. If the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, the value of the content identification bit can be 0, for example, that is, when the attribute content corresponding to the attribute is the default value, the default value corresponding to the attribute is directly obtained, and it is not necessary to parse the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute.
[0448] In one embodiment, the attribute type is a fixed attribute, and the attribute identification information is empty; the attribute content corresponding to each attribute is parsed from the dynamic attribute data block according to the attribute identification information corresponding to each attribute, including: directly reading the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute.
[0449] The attribute type is a fixed attribute, and the attribute identification information of the fixed attribute is empty and does not occupy any bit. In fact, this is because the attribute value corresponding to the fixed attribute must exist in the attribute content area of the dynamic attribute data block. Therefore, the attribute content corresponding to the attribute can be directly read from the dynamic attribute data block according to the data type corresponding to the attribute.
[0450] In one embodiment, the attribute type is a Boolean attribute, and the attribute identification information only includes a content identification bit; the attribute content corresponding to each attribute is parsed from the dynamic attribute data block according to the attribute identification information corresponding to each attribute, including: directly using the value of the content identification bit as the attribute content corresponding to the attribute.
[0451] The attribute type is Boolean type. Boolean attributes only occupy one bit, and the value of this bit is the value corresponding to the attribute. Therefore, the value of the content identifier can be directly used as the attribute value corresponding to the attribute. When the value of the content identifier is 1, the attribute value corresponding to the attribute is true; when the value of the content identifier is 0, the attribute value corresponding to the attribute is false.
[0452] In one embodiment, the attribute type is a simple animation attribute, a discrete animation attribute, a multi-dimensional time-delayed animation attribute, or a space-delayed animation attribute, and the attribute identification information at least includes a content identification bit; the attribute content corresponding to each attribute is parsed from the dynamic attribute data block according to the attribute identification information corresponding to each attribute, including: if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, then the attribute content corresponding to the attribute is read from the dynamic attribute data block; if the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, then the default value corresponding to the attribute is queried according to the attribute structure table.
[0453] When the property type corresponding to the attribute is a simple animation property (SimpleProperty), a discrete animation property (DiscreteProperty), a multi-dimensional time slow-motion animation property (MultiDimensionProperty) or a spatial slow-motion animation property (SpatialProperty), the property identification information corresponding to the attribute includes at least a content identification bit. Similarly, when the value of the content identification bit is parsed to indicate that the attribute value is not the default value, that is, it indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, for example, the value of the content identification bit may be 1, then it is necessary to read the attribute content corresponding to the attribute from the dynamic attribute data block. When the value of the content identification bit is parsed to indicate that the attribute value is the default value, that is, it indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, for example, the value of the content identification bit may be 0, then it is only necessary to use the default value corresponding to the attribute as the corresponding attribute content.
[0454] In one embodiment, if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, the attribute content corresponding to the attribute is read from the dynamic attribute data block, including: when the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, read the value of the next bit of the content identification bit as the value of the animation interval identification bit; if the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, then according to the data storage structure corresponding to the animation interval characteristic data, parse the animation interval characteristic data corresponding to the attribute from the dynamic attribute data block; if the value of the animation interval identification bit indicates that the attribute content does not include animation interval characteristic data, then directly parse the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type of the attribute.
[0455] Specifically, when the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, for example, when the content identification bit is 1, the attribute identification information corresponding to the attribute also includes at least the animation interval identification bit, that is, the attribute identification information occupies at least 2 bits. When the value of the next bit of the content identification bit (for example, 1) is read, it indicates that the attribute content includes the animation interval characteristic data, that is, the second bit of the attribute identification information is also 1, then it is necessary to parse the attribute content corresponding to the attribute in the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data. When the value of the next bit of the content identification bit (for example, 0) is read, it indicates that the attribute content does not include the animation interval characteristic data, that is, the second bit of the attribute identification information is also 0, that is, when the attribute identification information is "10", the attribute content corresponding to the attribute in the dynamic attribute data block is directly parsed according to the data type corresponding to the attribute.
[0456] In one embodiment, the fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the corresponding attribute of each animation interval.
[0457] The data storage structure corresponding to the animation interval characteristic data can refer to the explanation given in the animation data encoding method. Such a data storage structure is used to store the animation data of one or more animation intervals, and when storing the animation characteristic data of multiple animation intervals, it is to store one type of data of each animation interval in sequence and then store the next type of data in a centralized manner, rather than storing all the data of one animation interval first and then storing all the data of the next animation interval. The advantage of this is that similar data can be stored and compressed in a centralized manner, reducing storage space.
[0458] In one embodiment, the attribute type is a spatial easing animation attribute. If the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, the animation interval characteristic data corresponding to the attribute is parsed from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data, including: when the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, read the value of the next bit of the animation interval identification bit as the value of the spatial easing parameter identification bit; if the value of the spatial easing parameter identification bit indicates that the animation interval characteristic data includes spatial easing parameters, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data including the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block; if the value of the spatial easing parameter identification bit indicates that the animation interval characteristic data does not include spatial easing parameters, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data not including the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block.
[0459] Among them, the spatial easing parameter is a parameter used to describe complex animation effects. Only when the attribute type corresponding to the attribute is a spatial easing animation attribute, the attribute identification information corresponding to the attribute may occupy 3 bits, and the premise for the existence of the spatial easing parameter identification bit is that the content identification bit and the animation interval identification bit are both 1. For other attribute types, there is no need to determine whether there is a third identification bit, nor is there a need to store the spatial easing parameter.
[0460] Specifically, when the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, for example, when the animation interval identification bit is 1, the attribute identification information corresponding to the attribute also includes at least the spatial easing parameter identification bit, that is, the attribute identification information occupies 3 bits. When the value of the next bit of the animation interval identification bit read (for example, 1) indicates that the attribute content includes the spatial easing parameter, that is, when the third bit of the attribute identification information is also 1, that is, when the attribute identification information is "111", the animation interval characteristic data including the spatial easing parameter corresponding to the attribute is parsed from the dynamic attribute data block, and the spatial easing parameter also has a corresponding encoding structure, which needs to be parsed according to the corresponding encoding structure. When the value of the next bit of the animation interval identification bit read (for example, 0) indicates that the attribute content does not include the spatial easing parameter, when the third bit of the attribute identification information is 0, that is, when the attribute identification information is "110", the animation interval characteristic data corresponding to the attribute parsed from the dynamic attribute data block does not include the spatial easing parameter.
[0461] It should be noted that when parsing the attribute content according to the data storage structure of the animation interval characteristic data, it is also necessary to determine whether there is an interpolator type field for each animation interval according to the attribute type (there is no interpolator type field for discrete animation attributes, because the interpolator type defaults to Hold), and whether the animation interval characteristic data includes time easing parameters according to the parsed interpolator type (because there is no time easing parameter when the value of the interpolator type is not equal to Bezier), and whether there is a spatial easing parameter according to the attribute identification information, etc. In other words, the values of some fields in the data storage structure of the animation interval characteristic data may not exist, and it is necessary to combine the attribute type, attribute identification information, interpolator type, and the data type of the attribute value corresponding to the animation interval to judge step by step, so that the storage structure of the entire attribute content can be gradually clarified, so that the attribute content corresponding to the attribute can be parsed from the attribute content area. The parsing process of the attribute content corresponding to each attribute in the attribute structure table corresponding to the animation tag code is executed according to the previous parsing ideas.
[0462] In the above-mentioned animation data decoding method, the animation tag code can be used to identify a group of attributes, and the attribute structure table is used to describe the data structure of a group of attributes identified by the animation tag code. When the attribute values of this group of attributes are uncertain in terms of type or quantity, or when there is a lot of redundancy in the attribute values of the attributes, in order to avoid the problem of too large animation file size caused by the additional introduction of a large number of identifier fields used to describe the type or quantity of the attributes, a data structure of a dynamic attribute data block is introduced, which can maximize the compression of these identifiers and greatly reduce the volume occupied by the target animation file. Specifically, during decoding, after reading the animation tag code, when the attribute type exists in the attribute structure table corresponding to the animation tag code, it means that the attribute values of a group of attributes identified by the animation tag code are encoded in the form of a dynamic attribute data block, and the attribute identification information corresponding to each attribute can be parsed from the dynamic attribute data block corresponding to the animation tag code in combination with the attribute type corresponding to each attribute, and then based on the attribute identification information, the attribute content corresponding to each attribute can be parsed from the dynamic attribute data block to achieve decoding of the animation file.
[0463] In one embodiment, obtaining an animation tag code includes: parsing a target animation file to obtain a binary sequence; reading file header encoding information and node element encoding data of the target animation file from the binary sequence in sequence according to a target file structure of the target animation file; decoding the file header encoding information in accordance with the order of fields included in the file header organizational structure of the target animation file and the data type of each field to obtain file header information; decoding the node element encoding data in accordance with the node element organizational structure of the target animation file to obtain the animation tag code, data block length, and data blocks corresponding to each animation tag code in sequence; the data blocks include dynamic attribute data blocks and basic attribute data blocks.
[0464] The target animation file is a PAG file, and the file organization structure of the PAG file includes a file header (FileHeader) and a node element (Tag). When encoding the data of the entire animation file, the file header information is encoded according to the organization structure of the file header to obtain the file header encoding information. The node element organization structure includes an animation tag code, a data block length, and a data block. For the animation data corresponding to each animation tag code obtained from the animation project file, the node element encoding data is obtained after being encoded in sequence according to the node element organization structure. The data block here includes a dynamic attribute data block and a basic attribute data block. Therefore, after parsing and obtaining the binary sequence of the target animation file, it is necessary to decode the file header encoding information in the binary sequence according to the file header organization structure in reverse to obtain the file header information, and decode the encoding data of each node element in the binary sequence according to the node element organization structure to obtain the content included in the node element, that is, the animation tag code, the data block length, and the data block corresponding to each animation tag code.
[0465] In one embodiment, a target animation file is obtained by exporting an animation project file in accordance with a vector export method; the target animation file is parsed to obtain a binary sequence, including: obtaining a file data structure corresponding to the vector export method; parsing the target animation file according to the file data structure to obtain a binary sequence representing animation vector data.
[0466] like Fig.15 As shown in FIG. 1 , a file data structure corresponding to a vector export method in an embodiment is shown. Fig.15 , the entire target animation file is synthesized from the layer information of all layers. VectorComposition represents the entire file, which includes CompositionAttributes and Layer. CompositionAttributes represents the basic attribute data of the animation, including the animation width width, height height, etc., as well as the duration of the entire animation, frame rate framerate, background color backgroundcolor, etc. Layer represents the animation layer data, including the data corresponding to each layer. In the original animation file, different types of layers may be used, including but not limited to virtual objects (NullObjectLayer), solid color layers (SolidLayer), text layers (TextLayer), shape layers (ShapeLayer), image layers (ImageLayer), pre-composite layers (PreComposeLayer), etc. Therefore, the binary sequence obtained by parsing the target animation file is the animation vector data that describes the layer information according to the above layer structure. Taking a solid color layer as an example, the corresponding description information includes the width, height, color, and layer attributes (LayerAttributes) of the layer. The layer attributes include basic attributes and animation attribute groups. The basic attributes include the layer duration, the layer start time (which frame needs to be obtained when playing the layer), and the stretch parameter stretch, etc. The animation attribute group includes transform, mask, trackMatter, layerStyle, effect, and content. A layer is obtained by any one or more combinations of these six types of animation attribute groups.
[0467] In one embodiment, the target animation file is obtained by exporting the animation project file according to the bitmap sequence frame export method, and the target animation file is parsed to obtain a binary sequence, including: decompressing the target animation file according to the image decoding method to obtain the image binary data corresponding to the target animation file; the image binary data includes pixel data of key bitmap images in the animation project file and pixel data of difference pixel areas of non-key bitmap images.
[0468] Specifically, the target animation file obtained by exporting the animation project file according to the bitmap sequence frame export method is actually a series of coded pictures obtained by compressing and coding the difference pixel area corresponding to the non-key bitmap image and the key bitmap image according to the picture coding method. The specific steps include: obtaining the bitmap image sequence corresponding to the animation project file; comparing the bitmap image in the bitmap image sequence with the corresponding key bitmap image to obtain the difference pixel area in the bitmap image; when the bitmap image is a non-key bitmap image, encoding the difference pixel area according to the picture coding method to obtain the coded picture corresponding to the bitmap image; when the bitmap image is a key bitmap image, directly encoding the bitmap image using the picture coding method to obtain the coded picture corresponding to the bitmap image; generating the target animation file corresponding to the animation project file according to the coded pictures corresponding to each bitmap image in the bitmap image sequence.
[0469] Therefore, when parsing the target animation file, it is necessary to decode the target animation file according to the corresponding image decoding method to obtain a binary sequence of images corresponding to the target animation file. The binary data of the image includes pixel data of the key bitmap image in the animation project file and pixel data of the difference pixel area of the non-key bitmap image.
[0470] In one embodiment, a target animation file is obtained by exporting an animation project file in a video sequence frame export manner, and the target animation file is parsed to obtain a binary sequence, including: decompressing the target animation file in a video decoding manner to obtain image binary data corresponding to the target animation file; the image binary data is pixel data of a synthetic bitmap, and the synthetic bitmap is obtained by synthesizing a color channel bitmap and a transparency channel bitmap of a bitmap image included in the animation project file.
[0471] Specifically, the processing procedure of the target animation file obtained by exporting the animation project file according to the video sequence frame export method is as follows: obtain a bitmap image sequence corresponding to the animation project file; divide each bitmap image in the bitmap image sequence into a color channel bitmap and a transparency channel bitmap; synthesize the color channel bitmap and the transparency channel bitmap to obtain a synthesized bitmap; encode the synthesized bitmap according to the video encoding method to obtain an encoded picture corresponding to the bitmap image; generate a target animation file corresponding to the animation project file according to the encoded picture corresponding to each bitmap image in the bitmap image sequence.
[0472] Therefore, when parsing the target animation file, it is necessary to decode the target animation file according to the corresponding video decoding method to obtain the image binary data corresponding to the synthetic bitmap corresponding to the target animation file.
[0473] In one embodiment, Fig.16 As shown, an animation data encoding device 1600 is provided, the device comprising an animation data acquisition module 1602, an attribute identification information determination module 1604, an attribute content encoding module 1606 and a data block generation module 1608, wherein:
[0474] Animation data acquisition module 1602, used to acquire animation data corresponding to each animation tag code from the animation project file;
[0475] The attribute identification information determination module 1604 is used to determine the attribute identification information corresponding to each attribute when there is an attribute type in the attribute structure table corresponding to the animation tag code;
[0476] The attribute content encoding module 1606 is used to encode the attribute value corresponding to each attribute in the animation data according to the attribute identification information to obtain the attribute content corresponding to each attribute;
[0477] The data block generation module 1608 is used to sort the attributes corresponding to the attributes in the attribute structure table, store the attribute identification information and attribute content corresponding to the attributes in sequence, and obtain the dynamic attribute data block corresponding to the animation tag code.
[0478] In one embodiment, the animation data encoding device 1600 also includes a basic attribute data block generation module, which is used to encode the attribute values corresponding to each attribute in the animation data in turn according to the data type and attribute sorting corresponding to each attribute in the attribute structure table when the attribute type does not exist in the attribute structure table corresponding to the animation tag code, so as to obtain the basic attribute data block corresponding to the animation tag code.
[0479] In one embodiment, the attribute type corresponding to the attribute is a common attribute or a Boolean attribute, and the attribute identification information corresponding to the attribute only includes a content identification bit; the attribute identification information determination module 1604 is also used to encode the content identification bit into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block if the attribute value corresponding to the attribute in the animation data is not a default value; if the attribute value corresponding to the attribute in the animation data is a default value, the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
[0480] In one embodiment, the attribute type corresponding to the attribute is a fixed attribute, and the attribute identification information is empty; the attribute content encoding module 1606 is also used to directly encode the attribute value corresponding to the attribute in the animation data according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
[0481] In one embodiment, the attribute type corresponding to the attribute is a simple animation attribute, a discrete animation attribute, a multi-dimensional time-easing animation attribute or a space-easing animation attribute, and the attribute identification information at least includes a content identification bit; the attribute identification information determination module 1604 is also used to encode the content identification bit into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block if the attribute value corresponding to the attribute in the animation data is not a default value; if the attribute value corresponding to the attribute in the animation data is a default value, the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
[0482] In one embodiment, the attribute identification information also includes an animation interval identification bit; when the value of the content identification bit indicates that there is attribute content corresponding to the attribute in the dynamic attribute data block, the attribute identification information determination module 1604 is also used to, if the attribute value includes animation interval characteristic data, encode the animation interval identification bit into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the animation interval characteristic data; if the attribute value does not include the animation interval characteristic data, encode the animation interval identification bit into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the animation interval characteristic data.
[0483] In one embodiment, the attribute content encoding module 1606 is also used to encode the animation interval characteristic data corresponding to the attribute according to the data storage structure corresponding to the animation interval characteristic data to obtain the attribute content corresponding to the attribute if the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data; if the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include animation interval characteristic data, then directly encode the attribute value corresponding to the attribute in the animation data according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
[0484] In one embodiment, the attribute type corresponding to the attribute is a spatial easing animation attribute, and the attribute identification information also includes a spatial easing parameter identification bit; when the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, the attribute identification information determination module 1604 is also used to encode the spatial easing parameter identification bit into the value of the attribute content corresponding to the attribute stored in the dynamic attribute data block including the spatial easing parameters if the animation interval characteristic data includes the spatial easing parameters; if the animation interval characteristic data does not include the spatial easing parameters, the spatial easing parameter identification bit is encoded into the value of the attribute content corresponding to the attribute stored in the dynamic attribute data block not including the spatial easing parameters.
[0485] In one embodiment, the attribute content encoding module 1606 is also used to encode the animation interval characteristic data corresponding to the attribute according to the data storage structure corresponding to the animation interval characteristic data when the value of the spatial easing parameter identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the spatial easing parameters, so as to obtain the attribute content corresponding to the attribute including the spatial easing parameters; otherwise, the attribute content corresponding to the attribute not including the spatial easing parameters is obtained.
[0486] In one embodiment, the fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the corresponding attribute of each animation interval.
[0487] In one embodiment, the animation tag code is a bitmap synthesis tag code; the animation data acquisition module 1602 is also used to play the animation project file; screenshots are taken of the playback screens corresponding to the animation project file in sequence to obtain a bitmap image sequence corresponding to the animation project file; the bitmap image sequence is processed according to the bitmap sequence frame export method to obtain image binary data corresponding to the bitmap synthesis tag code.
[0488] In one embodiment, the animation tag code is a video synthesis tag code; the animation data acquisition module 1602 is also used to play the animation project file; screenshots are taken of the playback screens corresponding to the animation project file in sequence to obtain a bitmap image sequence corresponding to the animation project file; the bitmap image sequence is processed according to the video sequence frame export method to obtain image binary data corresponding to the video synthesis tag code.
[0489] In one embodiment, the animation data encoding device 1600 also includes a file header information encoding module, a node element encoding module and a target animation file generation module. The file header information encoding module is used to encode the file header information in sequence according to the file header organization structure to obtain the file header encoding information; the node element encoding module is used to encode the animation tag code, the data block length and the data block in sequence according to the node element organization structure to obtain the node element encoding data; the data block includes a dynamic attribute data block and a basic attribute data block; the target animation file generation module is used to organize the file header encoding information and each node element encoding data according to the target file structure to obtain the target animation file.
[0490] In the above-mentioned animation data encoding device, the animation tag code can be used to identify a group of attributes, and the attribute structure table is used to describe the data structure of a group of attributes identified by the animation tag code. When the attribute values of this group of attributes are uncertain in terms of type or quantity, or when there is a lot of redundancy in the attribute values of the attributes, in order to avoid the problem of introducing a large number of identifier fields for describing the type or quantity of the attributes, which leads to a large volume of the animation file, a data structure of a dynamic attribute data block is introduced, which can maximize the compression of these identifiers and greatly reduce the volume occupied by the target animation file. Specifically, after obtaining the animation project file, according to a group of attributes included in the attribute structure table corresponding to the animation tag code, the attribute values of this group of attributes are obtained from the animation project file, and the attribute identification information in the dynamic attribute data block is used to describe the attribute state of the attribute. When there is an attribute type in the attribute structure table, the attribute identification information corresponding to each attribute can be determined according to the animation data, and then the attribute values corresponding to each attribute can be dynamically encoded according to the attribute identification information to obtain the corresponding attribute content, and the dynamic attribute data block corresponding to the animation tag code is obtained by combining the attribute identification information and the attribute content of each attribute in the attribute structure table, which can significantly reduce the space occupied by the animation file.
[0491] In one embodiment, Fig.17 As shown, an animation data decoding device 1700 is provided, the device includes an acquisition module 1702, an attribute identification information parsing module 1704, and an attribute content parsing module 1706, wherein:
[0492] The acquisition module 1702 is used to acquire the animation tag code;
[0493] The attribute identification information parsing module 1704 is used to parse the attribute identification information corresponding to each attribute from the dynamic attribute data block corresponding to the animation tag code according to the attribute type corresponding to each attribute in the attribute structure table when the attribute type exists in the attribute structure table corresponding to the animation tag code;
[0494] The attribute content parsing module 1706 is used to parse the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute.
[0495] In one embodiment, the animation data decoding device 1700 also includes a basic attribute data block parsing module, which is used to read the attribute values corresponding to each attribute from the basic attribute data block corresponding to the animation tag code in sequence according to the data type and attribute sorting corresponding to each attribute in the attribute structure table when the attribute type does not exist in the attribute structure table corresponding to the animation tag code.
[0496] In one embodiment, the attribute identification information parsing module 1704 is also used to query the attribute structure table to obtain the attribute ranking corresponding to each attribute; determine the number of bits occupied by the attribute identification information corresponding to each attribute according to the attribute type corresponding to each attribute; read data starting from the first bit in the dynamic attribute data block corresponding to the animation tag code; based on the number of bits occupied by the attribute identification information corresponding to each attribute, determine the attribute identification information corresponding to each attribute from the data read in sequence according to the attribute ranking.
[0497] In one embodiment, the attribute type is a common attribute, and the attribute identification information only includes a content identification bit; the attribute content parsing module 1706 is also used to read the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, then query the default value corresponding to the attribute from the attribute structure table.
[0498] In one embodiment, the attribute type is a fixed attribute, and the attribute identification information is empty; the attribute content parsing module 1706 is further used to directly read the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute.
[0499] In one embodiment, the attribute type is a Boolean attribute, and the attribute identification information only includes a content identification bit; the attribute content parsing module 1706 is further configured to directly use the value of the content identification bit as the attribute content corresponding to the attribute.
[0500] In one embodiment, the attribute type is a simple animation attribute, a discrete animation attribute, a multi-dimensional time-delayed animation attribute or a space-delayed animation attribute, and the attribute identification information includes at least a content identification bit; the attribute content parsing module 1706 is also used to read the attribute content corresponding to the attribute from the dynamic attribute data block if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, then query the default value corresponding to the attribute according to the attribute structure table.
[0501] In one embodiment, the attribute content parsing module 1706 is also used to read the value of the next bit of the content identification bit as the value of the animation interval identification bit when the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, then the animation interval characteristic data corresponding to the attribute is parsed from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data; if the value of the animation interval identification bit indicates that the attribute content does not include animation interval characteristic data, then the attribute content corresponding to the attribute is directly parsed from the dynamic attribute data block according to the data type of the attribute.
[0502] In one embodiment, the attribute type is a spatial easing animation attribute, and the attribute content parsing module 1706 is also used to read the value of the next bit of the animation interval identification bit as the value of the spatial easing parameter identification bit when the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data; if the value of the spatial easing parameter identification bit indicates that the animation interval characteristic data includes spatial easing parameters, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data including the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block; if the value of the spatial easing parameter identification bit indicates that the animation interval characteristic data does not include spatial easing parameters, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data not including the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block.
[0503] In one embodiment, the fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the corresponding attribute of each animation interval.
[0504] In one embodiment, the acquisition module 1702 also includes a target animation file parsing module, a file header information parsing module and a node element parsing module. The target animation file parsing module is used to parse the target animation file to obtain a binary sequence; according to the target file structure of the target animation file, the file header encoding information and the node element encoding data of the target animation file are read from the binary sequence in sequence; the file header information parsing module is used to decode the file header encoding information according to the order of the fields included in the file header organization structure of the target animation file and the data type of each field to obtain the file header information; the node element parsing module is used to decode the node element encoding data according to the node element organization structure of the target animation file, and obtain the animation tag code, the data block length and the data block corresponding to each animation tag code in sequence; the data block includes a dynamic attribute data block and a basic attribute data block.
[0505] In one embodiment, the target animation file is obtained by exporting the animation project file in a vector export manner; the target animation file parsing module is also used to obtain the file data structure corresponding to the vector export manner; the target animation file is parsed according to the file data structure to obtain a binary sequence representing the animation vector data.
[0506] In one embodiment, the target animation file is obtained by exporting the animation project file in a bitmap sequence frame export method, and the target animation file parsing module is also used to decompress the target animation file in an image decoding method to obtain image binary data corresponding to the target animation file; the image binary data includes pixel data of key bitmap images in the animation project file and pixel data of difference pixel areas of non-key bitmap images.
[0507] In one embodiment, the target animation file is obtained by exporting the animation project file in a video sequence frame export manner, and the target animation file parsing module is also used to decompress the target animation file in a video decoding manner to obtain image binary data corresponding to the target animation file; the image binary data is pixel data of a synthetic bitmap, and the synthetic bitmap is obtained by synthesizing the color channel bitmap and transparency channel bitmap of the bitmap image included in the animation project file.
[0508] In the above-mentioned animation data decoding device 1700, the animation tag code can be used to identify a group of attributes, and the attribute structure table is used to describe the data structure of the group of attributes identified by the animation tag code. When the attribute values of this group of attributes are uncertain in terms of type or quantity, or when there is a lot of redundancy in the attribute values of the attributes, in order to avoid the problem of too large animation file size caused by the additional introduction of a large number of identifier fields for describing the type or quantity of the attributes, a data structure of a dynamic attribute data block is introduced, which can maximize the compression of these identifiers and greatly reduce the volume occupied by the target animation file. Specifically, during decoding, after reading the animation tag code, when the attribute type exists in the attribute structure table corresponding to the animation tag code, it means that the attribute values of the group of attributes identified by the animation tag code are encoded in the form of a dynamic attribute data block, and the attribute identification information corresponding to each attribute can be parsed from the dynamic attribute data block corresponding to the animation tag code in combination with the attribute type corresponding to each attribute, and then based on the attribute identification information, the attribute content corresponding to each of the attributes can be parsed from the dynamic attribute data block to achieve decoding of the animation file.
[0509] Fig.18 The internal structure diagram of a computer device in one embodiment is shown. The computer device may specifically be Figure 1 The terminal 110 in FIG. Fig.18 As shown, the computer device includes a processor and a memory connected via a system bus. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor may implement an animation data encoding method or an animation data decoding method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor may implement an animation data encoding method or an animation data decoding method.
[0510] Those skilled in the art will understand that Fig.18 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0511] In one embodiment, the animation data encoding device 1600 provided in the present application can be implemented in the form of a computer program. The computer program can be used in Fig.18 The computer device shown in the figure can be used to run the program. The memory of the computer device can store various program modules that constitute the animation data encoding device 1600, such as: Fig.16 The animation data acquisition module 1602, attribute identification information determination module 1604, attribute content encoding module 1606 and data block generation module 1608 are shown. The computer program composed of various program modules enables the processor to execute the steps of the animation data encoding method of each embodiment of the present application described in this specification.
[0512] For example, Fig.18 The computer device shown can be Fig.16 The animation data acquisition module 1602 in the animation data encoding device 1600 shown in the figure performs step S802. The computer device can perform step S804 through the attribute identification information determination module 1604. The computer device can perform step S1606 through the attribute content encoding module 1606. The computer device can perform step S1608 through the data block generation module 1608.
[0513] In one embodiment, the animation data decoding device 1700 provided by the present application can be implemented in the form of a computer program. The computer program can be used in Fig.18 The computer device shown in the figure can be used to run the program. The memory of the computer device can store various program modules that constitute the animation data decoding device 1700, for example, Fig.17 The illustrated example includes an acquisition module 1702, an attribute identification information parsing module 1704, and an attribute content parsing module 1706. The computer program composed of various program modules enables the processor to execute the steps of the animation data encoding method of each embodiment of the present application described in this specification.
[0514] For example, Fig.18 The computer device shown can be Fig.17 The acquisition module 1702 in the animation data decoding device 1700 shown in the figure performs step S1402. The computer device can perform step S1404 through the attribute identification information parsing module 1704. The computer device can perform step S1406 through the attribute content parsing module 1706.
[0515] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned animation data encoding method. The steps of the animation data encoding method here may be the steps of the animation data encoding method in the above-mentioned embodiments.
[0516] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above animation data encoding method. The steps of the animation data encoding method here can be the steps in the animation data decoding method of each of the above embodiments.
[0517] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above animation data decoding method. The steps of the animation data decoding method here may be the steps of the animation data decoding method in each of the above embodiments.
[0518] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above animation data decoding method. The steps of the animation data decoding method here can be the steps of the animation data decoding method in each of the above embodiments.
[0519] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0520] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0521] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims. < / float> < / float> < / float> < / float>
Claims
1. A method for encoding animation data, comprising: Play the animation project file, and take screenshots of the playback screens corresponding to the animation project file in sequence to obtain a bitmap image sequence corresponding to the animation project file; Processing the bitmap image sequence according to a bitmap sequence frame export method or a video sequence frame export method to obtain a target animation file, parsing the target animation file to obtain each animation tag code and corresponding animation data; When the attribute structure table corresponding to the animation tag code contains attribute types corresponding to each attribute, Determine the attribute identification information corresponding to each of the attributes according to the attribute type corresponding to each of the attributes and the animation data; According to the attribute identification information, the attribute value corresponding to each attribute in the animation data is encoded to obtain the attribute content corresponding to each attribute; According to the attribute sorting corresponding to each attribute in the attribute structure table, the attribute identification information and the attribute content corresponding to each attribute are stored in sequence to obtain the dynamic attribute data block corresponding to the animation tag code; When the attribute type does not exist in the attribute structure table corresponding to the animation tag code, the attribute values corresponding to each attribute in the animation data are encoded in sequence according to the data type and attribute order corresponding to each attribute in the attribute structure table to obtain the basic attribute data block corresponding to the animation tag code.
2. The method according to claim 1, characterized in that The attribute type corresponding to the attribute is a common attribute or a Boolean attribute, and the attribute identification information corresponding to the attribute only includes a content identification bit; and determining the attribute identification information corresponding to each of the attributes includes: If the attribute value corresponding to the attribute in the animation data is not a default value, encoding the content identification bit into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block; If the attribute value corresponding to the attribute in the animation data is a default value, the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
3. The method according to claim 1, characterized in that: The attribute type corresponding to the attribute is a fixed attribute, and the attribute identification information is empty; encoding the attribute value corresponding to each attribute in the animation data according to the attribute identification information to obtain the attribute content corresponding to each attribute, including: The attribute value corresponding to the attribute in the animation data is directly encoded according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
4. The method according to claim 1, characterized in that: The attribute type corresponding to the attribute is a simple animation attribute, a discrete animation attribute, a multi-dimensional time slow-motion animation attribute or a space slow-motion animation attribute, and the attribute identification information at least includes a content identification bit; the determining of the attribute identification information corresponding to each of the attributes includes: If the attribute value corresponding to the attribute in the animation data is not a default value, encoding the content identification bit into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block; If the attribute value corresponding to the attribute in the animation data is a default value, the content identification bit is encoded into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
5. The method according to claim 4, characterized in that The attribute identification information also includes an animation interval identification bit; When the value of the content identification bit indicates that the dynamic attribute data block contains attribute content corresponding to the attribute, the method further includes: If the attribute value includes animation interval characteristic data, the animation interval identification bit is encoded into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the animation interval characteristic data; If the attribute value does not include the animation interval characteristic data, the animation interval identification bit is encoded into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the animation interval characteristic data.
6. The method according to claim 5, characterized in that The encoding of the attribute values corresponding to the attributes in the animation data according to the attribute identification information to obtain the attribute contents corresponding to the attributes includes: If the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, encoding the animation interval characteristic data corresponding to the attribute according to the data storage structure corresponding to the animation interval characteristic data to obtain the attribute content corresponding to the attribute; If the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include animation interval characteristic data, the attribute value corresponding to the attribute in the animation data is encoded directly according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
7. The method according to claim 5, wherein the attribute type corresponding to the attribute is a spatial easing animation attribute, and the attribute identification information further includes a spatial easing parameter identification bit; when the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, the method further includes: If the animation interval characteristic data includes a spatial easing parameter, the spatial easing parameter identification bit is encoded into the attribute content corresponding to the attribute stored in the dynamic attribute data block including the value of the spatial easing parameter; If the animation interval characteristic data does not include a spatial easing parameter, the spatial easing parameter identification bit is encoded into a value in which the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the spatial easing parameter.
8. The method according to claim 7, characterized in that The encoding of the attribute values corresponding to the attributes in the animation data according to the attribute identification information to obtain the attribute contents corresponding to the attributes includes: When the value of the spatial easing parameter identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes spatial easing parameters, the animation interval characteristic data corresponding to the attribute is encoded according to the data storage structure corresponding to the animation interval characteristic data to obtain the attribute content including the spatial easing parameters corresponding to the attribute; otherwise, the attribute content corresponding to the attribute not including the spatial easing parameters is obtained.
9. According to the method of claim 8, the fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and also include the start value, end value, time easing parameter and space easing parameter of the attribute corresponding to each animation interval.
10. The method according to any one of claims 1 to 9, characterized in that: The method further comprises: According to the file header organization structure, the file header information is encoded in sequence to obtain the file header encoding information; According to the node element organization structure, the animation tag code, the data block length and the data block are encoded in sequence to obtain node element encoding data; the data block includes a dynamic attribute data block and a basic attribute data block; The file header encoding information and each node element encoding data are organized according to the target file structure to obtain a target animation file.
11. A method for decoding animation data, comprising: Parsing a target animation file to obtain an animation tag code, wherein the target animation file is obtained by exporting an animation project file in a bitmap sequence frame exporting manner or a video sequence frame exporting manner; When the attribute structure table corresponding to the animation tag code contains attribute types corresponding to each attribute, According to the attribute type corresponding to each attribute in the attribute structure table, parsing the attribute identification information corresponding to each attribute from the dynamic attribute data block corresponding to the animation tag code; parsing attribute contents corresponding to each of the attributes from the dynamic attribute data block according to the attribute identification information corresponding to each of the attributes; When the attribute type does not exist in the attribute structure table corresponding to the animation tag code, According to the data type and attribute order corresponding to each attribute in the attribute structure table, the attribute value corresponding to each attribute is read in sequence from the basic attribute data block corresponding to the animation tag code.
12. The method according to claim 11, characterized in that The step of parsing the attribute identification information corresponding to each attribute from the dynamic attribute data block corresponding to the animation tag code according to the attribute type corresponding to each attribute in the attribute structure table includes: Query the attribute structure table to obtain the attribute ranking corresponding to each attribute; Determine the number of bits occupied by the attribute identification information corresponding to each attribute according to the attribute type corresponding to each attribute; Read data starting from the first bit in the dynamic attribute data block corresponding to the animation tag code; Based on the number of bits occupied by the attribute identification information corresponding to each of the attributes, the attribute identification information corresponding to each of the attributes is determined from the data read sequentially according to the attribute sorting.
13. The method according to claim 11, characterized in that The attribute type is a common attribute, and the attribute identification information only includes a content identification bit; and parsing the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute includes: If the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, then reading the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute; If the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, a default value corresponding to the attribute is queried from the attribute structure table.
14. The method according to claim 11, characterized in that The attribute type is a fixed attribute, and the attribute identification information is empty; and parsing the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute includes: The attribute content corresponding to the attribute is directly read from the dynamic attribute data block according to the data type corresponding to the attribute.
15. The method according to claim 11, characterized in that The attribute type is a Boolean attribute, and the attribute identification information only includes a content identification bit; and parsing the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute includes: The value of the content identification bit is directly used as the attribute content corresponding to the attribute.
16. The method according to claim 11, characterized in that The attribute type is a simple animation attribute, a discrete animation attribute, a multi-dimensional time slow-motion animation attribute or a space slow-motion animation attribute, and the attribute identification information at least includes a content identification bit; and parsing the attribute content corresponding to each attribute from the dynamic attribute data block according to the attribute identification information corresponding to each attribute includes: If the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, then reading the attribute content corresponding to the attribute from the dynamic attribute data block; If the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, a default value corresponding to the attribute is queried according to the attribute structure table.
17. The method according to claim 16, characterized in that If the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, reading the attribute content corresponding to the attribute from the dynamic attribute data block includes: When the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block, the value of the next bit of the content identification bit is read as the value of the animation interval identification bit; If the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, the animation interval characteristic data corresponding to the attribute is parsed from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data; If the value of the animation interval identification bit indicates that the attribute content does not include animation interval characteristic data, the attribute content corresponding to the attribute is directly parsed from the dynamic attribute data block according to the data type of the attribute.
18. The method according to claim 17, characterized in that The attribute type is a spatial easing animation attribute, and if the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, then according to the data storage structure corresponding to the animation interval characteristic data, the animation interval characteristic data corresponding to the attribute is parsed from the dynamic attribute data block, including: When the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, reading the value of the next bit of the animation interval identification bit as the value of the spatial easing parameter identification bit; If the value of the spatial easing parameter flag indicates that the animation interval characteristic data includes the spatial easing parameter, parsing the animation interval characteristic data including the spatial easing parameter corresponding to the attribute from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data; If the value of the spatial easing parameter flag indicates that the animation interval characteristic data does not include the spatial easing parameters, the animation interval characteristic data that does not include the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data.
19. The method according to claim 18, characterized in that The fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the attribute corresponding to each animation interval.
20. The method according to claim 11, characterized in that The step of parsing the target animation file to obtain the animation tag code includes: Parse the target animation file and obtain a binary sequence; According to the target file structure of the target animation file, the file header encoding information and the node element encoding data of the target animation file are read from the binary sequence in sequence; Decoding the file header encoding information according to the order of the fields included in the file header organizational structure of the target animation file and the data type of each field to obtain the file header information; According to the node element organization structure of the target animation file, the node element encoding data is decoded to obtain the animation tag code, data block length and data blocks corresponding to each animation tag code in turn; the data blocks include dynamic attribute data blocks and basic attribute data blocks.
21. The method according to claim 20, characterized in that The target animation file is obtained by exporting the animation project file in a bitmap sequence frame exporting manner, and the target animation file is parsed to obtain a binary sequence, including: Decompress the target animation file in a picture decoding manner to obtain picture binary data corresponding to the target animation file; the picture binary data includes pixel data of key bitmap images in the animation project file and pixel data of difference pixel areas of non-key bitmap images.
22. The method according to claim 20, characterized in that The target animation file is obtained by exporting the animation project file in accordance with the video sequence frame export method, and the target animation file is parsed to obtain a binary sequence, including: Decompress the target animation file in a video decoding manner to obtain image binary data corresponding to the target animation file; the image binary data is pixel data of a synthetic bitmap, and the synthetic bitmap is obtained by synthesizing a color channel bitmap and a transparency channel bitmap of a bitmap image included in the animation project file.
23. An animation data encoding device, the device comprising: The animation data acquisition module is used to play the animation project file, take screenshots of the playback screen corresponding to the animation project file in sequence, and obtain the bitmap image sequence corresponding to the animation project file; process the bitmap image sequence according to the bitmap sequence frame export method or the video sequence frame export method to obtain the target animation file, and parse the target animation file to obtain each animation tag code and the corresponding animation data; An attribute identification information determination module, used for determining the attribute identification information corresponding to each attribute according to the attribute type corresponding to each attribute and the animation data when the attribute structure table corresponding to the animation tag code contains the attribute type corresponding to each attribute; An attribute content encoding module, used for encoding the attribute value corresponding to each attribute in the animation data according to the attribute identification information, to obtain the attribute content corresponding to each attribute; A data block generation module, used to sort the attributes corresponding to the attributes in the attribute structure table, store the attribute identification information and the attribute content corresponding to the attributes in sequence, and obtain the dynamic attribute data block corresponding to the animation tag code; The data block generation module is also used to, when the attribute type does not exist in the attribute structure table corresponding to the animation tag code, encode the attribute values corresponding to each attribute in the animation data in sequence according to the data type and attribute sorting corresponding to each attribute in the attribute structure table, so as to obtain the basic attribute data block corresponding to the animation tag code.
24. The device according to claim 23, characterized in that The attribute type corresponding to the attribute is a common attribute or a Boolean attribute, and the attribute identification information corresponding to the attribute only includes a content identification bit. The attribute identification information determination module is also used to, if the attribute value corresponding to the attribute in the animation data is not a default value, encode the content identification bit into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the attribute value corresponding to the attribute in the animation data is a default value, encode the content identification bit into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
25. The device according to claim 23, characterized in that The attribute type corresponding to the attribute is a fixed attribute, and the attribute identification information is empty; the attribute content encoding module is also used to directly encode the attribute value corresponding to the attribute in the animation data according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
26. The device according to claim 23, characterized in that The attribute type corresponding to the attribute is a simple animation attribute, a discrete animation attribute, a multi-dimensional time-easing animation attribute or a space-easing animation attribute, and the attribute identification information at least includes a content identification bit; the attribute identification information determination module is also used to, if the attribute value corresponding to the attribute in the animation data is not a default value, encode the content identification bit into a value indicating that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the attribute value corresponding to the attribute in the animation data is a default value, encode the content identification bit into a value indicating that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block.
27. The device according to claim 26, characterized in that The attribute identification information also includes an animation interval identification bit; when the value of the content identification bit indicates that there is attribute content corresponding to the attribute in the dynamic attribute data block, the attribute identification information determination module is also used to, if the attribute value includes animation interval characteristic data, encode the animation interval identification bit into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the animation interval characteristic data; if the attribute value does not include the animation interval characteristic data, encode the animation interval identification bit into a value indicating that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include the animation interval characteristic data.
28. The device according to claim 27, characterized in that The attribute content encoding module is also used to, if the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, encode the animation interval characteristic data corresponding to the attribute according to the data storage structure corresponding to the animation interval characteristic data to obtain the attribute content corresponding to the attribute; if the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block does not include animation interval characteristic data, directly encode the attribute value corresponding to the attribute in the animation data according to the data type corresponding to the attribute to obtain the attribute content corresponding to the attribute.
29. The device according to claim 27, characterized in that The attribute type corresponding to the attribute is a spatial easing animation attribute, and the attribute identification information also includes a spatial easing parameter identification bit; when the value of the animation interval identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes animation interval characteristic data, the attribute identification information determination module is also used to, if the animation interval characteristic data includes spatial easing parameters, encode the spatial easing parameter identification bit into the value of the attribute content corresponding to the attribute stored in the dynamic attribute data block including the spatial easing parameters; if the animation interval characteristic data does not include the spatial easing parameters, encode the spatial easing parameter identification bit into the value of the attribute content corresponding to the attribute stored in the dynamic attribute data block not including the spatial easing parameters.
30. The device according to claim 29, characterized in that The attribute content encoding module is also used to encode the animation interval characteristic data corresponding to the attribute according to the data storage structure corresponding to the animation interval characteristic data when the value of the spatial easing parameter identification bit indicates that the attribute content corresponding to the attribute stored in the dynamic attribute data block includes the spatial easing parameters, so as to obtain the attribute content including the spatial easing parameters corresponding to the attribute; otherwise, obtain the attribute content not including the spatial easing parameters corresponding to the attribute.
31. The device according to claim 30, characterized in that The fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the attribute corresponding to each animation interval.
32. The device according to any one of claims 23 to 31, characterized in that The device also includes: A file header information encoding module, used to encode the file header information in sequence according to the file header organization structure to obtain file header encoding information; A node element encoding module is used to encode the animation tag code, data block length and data block in sequence according to the node element organization structure to obtain node element encoding data; the data block includes a dynamic attribute data block and a basic attribute data block; The target animation file generation module is used to organize the file header encoding information and each node element encoding data according to the target file structure to obtain the target animation file.
33. An animation data decoding device, the device comprising: An acquisition module is used to parse a target animation file to obtain an animation tag code, wherein the target animation file is obtained by exporting the animation project file in a bitmap sequence frame export mode or a video sequence frame export mode; An attribute identification information parsing module, for parsing attribute identification information corresponding to each attribute from the dynamic attribute data block corresponding to the animation tag code according to the attribute type corresponding to each attribute in the attribute structure table corresponding to the animation tag code; An attribute content parsing module, used for parsing attribute content corresponding to each attribute from the dynamic attribute data block according to attribute identification information corresponding to each attribute; The attribute content parsing module is also used to read the attribute values corresponding to each attribute from the basic attribute data block corresponding to the animation tag code in sequence according to the data type and attribute sorting corresponding to each attribute in the attribute structure table when the attribute type does not exist in the attribute structure table corresponding to the animation tag code.
34. The device according to claim 33, characterized in that The attribute identification information parsing module is also used to query the attribute structure table to obtain the attribute ranking corresponding to each of the attributes; determine the number of bits occupied by the attribute identification information corresponding to each of the attributes according to the attribute type corresponding to each of the attributes; read data starting from the first bit in the dynamic attribute data block corresponding to the animation tag code; based on the number of bits occupied by the attribute identification information corresponding to each of the attributes, determine the attribute identification information corresponding to each of the attributes from the data read in sequence according to the attribute ranking.
35. The device according to claim 33, characterized in that The attribute type is a common attribute, and the attribute identification information only includes a content identification bit; the attribute content parsing module is also used to read the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, query a default value corresponding to the attribute from the attribute structure table.
36. The device according to claim 33, characterized in that The attribute type is a fixed attribute, and the attribute identification information is empty; the attribute content parsing module is further used to directly read the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type corresponding to the attribute.
37. The device according to claim 33, characterized in that The attribute type is a Boolean attribute, and the attribute identification information only includes a content identification bit; the attribute content parsing module is further used to directly use the value of the content identification bit as the attribute content corresponding to the attribute.
38. The device according to claim 33, characterized in that The attribute type is a simple animation attribute, a discrete animation attribute, a multi-dimensional time-easing animation attribute or a space-easing animation attribute, and the attribute identification information at least includes a content identification bit; the attribute content parsing module is also used to read the attribute content corresponding to the attribute from the dynamic attribute data block if the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the value of the content identification bit indicates that the attribute content corresponding to the attribute does not exist in the dynamic attribute data block, query the default value corresponding to the attribute according to the attribute structure table.
39. The device according to claim 38, characterized in that The attribute content parsing module is further used to read the value of the next bit of the content identification bit as the value of the animation interval identification bit when the value of the content identification bit indicates that the attribute content corresponding to the attribute exists in the dynamic attribute data block; if the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data, then parse the animation interval characteristic data corresponding to the attribute from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data; if the value of the animation interval identification bit indicates that the attribute content does not include animation interval characteristic data, then directly parse the attribute content corresponding to the attribute from the dynamic attribute data block according to the data type of the attribute.
40. The device according to claim 39, characterized in that The attribute type is a spatial easing animation attribute, and the attribute content parsing module is further used to read the value of the next bit of the animation interval identification bit as the value of the spatial easing parameter identification bit when the value of the animation interval identification bit indicates that the attribute content includes animation interval characteristic data; If the value of the spatial easing parameter identification bit indicates that the animation interval characteristic data includes spatial easing parameters, then the animation interval characteristic data including the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data; if the value of the spatial easing parameter identification bit indicates that the animation interval characteristic data does not include spatial easing parameters, then the animation interval characteristic data not including the spatial easing parameters corresponding to the attribute is parsed from the dynamic attribute data block according to the data storage structure corresponding to the animation interval characteristic data.
41. The device according to claim 40, characterized in that The fields included in the data storage structure corresponding to the animation interval characteristic data include the number of animation intervals, the interpolator type of each animation interval, the start and end time of each animation interval, and the start value, end value, time easing parameter and space easing parameter of the attribute corresponding to each animation interval.
42. The device according to claim 33, characterized in that The acquisition module further includes: A target animation file parsing module is used to parse the target animation file to obtain a binary sequence; and read the file header encoding information and node element encoding data of the target animation file from the binary sequence in sequence according to the target file structure of the target animation file; A file header information parsing module, used to decode the file header encoding information according to the order of the fields included in the file header organizational structure of the target animation file and the data type of each field, to obtain the file header information; The node element parsing module is used to decode the node element encoded data according to the node element organization structure of the target animation file, and obtain the animation tag code, data block length and data blocks corresponding to each animation tag code in turn; the data blocks include dynamic attribute data blocks and basic attribute data blocks.
43. The device according to claim 42, characterized in that The target animation file is obtained by exporting the animation project file in a bitmap sequence frame export mode; the target animation file parsing module is further used to decompress the target animation file in a picture decoding mode to obtain the picture binary data corresponding to the target animation file; The picture binary data includes pixel data of a key bitmap image in an animation project file and pixel data of a difference pixel area of a non-key bitmap image.
44. The device according to claim 42, characterized in that The target animation file is obtained by exporting the animation project file in a video sequence frame exporting manner; the target animation file parsing module is further used to decompress the target animation file in a video decoding manner to obtain the image binary data corresponding to the target animation file; The image binary data is pixel data of a synthetic bitmap, and the synthetic bitmap is obtained by synthesizing a color channel bitmap and a transparency channel bitmap of a bitmap image included in an animation project file.
45. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 22.
46. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method according to any one of claims 1 to 22.
Citation Information
Patent Citations
Methods and devices for viewing micro-animation effects
CN102289835A
Animation reuse method and system
CN106815880A