Animation File Processing Method, Device, Computer Readable Storage Medium, and Computer Equipment
By encoding differential pixel area for the bitmap image sequence of the animation file and generating encoded pictures, the problem of low decoding efficiency of animation files in the prior art is solved, and more efficient animation file storage and decoding is achieved.
Patent Information
- Application Number
- CN201910502757.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-11
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2039-06-11
AI Technical Summary
In the prior art, the decoding efficiency of animation files is low, especially when handling complex animation effects, resulting in increased file size and decoded performance.
By obtaining the bitmap image sequence corresponding to the original animation file, encode the differential pixel area between the non-key bitmap image and the key bitmap image, generate an encoded picture, and use it to generate an animation export file.
This method reduces the stored animation characteristic data, stores only one frame of encoded pictures, supports complex animation effects, and improves efficiency and reduces file size during decoding.
Smart Images

Figure CN112070863B_ABST
Abstract
Claims
1. A method for processing an animation file, comprising: obtaining an original animation file, where the original animation file is an original animation project file, and the animation project file includes animation vector data for presenting animation special effects, and the animation vector data includes animation layer data of each animation layer and animation basic attribute data of the original animation file; determining an export method for the original animation file, where the export method includes one of a vector export method, a bitmap sequence frame export method, and a video sequence frame export method, and each export method is respectively used to process the original animation file in different ways to obtain an animation export file in a target format; when the export method for the original animation file is selected as the video sequence frame export method, obtaining a bitmap image sequence corresponding to the original animation file, where the bitmap image sequence is a sequence composed of bitmap images corresponding to the playing frames in the original animation file, and the bitmap image is an uncompressed and encoded image, which is a pixel array composed of individual pixel points arranged in sequence; reading pixel data of each bitmap image in the bitmap image sequence pixel by pixel, separating color data and transparency data from the read pixel data, and obtaining corresponding color channel bitmaps and transparency channel bitmaps according to the separated data; merging the color channel bitmap and the transparency channel bitmap vertically to obtain a composite bitmap with a height twice that of the bitmap image; alternatively, merging the color channel bitmap and the transparency channel bitmap horizontally to obtain a composite bitmap with a width twice that of the bitmap image; encoding the composite bitmap according to a video encoding method to obtain an encoded picture corresponding to the bitmap image; generating an animation export file in a target format corresponding to the original animation file according to the encoded pictures corresponding to the bitmap images in the bitmap image sequence, where the animation export file includes picture binary data of the encoded pictures corresponding to each bitmap image and information for identifying the export method; when it is necessary to play the animation special effects, parsing the animation export file in the target format according to the video sequence frame export method, decoding the picture binary data according to the video decoding method to restore the composite bitmap, extracting the color channel bitmap and the transparency channel bitmap from the restored composite bitmap, rendering pictures according to the color data of each pixel point in the color channel bitmap, performing mask processing on the rendered pictures according to the transparency data of each pixel point in the transparency channel bitmap to obtain video frames with transparency, and sequentially displaying according to the order of each video frame to play the animation special effects presented by the animation export file.
2. The method according to claim 1, wherein, the obtaining the bitmap image sequence corresponding to the original animation file includes: obtaining the original animation file; playing the original animation file; sequentially taking screenshots of the playing frames corresponding to the original animation file to obtain the bitmap image sequence corresponding to the original animation file.
3. The method according to claim 1, wherein, the method further includes: Obtain an animation export file obtained by encoding the animation vector data of the original animation file; the animation vector data is used to describe the layers included in the animation export file; Parse the animation export file to obtain the static intervals of the animation drawing data corresponding to each layer; When the frame to be processed belongs to the static interval of the animation drawing data corresponding to the layer, then Obtain the animation drawing data corresponding to the layer from the cache; Perform animation rendering according to the animation drawing data of each layer corresponding to the frame to be processed.
4. The method according to claim 3, wherein, the method further includes: when the frame to be processed does not belong to the static interval of the animation drawing data corresponding to the layer, or when there is no static interval for the animation drawing data corresponding to the layer, then Obtain the animation object obtained by parsing the animation export file; Read the animation object to obtain the animation drawing data corresponding to the layer.
5. The method according to claim 3, wherein, the method further includes: Obtain the current rendering progress; Calculate the frame number of the frame to be processed according to the rendering progress, the total number of frames and the total duration corresponding to the animation export file; Traverse the static intervals of the animation drawing data corresponding to each layer; When the frame number is found from the static interval, then Determine that the frame to be processed belongs to the static interval of the animation drawing data corresponding to the layer.
6. The method according to claim 3, wherein, the method further includes: Parse the animation export file to obtain the static intervals of the animation drawing data corresponding to each layer; Obtain the animation drawing data corresponding to the starting frame in the static interval; Cache the animation drawing data of the starting frame, and the cached animation drawing data is used to perform rendering display according to the cached animation drawing data corresponding to the starting frame when rendering and displaying the animation frames after the starting frame in the static interval.
7. The method according to any one of claims 3 to 6, wherein, the method further includes: When the animation attribute value included in the layer meets the static condition, then Determine the static interval corresponding to the animation attribute group included in the layer according to the animation interval where the animation attribute value meets the static condition; Take the intersection of the static intervals of the animation attribute groups included in the layer to obtain the static interval corresponding to the layer.
8. An animation processing device, wherein, the device includes: An acquisition module for acquiring an original animation file, where the original animation file is an original animation project file, and the animation project file includes animation vector data for presenting animation special effects. The animation vector data includes animation layer data of each animation layer and animation basic attribute data of the original animation file; determining an export method for the original animation file, where the export method includes one of a vector export method, a bitmap sequence frame export method, and a video sequence frame export method. Each export method is used to process the original animation file in a different way to obtain an animation export file in a target format; in the case where the export method for the original animation file is selected as the video sequence frame export method, acquiring a bitmap image sequence corresponding to the original animation file, where the bitmap image sequence is a sequence composed of bitmap images corresponding to the playing frames in the original animation file. The bitmap image is an uncompressed and encoded image and is a pixel array composed of individual pixel points arranged in sequence. A division module for reading pixel data of each bitmap image in the bitmap image sequence pixel by pixel, separating color data and transparency data from the read pixel data, and obtaining corresponding color channel bitmaps and transparency channel bitmaps according to the separated data. A synthesis module for vertically merging the color channel bitmap and the transparency channel bitmap to obtain a synthesized bitmap with a height twice that of the bitmap image; or horizontally merging the color channel bitmap and the transparency channel bitmap to obtain a synthesized bitmap with a width twice that of the bitmap image. An encoding module for encoding the synthesized bitmap according to a video encoding method to obtain an encoded picture corresponding to the bitmap image. An export module for generating an animation export file in a target format corresponding to the original animation file according to the encoded pictures corresponding to each bitmap image in the bitmap image sequence. The animation export file includes picture binary data of the encoded pictures corresponding to each bitmap image and information for identifying the export method. An analysis module for, when it is necessary to play the animation special effects, analyzing the animation export file in the target format according to the video sequence frame export method, decoding the picture binary data according to a video decoding method to restore the synthesized bitmap, extracting the color channel bitmap and the transparency channel bitmap from the restored synthesized bitmap, rendering pictures according to the color data of each pixel point in the color channel bitmap, performing mask processing on the rendered pictures according to the transparency data of each pixel point in the transparency channel bitmap to obtain video frames with transparency, and sequentially displaying the video frames in order to play the animation special effects presented by the animation export file.
9. The apparatus according to claim 8, wherein, the acquisition module is further configured to acquire an original animation file; play the original animation file; and sequentially capture screenshots of the playing frames corresponding to the original animation file to obtain a bitmap image sequence corresponding to the original animation file.
10. The apparatus according to claim 8, wherein, the apparatus further includes: An animation drawing data parsing module, configured to obtain an animation export file obtained by encoding the animation vector data of the original animation file; the animation vector data is used to describe the layers included in the animation export file; parse the animation export file to obtain the static intervals of the animation drawing data corresponding to each of the layers; when the frame to be processed belongs to the static interval of the animation drawing data corresponding to the layer, obtain the animation drawing data corresponding to the layer from the cache; perform animation rendering according to the animation drawing data of each layer corresponding to the frame to be processed.
11. The apparatus according to claim 10, wherein, the animation drawing data parsing module is further configured to, when the frame to be processed does not belong to the static interval of the animation drawing data corresponding to the layer, or when there is no static interval for the animation drawing data corresponding to the layer, obtain the animation object obtained by parsing the animation export file; read the animation object to obtain the animation drawing data corresponding to the layer.
12. The apparatus according to claim 10, wherein, the apparatus further comprises: a static interval traversing module, configured to obtain the current rendering progress; calculate the frame number of the frame to be processed according to the rendering progress, the total number of frames and the total duration corresponding to the animation export file; traverse the static intervals of the animation drawing data corresponding to each layer; when the frame number is found in the static interval, determine that the frame to be processed belongs to the static interval of the animation drawing data corresponding to the layer.
13. The apparatus according to claim 10, wherein, the animation drawing data parsing module is further configured to parse the animation export file to obtain the static intervals of the animation drawing data corresponding to each of the layers; obtain the animation drawing data corresponding to the starting frame in the static interval; cache the animation drawing data of the starting frame, and the cached animation drawing data is used to perform rendering display according to the cached animation drawing data corresponding to the starting frame when rendering and displaying the animation frames after the starting frame in the static interval.
14. The apparatus according to any one of claims 10 to 13, wherein, the animation drawing data parsing module is further configured to, when the animation attribute value included in the layer meets the static condition, determine the static interval corresponding to the animation attribute group included in the layer according to the animation interval where the animation attribute value meets the static condition; take the intersection of the static intervals of the animation attribute groups included in the layer to obtain the static interval corresponding to the layer.
15. A computer-readable storage medium, storing a computer program, which when executed by a processor, causes the processor to execute the steps of the method according to any one of claims 1 to 7.
16. A computer device, comprising a memory and a processor, the memory storing a computer program, which when executed by the processor, causes the processor to execute the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Animation frame processing method, animation frame processing server, terminal and system
CN105979282A