CN118042181B - Video rendering method, apparatus, electronic device, computer-readable storage medium, and computer program product - Google Patents
Video rendering method, apparatus, electronic device, computer-readable storage medium, and computer program product Download PDFInfo
- Publication number
- CN118042181B CN118042181B CN202410438015.XA CN202410438015A CN118042181B CN 118042181 B CN118042181 B CN 118042181B CN 202410438015 A CN202410438015 A CN 202410438015A CN 118042181 B CN118042181 B CN 118042181B
- Authority
- CN
- China
- Prior art keywords
- rendering
- partitions
- resource
- resources
- partition
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000009877 rendering Methods 0.000 title claims abstract description 1440
- 238000000034 method Methods 0.000 title claims abstract description 91
- 238000004590 computer program Methods 0.000 title claims abstract description 18
- 238000005192 partition Methods 0.000 claims abstract description 540
- 230000015654 memory Effects 0.000 claims description 34
- 230000004044 response Effects 0.000 claims description 18
- 230000008569 process Effects 0.000 claims description 12
- 238000010801 machine learning Methods 0.000 claims description 11
- 238000000605 extraction Methods 0.000 claims description 2
- 239000000758 substrate Substances 0.000 claims 2
- 238000010586 diagram Methods 0.000 description 26
- 238000005516 engineering process Methods 0.000 description 25
- 230000006870 function Effects 0.000 description 15
- 238000012545 processing Methods 0.000 description 12
- 238000013473 artificial intelligence Methods 0.000 description 11
- 238000004422 calculation algorithm Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000012546 transfer Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 230000018109 developmental process Effects 0.000 description 3
- 235000019800 disodium phosphate Nutrition 0.000 description 3
- 230000017525 heat dissipation Effects 0.000 description 3
- 238000000638 solvent extraction Methods 0.000 description 3
- 230000000007 visual effect Effects 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 210000002569 neuron Anatomy 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004549 pulsed laser deposition Methods 0.000 description 2
- 238000013515 script Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 208000018747 cerebellar ataxia with neuropathy and bilateral vestibular areflexia syndrome Diseases 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 239000004744 fabric Substances 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 238000012805 post-processing Methods 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Landscapes
- Processing Or Creating Images (AREA)
Abstract
The application provides a video rendering method, a video rendering device, electronic equipment, a computer readable storage medium and a computer program product; the method comprises the following steps: receiving a first rendering task; querying a first rendering resource in an idle state from a plurality of rendering resources, wherein a rendering canvas of the first rendering resource comprises a plurality of rendering partitions, and different rendering partitions are used for responding to different rendering tasks; determining a first rendering partition in an idle state from a plurality of rendering partitions; executing at least one current rendering task through a plurality of rendering partitions to obtain rendering data, wherein the at least one current rendering task comprises a first rendering task, and the first rendering partition is used for executing the first rendering task; and extracting the first video data corresponding to the first rendering partition from the rendering data, and sending the first video data to the first terminal. According to the application, a plurality of rendering tasks can be processed in one rendering resource, and the utilization rate of the rendering resource is improved.
Description
Technical Field
The present application relates to artificial intelligence technology, and in particular, to a video rendering method, apparatus, electronic device, computer readable storage medium, and computer program product.
Background
With the development of computer technology, video generation technology, that is, rendering and generating video data, has emerged, and the video generation technology may be applied to various scenes, for example, in a live scene, a scene including a virtual anchor needs to be rendered and generated, and in a game scene, a scene including an avatar needs to be rendered and generated.
In the related art, one rendering task is usually processed through one rendering resource, that is, one rendering resource is monopolized for each rendering task, then the number of rendering resources is limited, and a large number of concurrent rendering tasks often exist, which affects the execution efficiency of the rendering task.
Disclosure of Invention
The embodiment of the application provides a video rendering method, a device, electronic equipment, a computer readable storage medium and a computer program product, which can process a plurality of rendering tasks in one rendering resource and improve the utilization rate of the rendering resource.
The technical scheme of the embodiment of the application is realized as follows:
the embodiment of the application provides a video rendering method, which comprises the following steps:
receiving a first rendering task, wherein the first rendering task is sent by a first terminal;
Querying a first rendering resource in a free state from a plurality of rendering resources, wherein a rendering canvas of the first rendering resource comprises a plurality of rendering partitions, and different rendering partitions are used for responding to different rendering tasks;
Determining a first rendering partition in an idle state from the plurality of rendering partitions;
executing at least one current rendering task through the plurality of rendering partitions to obtain rendering data, wherein the at least one current rendering task comprises the first rendering task, and the first rendering partition is used for executing the first rendering task;
and extracting first video data corresponding to the first rendering partition from the rendering data, and sending the first video data to the first terminal.
An embodiment of the present application provides a video rendering apparatus, including:
The receiving module is used for receiving a first rendering task, wherein the first rendering task is sent by a first terminal;
The query module is used for querying a first rendering resource in an idle state from a plurality of rendering resources, wherein rendering canvas of the first rendering resource comprises a plurality of rendering partitions, and different rendering partitions are used for responding to different rendering tasks;
a determining module, configured to determine a first rendering partition in an idle state from the plurality of rendering partitions;
The rendering module is used for executing at least one current rendering task through the plurality of rendering partitions to obtain rendering data, wherein the at least one current rendering task comprises the first rendering task, and the first rendering partition is used for executing the first rendering task;
And the extraction module is used for extracting first video data corresponding to the first rendering partition from the rendering data and sending the first video data to the first terminal.
An embodiment of the present application provides an electronic device, including:
A memory for storing computer executable instructions;
and the processor is used for realizing the video rendering method provided by the embodiment of the application when executing the computer executable instructions stored in the memory.
The embodiment of the application provides a computer readable storage medium, which stores a computer program or computer executable instructions for implementing the video rendering method provided by the embodiment of the application when being executed by a processor.
The embodiment of the application provides a computer program product, which comprises a computer program or a computer executable instruction, and the computer program or the computer executable instruction realize the video rendering method provided by the embodiment of the application when being executed by a processor.
The embodiment of the application has the following beneficial effects:
By dividing the rendering canvas of the rendering resource into a plurality of rendering partitions, different rendering partitions respectively respond to different rendering tasks, and compared with a mode that one rendering task monopolizes one rendering resource, the performance of the rendering resource is fully utilized; when a rendering task is received, the rendering task is executed by distributing rendering partitions in an idle state, and then video data corresponding to the rendering task is extracted from the rendering data.
Drawings
FIG. 1A is a schematic diagram of a related art video rendering provided by an embodiment of the present application;
Fig. 1B is a schematic diagram of a video rendering method according to an embodiment of the present application;
fig. 2 is a schematic architecture diagram of a video rendering system 100 according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of a server 200 according to an embodiment of the present application;
fig. 4A is a schematic flow chart of a video rendering method according to an embodiment of the present application;
Fig. 4B is a schematic diagram of a second flow of a video rendering method according to an embodiment of the present application;
fig. 4C is a schematic third flowchart of a video rendering method according to an embodiment of the present application;
fig. 4D is a fourth flowchart of a video rendering method according to an embodiment of the present application;
Fig. 4E is a fifth flowchart of a video rendering method according to an embodiment of the present application;
fig. 4F is a sixth flowchart of a video rendering method according to an embodiment of the present application;
Fig. 4G is a seventh flowchart of a video rendering method according to an embodiment of the present application;
Fig. 4H is an eighth flowchart of a video rendering method according to an embodiment of the present application;
fig. 4I is a ninth flowchart of a video rendering method according to an embodiment of the present application;
Fig. 4J is a tenth flowchart of a video rendering method according to an embodiment of the present application;
FIG. 5A is a first schematic diagram of a rendering task reassignment provided by an embodiment of the present application;
FIG. 5B is a second schematic diagram of rendering task reassignment provided by an embodiment of the present application;
Fig. 6 is an overall link architecture diagram of a video rendering method according to an embodiment of the present application;
FIG. 7 is a schematic flow diagram of matching idle cloud rendering resources provided by an embodiment of the present application;
fig. 8 is a schematic flow chart of picture cutting according to an embodiment of the present application;
FIG. 9 is a flow chart of determining the number of rendered partitions according to a frame rate provided by an embodiment of the present application;
fig. 10 is a schematic diagram of finding a partition according to a rendering instruction to complete rendering according to an embodiment of the present application.
It should be noted that the above "first" and "second" are only used to distinguish between different schemes, and do not represent the degree of preference or priority in implementation.
Detailed Description
The present application will be further described in detail with reference to the accompanying drawings, for the purpose of making the objects, technical solutions and advantages of the present application more apparent, and the described embodiments should not be construed as limiting the present application, and all other embodiments obtained by those skilled in the art without making any inventive effort are within the scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with one another without conflict.
If a similar description of "first/second" appears in the application document, the following description is added, in which the terms "first/second/third" merely distinguish similar objects and do not represent a specific ordering of the objects, it being understood that "first/second/third" may, where allowed, interchange a specific order or precedence, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein.
In the present embodiment, the term "module" or "unit" refers to a computer program or a part of a computer program having a predetermined function and working together with other relevant parts to achieve a predetermined object, and may be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Also, a processor (or multiple processors or memories) may be used to implement one or more modules or units. Furthermore, each module or unit may be part of an overall module or unit that incorporates the functionality of the module or unit.
Unless specifically stated otherwise, at least one of the following refers to one or more cases, and "a plurality" may refer to two or more cases.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the embodiments of the application is for the purpose of describing embodiments of the application only and is not intended to be limiting of the application.
Before describing embodiments of the present application in further detail, the terms and terminology involved in the embodiments of the present application will be described, and the terms and terminology involved in the embodiments of the present application will be used in the following explanation.
1) Rendering data refers to data involved in converting visual elements such as models, scenes, and animations into images for display on a screen. For example, rendering data may include: model data, texture data, illumination data, camera data, animation data, and post-processing data.
2) Rendering tasks refer to tasks that generate visual elements such as scenes, characters, and objects into rendering data that can be presented onto a screen. Taking a game as an example, the rendering task may refer to a task of generating rendering data from visual elements such as virtual scenes, virtual objects, virtual articles, and the like in the game through a computer graphics technology.
3) Rendering resources, hardware devices that perform rendering tasks, including graphics processors (Graphics Processing Unit, GPUs), central processing units (Central Processing Unit, CPUs), application Specific Integrated Circuits (ASICs), digital signal processors (DIGITAL SIGNAL processors, DSPs), programmable logic devices (Programmable Logic Device, PLDs), complex Programmable logic devices (Complex Programmable Logic Device, CPLDs), field-Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA), or other electronic components.
4) And the rendering partitions divide rendering canvases of the rendering resources into areas, and different rendering partitions are used for rendering pictures requested to be rendered by different rendering tasks. For example, the rendering canvas may be divided equally into 2 regions, or divided equally into 4 regions, each region acting as a rendering partition.
5) Rendering data, namely rendering data obtained by rendering a plurality of rendering partitions in a rendering resource. Rendering data may take a variety of forms, such as a video stream, a video file, a sequence of images, or a rendering layer.
6) Performance parameters, which represent the performance parameters of the rendering resources, such as graphics processors, may include memory capacity, memory bandwidth, dominant frequency, heat dissipation capability, and maximum resolution supported.
7) And rendering configuration conditions, namely completing the rendering task and requiring the lowest performance parameter of the rendering resource. Such as the lowest memory capacity, lowest memory bandwidth, lowest dominant frequency, lowest heat dissipation capability, and lowest resolution supported.
8) And a frame rate threshold, wherein when a rendering task is executed through a rendering resource, the minimum frame rate can be realized on the premise of ensuring the smoothness and definition of the picture. The Frame rate threshold may be determined based on the viewing experience of the user, taking the rendering of game frames as an example, and generally, 30 Frames Per Second (FPS) is a commonly employed Frame rate threshold.
Referring to fig. 1A, fig. 1A is a schematic diagram of video rendering according to the related art according to an embodiment of the present application. In fig. 1A, related art often puts different rendering tasks on different rendering resources for rendering, and each rendering resource generates a video stream and sends the video stream to a corresponding terminal to complete the rendering of the video. In practice, a rendering resource tends to monopolize the entire rendering canvas when performing one rendering task.
Referring to fig. 1B, fig. 1B is a schematic diagram of a video rendering method according to an embodiment of the present application. In fig. 1B, in the embodiment of the present application, by partitioning the rendering resources, partition 1 to partition 4 are obtained, so that the same rendering resource can perform multiple rendering tasks, and video data corresponding to the rendering partition is extracted to be sent to the corresponding terminal 1 to terminal 4.
Based on the above analysis, the applicant finds that the video rendering method of the related art cannot fully utilize rendering resources, resulting in rendering resources waste, and for the technical problems described above, the embodiment of the application provides a video rendering method, which can process a plurality of rendering tasks in one rendering resource, and improves the utilization rate of the rendering resource.
The embodiment of the application provides a video rendering method, a device, an electronic device, a computer readable storage medium and a computer program product, which can process a plurality of rendering tasks in one rendering resource, improve the utilization rate of the rendering resource, and the following describes an exemplary application of the electronic device provided by the embodiment of the application. In the following, an exemplary application when the electronic device is implemented as a server will be described.
Referring to fig. 2, fig. 2 is a schematic architecture diagram of a video rendering system 100 according to an embodiment of the present application, in order to support a video rendering application, a terminal 400 is connected to a server 200 through a network 300, where the network 300 may be a wide area network or a local area network, or a combination of the two.
The terminal 400 is configured to send a rendering request carrying a rendering task, and the server 200 is configured to divide a rendering resource into a plurality of rendering partitions, execute the rendering task with the rendering partition in an idle state, obtain rendering data, extract video data corresponding to the rendering task from the rendering task, and send the video data to the terminal 400 corresponding to the rendering task. The terminal 400 receives the video data and displays the video data on the man-machine interface 410.
Taking a game scene as an example, a plurality of terminals run an online game, the terminals respectively send rendering requests carrying rendering tasks to a server, the server executes the rendering tasks through rendering partitions in rendering resources to generate rendering data, video data corresponding to the rendering tasks sent by the terminals are extracted from the rendering data, the video data are sent to the terminals, and the terminals display game pictures according to the video data.
Taking a scene of video editing or creation as an example, a terminal runs a video creation application, a user submits a rendering request carrying a rendering task of video editing or creation to a server, the server executes the rendering task through a rendering partition in a rendering resource to generate rendering data, video data corresponding to the rendering task sent by the terminal is extracted from the rendering data, the video data is sent to the terminal, and the terminal plays according to the video data.
In some embodiments, the server 200 may be a stand-alone physical server, a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited in the embodiment of the present application.
The embodiments of the present application may be implemented by artificial intelligence techniques, i.e., artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) is a theory, method, technique, and application system that utilizes a digital computer or a digital computer-controlled machine to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain optimal results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
The artificial intelligence technology is a comprehensive subject, and relates to the technology with wide fields, namely the technology with a hardware level and the technology with a software level. Artificial intelligence infrastructure technologies generally include, for example, sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, pre-training model technologies, operation/interaction systems, mechatronics, and the like. The pre-training model is also called a large model and a basic model, and can be widely applied to all large-direction downstream tasks of artificial intelligence after fine adjustment. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
The embodiment of the application can also be realized by Cloud Technology, and the Cloud Technology (Cloud Technology) is based on the general terms of network Technology, information Technology, integration Technology, management platform Technology, application Technology and the like applied by a Cloud computing business mode, can form a resource pool, and is used as required, flexible and convenient. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the advanced development and application of the internet industry and the promotion of requirements of search services, social networks, mobile commerce, open collaboration and the like, each article possibly has a hash code identification mark, the hash code identification mark needs to be transmitted to a background system for logic processing, data of different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a server 200 according to an embodiment of the present application, and the server 200 shown in fig. 3 includes: at least one processor 210, a memory 230, and at least one network interface 220. The various components in server 200 are coupled together by bus system 240. It is understood that the bus system 240 is used to enable connected communications between these components. The bus system 240 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration the various buses are labeled as bus system 240 in fig. 3.
The Processor 210 may be an integrated circuit chip having signal processing capabilities such as a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc., where the general purpose Processor may be a microprocessor or any conventional Processor, etc.
Memory 230 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard drives, optical drives, and the like. Memory 230 optionally includes one or more storage devices that are physically remote from processor 210.
Memory 230 includes volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read Only Memory (ROM) and the volatile Memory may be a random access Memory (Random Access Memory, RAM). The memory 230 described in embodiments of the present application is intended to comprise any suitable type of memory.
In some embodiments, memory 230 is capable of storing data to support various operations, examples of which include programs, modules and data structures, or subsets or supersets thereof, as exemplified below.
An operating system 231 including system programs, e.g., a framework layer, a core library layer, a driver layer, etc., for handling various basic system services and performing hardware-related tasks, for implementing various basic services and handling hardware-based tasks;
a network communication module 232 for reaching other electronic devices via one or more (wired or wireless) network interfaces 220, the exemplary network interfaces 220 comprising: bluetooth, wireless compatibility authentication (WiFi), and universal serial bus (Universal Serial Bus, USB), etc.;
In some embodiments, the apparatus provided in the embodiments of the present application may be implemented in software, and fig. 3 shows a video rendering apparatus 233 stored in a memory 230, which may be software in the form of a program and a plug-in, and includes the following software modules: the receiving module 2331, the querying module 2332, the determining module 2333, the rendering module 2334 and the extracting module 2335 are logical, so that any combination or further splitting may be performed according to the implemented functions. The functions of the respective modules will be described hereinafter.
In other embodiments, the apparatus provided by the embodiments of the present application may be implemented in hardware, and by way of example, the apparatus provided by the embodiments of the present application may be a Processor in the form of a hardware decoding Processor that is programmed to perform the video rendering method provided by the embodiments of the present application, for example, the Processor in the form of a hardware decoding Processor may employ one or more Application-specific integrated circuits (ASICs), digital signal processors (DIGITAL SIGNAL processors, DSPs), programmable logic devices (Programmable Logic Device, PLDs), complex Programmable logic devices (Complex Programmable Logic Device, CPLDs), field-Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA), or other electronic components.
The video rendering method provided by the embodiment of the application will be described in conjunction with exemplary applications and implementations of the server provided by the embodiment of the application.
Referring to fig. 4A, fig. 4A is a schematic flow chart of a video rendering method according to an embodiment of the present application, and the method mainly includes a server, and is described with reference to the steps shown in fig. 4A.
In step 101, a first rendering task is received, wherein the first rendering task is sent by a first terminal.
In some embodiments, when a user opens a page or applet including a first rendering task at a first terminal, the first terminal sends a rendering request to a server, the first rendering task being carried in the rendering request sent by the first terminal. The rendering request may be a network request based on hypertext transfer protocol (HyperText Transfer Protocol, HTTP) or secure hypertext transfer protocol (HyperText Transfer Protocol Secure, HTTPs).
By way of example, taking a game scene as an example, the rendering request may be a rendering request for a virtual scene, virtual object, or virtual prop in the game. Taking video editing or authoring as an example, the rendering request may be a rendering request for a virtual scene or virtual object in the video that needs editing or authoring. Taking a movie or an animated scene as an example, the rendering request may be a rendering request for a virtual scene or virtual character in the movie or animation.
In step 102, a first rendering resource in a free state is queried from a plurality of rendering resources, wherein a rendering canvas of the first rendering resource includes a plurality of rendering partitions, different rendering partitions being used to respond to different rendering tasks.
In some embodiments, when the first rendering resource has a plurality of rendering partitions, querying a rendering resource including a rendering partition in a free state from the plurality of rendering resources as the first rendering resource; the first rendering resource may also be considered to be in a free state when the first rendering resource is not partitioned.
In some embodiments, in response to a plurality of rendering partitions of a rendering resource being in use, a notification of no rendering resource is sent to the first terminal.
In some embodiments, the first rendering task carries rendering configuration conditions, referring to fig. 4B, fig. 4B is a second flow diagram of the video rendering method according to the embodiment of the present application. Step 102 "querying the first rendering resource in the idle state from the plurality of rendering resources" of fig. 4A may be implemented through steps 1021 through 1022 of fig. 4B, which are described in detail below.
In step 1021, a rendering resource that satisfies the rendering configuration condition and includes the rendering partition in the free state is searched from among the plurality of rendering resources as the first rendering resource.
In some embodiments, if the rendering resource is a graphics card, the rendering configuration conditions may be: the performance parameter of the first rendering resource is greater than or equal to the lowest performance parameter of the rendering resource required to complete the first rendering task.
By way of example, the performance parameters include at least one of: memory capacity, memory bandwidth, main frequency, heat dissipation capability, and maximum resolution supported.
In some embodiments, referring to fig. 4C, fig. 4C is a third flow chart of a video rendering method according to an embodiment of the present application. Step 1021 of fig. 4B may be implemented by steps 10211A to 10212A of fig. 4C, as described in detail below.
In step 10211A, an index table is obtained, where the index table is used to record states of a plurality of rendering partitions respectively included by a plurality of rendering resources and performance parameters respectively included by the plurality of rendering resources.
In some embodiments, the server maintains an index table, and the performance parameters of the rendering resources may be written into the index table according to the registration request of the corresponding rendering resources when the rendering resources are online.
For example, if there are two rendering resources, rendering resource a and rendering resource B, the index table records that rendering resource a includes 6 rendering partitions, 3 of which are in idle state, 3 of which are in use state, and performance parameters of rendering resource a, while the index table records that rendering resource B includes 4 rendering partitions, 3 of which are in idle state, 1 of which are in use state, and performance parameters of rendering resource B.
In step 10212A, a rendering configuration condition is queried from the index table and includes at least one rendering partition in a free state as a first rendering resource, wherein the rendering configuration condition includes: the minimum performance parameter required to complete the first rendering task is less than the performance parameter possessed by the rendering resource.
In some embodiments, if the plurality of rendering resources all satisfy the rendering configuration condition and include at least one rendering partition in the idle state, any one rendering resource may be selected as the first rendering resource, or the rendering resource with the number of 1 rendering partitions in the idle state may be preferentially selected, that is, the number of rendering partitions in the idle state may just execute the first rendering request.
According to the embodiment of the application, the rendering resources with the number of 1 of the rendering partitions in the idle state are preferentially selected, so that when the rendering partitions in the idle state are used for executing the first rendering task, the rendering partitions of the rendering resources are just in the use state, the rendering partitions are prevented from being wasted, and the utilization rate of the rendering resources is improved.
In some embodiments, referring to fig. 4D, fig. 4D is a fourth flowchart of a video rendering method according to an embodiment of the present application. Step 1021 of fig. 4B may also be implemented by steps 10211B through 10214B of fig. 4D, as described in detail below.
In step 10211B, a rendering resource that satisfies the rendering configuration condition and includes the rendering partition in the free state is searched from among the plurality of rendering resources as a candidate rendering resource.
In some embodiments, satisfying the rendering configuration condition may be: the performance parameter of the rendering resource to be selected is larger than or equal to the lowest performance parameter of the rendering resource required to complete the first rendering task.
In step 10212B, in response to the number of the candidate rendering resources being one, the candidate rendering resource is taken as the first rendering resource.
In some embodiments, if only one of the rendering resources to be selected satisfies the rendering configuration condition and includes the rendering resource of the rendering partition in the idle state, none of the other rendering resources to be selected satisfies the rendering configuration condition or includes the rendering partition in the use state, the rendering resource to be selected is used as the first rendering resource.
When the rendering configuration conditions are met and only one candidate rendering resource including the rendering partition in the idle state is included, the candidate rendering resource is used as the first rendering resource, so that the rendering resource which is currently included and is in the idle state is guaranteed to be fully utilized preferentially.
In step 10213B, in response to the number of the rendering resources to be selected being plural, the rendering resource to be selected having the smallest number of rendering partitions in the free state is included as the first rendering resource.
For example, if there are 3 rendering resources to be selected, namely, rendering resource a to be selected, rendering resource B to be selected and rendering resource C to be selected, the number of rendering partitions in idle state included in rendering resource a to be selected is 4, the number of rendering partitions in idle state included in rendering resource B to be selected is 3, and the number of rendering partitions in idle state included in rendering resource C to be selected is 1, then rendering resource C to be selected is used as the first rendering resource.
In step 10214B, in response to the number of the candidate rendering resources being a plurality, determining differences between the time consumption of the first rendering task and the time consumption of the rendering task in the plurality of candidate rendering resources, respectively, and taking the candidate rendering resource corresponding to the smallest difference as the first rendering resource.
In some embodiments, in response to the number of candidate rendering resources being multiple, the time consumption of the rendering task in the plurality of candidate rendering resources may be a mean of the remaining rendering time consumption of the plurality of rendering tasks in each candidate rendering resource, or the longest remaining rendering time consumption of the plurality of rendering tasks.
Taking the longest remaining rendering time consumption in the rendering task as the time consumption of the rendering task in the candidate rendering resources as an example, if 3 candidate rendering resources are available, namely the candidate rendering resource a and the candidate rendering resource B, the remaining rendering time consumption of the first rendering task is 5 minutes, that is to say, the time required for completing the first rendering task is 5 minutes. The remaining consumption of the rendering tasks in the rendering resource A to be selected is 8 minutes and 10 minutes respectively, the remaining consumption of the rendering tasks in the rendering resource A to be selected is 10 minutes, the remaining consumption of the rendering tasks in the rendering resource B to be selected is 4 minutes and 6 minutes respectively, the consumption of the rendering tasks in the rendering resource B to be selected is 6 minutes, at this time, the difference between the consumption 5 of the first rendering task and the consumption 10 of the rendering tasks in the rendering resource A to be selected is 5, the difference between the consumption 5 of the first rendering task and the consumption 6 of the rendering tasks in the rendering resource B to be selected is 1, and the rendering resource B to be selected is taken as the first rendering resource.
Taking the average value of the remaining rendering time consumption of a plurality of rendering tasks in each candidate rendering resource as an example of the time consumption of the rendering tasks in the candidate rendering resource, if 3 rendering resources to be selected are respectively the rendering resource A to be selected and the rendering resource B to be selected, the time consumption of the first rendering task is 5 minutes, the remaining time consumption of the rendering task in the candidate rendering resource A is respectively 8 minutes and 10 minutes, the time consumption of the rendering task in the candidate rendering resource A is 9 minutes, the remaining time consumption of the rendering task in the candidate rendering resource B is respectively 4 minutes and 6 minutes, the time consumption of the rendering task in the candidate rendering resource B is 5 minutes, at this time, the difference between the time consumption 5 of the first rendering task and the time consumption 9 of the rendering task in the candidate rendering resource A is 4, and the difference between the time consumption 5 of the first rendering task and the time consumption 5 of the rendering task in the candidate rendering resource B is 0, and the rendering resource B to be selected is regarded as the first rendering resource.
In some embodiments, in response to the number of candidate rendering resources being multiple, either step 10213B or step 10214B may be performed to obtain the first rendering resource.
When the number of the rendering resources to be selected is a plurality of, the first rendering resources are determined according to the number of the rendering partitions in the idle state or the time length of the residual rendering, so that the rendering resources with the least number of the rendering partitions in the idle state or the rendering resources with the longest time length of the residual rendering can be preferentially used, the rendering resources in the current use state are fully utilized, the utilization rate of the rendering resources is improved, and the waste of the rendering resources is reduced.
With continued reference to fig. 4B, in step 1022, in response to none of the plurality of rendering resources including the rendering partition in the idle state, a rendering resource that meets the rendering configuration condition and is not partitioned is searched for from the plurality of rendering resources as the first rendering resource.
In some embodiments, if the number of rendering resources which meet the rendering configuration condition and are not partitioned is one in the plurality of rendering resources, the rendering resource is taken as a first rendering resource; if the number of the rendering resources which meet the rendering configuration conditions and are not partitioned is a plurality of the plurality of rendering resources, selecting the rendering resource with the largest performance parameter from the plurality of rendering resources as the first rendering resource.
When the first rendering resource is selected, the first rendering resource is required to meet the rendering configuration condition so as to ensure that the performance of the first rendering resource can support the first rendering task, so that the quality of a rendering picture can be ensured while the selected first rendering resource executes the first rendering task.
With continued reference to fig. 4A, in step 103, a first rendering partition in an idle state is determined from a plurality of rendering partitions.
In some embodiments, the first rendering partition in the idle state characterizes the first rendering partition as not being used to respond to rendering tasks.
In some embodiments, referring to fig. 4E, fig. 4E is a fifth flowchart of a video rendering method according to an embodiment of the present application. Before step 103, steps 201 to 203 of fig. 4E are performed, which will be described in detail below.
In step 201, an index table is obtained, where the index table includes a number of rendering partitions corresponding to a plurality of rendering resources, the number of rendering partitions being a maximum number of rendering partitions supported by a performance parameter of the rendering resources.
In some embodiments, different performance parameters correspond to different partition numbers, and the two may be in a positive correlation relationship, that is, the larger the value of the performance parameter of the rendering resource, the larger the value of the corresponding partition number.
Taking a display card as an example, if the rendering resource is a display card and the performance parameter is a display memory capacity, the number of rendering partitions corresponding to the rendering resource with large display memory capacity is larger than the number of rendering partitions corresponding to the rendering resource with small display memory capacity.
In some embodiments, before step 201 "acquire index table", the following operations may also be performed: and aiming at each rendering resource in the plurality of rendering resources, calling a machine learning model to predict based on the performance parameters of the rendering resources to obtain the number of rendering partitions of the rendering resources, wherein the machine learning model is trained based on the performance parameters of the sample rendering resources and the number of marked rendering partitions of the sample rendering resources, and the number of marked rendering partitions is the maximum number of rendering partitions which can be supported by the performance parameters of the sample rendering resources.
In some embodiments, the number of marked rendering partitions of the sample rendering resource is used as a real label, a machine learning model is called based on performance parameters of the rendering resource, a prediction label is obtained, a loss value between the real label and the prediction label is determined through a loss function, the loss value is propagated in the opposite direction, so that parameters of the machine learning model are updated, the process of calculating the loss value and updating the parameters is iterated for a plurality of times until the loss value is not increased or reduced any more, and the iterative process is stopped, so that the trained machine learning model is formed.
The loss functions may be, for example, mean square error loss functions, cross entropy loss functions, multi-label classification loss functions, and triplet loss functions.
The back propagation is implemented by way of example by a back propagation algorithm, calculating the gradient of each neuron from the output layer to the input layer, and updating the weights and biases of the neurons according to the gradient, with the parameters being continuously updated in a gradient descent manner, so that the loss value is reduced. Gradient descent may employ various gradient descent algorithms, such as a batch gradient descent algorithm, a stochastic gradient descent algorithm, an adaptive gradient descent algorithm, and a momentum gradient descent algorithm.
According to the embodiment of the application, the number of the rendering partitions is obtained through the machine learning model, so that the efficiency of determining the number of the rendering partitions is improved, and the accuracy of determining the number of the rendering partitions through the performance parameters of the rendering resources is improved.
In step 202, a first number of partitions corresponding to a first rendering resource is queried from an index table.
In some embodiments, when each rendering resource is registered, a rendering resource identifier may be allocated to each rendering resource, and the index table records the number of rendering partitions corresponding to the plurality of rendering resource identifiers respectively, and may query the index table for the number of first partitions corresponding to the first rendering resource through the rendering resource identifier of the first rendering resource.
In step 203, the rendering canvas of the first rendering resource is divided into a plurality of rendering partitions according to the first partition number.
For example, if the number of first partitions is 6, the width of the rendering canvas of the first rendering resource may be divided into 3 portions and the height into 2 portions, i.e., 6 rendering partitions in total. The width of the rendering canvas of the first rendering resource may also be divided into 6 parts or the height may be divided into 6 parts. The resolution supported by each of the partitioned rendering partitions should be greater than or equal to the minimum resolution required for the rendering task being performed.
In step 104, at least one current rendering task is performed by the plurality of rendering partitions, resulting in rendering data, wherein the at least one current rendering task includes a first rendering task, the first rendering partition being configured to perform the first rendering task.
By way of example, rendering data has a variety of manifestations, such as a video stream, a video file, a sequence of images, or a rendering layer.
In some embodiments, when the first rendering partition performs the first rendering task, the state corresponding to the first rendering partition in the index table is updated from the idle state to the use state.
In some embodiments, referring to fig. 4F, fig. 4F is a sixth flowchart of a video rendering method according to an embodiment of the present application. In step 104, "at least one current rendering task is performed by a plurality of rendering partitions to obtain rendering data", steps 301 to 302 of fig. 4F are performed, which will be described in detail below.
In step 301, a current frame rate at which at least one current rendering task is performed based on a plurality of rendering partitions in a first rendering resource is detected.
In some embodiments, the current frame rate at which at least one current rendering task is performed based on the plurality of rendering partitions in the first rendering resource is periodically detected during a period when rendering partitions in the first rendering resource are in use.
For example, a current frame rate at which at least one current rendering task is performed based on a plurality of rendering partitions in the first rendering resource may be detected every one hour.
In step 302, in response to the current frame rate being less than the frame rate threshold, iteratively: the first partition number is reduced to a second partition number according to a preset value or a preset proportion, the rendering canvas of the first rendering resource is divided into a plurality of new rendering partitions according to the second partition number, and at least one current rendering task is continuously executed based on the plurality of new rendering partitions.
In some embodiments, the frame rate threshold is a minimum frame rate for ensuring smoothness and sharpness of the picture, and if the current frame rate is less than the frame rate threshold, the current rendered picture is characterized as stuck.
For example, if the current frame rate is 20FPS, the frame rate threshold is 30FPS, the preset value is 1, and the first partition number is 6, the first partition number is reduced by 1, so as to obtain the second partition number 5. If the current frame rate is 25FPS, the second partition number is continuously updated according to the preset number 1, and the second partition number is updated to be 4. And if the current frame rate is 40FPS at this time, repartitioning the rendering canvas of the first rendering resource into 4 rendering partitions, and continuing to execute at least one current rendering task.
According to the embodiment of the application, the current frame rate is compared with the frame rate threshold, and when the current frame rate is smaller than the frame rate threshold, the number of the rendering partitions in the rendering resource is adjusted downwards, so that the frame loss phenomenon caused by blocking of a currently rendered picture is avoided when the rendering resource is used for rendering, and the smoothness of the picture is ensured.
In some embodiments, referring to fig. 4G, fig. 4G is a seventh flowchart of a video rendering method according to an embodiment of the present application. In step 302, "repartition of the rendering canvas of the first rendering resource into a new plurality of rendering partitions according to the second partition number", steps 401 to 402 of fig. 4G are performed, which will be described in detail below.
In step 401, if the number of rendering partitions of the rendering canvas is smaller than the number of second partitions after at least one of the number of horizontal partitions and the number of vertical partitions of the rendering canvas is adjusted down, the number of first partitions is kept unchanged.
For example, if the number of first partitions is 6, the number of horizontal partitions is 3, the number of vertical partitions is 2, the number of second partitions is 5, and if the number of horizontal partitions is reduced to 2, the number of rendering partitions of the rendering canvas is 4, and at this time, the number of first partitions is kept unchanged.
In step 402, if the number of rendering partitions of the rendering canvas is greater than or equal to the second partition number after at least one of the number of horizontal partitions and the number of vertical partitions of the rendering canvas is reduced, the process of re-dividing the rendering canvas of the first rendering resource into a new plurality of rendering partitions according to the second partition number is shifted.
In some embodiments, if the rendering configuration condition includes a resolution, it may also be desirable to ensure that when the rendering canvas of the first rendering resource is re-divided into a new plurality of rendering partitions according to the number of second partitions, the resolution of each rendering partition is greater than or equal to the resolution required by the first rendering task.
For example, if the number of first partitions is 6, the number of horizontal partitions is 3, the number of vertical partitions is 2, the number of second partitions is 4, if the number of horizontal partitions is reduced to 2, the number of rendering partitions of the rendering canvas is 4, and if the resolution required by the first rendering task at this time is 1080p, the resolution of each rendering partition is 1080p, the process of re-dividing the rendering canvas of the first rendering resource into a new plurality of rendering partitions according to the number of second partitions is shifted.
In some embodiments, half of the number of second partitions is rounded up to obtain the number of lateral partitions of the rendering canvas of the first rendering resource; determining the ratio of the width of a rendering canvas of the first rendering resource to the number of transverse partitions to serve as the width of each rendering partition; in response to the second number of partitions being less than half of the first number of partitions, taking a height of a rendering canvas of the first rendering resource as a height of each rendering partition; in response to the second number of partitions being greater than or equal to half of the first number of partitions, taking half of the height of the rendering canvas of the first rendering resource as the height of each rendering partition; the rendering canvas is divided according to the width of each rendering partition and the height of each rendering partition.
For example, the first partition number is 6, half of the first partition number is 3, the second partition number is 4, the width of the rendering canvas of the first rendering resource is 10, the height of the rendering canvas of the first rendering resource is 8, the number of horizontal divisions of the rendering canvas of the first rendering resource is 2, the width of each rendering partition is 5, the height of each rendering partition is 4, and the rendering canvas is divided into 4 rendering partitions with the width of 5 and the height of 4.
In some embodiments, referring to fig. 4H, fig. 4H is an eighth flowchart of a video rendering method according to an embodiment of the present application. Steps 501 through 502 of fig. 4H may also be performed when step 104 "at least one current rendering task is performed by multiple rendering partitions," as described in more detail below.
In step 501, a query includes a plurality of candidate rendering resources in a free state of a rendering partition and having the same performance parameters.
Taking performance parameters as resolution as an example, if the rendering resource a has 2 rendering partitions in idle state, each rendering partition has a resolution of 1080p, the rendering resource B has 4 rendering partitions in idle state, and each rendering partition has a resolution of 1080p, then the rendering resource a and the rendering resource B are candidate rendering resources.
In step 502, a rendering task performed by a first candidate rendering resource is reassigned to other candidate rendering resources, wherein the first candidate rendering resource is any one of a plurality of candidate rendering resources, and the other candidate rendering resources are candidate rendering resources other than the first candidate rendering resource of the plurality of candidate rendering resources.
In some embodiments, the first candidate rendering resource may be the least number of candidate rendering resources among the plurality of candidate rendering resources to perform rendering tasks.
In some embodiments, step 502, "reassign rendering tasks performed by the first candidate rendering resource to other candidate rendering resources," may be accomplished by iteratively: querying the candidate rendering resources with the largest number of rendering partitions in the idle state from the plurality of candidate rendering resources to serve as a first candidate rendering resource, and reassigning rendering tasks executed by the rendering partitions of the first candidate rendering resource to the rendering partitions in the idle state in other candidate rendering resources until the rendering partitions included in the other candidate rendering resources are all in a use state, or reassigning all rendering tasks executed by the first candidate rendering resource to the other candidate rendering resources.
For example, referring to fig. 5A, fig. 5A is a first schematic diagram of redistribution of rendering tasks according to an embodiment of the present application. In the left diagram of fig. 5A, a first candidate rendering resource a including the largest number of rendering partitions in a free state is queried from among a plurality of candidate rendering resources, the first candidate rendering resource a has 3 rendering partitions in a free state, that is, a rendering partition A2, a rendering partition A3, and a rendering partition A4, wherein a rendering task is executed in the rendering partition A1, so that the rendering partition A1 is in a use state, and the other candidate rendering resources B include 4 rendering partitions, wherein the rendering partition B1 and the rendering partition B2 are in a use state, and the rendering partition B3 and the rendering partition B4 are in a free state. In the right diagram of fig. 5A, the rendering tasks executed in the rendering partition A1 are reassigned to the rendering partition in which the other candidate rendering resources B are in the idle state, that is, the rendering partition B3 or the rendering partition B4, and in the right diagram of fig. 5A, the rendering partition B3 is taken as an example, at this time, all the rendering tasks executed in the first candidate rendering resource a are reassigned to the other candidate rendering resources B, and the iteration is stopped.
For example, referring to fig. 5B, fig. 5B is a second schematic diagram of redistribution of rendering tasks according to an embodiment of the present application. In the left diagram of fig. 5B, a first candidate rendering resource a including the largest number of rendering partitions in the free state is queried from among a plurality of candidate rendering resources, the first candidate rendering resource a has 2 rendering partitions in the free state, that is, a rendering partition A3 and a rendering partition A4, wherein rendering tasks are executed in the rendering partition A1 and the rendering partition A2, so that the rendering partition A1 and the rendering partition A2 are in use, the other candidate rendering resources B include 4 rendering partitions, wherein the rendering partition B1, the rendering partition B2 and the rendering partition B3 are in use, the rendering partition B4 is in the free state, the other candidate rendering resources C include 4 rendering partitions, wherein the rendering partition C1, the rendering partition C2 and the rendering partition C3 are in use, and the rendering partition C4 is in the free state. In the middle diagram of fig. 5B, the rendering task executed in the rendering partition A1 is reassigned to the rendering partition in the idle state of the other candidate rendering resources B, that is, the rendering partition B4, at which time, the rendering partition A2 in the first candidate rendering resource a is still executing the rendering task, but the other candidate rendering resources B have not been rendering partitions in the idle state, and thus, the process of iteratively executing reassignment is continued. In the right diagram of fig. 5B, the rendering tasks executed in the rendering partition A2 are reassigned to the rendering partition in which the other candidate rendering resources C are in the idle state, that is, the rendering partition C4, and at this time, all the rendering tasks executed in the first candidate rendering resource a are reassigned to the other candidate rendering resources B and the other candidate rendering resources C, and the iteration is stopped.
In some embodiments, in a case where the number of other candidate rendering resources is plural, referring to fig. 4I, fig. 4I is a ninth flowchart of the video rendering method provided by the embodiment of the present application. In the above embodiment, "the rendering task executed by the rendering partition of the first candidate rendering resource is reassigned to the rendering partition in the idle state in the other candidate rendering resources" may be implemented through steps 601 to 602 of fig. 4I, which is described in detail below.
In step 601, the rendering tasks performed by the other candidate rendering resources are sorted in descending order of the number of rendering tasks performed by the other candidate rendering resources from large to small.
In some embodiments, at least one other candidate rendering resource may also be arbitrarily selected to perform the rendering task performed by the first candidate rendering resource.
In step 602, the rendering tasks performed by the first candidate rendering resource are reassigned to at least one other candidate rendering resource as a result of the descending order of ordering.
In some embodiments, when the number of other candidate rendering resources with the largest number of rendering tasks to be executed is plural in the result of the descending order, the descending order is performed again according to the remaining time consumption of the rendering tasks in the other candidate rendering resources, and the other candidate rendering resources meeting the following conditions are preferentially selected: condition 1, other candidate rendering resources that remain more time consuming than the rendering task performed by the first candidate rendering resource. Condition 2, remaining of the other candidate rendering resources that have a minimum difference in time consumption over the rendering task performed by the first candidate rendering resource.
For example, in the left diagram of fig. 5B, if the other candidate rendering resources B and the other candidate rendering resources C are all other candidate rendering resources with the largest number of rendering tasks to be executed, where the remaining time of the other candidate rendering resources B is 6 minutes, the remaining time of the other candidate rendering resources C is 10 minutes, the rendering task executed by the rendering partition A1 in the first candidate rendering resource a is 5 minutes, at this time, the rendering task executed by the rendering partition A1 is preferentially redistributed to the free partition B4 of the other candidate rendering resources B, at this time, all the rendering partitions of the other candidate rendering resources B are in use, and therefore, the rendering task executed by the rendering partition A2 is redistributed to the free partition C4 of the other candidate rendering resources C.
In some embodiments, after "reassign rendering tasks performed by the first candidate rendering resource to other candidate rendering resources" step 502, the following operations may also be performed: releasing the first candidate rendering resources, and updating the states of the rendering partitions corresponding to the first candidate rendering resources in the index table into idle states.
According to the embodiment of the application, the rendering tasks executed in the rendering resources comprising the rendering partitions in the idle state are redistributed to the rendering partitions in the idle state in other candidate rendering resources, so that each rendering resource can be fully utilized, the situation that the rendering partitions in the idle state are too many is avoided, and the utilization rate of the rendering resources is enhanced.
With continued reference to fig. 4A, in step 105, first video data corresponding to the first rendering partition is extracted from the rendering data, and the first video data is transmitted to the first terminal.
In some embodiments, the rendering data obtained by the first rendering resource may be divided into a plurality of video data according to a plurality of rendering partitions, and the first video data corresponding to the first rendering partition may be extracted from the plurality of video data.
In some embodiments, referring to fig. 4J, fig. 4J is a tenth flowchart of a video rendering method according to an embodiment of the present application. Step 105 "extracting the first video data corresponding to the first rendering partition from the rendering data" of fig. 4A may be implemented by steps 1051 to 1052 of fig. 4J, which will be described in detail below.
In step 1051, the rendering data is divided into a plurality of sub-rendering data according to the number of rendering partitions of the first rendering resource, wherein different sub-rendering data correspond to different rendering partitions.
In some embodiments, the rendering data may be divided into a plurality of sub-rendering data using an open source video processing framework (Fast Forward Mpeg, FFMpeg).
For example, according to the position of the pre-recorded rendering partition, the rendering data is divided by executing "-f-buffer mpeg" according to the position of the rendering partition, so as to obtain a plurality of sub-rendering data corresponding to the plurality of rendering partitions respectively.
In step 1052, sub-rendering data corresponding to the first rendering partition among the plurality of sub-rendering data is taken as first video data.
In some embodiments, a plurality of sub-rendering data corresponding to all rendering partitions of the first rendering resource may be extracted, and then sub-rendering data corresponding to the first rendering partition is selected and sent to the first terminal; only sub-rendering data corresponding to the first rendering partition may be extracted and sent to the first terminal.
In some embodiments, if the rendering data is in the form of a video stream, extracting the first video data from the rendering data in real time, returning to the terminal; if the rendering data is in the form of a video file, periodically extracting first video data from the rendering data, encapsulating the first video data into a video file, and returning the video file to the terminal.
In some embodiments, if at step 101 "receive the first rendering task", at least one second rendering task is received, step 102 "query the first rendering resource in the idle state from the plurality of rendering resources" may be implemented by performing the following operations: querying a first rendering resource comprising not less than a set number of rendering partitions in a free state from a plurality of rendering resources, wherein the set number is a sum of a number of rendering partitions required to perform a first rendering task and a number of rendering partitions required to perform at least one second rendering task. At this time, when step 103 is performed, it is also possible to perform: at least one second rendering partition in an idle state is determined from the plurality of rendering partitions, wherein the at least one second rendering partition is respectively used for executing at least one second rendering task. In performing step 105 "extract first video data corresponding to the first rendering partition from the rendering data", it is also possible to perform: second video data corresponding to at least one second rendering partition is extracted from the rendering data.
For example, when receiving the first rendering task, receiving 2 second rendering tasks, where the second rendering tasks may be carried in a rendering request sent by the first terminal or may be carried in a rendering request sent by another terminal, and at this time, a sum of a number of rendering partitions required for executing the first rendering task and a number of rendering partitions required for executing the 2 second rendering tasks is 3, querying a first rendering resource including not less than 3 rendering partitions in an idle state from a plurality of rendering resources, determining one first rendering partition and 2 second rendering partitions in an idle state from the plurality of rendering partitions, executing the first rendering task and the 2 second rendering tasks respectively, and then extracting first video data corresponding to the first rendering partition from the rendering data and extracting second video data corresponding to the 2 second rendering partitions from the rendering data.
The embodiment of the application can process a plurality of rendering tasks simultaneously, and enhances the utilization rate of rendering resources.
Hereinafter, an exemplary application of the embodiment of the present application in an application scene for rendering an avatar in a game will be described.
Taking a scene of cloud rendering of a virtual object as an example, when a user opens a page or an applet including the virtual object, cloud rendering is required to be performed on the page or the applet by using cloud rendering resources, the virtual object in the related art is generally obtained by processing a rendering task through a rendering canvas of one rendering resource, and each rendering task carried by the rendering request needs to be responded by one rendering resource, however, due to the development of hardware at present, the maximum resolution supported by the rendering canvas of the rendering resource is obviously greater than the resolution of a picture required to be rendered by processing the rendering request, so that the rendering resource is wasted greatly. According to the video rendering method provided by the embodiment of the application, the rendering canvas of the rendering resource is divided into a plurality of rendering partitions, different rendering partitions can render the requested rendering pictures of different rendering tasks, and the first video data corresponding to the first rendering partition is extracted from the rendering data for the first terminal, so that one rendering resource can process a plurality of rendering tasks at the same time.
Referring to fig. 6, fig. 6 is an overall link architecture diagram of a video rendering method according to an embodiment of the present application. In fig. 6, the overall link is: user side→server side→cloud rendering engine side→server side, wherein the user side may be the terminal 400, and the server side and the cloud rendering engine side may be the server 200.
First, when a user opens a web page or an applet including a virtual screen (i.e., a first screen), the user sends a resource rendering task (i.e., a first rendering task) to a server.
Secondly, after receiving the resource rendering task, the server side inquires whether the current resource (namely rendering resource) is utilized or not, and if the current resource is utilized heavily, the server side sends idle-free resources to the user side so that the user side displays a prompt of the rendering-free resources; if the current resource utilization is not busy, finding an idle target cloud rendering resource (namely a first rendering resource), and reading a system parameter corresponding to the target cloud rendering resource, for example, when the system parameter is the cutting number, reading the cutting number corresponding to the target cloud rendering resource as N.
Then, the server side judges whether a rendering partition (slot) is created in the cloud engine side by the target cloud rendering resource, and if the rendering partition is created, the idle partition (namely, a first rendering partition) identification is obtained; if no partition is created, N picture partitions (i.e., multiple rendering partitions) are created according to the number of cuts, and each picture partition is not assigned a partition identification.
Then, the server side sends a rendering task to the cloud rendering engine side, wherein the rendering task comprises a partition identifier and system parameters.
And then, the cloud rendering engine determines the partition position of the specific request rendering according to the received partition identification.
Then, the cloud rendering engine inserts virtual object resources in the target partition, renders the whole picture through a rendering pipeline in the game engine, outputs a video stream (i.e. rendering data) corresponding to the picture, and sends the video stream to the server.
And thirdly, the server receives the video stream, reads system parameters, cuts pictures corresponding to the video stream according to the cutting number in the system parameters, obtains a new video stream (namely first video data) after cutting, and sends the new video stream to the user terminal according to the new video stream updating index table and resource application condition.
Finally, the user side receives the video stream, updates the picture of the webpage or the applet according to the video information in the video stream, and displays the rendered picture.
The server side mainly completes the following 2 core functions:
1. managing and distributing cloud rendering resources that can be used by the current service;
2. and the real-time video stream returned by the cloud rendering engine end is subjected to picture segmentation at the server end according to the partition allocation condition. For example, if slot=4, the real-time video stream is cut into 4 new video streams, and a desired video stream is selected as an output.
For the creation process of the index table, for a new cloud rendering video card (i.e., rendering resource), information of the new cloud rendering video card, such as a video card identifier and a video card configuration, is registered in the index table. And (3) when a rendering task is to be initiated, inquiring the index table, matching with idle target cloud rendering resources, executing the rendering flow of the idle partition, and updating the index table, namely updating the display card identifier and the partition use state.
Referring to fig. 7, fig. 7 is a schematic flow chart of matching idle cloud rendering resources according to an embodiment of the present application, and will be described with reference to the steps shown in fig. 7.
In step 701, the index table is queried.
In some embodiments, the index table stores an identifier corresponding to each of the plurality of cloud rendering resources, a configuration of the plurality of cloud rendering resources, a number of rendering partitions within each of the cloud rendering resources, and a usage of each of the rendering partitions.
In step 702, cloud rendering resource usage is obtained.
In some embodiments, cloud rendering resource usage includes identification and configuration of cloud rendering resources, and number and usage of rendering partitions in the cloud rendering resources.
In step 703, it is determined whether the number of partitions being used is equal to the predefined number of partitions (i.e., the first number of partitions) of the cloud rendering resource.
In some embodiments, the number of partitions being used refers to the number of rendering partitions in the cloud rendering resource that are being used, i.e., the number of rendering partitions in use, and the predefined number of partitions for the cloud rendering resource refers to the maximum number of partitions that the cloud rendering resource is able to partition.
In step 704, if the number of partitions being used is equal to the predefined number of partitions for the cloud rendering resource, a use state is returned.
For example, if the number of partitions being used is 6 and the number of partitions predefined by the cloud rendering resource is also 6, the usage status is returned to the user side, so that the user side re-initiates the rendering task.
In step 705, if the number of partitions being used is not equal to the predefined number of partitions for the cloud rendering resource, then information of the idle state and the rendering resource index table is returned.
For example, if the number of partitions being used is 2 and the predefined number of partitions of the cloud rendering resource is 6, the idle state and the information of the rendering resource index table are returned.
Referring to fig. 8, fig. 8 is a schematic flow chart of picture cutting according to an embodiment of the present application, and the steps shown in fig. 8 will be described.
In step 801, a partition identification for each partition in a rendering resource is obtained.
In some embodiments, when the target cloud rendering resource includes a plurality of partitions, a partition identification is assigned to each partition.
In step 802, the partitioning principle of the cloud rendering resource in the index table is looked up according to the partitioning identification.
In some embodiments, the index table includes partition principles in each cloud rendering resource and partition identifications for each partition.
In step 803, an open source video processing framework is invoked to segment the video.
In some embodiments, ffmpeg may be used to segment the video. For example, the number of the partitions is 4, the video stream is equally divided into 4 parts according to the number of the partitions, and the four partitions are sequentially corresponding to each other.
In step 804, multiple new video streams after being split are obtained and sent to the corresponding user end of each new video stream.
In some embodiments, the clients corresponding to different new video streams may be the same or different.
In step 805, video addresses and video information for the partitions of the cloud rendering resources in the index table are updated.
In some embodiments, the index table further includes video addresses and video information corresponding to each partition of the cloud rendering resource after the new video stream is generated.
Core functions of cloud rendering engine end: first, a maximum number of partitions of the cloud rendering resource needs to be determined. The maximum number of partitions may be determined by two ways:
According to the first mode, according to performance evaluation (namely rendering configuration conditions) of a target rendering object, namely complexity of a rendered virtual object model and cloth resolving, the maximum rendering partition number N of the same display card (namely rendering resource) is determined, and an engine rendering picture is divided into N areas.
The number of rendering partitions in the graphics card and the second mode can also be determined according to the guaranteed bottom frame rate (i.e. the frame rate threshold). Referring to fig. 9, fig. 9 is a flowchart illustrating a determination of the number of rendering partitions according to a frame rate according to an embodiment of the present application, and will be described with reference to the steps shown in fig. 9.
In step 901, a guard frame rate of the cloud rendering resource display and a preset maximum partition number (i.e., a first partition number) are set.
For example, the preset maximum partition number may be set according to the performance of the graphics card, and the preset maximum partition number may be set to 6, and the bottom frame rate may be set to 30FPS.
In step 902, a maximum number of partitions of resources are inserted in the cloud rendering resources.
In some embodiments, the resources of the corresponding partition are inserted in the cloud rendering resources according to the preset maximum partition number.
In step 903, the engine real-time frame rate (i.e., the current frame rate) is obtained.
In some embodiments, the real-time frame rate may be obtained by nowFPS = engine_api. Gaveragems, where nowFPS represents the real-time frame rate.
In step 904, it is determined whether the real-time frame rate is less than the guard frame rate.
In some embodiments, the comparison is made with a real-time frame rate and a guard frame rate, and when the real-time frame rate is less than the guard frame rate, it is stated that page stuck may occur according to the current partition.
In step 905, if the real-time frame rate is smaller than the guaranteed frame rate, the maximum partition number is reduced by one (i.e. the second partition number), then the resource reduced by one by the maximum partition number is reinserted in the cloud rendering resource, the real-time frame rate is obtained again, and the judgment of 904 is performed again.
For example, if the guaranteed bottom frame rate is 30FPS, the real-time frame rate is 20FPS, and the preset maximum partition number is 6, the preset maximum partition number is updated to 5, the resources of 5 partitions are inserted into the cloud rendering resources again, the real-time frame rate is obtained again, and whether the real-time frame rate is smaller than the guaranteed bottom frame rate is judged again.
In step 906, until the real-time frame rate is greater than or equal to the guaranteed base frame rate, the updated maximum number of partitions is obtained.
For example, when the preset maximum partition number is updated to 4, the guaranteed bottom frame rate is 30FPS, the real-time frame rate is 40FPS, and the updated maximum partition number is 4.
In step 907, half of the updated maximum partition number is calculated and rounded up as the average number of width of the screen of the cloud rendering resource.
For example, if the updated maximum partition number is 4, the average number of width of the pictures of the cloud rendering resource is 2.
In step 908, it is determined whether the updated maximum number of partitions is between half of the preset maximum number of partitions and the preset maximum number of partitions.
For example, if the preset maximum partition number is 6 and half of the preset maximum partition number is 3, it is necessary to determine whether the updated maximum partition number is between 3 and 6, that is, 3 or more and 6 or less.
In step 909, when the updated maximum partition number is between half of the preset maximum partition number and the preset maximum partition number, the height halving number of the screen of the cloud rendering resource is set to 2.
For example, if the preset maximum partition number is 6, half of the preset maximum partition number is 3, and the updated maximum partition number is 4, the number of the height halves of the screen of the cloud rendering resource is set to 2.
In step 910, when the updated maximum partition number is not between half of the preset maximum partition number and the preset maximum partition number, the number of halves of the height of the screen of the cloud rendering resource is set to 1.
For example, if the preset maximum partition number is 6, half of the preset maximum partition number is 3, and the updated maximum partition number is 2, the number of the height halves of the screen of the cloud rendering resource is set to 1.
In step 911, calculating the ratio of the height of the picture of the cloud rendering resource to the number of bisectors of the height as the height of each partition; the ratio of the width of the screen of the cloud rendering resource to the width halved number of parts is calculated as the width of each partition.
For example, the height of the picture of the cloud rendering resource is 4, the halving number of the height is 2, and the height of each partition is 2; the width of the picture of the cloud rendering resource is 8, the width halving number of parts is 2, and the width of each partition is 4.
In step 912, the logic of the partitions described above, the height of the partition in each cloud rendering resource, the width of the partition, and the updated maximum number of partitions are recorded.
For example, the height of the partitions in each cloud rendering resource is 2, the width of the partitions is 4, and the maximum number of updated partitions is 4.
In step 913, the index table is updated according to the record in step 912.
In some embodiments, the number of partitions of the cloud rendering resource in the index table is changed to an updated maximum number of partitions, and the height and width of each partition are changed.
In some embodiments, if a virtual object model occupies more than one graphics card when occupying graphics card resources, for example, occupies 5 partitions of an a graphics card and 1 partition of a B graphics card, and if both the a graphics card and the B graphics card have 6 partitions and the partition of the a graphics card not occupied by the virtual object is currently in an idle state, then transferring the task of rendering the partition of the B graphics card to the partition of the a graphics card not occupied, executing new rendering, updating the index table, and releasing the resource occupation of the B graphics card.
According to the embodiment of the application, the rendering tasks in different cloud rendering resources are combined, and the task-free cloud rendering resources are released, so that the utilization rate of partitions in the cloud rendering resources is improved, and the occupancy rate of the resources is reduced.
Secondly, each partition identification is registered in the server.
In some embodiments, the maximum partition number of a single display card is determined, a partition identifier is generated, a resource index table is updated, and registration is registered with a server.
Then, a rendering instruction of a specific partition identification of the server is received.
And finally, completing virtual object picture rendering in the corresponding partition.
In some embodiments, rendering is performed according to the selected game engine.
For example, a illusion engine (Unreal Engine, UE) is used to set the proportions of virtual objects in the screen, garment rendering, and presentation of actions from start to end.
In some embodiments, referring to fig. 10, fig. 10 is a schematic diagram of finding a partition according to a rendering instruction to complete rendering according to an embodiment of the present application. The method comprises the following steps: after receiving a rendering instruction of a server, judging whether the current partition is occupied according to the partition identification, if not, finding a specific partition position, and implementing picture rendering; if so, the partition status is updated to occupied (i.e., in use) at the server and the free partition is re-looked up to allocate resources.
The core function of the user terminal is to receive the video information returned by the server terminal and complete the creation of the video in the corresponding carrier. Taking the Web side as an example, a function named createVideoElement is first defined, which accepts parameter data from the server side, such as the width of the partition, the height of the partition, and the automatic play parameters. Then, a new video element is created using document. Finally, the created video element is added to the body of the document.
According to the embodiment of the application, the rendering canvas of the rendering resource is divided into the plurality of rendering partitions, so that different rendering partitions respectively respond to different rendering tasks, and compared with a mode that one rendering task monopolizes one rendering resource, the performance of the rendering resource is fully utilized; when a rendering task is received, the rendering task is executed by distributing rendering partitions in an idle state, and then video data corresponding to the rendering task is extracted from the rendering data. When the first rendering resource is selected, the first rendering resource is required to meet the rendering configuration condition so as to ensure that the performance of the first rendering resource can support the first rendering task, so that the quality of a rendering picture can be ensured while the selected first rendering resource executes the first rendering task. According to the embodiment of the application, the current frame rate is compared with the frame rate threshold, and when the current frame rate is smaller than the frame rate threshold, the number of the rendering partitions in the rendering resource is adjusted downwards, so that the current rendered picture is ensured not to be blocked when the rendering resource is used for rendering, and the picture fluency is ensured. When the number of the rendering resources to be selected is a plurality of, the first rendering resources are determined according to the number of the rendering partitions in the idle state or the time length of the residual rendering, the rendering resources with the small number of the rendering partitions in the idle state or the rendering resources with the longest time length of the residual rendering can be preferentially used, and meanwhile, the rendering tasks executed in the rendering resources including the rendering partitions in the idle state are redistributed to the rendering partitions in the idle state in other candidate rendering resources, so that each rendering resource can be fully utilized, the situation that the rendering partitions in the idle state are too many is avoided, and the utilization rate of the rendering resources is enhanced.
Continuing with the description below of an exemplary architecture of video rendering device 233 implemented as a software module provided by embodiments of the present application, in some embodiments, as shown in fig. 3, the software modules stored in video rendering device 233 of memory 230 may include:
and a receiving module 2331, configured to receive a first rendering task, where the first rendering task is sent by the first terminal.
A query module 2332 for querying a first rendering resource in a free state from a plurality of rendering resources, wherein a rendering canvas of the first rendering resource includes a plurality of rendering partitions, different rendering partitions being used to respond to different rendering tasks.
A determination module 2333 is configured to determine a first rendering partition in a free state from the plurality of rendering partitions.
And a rendering module 2334, configured to execute at least one current rendering task through the plurality of rendering partitions to obtain rendering data, where the at least one current rendering task includes a first rendering task, and the first rendering partition is configured to execute the first rendering task.
And the extracting module 2335 is used for extracting the first video data corresponding to the first rendering partition from the rendering data and sending the first video data to the first terminal.
In some embodiments, the first rendering task carries rendering configuration conditions, and the query module 2332 is further configured to search, from among the plurality of rendering resources, for a rendering resource that satisfies the rendering configuration conditions and includes a rendering partition in an idle state, as the first rendering resource; and in response to none of the plurality of rendering resources including the rendering partition in the idle state, searching the rendering resource which accords with the rendering configuration condition and is not partitioned from the plurality of rendering resources as a first rendering resource.
In some embodiments, the query module 2332 is further configured to obtain an index table, where the index table is configured to record a state of a plurality of rendering partitions respectively included by the plurality of rendering resources and performance parameters respectively included by the plurality of rendering resources; querying, from an index table, a rendering configuration condition that includes at least one rendering partition in a free state as a first rendering resource, wherein the rendering configuration condition includes: the minimum performance parameter required to complete the first rendering task is less than the performance parameter possessed by the rendering resource.
In some embodiments, the query module 2332 is further configured to search for a rendering resource that satisfies the rendering configuration condition and includes the rendering partition in the idle state from the plurality of rendering resources as a candidate rendering resource; in response to the number of rendering resources to be selected being one, taking the rendering resources to be selected as first rendering resources; responding to the fact that the number of the rendering resources to be selected is a plurality of, and taking the rendering resources to be selected with the minimum number of the rendering partitions in the idle state as first rendering resources; and in response to the number of the rendering resources to be selected being a plurality of, determining difference values of time consumption of the first rendering task and time consumption of the rendering tasks in the plurality of the rendering resources to be selected respectively, and taking the rendering resource to be selected corresponding to the smallest difference value as the first rendering resource.
In some embodiments, the determining module 2333 is further configured to obtain an index table, where the index table includes a number of rendering partitions corresponding to the plurality of rendering resources, the number of rendering partitions being a maximum number of rendering partitions supported by a performance parameter of the rendering resources; inquiring the first partition number corresponding to the first rendering resource from the index table; the rendering canvas of the first rendering resource is divided into a plurality of rendering partitions according to the first partition number.
In some embodiments, the determining module 2333 is further configured to call a machine learning model for predicting, for each of the plurality of rendering resources, based on the performance parameter of the rendering resource, to obtain a number of rendering partitions of the rendering resource, where the machine learning model is trained based on the performance parameter of the sample rendering resource and a number of marked rendering partitions of the sample rendering resource, and the number of marked rendering partitions is a maximum number of rendering partitions that can be supported by the performance parameter of the sample rendering resource.
In some embodiments, the rendering module 2334 is further configured to update a state corresponding to the first rendering partition in the index table from the idle state to the use state when the first rendering partition performs the first rendering task.
In some embodiments, the rendering module 2334 is further to detect a current frame rate when performing at least one current rendering task based on the plurality of rendering partitions in the first rendering resource; in response to the current frame rate being less than the frame rate threshold, iteratively performing the following: the first partition number is reduced to a second partition number according to a preset value or a preset proportion, the rendering canvas of the first rendering resource is divided into a plurality of new rendering partitions according to the second partition number, and at least one current rendering task is continuously executed based on the plurality of new rendering partitions.
In some embodiments, the rendering module 2334 is further configured to, after at least one of the number of horizontal partitions and the number of vertical partitions of the rendering canvas is adjusted, maintain the number of first partitions unchanged if the number of rendering partitions of the rendering canvas is less than the number of second partitions; and if the number of rendering partitions of the rendering canvas is greater than or equal to the number of second partitions after at least one of the number of horizontal partitions and the number of vertical partitions of the rendering canvas is reduced, switching to the process of re-dividing the rendering canvas of the first rendering resource into a new plurality of rendering partitions according to the number of second partitions.
In some embodiments, rendering module 2334 is further configured to query a plurality of candidate rendering resources including rendering partitions in a free state and having the same performance parameters; the method includes reassigning a rendering task performed by a first candidate rendering resource to other candidate rendering resources, wherein the first candidate rendering resource is any one of a plurality of candidate rendering resources, and the other candidate rendering resources are candidate rendering resources other than the first candidate rendering resource among the plurality of candidate rendering resources.
In some embodiments, rendering module 2334 is further configured to iteratively perform the following implementation of operations: querying the candidate rendering resources with the largest number of rendering partitions in the idle state from the plurality of candidate rendering resources to serve as a first candidate rendering resource, and reassigning rendering tasks executed by the rendering partitions of the first candidate rendering resource to the rendering partitions in the idle state in other candidate rendering resources until the rendering partitions included in the other candidate rendering resources are all in a use state, or reassigning all rendering tasks executed by the first candidate rendering resource to the other candidate rendering resources.
In some embodiments, in the case where the number of other candidate rendering resources is multiple, the rendering module 2334 is further configured to sort in descending order the number of rendering tasks performed by the other candidate rendering resources from greater to lesser order; and reassigning rendering tasks performed by the first candidate rendering resource to at least one other candidate rendering resource as a result of the ordering in descending order.
In some embodiments, the rendering module 2334 is further configured to release the first candidate rendering resource, and update the states of the plurality of rendering partitions corresponding to the first candidate rendering resource in the index table to an idle state.
In some embodiments, the extracting module 2335 is further configured to divide the rendering data into a plurality of sub-rendering data according to the number of rendering partitions of the first rendering resource, wherein different sub-rendering data corresponds to different rendering partitions; and taking sub-rendering data corresponding to the first rendering partition in the plurality of sub-rendering data as first video data.
In some embodiments, the receiving module 2331 is further configured to receive at least one second rendering task. The query module 2332 is further configured to query a first rendering resource that includes not less than a set number of rendering partitions in an idle state from among a plurality of rendering resources, where the set number is a sum of a number of rendering partitions required to perform the first rendering task and a number of rendering partitions required to perform at least one second rendering task. The determining module 2333 is further configured to determine at least one second rendering partition in an idle state from the plurality of rendering partitions, where the at least one second rendering partition is configured to perform at least one second rendering task, respectively. The extracting module 2335 is further configured to extract second video data corresponding to at least one second rendering partition from the rendering data.
Embodiments of the present application provide a computer program product comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of the electronic device reads the computer-executable instructions from the computer-readable storage medium, and the processor executes the computer-executable instructions, so that the electronic device executes the video rendering method according to the embodiment of the application.
Embodiments of the present application provide a computer-readable storage medium storing computer-executable instructions or a computer program stored therein, which when executed by a processor, cause the processor to perform a video rendering method provided by embodiments of the present application, for example, a video rendering method as shown in fig. 4A.
In some embodiments, the computer readable storage medium may be RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; but may be a variety of devices including one or any combination of the above memories.
In some embodiments, computer-executable instructions may be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, in the form of programs, software modules, scripts, or code, and they may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
As an example, computer-executable instructions may, but need not, correspond to files in a file system, may be stored in a portion of a file that holds other programs or data, such as in one or more scripts in a hypertext markup language (Hyper Text Markup Language, HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub-programs, or portions of code).
As an example, computer-executable instructions may be deployed to be executed on one electronic device or on multiple electronic devices located at one site or distributed across multiple sites and interconnected by a communication network.
In summary, according to the embodiment of the application, the rendering canvas of the rendering resource is divided into the plurality of rendering partitions, so that different rendering partitions respectively respond to different rendering tasks, and compared with a mode that one rendering task monopolizes one rendering resource, the performance of the rendering resource is fully utilized; when a rendering task is received, the rendering task is executed by distributing rendering partitions in an idle state, and then video data corresponding to the rendering task is extracted from the rendering data. When the first rendering resource is selected, the first rendering resource is required to meet the rendering configuration condition so as to ensure that the performance of the first rendering resource can support the first rendering task, so that the quality of a rendering picture can be ensured while the selected first rendering resource executes the first rendering task. According to the embodiment of the application, the current frame rate is compared with the frame rate threshold, and when the current frame rate is smaller than the frame rate threshold, the number of the rendering partitions in the rendering resource is adjusted downwards, so that the current rendered picture is ensured not to be blocked when the rendering resource is used for rendering, and the picture fluency is ensured. When the number of the rendering resources to be selected is a plurality of, the first rendering resources are determined according to the number of the rendering partitions in the idle state or the time length of the residual rendering, the rendering resources with the small number of the rendering partitions in the idle state or the rendering resources with the longest time length of the residual rendering can be preferentially used, and meanwhile, the rendering tasks executed in the rendering resources including the rendering partitions in the idle state are redistributed to the rendering partitions in the idle state in other candidate rendering resources, so that each rendering resource can be fully utilized, the situation that the rendering partitions in the idle state are too many is avoided, and the utilization rate of the rendering resources is enhanced.
The foregoing is merely exemplary embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims (19)
1. A method of video rendering, the method comprising:
receiving a first rendering task, wherein the first rendering task is sent by a first terminal;
Querying a first rendering resource in a free state from a plurality of rendering resources, wherein a rendering canvas of the first rendering resource comprises a plurality of rendering partitions, and different rendering partitions are used for responding to different rendering tasks;
Determining a first rendering partition in an idle state from the plurality of rendering partitions;
executing at least one current rendering task through the plurality of rendering partitions to obtain rendering data, wherein the at least one current rendering task comprises the first rendering task, and the first rendering partition is used for executing the first rendering task;
and extracting first video data corresponding to the first rendering partition from the rendering data, and sending the first video data to the first terminal.
2. The method of claim 1, wherein the step of determining the position of the substrate comprises,
The first rendering task carries rendering configuration conditions;
The querying a first rendering resource in a idle state from a plurality of rendering resources includes:
searching a rendering resource which meets the rendering configuration condition and comprises a rendering partition in a idle state from the plurality of rendering resources to serve as a first rendering resource;
And in response to none of the plurality of rendering resources including the rendering partition in the idle state, searching the rendering resource which accords with the rendering configuration condition and is not partitioned from the plurality of rendering resources as the first rendering resource.
3. The method of claim 2, wherein the step of determining the position of the substrate comprises,
The searching, from the plurality of rendering resources, for a rendering resource that meets the rendering configuration condition and includes a rendering partition in a free state as a first rendering resource includes:
obtaining an index table, wherein the index table is used for recording states of a plurality of rendering partitions respectively included by the plurality of rendering resources and performance parameters respectively included by the plurality of rendering resources;
Querying, from the index table, a rendering resource that satisfies the rendering configuration condition and includes at least one rendering partition in a free state as a first rendering resource, wherein the rendering configuration condition includes: the minimum performance parameter required for completing the first rendering task is less than the performance parameter possessed by the rendering resource.
4. The method of claim 3, wherein while the first rendering partition performs the first rendering task, the method further comprises:
and updating the state corresponding to the first rendering partition in the index table from an idle state to a use state.
5. The method of claim 2, wherein the searching for a rendering resource from the plurality of rendering resources that satisfies the rendering configuration condition and includes a rendering partition in a free state as a first rendering resource comprises:
searching the rendering resources which meet the rendering configuration conditions and comprise the rendering partition in the idle state from the plurality of rendering resources to serve as rendering resources to be selected;
in response to the number of the rendering resources to be selected being one, taking the rendering resources to be selected as first rendering resources;
In response to the number of the candidate rendering resources being a plurality, performing any one of the following:
taking the rendering resource to be selected with the least number of rendering partitions in idle state as a first rendering resource;
Determining difference values of time consumption of the first rendering task and time consumption of rendering tasks in a plurality of rendering resources to be selected respectively, and taking the rendering resource to be selected corresponding to the smallest difference value as the first rendering resource.
6. The method of any of claims 1-5, wherein prior to the determining a first rendering partition in an idle state from the plurality of rendering partitions, the method further comprises:
obtaining an index table, wherein the index table comprises the number of rendering partitions corresponding to the plurality of rendering resources, and the number of rendering partitions is the maximum number of rendering partitions supported by the performance parameters of the rendering resources;
Inquiring the first partition number corresponding to the first rendering resource from the index table;
and dividing the rendering canvas of the first rendering resource into a plurality of rendering partitions according to the first partition number.
7. The method of claim 6, wherein prior to the obtaining the index table, the method further comprises:
And for each rendering resource in the plurality of rendering resources, calling a machine learning model to predict based on the performance parameters of the rendering resource to obtain the number of rendering partitions of the rendering resource, wherein the machine learning model is trained based on the performance parameters of a sample rendering resource and the number of marked rendering partitions of the sample rendering resource, and the number of marked rendering partitions is the maximum number of rendering partitions which can be supported by the performance parameters of the sample rendering resource.
8. The method of claim 6, wherein upon said performing at least one current rendering task by said plurality of rendering partitions resulting in rendered data, the method further comprises:
detecting a current frame rate at which the at least one current rendering task is performed based on the plurality of rendering partitions in the first rendering resource;
In response to the current frame rate being less than a frame rate threshold, iteratively: and the first partition number is reduced to a second partition number according to a preset value or a preset proportion, the rendering canvas of the first rendering resource is divided into a plurality of new rendering partitions according to the second partition number, and the at least one current rendering task is continuously executed based on the plurality of new rendering partitions.
9. The method of claim 8, wherein prior to repartitioning the rendering canvas of the first rendering resource into a new plurality of rendering partitions according to the second partition number, the method further comprises:
if at least one of the number of horizontal partitions and the number of vertical partitions of the rendering canvas is reduced, the number of rendering partitions of the rendering canvas is smaller than the number of second partitions, and the number of first partitions is kept unchanged;
And if the number of rendering partitions of the rendering canvas is greater than or equal to the second partition number after at least one of the number of horizontal partitions and the number of vertical partitions of the rendering canvas is reduced, switching to the process of re-dividing the rendering canvas of the first rendering resource into a new plurality of rendering partitions according to the second partition number.
10. The method of any of claims 1-5, wherein, in performing at least one current rendering task by the plurality of rendering partitions, the method further comprises:
Querying a plurality of candidate rendering resources which comprise rendering partitions in idle states and have the same performance parameters;
Reassigning rendering tasks performed by a first candidate rendering resource to other candidate rendering resources, wherein the first candidate rendering resource is any one of the plurality of candidate rendering resources, and the other candidate rendering resources are candidate rendering resources other than the first candidate rendering resource among the plurality of candidate rendering resources.
11. The method of claim 10, wherein the reassigning rendering tasks performed by the first candidate rendering resource to other candidate rendering resources comprises:
the following operations are iteratively performed:
Querying a candidate rendering resource including the largest number of rendering partitions in a free state from the plurality of candidate rendering resources as the first candidate rendering resource, and
And reassigning the rendering tasks executed by the rendering partitions of the first candidate rendering resources to the rendering partitions in the idle state in the other candidate rendering resources until the rendering partitions included in the other candidate rendering resources are all in a use state, or reassigning all the rendering tasks executed by the first candidate rendering resources to the other candidate rendering resources.
12. The method of claim 11, wherein, in the case where the number of the other candidate rendering resources is a plurality, the reassigning the rendering task performed by the rendering partition of the first candidate rendering resource to the rendering partition in the idle state among the other candidate rendering resources comprises:
Descending order according to the order of the number of rendering tasks executed by the other candidate rendering resources from large to small;
and reassigning rendering tasks performed by the first candidate rendering resources to at least one of the other candidate rendering resources according to the result of the descending order.
13. The method of claim 10, wherein after the reassigning the rendering task performed by the first candidate rendering resource to the other candidate rendering resource, the method further comprises:
Releasing the first candidate rendering resources, and updating the states of the rendering partitions corresponding to the first candidate rendering resources into idle states.
14. The method according to any one of claim 1 to 5, wherein,
Upon said receiving a first rendering task, the method further comprises:
receiving at least one second rendering task;
Querying a first rendering resource in a free state from a plurality of rendering resources, wherein the first rendering resource comprises;
Querying a first rendering resource comprising not less than a set number of rendering partitions in an idle state from a plurality of rendering resources, wherein the set number is a sum of a number of rendering partitions required to perform the first rendering task and a number of rendering partitions required to perform the at least one second rendering task;
Upon the determining a first rendering partition in a free state from the plurality of rendering partitions, the method includes:
Determining at least one second rendering partition in an idle state from the plurality of rendering partitions, wherein the at least one second rendering partition is respectively used for executing the at least one second rendering task;
Upon extracting first video data corresponding to the first rendering partition from the rendering data, the method further includes:
second video data corresponding to the at least one second rendering partition is extracted from the rendering data.
15. The method of any of claims 1 to 5, wherein the extracting first video data corresponding to the first rendering partition from the rendering data comprises:
dividing the rendering data into a plurality of sub-rendering data according to the number of rendering partitions of the first rendering resource, wherein different sub-rendering data correspond to different rendering partitions;
and taking sub-rendering data corresponding to the first rendering partition in the plurality of sub-rendering data as the first video data.
16. A video rendering device, the device comprising:
The receiving module is used for receiving a first rendering task, wherein the first rendering task is sent by a first terminal;
The query module is used for querying a first rendering resource in an idle state from a plurality of rendering resources, wherein rendering canvas of the first rendering resource comprises a plurality of rendering partitions, and different rendering partitions are used for responding to different rendering tasks;
a determining module, configured to determine a first rendering partition in an idle state from the plurality of rendering partitions;
The rendering module is used for executing at least one current rendering task through the plurality of rendering partitions to obtain rendering data, wherein the at least one current rendering task comprises the first rendering task, and the first rendering partition is used for executing the first rendering task;
And the extraction module is used for extracting first video data corresponding to the first rendering partition from the rendering data and sending the first video data to the first terminal.
17. An electronic device, the electronic device comprising:
A memory for storing computer executable instructions;
a processor for implementing the video rendering method of any one of claims 1 to 15 when executing computer-executable instructions stored in the memory.
18. A computer readable storage medium storing computer executable instructions or a computer program, which when executed by a processor implements the video rendering method of any one of claims 1 to 15.
19. A computer program product comprising computer executable instructions or a computer program, which when executed by a processor implements the video rendering method of any one of claims 1 to 15.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410438015.XA CN118042181B (en) | 2024-04-12 | 2024-04-12 | Video rendering method, apparatus, electronic device, computer-readable storage medium, and computer program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410438015.XA CN118042181B (en) | 2024-04-12 | 2024-04-12 | Video rendering method, apparatus, electronic device, computer-readable storage medium, and computer program product |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118042181A CN118042181A (en) | 2024-05-14 |
CN118042181B true CN118042181B (en) | 2024-06-28 |
Family
ID=90999122
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410438015.XA Active CN118042181B (en) | 2024-04-12 | 2024-04-12 | Video rendering method, apparatus, electronic device, computer-readable storage medium, and computer program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118042181B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111209098A (en) * | 2019-12-19 | 2020-05-29 | 无锡量子云数字新媒体科技有限公司 | Intelligent rendering scheduling method, server, management node and storage medium |
CN114501062A (en) * | 2022-01-27 | 2022-05-13 | 腾讯科技(深圳)有限公司 | Video rendering coordination method, device, equipment and storage medium |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11216993B2 (en) * | 2019-11-27 | 2022-01-04 | Arm Limited | Graphics processing systems |
US20230298125A1 (en) * | 2022-03-18 | 2023-09-21 | Intel Corporation | Multi-render partitioning |
CN114968521A (en) * | 2022-05-20 | 2022-08-30 | 每平每屋(上海)科技有限公司 | Distributed rendering method and device |
CN115858177B (en) * | 2023-02-08 | 2023-10-24 | 成都数联云算科技有限公司 | Method, device, equipment and medium for distributing resources of rendering machine |
-
2024
- 2024-04-12 CN CN202410438015.XA patent/CN118042181B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111209098A (en) * | 2019-12-19 | 2020-05-29 | 无锡量子云数字新媒体科技有限公司 | Intelligent rendering scheduling method, server, management node and storage medium |
CN114501062A (en) * | 2022-01-27 | 2022-05-13 | 腾讯科技(深圳)有限公司 | Video rendering coordination method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN118042181A (en) | 2024-05-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107403173B (en) | Face recognition system and method | |
CN112232293B (en) | Image processing model training method, image processing method and related equipment | |
CN106021421B (en) | method and device for accelerating webpage rendering | |
CN110784759A (en) | Barrage information processing method and device, electronic equipment and storage medium | |
US10474574B2 (en) | Method and apparatus for system resource management | |
WO2022242352A1 (en) | Methods and apparatuses for building image semantic segmentation model and image processing, electronic device, and medium | |
CN113518256A (en) | Video processing method and device, electronic equipment and computer readable storage medium | |
CN113704531A (en) | Image processing method, image processing device, electronic equipment and computer readable storage medium | |
CN112765513A (en) | Fine-grained Web3D online visualization method for large-scale building scene | |
CN115170390B (en) | File stylization method, device, equipment and storage medium | |
CN113516666A (en) | Image cropping method and device, computer equipment and storage medium | |
CN111783712A (en) | Video processing method, device, equipment and medium | |
CN111246287A (en) | Video processing method, video publishing method, video pushing method and devices thereof | |
CN113761609A (en) | Real-time rendering system and method of cloud architecture CAD platform based on server side | |
CN112948043A (en) | Fine-grained Web3D online visualization method for large-scale building scene | |
CN116166690A (en) | Mixed vector retrieval method and device for high concurrency scene | |
Fujii et al. | RGB-D image inpainting using generative adversarial network with a late fusion approach | |
CN117765149A (en) | Large-scale scene real-time interactive rendering method based on visual cone action prediction | |
CN118042181B (en) | Video rendering method, apparatus, electronic device, computer-readable storage medium, and computer program product | |
Li et al. | CEBOW: A Cloud‐Edge‐Browser Online Web3D approach for visualizing large BIM scenes | |
CN116980605A (en) | Video processing method, apparatus, computer device, storage medium, and program product | |
CN111814091A (en) | Message distribution method and related device | |
US20240259651A1 (en) | Map scene rendering method and apparatus, server, terminal, computer-readable storage medium, and computer program product | |
WO2024027274A1 (en) | Map scene rendering method and apparatus, server, terminal, computer-readable storage medium, and computer program product | |
CN113778905B (en) | UI design acceptance method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |