The present application is based on and claims priority to Chinese Patent Application No. 202111637729.6 filed on Dec. 29, 2021, the disclosure of which is incorporated by reference herein in its entirety.
This disclosure relates to the technical field of special-effect editing, and particularly to a special-effect editing method and apparatus.
With the continuous development of science and technology, special effects are increasingly applied in scenes such as self-shooting, short video production, film production, live streaming, and the like, and since works after being processed by the special effects may exceed visual effects that can be achieved by actual shooting, the special effects provide powerful technical supports for improving quality of the works.
Embodiments of the present disclosure provide a special-effect editing method and apparatus. In a first aspect, an embodiment of the present disclosure provides a special-effect editing method, comprising:
As an optional implementation of the embodiment of the present disclosure, the resource manager executing the editing instructions in the instruction cache queue in sequence comprises:
the resource manager executing the editing instructions in the instruction cache queue in sequence through a plurality of execution threads in parallel.
As an optional implementation of the embodiment of the present disclosure, the graphic engine loading the objects corresponding to the editing instructions in the instruction cache queue in sequence comprises: the graphic engine loading the objects corresponding to the editing instructions in the instruction cache queue in sequence through a plurality of loading threads in parallel.
As an optional implementation of the embodiment of the present disclosure, the method further comprises:
As an optional implementation of the embodiment of the present disclosure, the method further comprises:
As an optional implementation of the embodiment of the present disclosure, the method further comprises: before the graphic engine renders the second object, the editor receiving a second editing operation, generating a second editing instruction corresponding to the second editing operation, and writing the second editing instruction into the instruction cache queue.
In a second aspect, an embodiment of the present disclosure provides a special-effect editing apparatus, comprising:
As an optional implementation of the embodiment of the present disclosure, the resource manager is specifically configured to execute the editing instructions in the instruction cache queue in sequence through a plurality of execution threads in parallel.
As an optional implementation of the embodiment of the present disclosure, the graphic engine is specifically configured to load the objects corresponding to the editing instructions in the instruction cache queue in sequence through a plurality of loading threads in parallel.
As an optional implementation of the embodiment of the present disclosure, the resource manager is further configured to generate a first feedback message corresponding to the first editing instruction, and write the first feedback message into a first feedback message queue; and
the editor is further configured to read and output feedback messages in the first feedback message queue in sequence.
As an optional implementation of the embodiment of the present disclosure, the graphic engine is further configured to generate a second feedback message corresponding to the first editing instruction, and write the second feedback message into a second feedback message queue; and
the editor is further configured to read and output feedback messages in the second feedback message queue in sequence.
As an optional implementation of the embodiment of the present disclosure, the editor is further configured to, before the graphic engine renders the second object, receive a second editing operation, generate a second editing instruction corresponding to the second editing operation, and write the second editing instruction into the instruction cache queue.
In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a memory and a processor, the memory being configured to store a computer program; the processor being configured to, when executing the computer program, causes the electronic device to implement the special-effect editing method according to any of the above implementations.
In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium having thereon stored a computer program which, when executed by a computing device, causes the computing device to implement the special-effect editing method according to any of the above implementations.
In a fifth aspect, an embodiment of the present disclosure provides a computer program product which, when running on a computer, causes the computer to implement the special-effect editing method according to any of the above implementations.
The accompanying drawings herein, which are incorporated in and constitute a part of this description, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
In order to more clearly illustrate the embodiments of the present disclosure or technical solutions in the prior art, the drawings that need to be called in the description of the embodiments or the prior art will be briefly described below, and it is obvious that, for one of ordinary skill in the art, other drawings can also be obtained from these drawings without paying creative efforts.
In order to enable more clear understanding of the above objectives, features and advantages of the present disclosure, solutions of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and features in the embodiments can be combined with each other provided there is no conflict.
In the following description, numerous specific details are set forth in order to facilitate full understanding of the present disclosure, but the present disclosure can also be implemented in other manners different from those described herein; and it is obvious that the embodiments in this specification are only part of the embodiments of the present disclosure, and not all of them.
In the embodiments of the present disclosure, words such as “exemplary” or “for example” are used for indicating giving an example, illustration or description. Any embodiment or design solution described as “exemplary” or “for example” in the embodiments of the present disclosure shall not be interpreted as more preferred or advantageous over other embodiments or design solutions. Rather, calling the word such as “exemplary” or “for example” is intended to present a related concept in a specific manner. Furthermore, in the description of the embodiments of the present disclosure, “a plurality” means two or more unless otherwise specified.
Generally, a special-effect editing system is composed of an editor, a graphic engine, and a resource manager. The editor provides special-effect editing and making capabilities, to facilitate a user making or editing special effects and hiding implementation details of the graphic engine; the graphic engine provides special-effect display and dynamic running capabilities, to facilitate the user checking whether the made or edited special effects meet an expected effect; and the digital resource manager is used for storing and managing related resources of the special effects, to facilitate the editor and the graphic engine loading the related resources. In the prior art, a process of performing special-effect editing through the special-effect editing system includes: the editor, when receiving an editing operation input by the user in the editor, editing a corresponding resource stored in the resource manager, the graphic engine loading and running the edited resource from the resource manager after the editing is completed to present the special-effect editing effect to the user, and the user being unable to input a next editing operation before the graphic engine loads and runs the edited resource from the resource manager. As described above, in the prior art, after the user inputs one editing operation, since the graphic engine needs to wait for the resource manager completing the editing of the corresponding resource before loading and running the edited resource, and the editor needs to wait for the graphic engine completing the loading and running of the edited resource before continuing receiving the next editing operation, the special-effect editing solution in the prior art is very easy to block the user’s editing operation due to resource operation or resource loading.
In view of this, embodiments of the present disclosure provide a special-effect editing method and apparatus, for avoiding an editing operation of a user from being blocked, and improving fluency of special-effect editing.
According to the special-effect editing method provided by the embodiment of the present disclosure, an editor, when receiving a first editing operation, generates a first editing instruction corresponding to the first editing operation, and writes the first editing instruction into an instruction cache queue, a resource manager reads editing instructions in the instruction cache queue in sequence, and when executing the first editing instruction, edits the first object corresponding to the first editing instruction according to the first editing instruction, a graphic engine loads objects corresponding to the editing instructions in the instruction cache queue in sequence, and when loading an object corresponding to the first editing instruction, sends the request information for requesting loading the first object edited by the resource manager to the resource manager, the resource manager sends the edited first object to the graphic engine, and finally the graphic engine renders the edited first object. Since the editor, the resource manager, and the graphic engine in the special-effect editing method provided by the embodiment of the present disclosure interact through the instruction cache queue, the special-effect editing method provided by the embodiment of the present disclosure decouples the editor, the resource manager, and the graphic engine, and avoids mutual waiting among the editor, the resource manager, and the graphic engine, so that the embodiment of the present disclosure can avoid the editing operation of the user from being blocked, and improve the fluency of the special-effect editing.
A scene architecture diagram of a special-effect editing method provided in an embodiment of the present disclosure will be firstly described below.
As shown in
The editor 11 is configured to receive an editing operation input by a user, generate an editing instruction for editing a corresponding resource stored in the resource manager 12 according to the received editing operation, and write the editing instruction into an instruction cache queue. The resource manager 12 is configured to read the editing instructions in the instruction cache queue in sequence, edit the corresponding resource according to the read editing instruction, and in response to a resource loading request of the editor 11 or the graphic engine 13, send a responded resource to the editor 11 or the graphic engine 13. The graphic engine 13 is configured to read the editing instructions in the instruction cache queue in sequence, and when reading a certain editing instruction, send, to the resource manager 12, request information for requesting loading a resource obtained by editing the responded resource according to the editing instruction, and after loading the resource, render, run, and display the resource. In addition, the resource manager 12 is further configured to generate a feedback message according to an execution result of the read editing instruction, and write the feedback message into a first feedback message queue, and the editor 11 is further configured to output feedback messages in the first feedback message queue in sequence, to facilitate the user checking a running state of the resource manager 12. The graphic engine 13 is further configured to generate a feedback message according to a resource loading result, a resource running result, a resource rendering result, and the like, and write the feedback message into a second feedback message queue, and the editor 11 is further configured to output feedback messages in the second feedback message queue in sequence, to facilitate the user checking a running state of the graphic engine 13.
It should be noted that, the editor 11, the resource manager 12, and the graphic engine 13 in the embodiment of the present disclosure can be different function modules in one same hardware device, or can be hardware devices independent of each other, which is not limited in this embodiment of the present disclosure and is subject to that the editor 11, the resource manager 12, and the graphic engine 13 can all implement corresponding functions.
An embodiment of the present disclosure provides a special-effect editing method, and as shown in
S11, the editor receiving a first editing operation, generating a first editing instruction corresponding to the first editing operation, and writing the first editing instruction into an instruction cache queue.
Exemplarily, the first editing operation in the embodiment of the present disclosure can specifically include: an operation for creating an object, an operation for deleting an object, an operation for modifying an attribute value of an object, and the like, and the editing operation is not limited in the embodiment of the present disclosure, and can include any one or more editing operations on one or more objects in an editing scene.
The editing instruction in the embodiment of the present disclosure refers to: an instruction for instructing the resource manager to perform a corresponding operation on a resource operated by the editing operation. For another example: if the first editing operation is an operation for modifying an attribute value of an object A from ×0 to ×1, a first editing instruction generated by an editor can include: an identification of the object A and an operation content “modifying ×0 to ×1”. The identification of the object can be a universally unique identifier (UUID) of the object.
In the embodiment of the present disclosure, the editor, when writing the editing instruction into the instruction cache queue, always writes the editing instruction into a tail of the instruction cache queue. That is, the editing instructions in the cache queue are ranked in the writing sequence.
S12, the resource manager executing the editing instructions in the instruction cache queue in sequence, and when executing the first editing instruction, editing a first object corresponding to the first editing instruction according to the first editing instruction.
Specifically, the resource manager executing the editing instructions in the instruction cache queue in sequence refers to: the resource manager executing the editing instructions in the instruction cache queue in sequence from the first to the last in the ranking sequence of the editing instructions in the cache queue.
As an optional implementation of the embodiment of the present disclosure, an implementation of the above step S12 (namely, the resource manager executing the editing instructions in the instruction cache queue in sequence) comprises: the resource manager executing the editing instructions in the instruction cache queue in sequence through a plurality of execution threads in parallel.
Since the special-effect editing method provided by the above embodiment executes the editing instructions in the instruction cache queue in sequence through the plurality of execution threads in parallel, the execution of other editing instructions in the instruction cache queue will not be blocked due to the blocked execution of a certain editing instruction in the embodiment of the present disclosure.
Exemplarily, referring to
Optionally, after the execution thread starts to execute an editing instruction in the instruction cache queue, the editing instruction that start to be executed can be deleted from the instruction cache queue, so that the execution thread is configured to always execute the first editing instruction in the instruction cache queue when executing the editing instructions in the instruction cache queue.
S13, the graphic engine loading objects corresponding to the editing instructions in the instruction cache queue in sequence, and when loading an object corresponding to the first editing instruction, sending request information for requesting loading a second object to the resource manager.
The second object is an object obtained by the resource manager by editing the first object according to the first editing instruction.
Specifically, the graphic engine executing the editing instructions in the instruction cache queue in sequence refers to: the graphic engine loading the objects corresponding to the editing instructions in the instruction cache queue in sequence from the first to the last in the ranking sequence of the editing instructions in the cache queue.
As an optional implementation of the embodiment of the present disclosure, an implementation of the above step S13 (namely, the graphic engine loading the objects corresponding to the editing instructions in the instruction cache queue in sequence) comprises:
the graphic engine loading the objects corresponding to the editing instructions in the instruction cache queue in sequence through a plurality of loading threads in parallel.
Since the special-effect editing method provided by the above embodiment loads the objects corresponding to the editing instructions in the instruction cache queue in sequence through the plurality of loading threads in parallel, the loading of objects corresponding to other editing instructions in the instruction cache queue will not be blocked due to the blocked loading of an object corresponding to a certain editing instruction in the embodiment of the present disclosure.
Exemplarily, referring to
S14, the resource manager sending the second object to the graphic engine in response to the request information.
Optionally, the resource manager, when receiving the request information for requesting the second object that is sent by the graphic engine, first judges whether the execution of the first editing instruction is completed; if the execution of the first editing instruction is completed, sends the second object to the graphic engine; and if the execution of the first editing instruction is not completed, waits for the completion of the execution of the first editing instruction, and sends the second object to the graphic engine after the execution of the first editing instruction is completed.
S15, the graphic engine rendering the second object.
Since the graphic engine renders the second object, the user can check whether the editing effect of the first editing operation is consistent with an expected effect through the second object displayed by the graphic engine.
According to the special-effect editing method provided by the embodiment of the present disclosure, the editor, when receiving the first editing operation, generates the first editing instruction corresponding to the first editing operation, and writes the first editing instruction into the instruction cache queue, the resource manager reads the editing instructions in the instruction cache queue in sequence, and when executing the first editing instruction, edits the first object corresponding to the first editing instruction according to the first editing instruction, the graphic engine loads the objects corresponding to the editing instructions in the instruction cache queue in sequence, and when loading the object corresponding to the first editing instruction, sends the request information for requesting loading the first object edited by the resource manager to the resource manager, the resource manager sends the edited first object to the graphic engine, and finally the graphic engine renders the edited first object. Since the editor, the resource manager, and the graphic engine in the special-effect editing method provided by the embodiment of the present disclosure interact through the instruction cache queue, the special-effect editing method provided by the embodiment of the present disclosure decouples the editor, the resource manager, and the graphic engine, and avoids mutual waiting among the editor, the resource manager, and the graphic engine, so that the embodiment of the present disclosure can avoid the editing operation of the user from being blocked, and improve the fluency of the special-effect editing.
As an optional implementation of the embodiment of the present disclosure, the special-effect editing method provided by the embodiment of the present disclosure further comprises:
Since the first feedback message corresponding to the first editing instruction that is generated by the resource manager is not directly sent to the editor, the execution result of the editing instruction that is fed back by the resource manager will not block the running of the editor, thereby further avoiding blocking the user’s input of the editing operation on the editor.
As an optional implementation of the embodiment of the present disclosure, the special-effect editing method provided by the embodiment of the present disclosure further comprises:
Since the second feedback message corresponding to the first editing instruction that is generated by the graphic engine is not directly sent to the editor, the running result of the object corresponding to the editing instruction that is fed back by the graphic engine will not block the running of the editor, thereby further avoiding blocking the user’s input of the editing operation on the editor.
As an optional implementation of the embodiment of the present disclosure, the special-effect editing method provided by the embodiment of the present disclosure further comprises:
before the graphic engine renders the second object, the editor receiving a second editing operation, generating a second editing instruction corresponding to the second editing operation, and writing the second editing instruction into the instruction cache queue.
That is, the editor can continuously receive the editing operations, without waiting for the completion of the execution of a previous editing operation before receiving a next editing operation, so that the above embodiment can further avoid blocking the user’s input of the editing operation on the editor.
Based on the same invention concept, as an implementation of the above method, an embodiment of the present disclosure further provides a special-effect editing apparatus, and this embodiment corresponds to the above method embodiment, and for convenience of reading, details in the above method embodiment are not repeated in this embodiment one by one, but it should be appreciated that the special-effect editing apparatus in this embodiment can correspondingly implement all the contents in the above method embodiment.
An embodiment of the present disclosure provides a special-effect editing apparatus, and
As an optional implementation of the embodiment of the present disclosure, the resource manager 52 is specifically configured to execute the editing instructions in the instruction cache queue in sequence through a plurality of execution threads in parallel.
As an optional implementation of the embodiment of the present disclosure, the graphic engine 53 is specifically configured to load objects corresponding to the editing instructions in the instruction cache queue in sequence through a plurality of loading threads in parallel.
As an optional implementation of the embodiment of the present disclosure, the resource manager 52 is further configured to generate a first feedback message corresponding to the first editing instruction, and write the first feedback message into a first feedback message queue; and
the editor 51 is further configured to read and output feedback messages in the first feedback message queue in sequence.
As an optional implementation of the embodiment of the present disclosure, the graphic engine 53 is further configured to generate a second feedback message corresponding to the first editing instruction, and write the second feedback message into a second feedback message queue; and
the editor 51 is further configured to read and output feedback messages in the second feedback message queue in sequence.
As an optional implementation of the embodiment of the present disclosure, the editor 51 is further configured to, before the graphic engine renders the second object, receive a second editing operation, generate a second editing instruction corresponding to the second editing operation, and write the second editing instruction into the instruction cache queue.
The special-effect editing apparatus provided in this embodiment can execute the special-effect editing method provided in the above method embodiment, and they are similar in implementation principles and technical effects, which are not repeated herein.
Based on the same invention concept, an embodiment of the present disclosure further provides an electronic device.
Based on the same invention concept, an embodiment of the present disclosure further provides a non-transitory computer-readable storage medium having thereon stored a computer program which, when executed by a computing device, causes the computing device to implement the special-effect editing method provided by the above embodiments.
Based on the same invention concept, an embodiment of the present disclosure further provides a computer program product which, when running on a computer, causes the computer to implement the special-effect editing method provided by the above embodiments.
It should be appreciated by one skilled in the art that, the embodiments of the present disclosure can be provided as a method, system, or computer program product. Accordingly, the present disclosure can take a form of an entire hardware embodiment, an entire software embodiment or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take a form of a computer program product implemented on one or more computer-usable storage media having computer-usable program code embodied therein.
The processor can be a central processing unit (CPU), and can also be another general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, a discrete gate or transistor logic, a discrete hardware component, etc. The general-purpose processor can be a microprocessor and can also be any conventional processor, or the like.
The memory can include a non-permanent memory, random access memory (RAM), and/or non-volatile memory in a computer-readable medium, such as a read-only memory (ROM) or flash memory (flash RAM) . The memory is an example of the computer-readable medium.
The computer-readable medium includes permanent and non-permanent, removable and non-removable storage media. The storage medium can implement information storage by any method or technology, and information can be a computer-readable instruction, data structure, a module of a program, or other data. Examples of the storage medium of a computer include, but are not limited to, a phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disks (DVD) or other optical storage, magnetic cassette, magnetic disk storage or other magnetic storage device, or any other non-transmission medium, which can be used for storing information that can be accessed by the computing device. As defined herein, the computer-readable medium does not include computer readable transitory media such as modulated data signals and carrier waves.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present disclosure, and not limiting them; while the present disclosure has been described in detail with reference to the foregoing embodiments, it should be understood by one of ordinary skill in the art that: the technical solutions described in the foregoing embodiments can be modified, or some or all of the technical features can be equivalently replaced; and these modifications or replacements do not make the spirit of corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
202111637729.6 | Dec 2021 | CN | national |