CN113407325A - Video rendering method and device, computer equipment and storage medium - Google Patents

Video rendering method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113407325A
CN113407325A CN202110732319.3A CN202110732319A CN113407325A CN 113407325 A CN113407325 A CN 113407325A CN 202110732319 A CN202110732319 A CN 202110732319A CN 113407325 A CN113407325 A CN 113407325A
Authority
CN
China
Prior art keywords
rendering
preset
current
video
frame
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.)
Pending
Application number
CN202110732319.3A
Other languages
Chinese (zh)
Inventor
陈明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Wondershare Software Co Ltd
Original Assignee
Shenzhen Sibo Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Sibo Technology Co ltd filed Critical Shenzhen Sibo Technology Co ltd
Priority to CN202110732319.3A priority Critical patent/CN113407325A/en
Publication of CN113407325A publication Critical patent/CN113407325A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining

Abstract

The embodiment of the invention discloses a video rendering method, a video rendering device, computer equipment and a storage medium. The application is applied to the technical field of video playing and 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 the 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 a preset idle slot allocation instruction in an output queue; and adding 1 to the index value corresponding to the current frame index, and returning to the step of executing the preset idle slot allocation instruction sent by the preset output queue until a preset rendering stopping instruction is received. The embodiment of the application can improve the video rendering efficiency.

Description

Video rendering method and device, computer equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of video playing, in particular to a video rendering method, a video rendering device, computer equipment and a storage medium.
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.

Claims (10)

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.
CN202110732319.3A 2021-06-30 2021-06-30 Video rendering method and device, computer equipment and storage medium Pending CN113407325A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110732319.3A CN113407325A (en) 2021-06-30 2021-06-30 Video rendering method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110732319.3A CN113407325A (en) 2021-06-30 2021-06-30 Video rendering method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113407325A true CN113407325A (en) 2021-09-17

Family

ID=77680384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110732319.3A Pending CN113407325A (en) 2021-06-30 2021-06-30 Video rendering method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113407325A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113923519A (en) * 2021-11-11 2022-01-11 深圳万兴软件有限公司 Video rendering method and device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010053275A1 (en) * 2000-04-07 2001-12-20 Hiroaki Adachi Device, method, and system for video editing, and computer readable recording medium having video editing program recorded threon
US6763176B1 (en) * 2000-09-01 2004-07-13 Matrox Electronic Systems Ltd. Method and apparatus for real-time video editing using a graphics processor
US20070230584A1 (en) * 2006-03-31 2007-10-04 Yi-Jen Chiu Image buffering techniques
CN101512656A (en) * 2005-06-30 2009-08-19 微软公司 GPU timeline with render-ahead queue
CN102254297A (en) * 2010-10-15 2011-11-23 威盛电子股份有限公司 Multiple shader system and processing method thereof
CN106331696A (en) * 2016-08-29 2017-01-11 苏州蓝海彤翔系统科技有限公司 Frame loss detection method and device
CN108093293A (en) * 2018-01-15 2018-05-29 北京奇艺世纪科技有限公司 A kind of Video Rendering method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010053275A1 (en) * 2000-04-07 2001-12-20 Hiroaki Adachi Device, method, and system for video editing, and computer readable recording medium having video editing program recorded threon
US6763176B1 (en) * 2000-09-01 2004-07-13 Matrox Electronic Systems Ltd. Method and apparatus for real-time video editing using a graphics processor
CN101512656A (en) * 2005-06-30 2009-08-19 微软公司 GPU timeline with render-ahead queue
US20070230584A1 (en) * 2006-03-31 2007-10-04 Yi-Jen Chiu Image buffering techniques
CN102254297A (en) * 2010-10-15 2011-11-23 威盛电子股份有限公司 Multiple shader system and processing method thereof
CN106331696A (en) * 2016-08-29 2017-01-11 苏州蓝海彤翔系统科技有限公司 Frame loss detection method and device
CN108093293A (en) * 2018-01-15 2018-05-29 北京奇艺世纪科技有限公司 A kind of Video Rendering method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李涛 等: "基于线程池的GPU任务并行计算模式研究", 《计算机学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113923519A (en) * 2021-11-11 2022-01-11 深圳万兴软件有限公司 Video rendering method and device, computer equipment and storage medium
CN113923519B (en) * 2021-11-11 2024-02-13 深圳万兴软件有限公司 Video rendering method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US9201693B2 (en) Quota-based resource management
US20190228217A1 (en) Method, apparatus and device for waking up voice interaction function based on gesture, and computer readable medium
EP3576036A1 (en) Service execution method and device
CN108566634B (en) Method and device for reducing continuous awakening delay of Bluetooth sound box and Bluetooth sound box
CN111221643B (en) Task processing method and task processing device
CN106250093A (en) The search mechanism of the audio frequency previously caught
US8782674B2 (en) Wait on address synchronization interface
US20210208935A1 (en) Method for Scheduling Multi-Core Processor, Terminal, and Storage Medium
CN109783028A (en) Optimization method, device, storage medium and the intelligent terminal of I/O scheduling
CN113923519A (en) Video rendering method and device, computer equipment and storage medium
US11431182B2 (en) Resource statistics collection method and apparatus and terminal
US7444449B2 (en) Method, computer program product and computer system for controlling execution of an interruption routine
CN113407325A (en) Video rendering method and device, computer equipment and storage medium
US8832700B2 (en) Subscriber-based ticking model for platforms
CN111597009A (en) Application program display method and device and terminal equipment
CN113360263B (en) Task processing method, system and related equipment
CN107547742B (en) Wake-up lock release method and device for mobile terminal
CN113268325A (en) Method, device and storage medium for scheduling task
CN113056756A (en) Sleep recognition method and device, storage medium and electronic equipment
CN116302558A (en) Thread scheduling method and device and electronic equipment
US11347544B1 (en) Scheduling work items based on declarative constraints
CN113742096B (en) Method and system for realizing event queue
US20230185574A1 (en) Instruction Scheduling Method, Device, And Storage Medium
CN110418245B (en) Method and device for reducing reaction delay of Bluetooth sound box and terminal equipment
KR102408961B1 (en) Method for processing a delayed task and electronic device implementing the same

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
TA01 Transfer of patent application right

Effective date of registration: 20211119

Address after: 518000 1001, block D, building 5, software industry base, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Applicant after: Shenzhen Wanxing Software Co.,Ltd.

Address before: 518000 1002, block D, building 5, software industry base, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Applicant before: SHENZHEN SIBO TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20210917

RJ01 Rejection of invention patent application after publication