Video rendering method and device, computer equipment and storage medium

文档序号:7327 发布日期:2021-09-17 浏览:31次 中文

1. A method of video rendering, comprising:

if a preset video rendering instruction is received, generating a rendering list according to the preset video rendering instruction;

if a preset idle slot allocation instruction sent by a preset output queue is received, acquiring a current frame index corresponding to the rendering list;

if the current frame index meets a preset detection condition, constructing a current rendering task according to the current frame index, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame;

storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue;

and adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if a preset idle slot allocation instruction sent by a preset output queue is received.

2. The video rendering method according to claim 1, wherein before obtaining the current frame index corresponding to the rendering list if receiving a preset free slot allocation command sent by a preset output queue, the method further comprises:

and sending a free slot allocation request to a preset output queue through a polling mechanism.

3. The video rendering method of claim 1, wherein the step of, if the current frame index satisfies a predetermined detection condition, further comprising:

detecting whether the current frame count in a preset sequence lock is the current frame index;

and if the current frame count in the preset sequence lock is the current frame index, judging that the current frame index meets a preset detection condition.

4. The video rendering method of claim 1, wherein the constructing a current rendering task according to the current frame index and placing the current rendering task into a rendering thread pool for rendering to obtain a rendered video frame comprises:

acquiring execution parameters related to the current video frame according to the current frame index, wherein the execution parameters comprise the number of rendering threads allowed to be used simultaneously and a preset frame loss mark;

and if the preset frame loss mark is not the preset frame loss value, constructing a current rendering task related to the current video frame according to the rendering thread number, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame.

5. The video rendering method of claim 4, wherein the obtaining of the execution parameters related to the current video frame according to the current frame index further comprises, after the execution parameters include the number of rendering threads allowed to be used simultaneously and a preset frame loss flag:

and if the preset frame loss mark is a preset frame loss value, storing the preset frame loss mark to an idle slot corresponding to the preset allocation idle slot instruction in the output queue.

6. The video rendering method according to claim 1, wherein the step of adding 1 to the index value corresponding to the current frame index and returning to execute the step of obtaining the current frame index corresponding to the rendering list if the preset free slot allocation instruction sent by the preset output queue is received until a preset rendering stopping instruction is received further comprises:

if a preset frame obtaining instruction is received, obtaining the rendered video frame and a frame number corresponding to the video frame from the preset output queue;

and playing or deriving a video according to the video frame and the frame number.

7. The video rendering method according to claim 6, wherein the obtaining the rendered video frame and the frame number corresponding to the video frame from the preset output queue comprises:

detecting whether the video frame exists in the current idle slot of the preset output queue;

if the video frame exists in the current idle slot, acquiring the video frame from the current idle slot, and adding 1 to a frame number corresponding to the video frame;

and if the video frame does not exist in the idle slot, skipping the current idle slot, taking the next idle slot as the current idle slot, and returning to the step of detecting whether the video frame exists in the current idle slot of the preset output queue until a preset finishing instruction is received.

8. A video rendering apparatus, comprising:

the generating unit is used for generating a rendering list according to a preset video rendering instruction if the preset video rendering instruction is received;

the first obtaining unit is used for obtaining a current frame index corresponding to the rendering list if a preset idle slot allocation instruction sent by a preset output queue is received;

the rendering unit is used for constructing a current rendering task according to the current frame index if the current frame index meets a preset detection condition, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame;

the storage unit is used for storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue;

and the computing unit is used for adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if the preset idle slot allocation instruction sent by the preset output queue is received.

9. A computer device, characterized in that the computer device comprises a memory having stored thereon a computer program and a processor implementing the video rendering method according to any of claims 1-7 when executing the computer program.

10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements a video rendering method according to any of claims 1-7.

Background

Currently, video editing is very popular both on the PC side and the mobile side, and for example, video clip software such as Premiere software on the PC side and jittering sound on the mobile side is used. Generally, users can perform picture color matching, small object decoration, character addition and the like on a shot video, namely, the video is rendered, and then the rendered video is shared by others or stored locally. Video rendering is generally inefficient because it requires a high processing load on its own.

Disclosure of Invention

The embodiment of the invention provides a video rendering method and device, computer equipment and a storage medium, and aims to solve the problem of low video rendering efficiency in the prior art.

In a first aspect, an embodiment of the present invention provides a video rendering method, which includes:

if a preset video rendering instruction is received, generating a rendering list according to the preset video rendering instruction;

if a preset idle slot allocation instruction sent by a preset output queue is received, acquiring a current frame index corresponding to the rendering list;

if the current frame index meets a preset detection condition, constructing a current rendering task according to the current frame index, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame;

storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue;

and adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if a preset idle slot allocation instruction sent by a preset output queue is received.

Further, a request for allocating a free slot is sent to a preset output queue through a polling mechanism.

Further, detecting whether the current frame count in the preset sequence lock is the current frame index; and if the current frame count in the preset sequence lock is the current frame index, judging that the current frame index meets a preset detection condition.

Further, obtaining an execution parameter related to the current video frame according to the current frame index, wherein the execution parameter comprises the number of rendering threads allowed to be used simultaneously and a preset frame loss mark; and if the preset frame loss mark is not the preset frame loss value, constructing a current rendering task related to the current video frame according to the rendering thread number, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame.

Further, if the preset frame loss flag is a preset frame loss value, the preset frame loss flag is stored in the idle slot corresponding to the preset allocation idle slot instruction in the output queue.

Further, if a preset frame acquisition instruction is received, acquiring the rendered video frame and a frame number corresponding to the video frame from the preset output queue; and playing or deriving a video according to the video frame and the frame number.

Further, detecting whether the video frame exists in the current idle slot of the preset output queue; if the video frame exists in the current idle slot, acquiring the video frame from the current idle slot, and adding 1 to a frame number corresponding to the video frame; and if the video frame does not exist in the idle slot, skipping the current idle slot, taking the next idle slot as the current idle slot, and returning to the step of detecting whether the video frame exists in the current idle slot of the preset output queue until a preset finishing instruction is received.

In a second aspect, an embodiment of the present invention further provides a video rendering apparatus, which includes:

the generating unit is used for generating a rendering list according to a preset video rendering instruction if the preset video rendering instruction is received;

the first obtaining unit is used for obtaining a current frame index corresponding to the rendering list if a preset idle slot allocation instruction sent by a preset output queue is received;

the rendering unit is used for constructing a current rendering task according to the current frame index if the current frame index meets a preset detection condition, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame;

the storage unit is used for storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue;

and the computing unit is used for adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if the preset idle slot allocation instruction sent by the preset output queue is received.

In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the above method when executing the computer program.

In a fourth aspect, the present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program can implement the above method when being executed by a processor.

The embodiment of the invention provides a video rendering method, a video rendering device, computer equipment and a storage medium. Wherein the method comprises the following steps: if a preset video rendering instruction is received, generating a rendering list according to the preset video rendering instruction; if a preset idle slot allocation instruction sent by a preset output queue is received, acquiring a current frame index corresponding to the rendering list; if the current frame index meets a preset detection condition, constructing a current rendering task according to the current frame index, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame; storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue; and adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if a preset idle slot allocation instruction sent by a preset output queue is received. According to the technical scheme of the embodiment of the invention, the preset output queue is matched with the working thread pool for use, so that not only can the rendering tasks corresponding to the video frames be subjected to multi-thread rendering, but also the rendered video frames can be stored in order, and therefore, the video frames can be conveniently acquired and played, and the video rendering efficiency can be improved.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

Fig. 1 is a schematic flowchart of a video rendering method according to an embodiment of the present invention;

fig. 2 is a schematic sub-flow diagram of a video rendering method according to an embodiment of the present invention;

fig. 3 is a flowchart illustrating a video rendering method according to another embodiment of the present invention;

fig. 4 is a flowchart illustrating a video rendering method according to another embodiment of the present invention;

fig. 5 is a schematic block diagram of a video rendering apparatus according to an embodiment of the present invention;

FIG. 6 is a schematic block diagram of a rendering unit of a video rendering apparatus according to an embodiment of the present invention;

FIG. 7 is a schematic block diagram of a video rendering apparatus according to another embodiment of the present invention;

FIG. 8 is a schematic block diagram of a video rendering apparatus according to yet another embodiment of the present invention;

fig. 9 is a schematic block diagram of a second obtaining unit of a video rendering apparatus according to yet another embodiment of the present invention; and

fig. 10 is a schematic block diagram of a computer device according to an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".

Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a video rendering method according to an embodiment of the invention. The video rendering method provided by the embodiment of the invention can be applied to a terminal, such as intelligent terminal equipment of a smart phone, a portable computer, a desktop computer, a notebook computer and the like, and the video rendering method is realized through software installed on the terminal, such as an application program named as audio and video editing software, so that the video rendering efficiency is improved. The video rendering method is explained in detail below. As shown in fig. 1, the method includes the following steps S100-S140.

S100, if a preset video rendering instruction is received, a rendering list is generated according to the preset video rendering instruction.

In the embodiment of the invention, a user inputs a rendering requirement in audio and video editing software and clicks a play button of the audio and video editing software, and then a preset video rendering instruction is triggered to be sent, namely, if the audio and video editing software receives the preset video rendering instruction, a rendering list is generated according to the preset video rendering instruction. In practical applications, for example, a video needs to be played and beautified while a rabbit ear is attached to the video, and then specific function implementations (human, beauty, rabbit, etc.) need to be disassembled into rendering nodes and connected to obtain a rendering list. Understandably, the nodes in the rendering list are the various processes for processing the video frame, which are essentially a series of frame data to be rendered.

It should be noted that, in the embodiment of the present invention, in order to implement the video rendering method, the audio/video editing software includes a preset output queue, a work thread pool, a performance monitoring module, and the like.

S110, if a preset idle slot allocation instruction sent by a preset output queue is received, acquiring a current frame index corresponding to the rendering list.

In the embodiment of the present invention, after a rendering list is generated, if a preset idle slot allocation instruction sent by a preset output queue is received, which indicates that there is an idle slot in the preset output queue and a rendered video frame can be stored, a current frame index corresponding to the rendering list is obtained. It should be noted that, in the embodiment of the present invention, after the rendering list is generated, a starting frame number and a total frame number corresponding to the rendering list are generated, where the starting frame number is a current frame index.

And S120, if the current frame index meets a preset detection condition, constructing a current rendering task according to the current frame index, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame.

In the embodiment of the present invention, after the current frame index corresponding to the rendering list is obtained, it is detected whether the current frame index meets a preset detection condition. Specifically, whether the current frame count in a preset sequence lock is the current frame index is detected; if the current frame count in the preset sequence lock is the current frame index, which indicates that the previous video frame of the current video frame is processed completely, judging that the current frame index meets a preset detection condition; otherwise, if the current frame count in the preset sequence lock is not the current frame index, which indicates that the previous video frame of the current video frame is not processed and the processing of the current video frame needs to be blocked, it is determined that the current frame index does not meet the preset detection condition. In practical application, the video frames are rendered in sequence according to the frame index numbers by mutually exclusive lock mutex.

Referring to fig. 2, in an embodiment, for example, in the embodiment of the present invention, the step S120 includes the following steps S121 to S122.

S121, acquiring execution parameters related to the current video frame according to the current frame index, wherein the execution parameters comprise rendering thread numbers allowed to be used simultaneously and a preset frame loss mark;

and S122, if the preset frame loss mark is not the preset frame loss value, constructing a current rendering task related to the current video frame according to the rendering thread number, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame.

In the embodiment of the invention, if the current frame index meets the preset detection condition, the execution parameters related to the current video frame are firstly obtained from a performance monitoring module according to the current frame index, wherein the execution parameters comprise the number of rendering threads allowed to be used simultaneously and a preset frame loss mark; and then judging whether the preset frame loss mark is a preset frame loss value or not, if the preset frame loss mark is not the preset frame loss value, indicating that the current video frame does not need to be discarded and needs to be rendered, constructing a current rendering task related to the current video frame according to the number of rendering threads, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame. Understandably, the construction of the current rendering task is well known to those skilled in the art and will not be described herein. In practical application, if the preset frame loss flag is a preset frame loss value, which indicates that the current video frame meets a frame loss strategy and needs to be discarded, the preset frame loss flag is stored in an idle slot corresponding to the preset allocation idle slot instruction in the output queue.

It should be noted that, in the embodiment of the present invention, by using the preset output queue and the working thread pool in a matching manner, not only the rendering task corresponding to the video frame can be subjected to multi-thread rendering, but also the rendered video frame can be stored in order, so that the video frame can be conveniently acquired and played, and the video rendering efficiency can be improved.

S130, storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue.

In the embodiment of the invention, after the rendered video frame is obtained, the video frame is stored in the idle slot corresponding to the preset allocation idle slot instruction in the output queue, so that the video frame can be conveniently acquired, and the playing efficiency is further improved.

And S140, adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if a preset idle slot allocation instruction sent by a preset output queue is received.

In the embodiment of the present invention, after the rendered video frame is stored in the idle slot, 1 is added to the index value corresponding to the current frame index, and it is understood that if the index value corresponding to the current frame index is 1, and after 1 is added, the index value corresponding to the current frame index is 2, and when the index value corresponding to the current frame index is within the total frame number and a preset terminal instruction is not received, that is, the audio and video editing software does not receive a preset rendering stopping instruction, the step of obtaining the current frame index corresponding to the rendering list is returned to execute if a preset idle slot allocation instruction sent by a preset output queue is received.

Fig. 3 is a flowchart illustrating a magnetic disk data reading method according to another embodiment of the present invention, as shown in fig. 3, in the embodiment of the present invention, the magnetic disk data reading method includes steps S200 to S250. Steps S200 to S240 are similar to steps S100 to S140 in the above embodiments, and are not described herein again. The added step S250 in the present embodiment is explained in detail below.

And S250, sending a free slot allocation request to a preset output queue through a polling mechanism.

In the embodiment of the present invention, after the rendering list is generated, a request for allocating a free slot is sent to the preset output queue through a polling mechanism, specifically, a request for allocating a free slot is sent to the preset output queue at an interval of 1 ms. In practical application, if a preset idle slot allocation instruction sent by a preset output queue is received, sending an idle slot allocation request to the preset output queue is stopped; and if the preset idle slot allocation instruction sent by the preset output queue is not received, after waiting for 1ms, sending an idle slot allocation request to the preset output queue.

Fig. 4 is a flowchart illustrating a magnetic disk data reading method according to another embodiment of the present invention, as shown in fig. 4, in the embodiment of the present invention, the magnetic disk data reading method includes steps S300 to S370. Steps S300 to S350 are similar to steps S200 to S250 in the above embodiments, and are not described herein again. The steps S360 and S370 added in the present embodiment are explained in detail below.

S360, if a preset frame obtaining instruction is received, obtaining the rendered video frame and a frame number corresponding to the video frame from the preset output queue;

and S370, playing or deriving a video according to the video frame and the frame number.

In the embodiment of the present invention, after the video frame rendering is completed, if a preset frame obtaining instruction is received, obtaining the rendered video frame and a frame number corresponding to the video frame from the preset output queue; specifically, detecting whether the video frame exists in the current idle slot of the preset output queue; if the video frame exists in the current idle slot, acquiring the video frame from the current idle slot, and adding 1 to a frame number corresponding to the video frame; and if the video frame does not exist in the idle slot, skipping the current idle slot, taking the next idle slot as the current idle slot, and returning to the step of detecting whether the video frame exists in the current idle slot of the preset output queue until a preset finishing instruction is received. And playing or deriving a video according to the video frame and the frame number. It should be noted that, in the embodiment of the present invention, when a rendered video frame is obtained from a preset output queue, a frame number is not specified, that is, a frame number corresponding to the video frame in the current idle slot is assigned to be 1, and frame numbers corresponding to subsequent video frames are sequentially added by 1.

Fig. 5 is a schematic block diagram of a video rendering apparatus 200 according to an embodiment of the present invention. As shown in fig. 5, the present invention further provides a video rendering apparatus 200 corresponding to the above video rendering method. The video rendering apparatus 200 includes a unit for performing the above-described video rendering method, and the apparatus may be configured in a terminal. Specifically, referring to fig. 5, the video rendering apparatus 200 includes a generating unit 201, a first obtaining unit 202, a rendering unit 203, a saving unit 204, and a calculating unit 205.

The generating unit 201 is configured to generate a rendering list according to a preset video rendering instruction if the preset video rendering instruction is received; the first obtaining unit 202 is configured to obtain a current frame index corresponding to the rendering list if a preset idle slot allocation instruction sent by a preset output queue is received; the rendering unit 203 is configured to construct a current rendering task according to the current frame index if the current frame index meets a preset detection condition, and place the current rendering task in a rendering thread pool for rendering to obtain a rendered video frame; the saving unit 204 is configured to save the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue; the calculating unit 205 is configured to add 1 to the index value corresponding to the current frame index, and return to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if the preset free slot allocation instruction sent by the preset output queue is received.

In some embodiments, for example, in this embodiment, as shown in fig. 6, the rendering unit 203 includes a first obtaining subunit 2031 and a rendering subunit 2032.

The first obtaining subunit 2031 is configured to obtain, according to the current frame index, an execution parameter related to a current video frame, where the execution parameter includes a number of rendering threads allowed to be used simultaneously and a preset frame loss flag; the rendering subunit 2032 is configured to, if the preset frame loss flag is not a preset frame loss value, construct a current rendering task related to the current video frame according to the number of rendering threads, and place the current rendering task in a rendering thread pool for rendering to obtain a rendered video frame.

In some embodiments, for example, in this embodiment, as shown in fig. 7, the video rendering apparatus 200 further includes a sending unit 206.

The sending unit 206 is configured to send a free slot allocation request to a preset output queue through a polling mechanism.

In some embodiments, for example, in this embodiment, as shown in fig. 8, the video rendering apparatus 200 further includes a second obtaining unit 207 and a playing unit 208.

The second obtaining unit 207 is configured to obtain the rendered video frame and a frame number corresponding to the video frame from the preset output queue if a preset frame obtaining instruction is received; the playing unit 208 is configured to play or derive a video according to the video frame and the frame number.

In some embodiments, for example, in this embodiment, as shown in fig. 9, the second obtaining unit 207 further includes a detecting unit 2071, a second obtaining subunit 2072 and an executing unit 2073.

The detecting unit 2071 is configured to detect whether the video frame exists in the current idle slot of the preset output queue; the second obtaining subunit 2072 is configured to, if the video frame exists in the current idle slot, obtain the video frame from the current idle slot, and add 1 to a frame number corresponding to the video frame; the execution unit 2073 is configured to skip the current idle slot if the video frame does not exist in the idle slot, take the next idle slot as the current idle slot, and return to the step of detecting whether the video frame exists in the current idle slot of the preset output queue until a preset completion instruction is received.

The specific implementation manner of the video rendering apparatus 200 according to the embodiment of the present invention corresponds to the above-described flow verification method, and is not described herein again.

The video rendering apparatus may be implemented in the form of a computer program that is executable on a computer device such as that shown in fig. 10.

Referring to fig. 10, fig. 10 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 300 is a terminal, and the terminal may be an electronic device with a communication function, such as a smart phone, a desktop computer, a laptop computer, or a tablet computer.

Referring to fig. 10, the computer device 300 includes a processor 302, a memory, which may include a storage medium 303 and an internal memory 304, and a network interface 305 connected by a system bus 301.

The storage medium 303 may store an operating system 3031 and computer programs 3032. The computer program 3032, when executed, may cause the processor 302 to perform a method of video rendering.

The processor 302 is used to provide computing and control capabilities to support the operation of the overall computer device 300.

The internal memory 304 provides an environment for the execution of the computer program 3032 in the storage medium 303, which computer program 3032, when executed by the processor 302, causes the processor 302 to perform a video rendering method.

The network interface 305 is used for network communication with other devices. Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing device 300 to which the disclosed aspects apply, as a particular computing device 300 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.

Wherein the processor 302 is configured to run a computer program 3032 stored in the memory to implement the following steps: if a preset video rendering instruction is received, generating a rendering list according to the preset video rendering instruction; if a preset idle slot allocation instruction sent by a preset output queue is received, acquiring a current frame index corresponding to the rendering list; if the current frame index meets a preset detection condition, constructing a current rendering task according to the current frame index, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame; storing the rendered video frame to an idle slot corresponding to the preset idle slot allocation instruction in the output queue; and adding 1 to the index value corresponding to the current frame index, and returning to execute the step of obtaining the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received if a preset idle slot allocation instruction sent by a preset output queue is received.

In some embodiments, for example, in this embodiment, before implementing the step of obtaining the current frame index corresponding to the rendering list if the processor 302 receives the preset free slot allocation instruction sent by the preset output queue, the specific implementation further includes the following steps: and sending a free slot allocation request to a preset output queue through a polling mechanism.

In some embodiments, for example, in this embodiment, when the processor 302 implements the step of determining that the current frame index satisfies the predetermined detection condition, the following steps are specifically implemented: detecting whether the current frame count in a preset sequence lock is the current frame index; and if the current frame count in the preset sequence lock is the current frame index, judging that the current frame index meets a preset detection condition.

In some embodiments, for example, in this embodiment, when implementing the steps of constructing the current rendering task according to the current frame index, and placing the current rendering task into a rendering thread pool for rendering to obtain a rendered video frame, the processor 302 specifically implements the following steps: acquiring execution parameters related to the current video frame according to the current frame index, wherein the execution parameters comprise the number of rendering threads allowed to be used simultaneously and a preset frame loss mark; and if the preset frame loss mark is not the preset frame loss value, constructing a current rendering task related to the current video frame according to the rendering thread number, and putting the current rendering task into a rendering work thread pool for rendering to obtain a rendered video frame.

In some embodiments, for example, in this embodiment, after implementing the step of obtaining the execution parameter related to the current video frame according to the current frame index, where the execution parameter includes the number of rendering threads allowed to be used simultaneously and a preset frame loss flag, the processor 302 further implements the following steps: and if the preset frame loss mark is a preset frame loss value, storing the preset frame loss mark to an idle slot corresponding to the preset allocation idle slot instruction in the output queue.

In some embodiments, for example, in this embodiment, after implementing the step of adding 1 to the index value corresponding to the current frame index and returning to execute the step of, if the preset allocation free slot instruction sent by the preset output queue is received, acquiring the current frame index corresponding to the rendering list until a preset rendering stopping instruction is received, the specific implementation further includes the following steps: if a preset frame obtaining instruction is received, obtaining the rendered video frame and a frame number corresponding to the video frame from the preset output queue; and playing or deriving a video according to the video frame and the frame number.

In some embodiments, for example, in this embodiment, when the processor 302 implements the step of obtaining the rendered video frame and the frame number corresponding to the video frame from the preset output queue, the following steps are implemented: detecting whether the video frame exists in the current idle slot of the preset output queue; if the video frame exists in the current idle slot, acquiring the video frame from the current idle slot, and adding 1 to a frame number corresponding to the video frame; and if the video frame does not exist in the idle slot, skipping the current idle slot, taking the next idle slot as the current idle slot, and returning to the step of detecting whether the video frame exists in the current idle slot of the preset output queue until a preset finishing instruction is received.

It should be understood that, in the embodiment of the present Application, the Processor 302 may be a Central Processing Unit (CPU), and the Processor 302 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.

Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the video rendering method described above.

The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.

Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.

The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.

The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.

In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, while the invention has been described with respect to the above-described embodiments, it will be understood that the invention is not limited thereto but may be embodied with various modifications and changes.

While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种基于限界上下文的微服务划分方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!