Template-based resource rendering method and apparatus, and computing device

By generating directed acyclic graphs and using concurrent rendering branches, the problems of poor rendering effects and high error rates of multimedia resources are solved, achieving efficient and accurate rendering effects and improved user experience.

CN119865564BActive Publication Date: 2025-12-12SHANGHAI BILIBILI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411929117.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-12-12
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

Existing technologies have poor rendering results and a high error rate when rendering template-based multimedia resources.

Method used

By generating a directed acyclic graph of the target template, the rendering order of the template elements is determined based on the rendering dependencies and node weights between the template elements. Concurrent threads are used to render the branches, prioritizing the rendering of elements with high complexity and user preferences.

Benefits of technology

It improves the rendering effect of multimedia resources, reduces the rendering error rate, and enhances rendering efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119865564B_ABST
    Figure CN119865564B_ABST
Patent Text Reader

Abstract

The application discloses a template-based resource rendering method and device and a computing device. The method comprises the following steps: generating a directed acyclic graph of a target template according to a rendering dependency relationship between template elements in the target template; calculating a node weight of any graph node according to a rendering complexity of a template element corresponding to the graph node; determining a rendering sequence of the template elements in the target template according to the directed acyclic graph and the node weight of the graph node in the directed acyclic graph; and rendering the template elements according to the rendering sequence of the template elements. According to the scheme, the template elements can be rendered in a correct and good rendering sequence, so that the rendering effect is improved and the rendering error rate is reduced. Moreover, the node weight of the graph node is calculated according to the rendering complexity of the template element, and the rendering sequence of the template element is determined according to the node weight, so that the template element with high complexity can be preferentially rendered on the basis that the rendering sequence conforms to the directed acyclic graph, and the overall rendering efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet, in particular to a template-based resource rendering method and device, computing device, computer storage medium and computer program product. BACKGROUND

[0002] With the continuous development of multimedia technology, the creation demand of users for multimedia resources such as audio and video is increasing. In order to improve the user experience and improve the creation efficiency of multimedia resources such as audio and video, some platforms provide multimedia resource creation templates for users. The template usually contains at least one template element, such as a preset special effect, a subtitle, etc.

[0003] However, the inventors have found in the implementation process that the rendering effect of the prior art is poor when rendering multimedia resources based on templates, and the error rate of rendering is high. SUMMARY

[0004] In view of the above problems, the present application is proposed in order to provide a template-based resource rendering method, device, computing device, computer storage medium and computer program product which overcome the above problems or at least partially solve the above problems.

[0005] According to a first aspect of the present application, a template-based resource rendering method is provided, comprising:

[0006] According to the rendering dependency relationship between the template elements in the target template, a directed acyclic graph of the target template is generated; wherein the graph nodes in the directed acyclic graph correspond to the template elements in the target template, and the directed edges in the directed acyclic graph correspond to the rendering dependency relationship between the template elements in the target template;

[0007] For any graph node, the node weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node;

[0008] According to the directed acyclic graph and the node weights of the graph nodes in the directed acyclic graph, the rendering order of the template elements in the target template is determined;

[0009] The template elements are rendered according to the rendering order of the template elements.

[0010] In an optional implementation, the method further comprises: obtaining a material added for any template element, and obtaining a material attribute of the material;

[0011] The calculation of the node weight of the graph node according to the rendering complexity of the template element corresponding to the graph node comprises: the calculation of the element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node;

[0012] According to the material attribute of the template element corresponding to the graph node, the material weight of the graph node is calculated;

[0013] According to the element weight and the material weight, the node weight of the graph node is generated.

[0014] In an optional implementation, before the element weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node, the method further comprises:

[0015] The rendering data of different elements under corresponding default parameters is acquired in advance;

[0016] For any element, the system overhead and the rendering time consumption of the element are extracted from the rendering data of the element, and the rendering complexity of the element is generated according to the system overhead and the rendering time consumption.

[0017] In an optional implementation, the material weight of the graph node is calculated according to the material attribute of the template element corresponding to the graph node, which comprises:

[0018] The difference coefficient of the material attribute of the template element and the default parameter of the template element is calculated;

[0019] The material weight of the graph node is generated according to the difference coefficient.

[0020] In an optional implementation, the method further comprises: acquiring user historical resource rendering data, and calculating the preference value of any element according to the user historical resource rendering data;

[0021] The node weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node, which comprises:

[0022] The element weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node;

[0023] The material weight of the graph node is calculated according to the material attribute of the template element corresponding to the graph node;

[0024] The preference weight of the graph node is calculated according to the preference value corresponding to the template element corresponding to the graph node;

[0025] According to the element weight, the material weight and the preference weight, the node weight of the graph node is generated.

[0026] In an optional implementation, the rendering order of the template elements in the target template is determined according to the directed acyclic graph and the node weights of the graph nodes in the directed acyclic graph, which comprises:

[0027] The directed acyclic graph is split into multiple branches;

[0028] For any branch, a branch weight of the branch is calculated according to node weights of graph nodes included in the branch;

[0029] A rendering order of the branch is determined according to the branch weight.

[0030] The rendering of the template elements according to the rendering order of the template elements comprises rendering each branch according to the rendering order of the branch by using a plurality of concurrent threads.

[0031] In an optional implementation, the splitting of the directed acyclic graph into a plurality of branches comprises:

[0032] Determining a number of concurrent threads;

[0033] Splitting the directed acyclic graph into a plurality of branches according to the number of threads.

[0034] According to a second aspect of the present application, a template-based resource rendering apparatus is provided, comprising:

[0035] A directed graph generation module, configured to generate a directed acyclic graph of a target template according to rendering dependency relationships between template elements in the target template; wherein a graph node in the directed acyclic graph corresponds to a template element in the target template, and a directed edge in the directed acyclic graph corresponds to a rendering dependency relationship between template elements in the target template;

[0036] A weight determination module, configured to, for any graph node, calculate a node weight of the graph node according to a rendering complexity of a template element corresponding to the graph node;

[0037] An order determination module, configured to determine a rendering order of template elements in the target template according to the directed acyclic graph and the node weights of the graph nodes in the directed acyclic graph;

[0038] A rendering module, configured to render the template elements according to the rendering order of the template elements.

[0039] In an optional implementation, the apparatus further comprises an acquisition module, configured to acquire a material added for any template element, and acquire a material attribute of the material;

[0040] The weight determination module is configured to calculate an element weight of the graph node according to a rendering complexity of a template element corresponding to the graph node;

[0041] Calculate a material weight of the graph node according to a material attribute of a template element corresponding to the graph node;

[0042] Generate a node weight of the graph node according to the element weight and the material weight.

[0043] In an alternative implementation, the rendering complexity is obtained by pre-acquiring rendering data of different elements under corresponding default parameters;

[0044] For any element, the system overhead and the rendering time consumption of the element are extracted from the rendering data of the element, and the rendering complexity of the element is generated according to the system overhead and the rendering time consumption.

[0045] In an alternative implementation, the weight determination module is configured to: calculate a difference coefficient of the material attribute of the template element and the default parameter of the template element;

[0046] The material weight of the graph node is generated according to the difference coefficient.

[0047] In an alternative implementation, the weight determination module is configured to: acquire user historical resource rendering data, and calculate a preference value of any element according to the user historical resource rendering data;

[0048] The element weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node;

[0049] The material weight of the graph node is calculated according to the material attribute of the template element corresponding to the graph node;

[0050] The preference weight of the graph node is calculated according to the preference value corresponding to the template element corresponding to the graph node;

[0051] The node weight of the graph node is generated according to the element weight, the material weight and the preference weight.

[0052] In an alternative implementation, the sequence determination module is configured to: split the directed acyclic graph into multiple branches;

[0053] For any branch, the branch weight of the branch is calculated according to the node weight of the graph node included in the branch;

[0054] The rendering sequence of the branch is determined according to the branch weight.

[0055] The rendering module is configured to: render each branch according to the rendering sequence of the branch by using multiple threads in parallel.

[0056] In an alternative implementation, the sequence determination module is configured to: determine the number of threads in parallel, and split the directed acyclic graph into multiple branches according to the number of threads.

[0057] According to the third aspect of the present application, a computing device is provided, comprising: a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus;

[0058] The memory is configured to store at least one executable instruction, and the executable instruction causes the processor to perform operations corresponding to the template-based resource rendering method.

[0059] According to a fourth aspect of the present application, a computer storage medium is provided, and the storage medium stores at least one executable instruction, and the executable instruction causes a processor to perform operations corresponding to the template-based resource rendering method.

[0060] According to a fifth aspect of the present application, a computer program product is provided, and the computer program product includes at least one executable instruction, and the executable instruction causes a processor to perform operations corresponding to the template-based resource rendering method.

[0061] The embodiments of the present application generate a directed acyclic graph according to the rendering dependency relationship between the template elements in the target template, and finally determine the rendering order of the template elements in the target template based on the directed acyclic graph, so that the template elements can be rendered in a correct and good rendering effect order, the rendering effect is improved, and the rendering error rate is reduced. Moreover, the embodiments of the present application calculate the node weight of the graph node according to the rendering complexity of the template element, and subsequently determine the rendering order of the template element according to the node weight, so that the template element with high complexity can be preferentially rendered on the basis that the rendering order meets the directed acyclic graph, and the overall rendering efficiency is improved.

[0062] The embodiments of the present application obtain the element weight of the graph node according to the rendering complexity, which can reflect the rendering complexity of the template element under the default condition. The material weight is obtained according to the material attribute, which can reflect the rendering complexity of the actual material, and the node weight is obtained by comprehensively considering the material weight and the element weight, so that the node weight can accurately reflect the rendering complexity of the element under the actual condition, and the determination accuracy of the node weight is improved.

[0063] The embodiments of the present application can accurately evaluate the rendering complexity of the element by testing the system overhead and the rendering time of different elements under the default parameters, accurately quantify the rendering complexity, and improve the determination accuracy of the rendering complexity.

[0064] The embodiments of the present application determine the material weight according to the difference coefficient of the material attribute compared with the default parameters, so that the material weight can accurately reflect the difference of the rendering complexity of the actual material compared with the default parameter material, and the element weight is adjusted through the material weight, so that the determined node weight can more accurately reflect the rendering complexity of the element under the actual condition.

[0065] The embodiment of the present application generates a preference weight according to the preference value of a user for an element, and then obtains a node weight in combination with the preference weight, so that the generated node weight contains the preference information of the user for the template element, and the element with high user preference can be preferentially rendered subsequently, thereby improving the user experience.

[0066] The embodiment of the present application splits the directed acyclic graph of the target template into multiple branches, and executes the multiple branches concurrently, thereby shortening the resource rendering time and improving the resource rendering efficiency; and the embodiment of the present application calculates a branch weight of a branch according to the node weight of a graph node in the branch, and determines a branch rendering order according to the branch weight, so that the branch with high branch weight can be preferentially rendered, thereby the branch with high complexity and / or the branch that is interesting to the user can be preferentially rendered, further improving the rendering efficiency and the user experience.

[0067] The embodiment of the present application splits the directed acyclic graph according to the number of concurrent threads, so that the number of branches after final splitting is greater than or equal to the number of concurrent threads, which is beneficial to improve the resource rendering efficiency and can avoid waste of system processing capacity.

[0068] The above description is only a summary of the technical solutions of the present application, in order to more clearly understand the technical means of the present application, the specific embodiments of the present application can be implemented according to the content of the specification, and in order to make the above and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS

[0069] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not meant to limit the present application. Moreover, the same reference numerals in different figures represent the same or similar components. In the drawings:

[0070] Figure 1 A running environment schematic diagram provided for implementing at least one embodiment of the present application is shown;

[0071] Figure 2 A flowchart of a template-based resource rendering method provided by the embodiment one of the present application is shown;

[0072] Figure 3 A schematic diagram of a directed acyclic graph provided by the embodiment one of the present application is shown;

[0073] Figure 4 A flowchart of a template-based resource rendering method provided by the embodiment two of the present application is shown;

[0074] Figure 5 A schematic diagram of a directed acyclic graph provided by the embodiment two of the present application is shown;

[0075] Figure 6 A structural diagram of a template-based resource rendering device is shown.

[0076] Figure 7 A structural diagram of a computing device is shown. DETAILED DESCRIPTION

[0077] Exemplary embodiments of the present application will be described herein below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present application can be more thoroughly and completely understood, and so that the scope of the present application can be accurately conveyed to those skilled in the art.

[0078] It should be noted that the user-related data involved in the embodiments of the present application, such as user historical resource rendering data, etc. (which includes but is not limited to data for analysis, stored data, displayed data, etc.), are all authorized or fully authorized by the parties, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation portals for users to choose authorization or rejection.

[0079] Figure 1 A running environment diagram is shown for implementing various embodiments of the present application. The present application can be applied to an application environment including, but not limited to, a client 2, a server 4, a network 6.

[0080] Wherein:

[0081] The server 4 can be composed of a single or multiple computing devices. The multiple computing devices can include virtualized computing instances. The virtualized computing instances can include virtual machines, such as emulations of computer systems, operating systems, servers, etc. The computing devices can load the virtual machines based on virtual images and / or other data defining specific software (e.g., operating systems, specialized applications, servers) for emulation. As the demand for different types of processing services changes, different virtual machines can be loaded and / or terminated on one or more computing devices. A hypervisor can be implemented to manage the use of different virtual machines on the same computing device.

[0082] Server 4 can be configured to communicate with client 2, etc., via network 6. Network 6 includes various network devices such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or similar devices. Network 6 may include physical links, such as coaxial cable links, twisted pair cable links, fiber optic links, or combinations thereof, or wireless links, such as cellular links, satellite links, Wi-Fi links, etc.

[0083] Server 4 can provide services such as storage, reading, downloading, writing, querying, and deleting, such as providing static resource download services to clients through multiple domain names.

[0084] Client 2 can be running Windows or Android. TM Electronic devices running operating systems such as iOS, including smartphones, tablets, laptops, virtual reality devices, gaming devices, set-top boxes, in-vehicle terminals, and smart TVs. Based on these operating systems, various applications, such as browsers, can run.

[0085] Example 1

[0086] Figure 2 A flowchart illustrating a template-based resource rendering method according to Embodiment 1 of this application is shown. This resource rendering method can be executed on the client side or collaboratively by the client and server. Specifically, this embodiment can be applied to rendering scenarios of multimedia resources such as audio and video using templates.

[0087] Specifically, such as Figure 2 As shown, the method includes the following steps:

[0088] Step S210: Generate a directed acyclic graph of the target template based on the rendering dependencies between template elements in the target template; wherein, the graph nodes in the directed acyclic graph correspond to the template elements in the target template, and the directed edges in the directed acyclic graph correspond to the rendering dependencies between template elements in the target template.

[0089] The target template is the template selected by the user during the creation of multimedia resources such as audio and video. The target template typically contains at least one template element, each of which can achieve a corresponding rendering effect. These template elements include, but are not limited to: special effects, subtitles, stickers, music, and / or filters, etc.

[0090] In the implementation process, the inventors found that multiple elements can make the overall rendering effect optimal when meeting the corresponding rendering order. For example, rendering the dynamic blur special effect after rendering the filter can improve the overall rendering effect. Therefore, the embodiments of the present application pre-configure the rendering order between different elements in the case of optimal rendering effect, generate element rendering dependency configuration data based on the rendering order, and record whether any two elements have a dependency relationship (if element A can have a good rendering effect after element B is rendered, element A has a dependency relationship with element B, and element B is an upstream element of element A) in the element rendering dependency configuration data, and record the upstream and downstream relationships between elements with a dependency relationship.

[0091] After determining that the user selects the target template, the template elements contained in the target template are determined, and the rendering dependency relationship between the template elements can be quickly and accurately determined by searching the pre-generated element rendering dependency configuration data. Further, a directed acyclic graph (DAG) of the target template is generated according to the rendering dependency relationship between the template elements. The directed acyclic graph includes graph nodes and directed edges between the graph nodes. Each graph node in the directed acyclic graph of the target template corresponds to a template element in the target template, that is, the graph nodes and the template elements are one-to-one corresponding, and the directed edges between the graph nodes correspond to the rendering dependency relationship between the template elements.

[0092] In the specific directed acyclic graph generation process, a graph node corresponding to each template element is generated. For any two graph nodes, it is judged whether there is a rendering dependency relationship between the template elements corresponding to the two graph nodes; if so, a directed edge is established between the two graph nodes, and the direction of the directed edge is determined according to the upstream and downstream relationships of the two template elements, for example, template element A is an upstream element of template element B, template element A corresponds to graph node N1, and template element B corresponds to graph node N2, there is a directed edge between graph node N1 and graph node N2 in the directed acyclic graph, and the directed edge is from graph node N1 to graph node N2; if not, no directed edge is established between the two graph nodes. Reference Figure 3 , the volume element depends on the addition of the music background element, the addition of the music background element depends on the addition of the subtitle element, the addition of the subtitle element depends on the basic video special effect element, the addition of the sticker element depends on the basic video special effect element, and the dynamic blur special effect element depends on the basic video special effect element.

[0093] In actual implementation, after the target template is determined, the rendering dependency relationship between the template elements can be determined according to the element rendering dependency relationship configuration data, and then a directed acyclic graph of the target template is generated. Alternatively, a global directed acyclic graph corresponding to each element in the platform can be generated in advance according to the element rendering dependency relationship configuration data. After the target template is determined, a sub-directed graph containing only the template elements is extracted from the global directed acyclic graph as the directed acyclic graph of the target template. In the specific extraction process, all links containing the template elements of the target template are first extracted from the global directed acyclic graph, and the non-template elements in the links are short-circuited to obtain the directed acyclic graph of the target template.

[0094] In step S220, for any graph node, a node weight of the graph node is calculated according to a rendering complexity of a template element corresponding to the graph node.

[0095] For any graph node in the directed acyclic graph, a rendering complexity of a template element corresponding to the graph node is obtained. The rendering complexity is used to describe the difficulty of rendering the template element. The higher the rendering complexity of the template element, the more difficult it is to render the template element. A node weight is further generated according to the rendering complexity. The node weight is positively correlated with the rendering complexity.

[0096] In an optional embodiment, the node weight can be generated by one or more of the following methods:

[0097] Embodiment one: The element weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node, and then the node weight is determined according to the element weight. Specifically, the rendering complexity of different elements under default parameters can be generated in advance. The rendering complexity of an element under default parameters indicates the corresponding rendering complexity when the element uses default parameters of the material. The default parameters include default length, default resolution, default format, and the like. For example, the rendering complexity of a sticker element under default parameters can refer to the complexity of a sticker picture with a resolution of 1080p and a format of JPG when resources are rendered based on the template. In this embodiment, the rendering complexity of the template element can be obtained by looking up the rendering complexity of different elements generated in advance, and then the element weight is obtained. For example, the rendering complexity can be directly used as the element weight, or the rendering complexity can be processed to obtain the element weight. Therefore, the element weight can reflect the rendering difficulty of the element under the default condition.

[0098] Optionally, to improve the accuracy of rendering complexity determination, this embodiment performs element rendering complexity testing in advance, records the rendering time data of elements under different default parameters on the test end (where the default parameters corresponding to different elements can be different), and obtains the rendering data of different elements under the corresponding default parameters; for any element, extracts the system overhead and rendering time of the element from the rendering data of the element, and further generates the rendering complexity of the element based on the system overhead and rendering time.

[0099] Specifically, for any given element, the average system overhead and average rendering time are calculated when rendering that element with default parameters on the test server. The element rendering time per unit of system overhead is then calculated based on these average rendering time and average system overhead. For example, the average system overhead can be quantized as N * unit system overhead, and the ratio of the average rendering time to this average system overhead can be used as the element rendering time per unit of system overhead. This allows for appropriate processing of the element rendering time (such as normalization) to obtain the rendering complexity. This method enables precise quantification of rendering complexity, improving the accuracy of rendering complexity determination and consequently improving the accuracy of node weight determination.

[0100] Alternatively, to improve the resource rendering efficiency on the client side, the server can pre-generate the rendering complexity of different elements, thereby obtaining the element weights of different elements, and store the element weights of different elements on the server. After determining the target template, the client obtains the element weights of the template elements from the server, and then obtains the element weights of the corresponding graph nodes.

[0101] Implementation Method Two: After selecting a target template, users can add materials to the corresponding template elements. The client then obtains the materials added to any template element and their attributes. These attributes include resolution, length, bitrate, etc. For example, if the target template contains subtitle elements, the user can add specific subtitle materials to those elements; or, if the target template contains sticker elements, the user can add specific images to those sticker elements, and so on.

[0102] As can be known from the description of one of the above embodiments, the element weight can reflect the rendering complexity of the element in the default case. However, in actual implementation, the material attribute of the material added for the element can be consistent with the default parameter or inconsistent with the default parameter, and the material attribute of the actual material added for the element affects the rendering difficulty of the actual element. Therefore, in this embodiment, in addition to calculating the element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node, the material weight of the graph node is also calculated according to the material attribute of the template element corresponding to the graph node. The material weight can reflect the rendering difficulty of the actual added material, and then the node weight of the graph node is generated according to the element weight and the material weight, so as to obtain a more accurate node weight by correcting the element weight through the material weight.

[0103] Further optionally, the material weight can be obtained by calculating the difference coefficient of the material attribute of the template element and the default parameter of the template element. Specifically, for each template element, the difference coefficient of the material attribute compared with the corresponding default parameter is calculated, for example, the ratio of the material attribute to the default parameter can be taken as the corresponding difference coefficient; the material weight of the graph node is generated according to the difference coefficient. For example, the ratio of the material resolution of the template element to the default resolution is calculated as the resolution difference coefficient, the ratio of the material length of the template element to the default length is calculated as the length difference coefficient, and then the product of the resolution difference coefficient and the length difference coefficient is obtained as the material weight. In this way, the difference between the material attribute of the actual added material and the default parameter can be accurately determined, which facilitates the accurate correction of the element weight through the material weight subsequently.

[0104] Embodiment three: In this embodiment, the user historical resource rendering data is pre-acquired, and the preference value of any element is calculated according to the user historical resource rendering data. Specifically, the historical resource rendering data of the user corresponding to the client can be acquired, the occurrence frequency of different elements is counted, and the preference value of each element for the current user is determined according to the occurrence frequency. The preference value of the user for the element is positively correlated with the occurrence frequency of the element in the historical resource rendering data of the user. The preference value can be pre-generated and stored, and the preference value is acquired subsequently in this embodiment. In addition to calculating the element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node, the preference weight of the graph node is also calculated according to the preference value corresponding to the template element corresponding to the graph node in this embodiment, and then the node weight of the graph node is generated according to the preference weight and the element weight (for example, the sum or weighted sum of the preference weight and the element weight can be taken as the node weight). Therefore, the node weight contains the preference information of the user for the template element, so that the element with high user preference can be preferentially rendered, and the user experience is improved.

[0105] In an embodiment four, the element weight of the graph node is calculated according to the rendering complexity of the template element corresponding to the graph node, the material weight of the graph node is calculated according to the material attribute of the template element corresponding to the graph node, the preference weight of the graph node is calculated according to the preference value corresponding to the template element corresponding to the graph node, and the node weight of the graph node is generated according to the element weight, the material weight and the preference weight, so that the node weight comprehensively has the element complexity information, the material related information and the user preference information, the determined node weight is more reasonable and accurate, and the rendering effect is improved and the user experience is improved. In the specific implementation process, a person skilled in the art can select a suitable node weight function according to the actual situation, for example, the product of the element weight and the material weight can be calculated, and the sum or weighted sum of the product and the preference weight is taken as the final node weight.

[0106] In step S230, the rendering order of the template elements in the target template is determined according to the directed acyclic graph and the node weight of the graph node in the directed acyclic graph.

[0107] According to the directed acyclic graph obtained in step S210 and the node weight obtained in step S220, a weighted directed acyclic graph can be obtained, so that the rendering order of the template elements is determined according to the weighted directed acyclic graph. For example, on the basis of the dependency relationship conforming to the directed acyclic graph, the node with high weight is preferentially executed.

[0108] In step S240, the template elements are rendered according to the rendering order of the template elements.

[0109] Specifically, the template elements containing materials are sequentially rendered according to the rendering order in step S230.

[0110] It can be seen that the template-based resource rendering method provided by the embodiments of the present application generates a directed acyclic graph according to the rendering dependency relationship between the template elements in the target template, and finally determines the rendering order of the template elements in the target template according to the directed acyclic graph, so that the template elements can be rendered in the correct order and with good rendering effect, the rendering effect is improved, and the rendering error rate is reduced. Moreover, the node weight of the graph node is calculated according to the rendering complexity of the template element, and the rendering order of the template element is determined according to the node weight subsequently, so that the template element with high complexity can be preferentially rendered on the basis that the rendering order conforms to the directed acyclic graph, and the overall rendering efficiency is improved.

[0111] Embodiment two

[0112] Figure 4 A flowchart of a template-based resource rendering method provided by an embodiment two of the present application is shown. Specifically, as shown in Figure 4 The method includes the following steps:

[0113] Step S410, generating a directed acyclic graph of the target template according to the rendering dependency relationship between the template elements in the target template, and calculating the node weight of each graph node.

[0114] The specific implementation process of this step can refer to the description in other embodiments, which will not be repeated here.

[0115] Step S420, splitting the directed acyclic graph into multiple branches.

[0116] The directed acyclic graph of the target template is split into multiple branches, each branch contains at least one graph node, and there is no overlapping graph node between different branches. Preferably, different branches should be independent of each other, that is, there is no overlapping node and no connection of directed edges between different branches.

[0117] In an optional embodiment, the directed acyclic graph can be split in the following way: determine the number of concurrent threads (which can be referred to as the number of concurrent threads), which is the number of threads for concurrent rendering of target template resources, and further split the directed acyclic graph into multiple branches according to the number of threads, so that the number of branches obtained by splitting is greater than or equal to the number of concurrent threads, thereby improving rendering efficiency and shortening rendering time.

[0118] Specifically, the directed acyclic graph is first split according to the directed edge connection relationship between the graph nodes in the directed acyclic graph. There is no overlapping graph node between the branches obtained after the initial splitting, and the branches obtained after the initial splitting are independent of each other (that is, all graph nodes contained in the branches do not have directed edges with all graph nodes contained in other branches). Determine whether the number of branches obtained by the current splitting is less than the number of concurrent threads; if not, the splitting is complete; if yes, further splitting is performed. In the further splitting, the branch containing the most graph nodes is selected, and the branch is further split. After splitting, it is judged again whether the number of branches is less than the number of concurrent threads, and the process is repeated until the number of branches obtained by splitting is equal to the number of concurrent threads. This method can ensure that the number of branches obtained by splitting is greater than or equal to the number of concurrent threads, improve the overall rendering efficiency, and avoid resource waste.

[0119] For example, the number of concurrent threads is 4, and the number of branches obtained by splitting is 4 or more. Figure 5As shown in the directed acyclic graph, at the initial splitting, N1-N6 is taken as a branch 1, N7-N9 is taken as a branch 2, and N10-N11 is taken as a branch 3. If the number of concurrent threads is 2 or 3, the current number of branches is greater than or equal to the number of concurrent threads, and then the splitting ends, and the branch 1, the branch 2, and the branch 3 are the final branches of the directed acyclic graph after splitting. If the number of concurrent threads is 4, the current number of branches is less than the number of concurrent threads, and then the branch 1 containing the largest number of graph nodes is split again, and N1-N4 is taken as a branch 1-1, and the branch N5-N6 is taken as a branch 1-2, or N2-N4 is taken as a branch 1-1, and N1, N5, and N6 are taken as a branch 1-2. After the splitting again, the current number of branches is equal to the number of concurrent threads, and then the splitting ends, and the branch 1-1, the branch 1-2, the branch 2, and the branch 3 are the final branches of the directed acyclic graph after splitting.

[0120] In step S430, for any branch, a branch weight of the branch is calculated according to node weights of graph nodes contained in the branch.

[0121] For each split branch, a sum of node weights of all graph nodes in the branch is taken as a branch weight of the branch.

[0122] In an optional embodiment, an initial branch weight of the instruction can be generated according to node weights of all graph nodes in the branch, and the initial branch weight is corrected by using the preference weight of the graph node in the branch, and a weight obtained after the correction is taken as a final branch weight. For example, a sum of node weights of all graph nodes in the graph node is calculated as an initial branch weight, and a sum of preference weights of all graph nodes in the branch is calculated, and a product of the initial branch weight and the sum of the preference weights is taken as a branch weight of the branch, so that the element preferred by the user can be preferentially rendered, and the user experience is improved.

[0123] In step S440, a rendering order of each branch is determined according to the branch weight.

[0124] The branches are sorted according to the branch weight from high to low, and a sorting result is taken as a corresponding rendering order. That is, the higher the branch weight, the earlier the rendering order, and the branch is rendered earlier.

[0125] In step S450, a plurality of threads are used to render each branch according to the rendering order of the branch.

[0126] The multiple concurrent threads are used to render each branch chain in parallel. In the initial distribution state, N branch chains with the top N rendering orders are selected and distributed to N concurrent idle threads for processing. After any thread finishes processing the currently distributed branch chain, the branch chain with the earliest rendering order that has not yet started rendering is selected and the corresponding rendering task is executed. During the rendering of the branch chain, the threads render the template elements corresponding to the graph nodes in the branch chain in sequence according to the dependency relationship between the graph nodes.

[0127] In actual implementation, since the present application generally involves rendering of multiple different elements, a module registration mechanism for different rendering services (such as special effect processing, subtitle rendering, audio synthesis, etc.) can be provided in advance, dynamic access and configuration of different rendering services are supported, the different rendering services can be enabled and executed in parallel according to requirements, a unified parallel calling interface can be used to call the rendering services, and it is ensured that the different rendering services do not interfere with each other during execution, thereby improving processing efficiency.

[0128] As can be seen, the template-based resource rendering method provided by the embodiments of the present application splits the directed acyclic graph of the target template into multiple branch chains, and concurrently executes the multiple branch chains, thereby shortening the resource rendering time and improving the resource rendering efficiency. Moreover, the embodiments of the present application calculate the branch chain weight of a branch chain according to the node weight of a graph node in the branch chain, determine the branch chain rendering order according to the branch chain weight, and enable the branch chain with a high branch chain weight to be rendered preferentially, thereby enabling the branch chain with high complexity and / or interesting to the user to be rendered preferentially, and further improving the rendering efficiency and user experience.

[0129] Embodiment Three

[0130] Figure 6 A structure diagram of a template-based resource rendering device provided by Embodiment Three of the present application is shown. As shown in the figure, Figure 6 The device 600 includes a directed graph generation module 610, a weight determination module 620, an order determination module 630, and a rendering module 640.

[0131] The directed graph generation module 610 is configured to generate a directed acyclic graph of a target template according to the rendering dependency relationship between template elements in the target template. In the directed acyclic graph, a graph node corresponds to a template element in the target template, and a directed edge corresponds to the rendering dependency relationship between template elements in the target template.

[0132] The weight determination module 620 is configured to calculate the node weight of any graph node according to the rendering complexity of the template element corresponding to the graph node.

[0133] The order determination module 630 is configured to determine the rendering order of the template elements in the target template according to the directed acyclic graph and the node weight of the graph node in the directed acyclic graph.

[0134] a rendering module 640, configured to render the template elements according to the rendering order of the template elements.

[0135] In an optional implementation, the apparatus further comprises an obtaining module (not shown in the figure), configured to obtain the material added for any template element, and obtain the material attribute of the material;

[0136] The weight determining module 620 is configured to calculate the element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node;

[0137] calculate the material weight of the graph node according to the material attribute of the template element corresponding to the graph node;

[0138] generate the node weight of the graph node according to the element weight and the material weight.

[0139] In an optional implementation, the rendering complexity is obtained by: obtaining the rendering data of different elements under corresponding default parameters in advance;

[0140] For any element, extract the system overhead and rendering time consumption of the element from the rendering data of the element, and generate the rendering complexity of the element according to the system overhead and the rendering time consumption.

[0141] In an optional implementation, the weight determining module 620 is configured to: calculate the difference coefficient of the material attribute of the template element and the default parameter of the template element;

[0142] generate the material weight of the graph node according to the difference coefficient.

[0143] In an optional implementation, the weight determining module 620 is configured to: obtain user historical resource rendering data, calculate the preference value of any element according to the user historical resource rendering data; calculate the element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node; calculate the material weight of the graph node according to the material attribute of the template element corresponding to the graph node; calculate the preference weight of the graph node according to the preference value corresponding to the template element corresponding to the graph node; generate the node weight of the graph node according to the element weight, the material weight and the preference weight.

[0144] In an optional implementation, the order determining module 630 is configured to: split the directed acyclic graph into multiple branches;

[0145] For any branch, calculate the branch weight of the branch according to the node weight of the graph node included in the branch;

[0146] determine the rendering order of the branch according to the branch weight.

[0147] The rendering module 640 is configured to render each branch according to the rendering order of the branch by using a plurality of threads in parallel.

[0148] In an optional embodiment, the order determination module 630 is configured to determine the number of threads in parallel, and split the directed acyclic graph into a plurality of branches according to the number of threads.

[0149] Therefore, the template-based resource rendering apparatus provided by the embodiments of the present application generates a directed acyclic graph according to the rendering dependency relationship between the template elements in the target template, and finally determines the rendering order of the template elements in the target template according to the directed acyclic graph, so that the template elements can be rendered in a correct and good rendering effect order, the rendering effect is improved, and the rendering error rate is reduced. Moreover, the embodiments of the present application calculate the node weight of the graph node according to the rendering complexity of the template element, and subsequently determine the rendering order of the template element according to the node weight, so that the template element with high complexity can be preferentially rendered on the basis that the rendering order meets the directed acyclic graph, and the overall rendering efficiency is improved.

[0150] Embodiment Four

[0151] Figure 7 A structural schematic diagram of a computing device provided by the fourth embodiment of the present application is shown. The specific embodiments of the present application do not limit the specific implementation of the computing device.

[0152] As shown in Figure 7 the computing device can include a processor 702, a communications interface 704, a memory 706, and a communications bus 708.

[0153] The processor 702, the communications interface 704, and the memory 706 complete mutual communication through the communications bus 708. The communications interface 704 is configured to communicate with network elements such as clients or other servers, etc. The processor 702 is configured to execute the program 710, and specifically can execute the related steps in the above-described template-based resource rendering method embodiments for the computing device.

[0154] Specifically, the program 710 can include program code including computer operation instructions.

[0155] The processor 702 can be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to perform the operations of embodiments of the application. The one or more processors included in the computing device can be of the same type or different types, such as one or more CPUs and one or more ASICs.

[0156] The memory 706 is configured to store programs 710. The memory 706 can include a high-speed RAM memory, and can also include a non-volatile memory such as at least one disk memory. The programs 710 can be specifically configured to cause the processor 702 to perform the operations in the above method embodiments.

[0157] Embodiment five

[0158] Embodiment five of the present application provides a non-volatile computer storage medium, which stores at least one executable instruction or computer program. The executable instruction or computer program can cause a processor to perform operations corresponding to the template-based resource rendering method in any of the above method embodiments.

[0159] Embodiment six

[0160] Embodiment six of the present application provides a computer program product, which includes at least one executable instruction or computer program. The executable instruction or computer program can cause a processor to perform operations corresponding to the template-based resource rendering method in any of the above method embodiments.

[0161] In summary, according to the computing device, computer storage medium and computer program product provided by the present embodiment, the directed acyclic graph is generated according to the rendering dependency relationship between the template elements in the target template, and finally the rendering order of the template elements in the target template is determined according to the directed acyclic graph, so that the template elements can be rendered in the correct and good rendering order, the rendering effect is improved, and the rendering error rate is reduced. Moreover, according to the rendering complexity of the template elements, the node weight of the graph node is calculated, and subsequently the rendering order of the template elements is determined according to the node weight, so that on the basis of the rendering order conforming to the directed acyclic graph, the template elements with high complexity are preferentially rendered, and the overall rendering efficiency is improved.

[0162] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems can be used with programs in accordance with the teachings herein, or it can prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will be apparent from the description above. In addition, the present embodiments are not described with reference to any particular programming language. It will be appreciated that a variety of programming languages can be used to implement the teachings of the present disclosure as described herein, and any references below to specific languages are provided for disclosure of enablement only.

[0163] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to avoid obscuring the understanding of this description.

[0164] Similarly, it is to be understood that the mechanical details of the application that have been set forth in the description above of exemplary embodiments of the application sometimes comprise groups of alternative or interchangeable features that have been grouped together for ease of understanding and description. It is not to be construed that the application is in any way limited to these grouped features, and it is to be understood that the application can comprise any of the grouped features in any combination with any of the other features disclosed herein. It is to be understood that the disclosure of a specific number of features in a claim is to be interpreted as a specific disclosure of one feature or a specific disclosure of "at least one" feature. It is to be understood that the disclosure of features in the specification and the claims is to be interpreted as a disclosure of at least one feature and examples of features, data, and steps can be combined with each other in different ways depending upon the desired result. It is to be understood that the application is not limited in scope to the specific embodiments disclosed herein, which are intended for illustrative purposes only, and that any other embodiments which come within the scope of the following claims and equivalents thereof are likewise intended to be embraced.

[0165] Those skilled in the art will appreciate that the modules in the apparatuses of the embodiments can be adapted and placed in one or more apparatuses other than the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and further can be divided into more sub-modules or sub-units or sub-components. Any combination of all the features disclosed in the specification (including the accompanying claims, abstract and drawings), and any method or apparatus so disclosed, can be made by using any combination of the individual features implied by the disclosure. Except where expressly described otherwise, each feature disclosed in the specification (including the accompanying claims, abstract and drawings) can also be replaced by an alternative feature serving the same, equivalent or a similar purpose to provide the same, equivalent or similar result.

[0166] Furthermore, those skilled in the art will recognize that, while certain embodiments described herein include certain features that are not included in other embodiments, combinations of features of the different embodiments are meant to be within the scope of the application and form different embodiments. For example, in the claims below any of the claimed embodiments can be used in any combination.

[0167] Various component embodiments of the present application can be implemented in hardware, or as software modules running in one or more processors, or in combinations thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functionality of some or all of the components according to embodiments of the present application. The present application can also be implemented as a program of instructions for performing part or all of the methods described herein, e.g., a computer program and a computer program product. Such a program of instructions of the present application can be stored on a computer readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier signal, or in any other form.

[0168] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that one skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word 'comprising' does not exclude the presence of elements or steps other than those listed in a claim. The word 'a' or 'an' preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unitary claim, several devices, apparatuses or means can be listed, comprising means for performing a certain function. The means performed by one device, apparatus or means can also be performed by one or more of the other devices, apparatuses or means. The word 'processor' should be construed to cover any hardware component, and meanwhile one or more processors in a processing system. The word 'processor' can also cover a plurality of processors, e.g., in a multi-processor system. The embodiments were chosen and described in order to explain the principles of the application and the practical application, and to allow others skilled in the art to understand the application for various embodiments with various modifications that are suited to the particular use contemplated.

Claims

1. A template-based resource rendering method, characterized by, The method comprises: generating a directed acyclic graph of the target template according to rendering dependency relationships between template elements in the target template; wherein a graph node in the directed acyclic graph corresponds to a template element in the target template, and a directed edge in the directed acyclic graph corresponds to a rendering dependency relationship between template elements in the target template; for any graph node, calculating a node weight of the graph node according to a rendering complexity of the template element corresponding to the graph node; splitting the directed acyclic graph into multiple branches; for any branch, calculating a branch weight of the branch according to node weights of graph nodes included in the branch; and determining a rendering order of the branch according to the branch weight; rendering each branch according to the rendering order of the branch by using multiple threads in parallel.

2. The method of claim 1, wherein, The method further comprises: obtaining a material added for any template element, and obtaining a material attribute of the material; The calculation of the node weight of the graph node according to the rendering complexity of the template element corresponding to the graph node comprises: calculating an element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node; calculating a material weight of the graph node according to a material attribute of the template element corresponding to the graph node; generating the node weight of the graph node according to the element weight and the material weight.

3. The method of claim 2, wherein, Before the calculation of the element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node, the method further comprises: pre-obtaining rendering data of different elements under corresponding default parameters; for any element, extracting a system overhead and a rendering time consumption of the element from the rendering data of the element, and generating a rendering complexity of the element according to the system overhead and the rendering time consumption.

4. The method of claim 3, wherein, The calculation of the material weight of the graph node according to the material attribute of the template element corresponding to the graph node comprises: calculating a difference coefficient of the material attribute of the template element and a default parameter of the template element; generating the material weight of the graph node according to the difference coefficient.

5. The method according to any one of claims 2-4, characterized in that, The method further comprises: obtaining user historical resource rendering data, and calculating a preference value of any element according to the user historical resource rendering data; The calculation of the node weight of the graph node according to the rendering complexity of the template element corresponding to the graph node comprises: calculating an element weight of the graph node according to the rendering complexity of the template element corresponding to the graph node; calculating a material weight of the graph node according to a material attribute of the template element corresponding to the graph node; calculating a preference weight of the graph node according to a preference value corresponding to the template element corresponding to the graph node; generating the node weight of the graph node according to the element weight, the material weight, and the preference weight.

6. The method of claim 1, wherein, The splitting of the directed acyclic graph into multiple branches comprises: determining a number of threads in parallel; splitting the directed acyclic graph into multiple branches according to the number of threads.

7. A template-based resource rendering apparatus, characterized by comprising: The method comprises: a directed graph generation module configured to generate a directed acyclic graph of a target template according to rendering dependency relationships between template elements in the target template; wherein a graph node in the directed acyclic graph corresponds to a template element in the target template, and a directed edge in the directed acyclic graph corresponds to a rendering dependency relationship between template elements in the target template; a weight determination module, configured to calculate a node weight of any graph node according to a rendering complexity of a template element corresponding to the graph node; a sequence determination module, configured to split the directed acyclic graph into a plurality of branches, calculate a branch weight of any branch according to node weights of graph nodes included in the branch, and determine a rendering sequence of the branch according to the branch weight; a rendering module, configured to render each branch according to the rendering sequence of the branch by using a plurality of threads in parallel.

8. A computing device, comprising: comprising: a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction makes the processor execute the operation corresponding to the template-based resource rendering method in any one of claims 1-6.

9. A computer storage medium, characterized in that the storage medium has at least one executable instruction stored therein, and the executable instruction makes the processor execute the operation corresponding to the template-based resource rendering method in any one of claims 1-6.

10. A computer program product, characterised in that, comprise at least one executable instruction, and the executable instruction makes the processor execute the operation corresponding to the template-based resource rendering method in any one of claims 1-6.

Citation Information

Patent Citations

  • Three-dimensional rendering system and method for animation image

    CN118334223A