Layer superposition method and device, video processing equipment and storage medium
By synchronously calculating the sorting position of layers using a sorting and counting algorithm and then performing overlay processing, the problem of slow sorting speed in layer overlay methods is solved, enabling rapid layer overlay and improving processing speed.
Patent Information
- Application Number
- CN202410812281.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2025-12-23
AI Technical Summary
Existing layer overlay methods have a slow sorting speed, which is especially unsatisfactory when there are many layers.
A sorting and counting algorithm is used to calculate the sorting position of each layer synchronously, and the layers are overlaid based on the calculation results to improve the calculation speed of the sorting position.
It greatly improves the processing speed of layer overlay, enabling rapid layer overlay and enhancing the user experience.
Smart Images

Figure CN121193871A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing technology, specifically to a layer overlay method, apparatus, video processing device, and storage medium. Background Technology
[0002] In video processing equipment applications, there are often situations where multiple layers overlap and overlap each other. In this case, the priority attribute of each layer determines the display order of the layers.
[0003] For layer overlays without opacity, only the layer with the highest priority needs to be displayed; while for layer overlays with opacity, the layers need to be stacked sequentially according to their priority.
[0004] Layer priority sorting methods in related technologies are based on the traditional idea of serial sorting, such as using selection sort to sort layers. However, these methods are slow in processing, especially when there are many layers, which often leads to the processing speed not meeting the requirements. Summary of the Invention
[0005] In view of the above problems, this application provides a layer overlay method, apparatus, video processing device and storage medium to solve the above technical problems.
[0006] Firstly, this application provides a layer overlay method, which includes:
[0007] Obtain priority information for multiple overlay layers in the area to be processed;
[0008] For each layer in multiple overlay layers, the sorting position of each layer in the multiple overlay layers is calculated synchronously based on the sorting and counting algorithm and the obtained priority information.
[0009] Based on the calculated ranking of each layer in multiple overlay layers, the multiple overlay layers are overlaid to obtain an overlay image of the area to be processed.
[0010] In one possible implementation of this application, the sorting position of each layer among multiple overlay layers is calculated synchronously based on a sorting and counting algorithm and the acquired priority information, including:
[0011] For the current layer, the priority information of the current layer is compared with the priority information of other layers in the multiple overlay layers. The ranking of the current layer in the multiple overlay layers is obtained based on the comparison results of each comparison.
[0012] In one possible implementation of this application, the sorting position of the current layer among multiple overlay layers is obtained based on the comparison result of each comparison, including:
[0013] During each comparison, if the current layer has higher priority information, its current count value is updated based on a preset step size; otherwise, the current count value remains unchanged. At the end of all comparisons, the current layer's ranking among multiple overlay layers is determined based on its current count value; or...
[0014] During each comparison, if the priority information of the current layer is smaller, the current count value of the current layer is updated based on the preset step size; otherwise, the current count value is kept unchanged. When all comparisons are completed, the sorting position of the current layer among multiple overlay layers is obtained based on the current count value.
[0015] In one possible implementation of this application, multiple overlay layers are overlaid according to the calculated ranking of each layer among multiple overlay layers to obtain an overlay image of the area to be processed, including:
[0016] Multiple layers are superimposed sequentially according to a preset superposition order and the corresponding sorting position of each layer to obtain a superimposed image.
[0017] In one possible implementation of this application, priority information of multiple overlay layers in the area to be processed is obtained, including:
[0018] In response to the overlay trigger command, the region to be processed in the acquired video frame is determined, and the priority information of multiple overlay layers in the region to be processed is obtained. The overlay trigger command is used to instruct the multiple overlay layers to be overlaid with transparency attributes.
[0019] Secondly, this application also provides a layer overlay device, which includes a priority register, a parallel computing module, and an overlay processing module;
[0020] The priority register is used to acquire and store priority information of multiple overlay layers in the area to be processed;
[0021] The parallel computing module is used to synchronously calculate the ranking position of each layer in the multiple overlay layers based on the sorting and counting algorithm and the obtained priority information.
[0022] The overlay processing module is used to overlay multiple layers according to the calculated sorting position of each layer in multiple overlay layers, so as to obtain an overlay image of the area to be processed.
[0023] In one possible implementation of this application, the parallel computing module includes multiple comparators and multiple sorting counters, each of which corresponds to a multiple overlay layer.
[0024] Each comparator is used to compare the priority information of the corresponding overlay layer with the priority information of other layers in the multiple overlay layers, and output the comparison result of each comparison to the corresponding sort counter;
[0025] Each sorting counter is used to update the count value based on the received comparison result, and to obtain the sorting position of the corresponding overlay layer based on the count value.
[0026] In one possible implementation of this application, the overlay processing module includes a remapping unit and a layer overlay unit, wherein the layer overlay unit is configured with multiple overlay channels;
[0027] The remapping unit is used to send the overlay layers to the corresponding overlay channel of the layer overlayer according to the sorting position of each overlay layer;
[0028] The layer overlay tool is used to overlay layers in each overlay channel according to a preset overlay order to obtain an overlay image.
[0029] Thirdly, this application also provides a video processing apparatus, which includes a memory and a processor. The memory is used to store a computer program, which, when executed by the processor, is used to implement the steps of the layer overlay method of the first aspect.
[0030] Fourthly, this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the layer overlay method of the first aspect.
[0031] From the above, it can be concluded that this application has the following beneficial effects:
[0032] In this application, for each layer in multiple overlay layers, the sorting position of each layer is calculated synchronously based on the sorting counting algorithm and the priority information of each overlay layer. Then, the multiple overlay layers are overlaid according to the calculated sorting position to obtain the corresponding overlay image. Compared with the serial sorting method in related technologies, this greatly improves the calculation speed of the sorting position of each overlay layer, thereby improving the processing speed of layer overlay and realizing the rapid overlay of overlay layers. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a diagram illustrating layer overlay without opacity;
[0035] Figure 2 This is a diagram illustrating layer overlays with varying transparency.
[0036] Figure 3 This is a flowchart illustrating a layer overlay method provided in an embodiment of this application;
[0037] Figure 4 This is a schematic diagram of a layer overlay device provided in an embodiment of this application;
[0038] Figure 5 This is another schematic diagram of the layer overlay device provided in the embodiments of this application;
[0039] Figure 6 This is a schematic diagram of the video processing device provided in the embodiments of this application. Detailed Implementation
[0040] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0041] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0042] In the embodiments of this application, it should be noted that, in this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0043] Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or device that includes said element.
[0044] In the description of the embodiments of this application, the words "example" or "for example" are used to indicate exemplification, illustration, or description. Any embodiment or design described as "example" or "for example" in the embodiments of this application is not to be construed as being more preferred or having more advantages than another embodiment or design. The use of the words "example" or "for example" is intended to present relative concepts in a clear manner.
[0045] Before introducing the layer overlay method, apparatus, video processing device and storage medium of this application, we will first introduce the relevant background information of the embodiments of this application.
[0046] With the development of live video streaming and multi-layer overlay technology, a growing demand has emerged in the market for applying multi-layer overlay to live video streaming. Applying multi-layer overlay to live video streaming allows for the creation of a comprehensive presentation of multiple videos from different sources, and also enables the overlay of multiple real or virtual materials to achieve a virtual studio effect. Therefore, in video processing equipment applications, situations involving the overlapping and layering of multiple layers are frequently encountered.
[0047] Taking the overlay of three layers as an example, if there are three different layers (red, green, and blue) on a monitor, the blue layer has the highest priority, followed by the green layer, then the red layer, and the white background color has the lowest priority. When these layers overlap, the higher-priority layer will cover the lower-priority layer. In other words, the layer priority attribute determines the display order of the layers.
[0048] Layer masking is generally divided into full masking and masking with opacity. Full masking is masking without opacity, such as... Figure 1 As shown, at this point, you only need to find the highest priority layer in the overlapping area and display it; while for overlays with transparency attributes, such as... Figure 2 As shown, layers need to be stacked sequentially according to their priority in the overlapping area.
[0049] Specifically, for image overlay at each pixel, it is necessary to determine how many layers overlap at the current position, then organize the priorities of all layers at the current position into an array, sort the priorities in the array, and then perform overlay processing from top to bottom or from bottom to top.
[0050] The current layer priority sorting method is based on the traditional idea of serial sorting, such as selection sort. First, it iterates through the array to find the smallest element and swaps it with the first element. Then, it finds the smallest element among the remaining elements and swaps it with the second element, and so on, until the last element, thus completing the sorting of the entire array and obtaining an ordered array.
[0051] However, the sorting methods used in related technologies are relatively slow, especially when there are many layers, which often results in the processing speed not meeting the requirements.
[0052] For example, taking the sorting of N layers as an example, the first layer needs to be compared with the other N-1 layers one by one, the second layer needs to be compared N-2 times, and after (N-1)+(N-2)+…+2+1 comparisons and at most N-1 element swaps, the sorting of N layers is completed. In summary, the total number of calculation cycles is N*(N-1) / 2, which takes a long time.
[0053] Based on this, embodiments of this application provide a layer overlay method, apparatus, video processing device, and storage medium. For each layer in multiple overlay layers, a sorting and counting algorithm is used to calculate the sorting position of each layer synchronously. Then, all overlay layers are overlaid based on the calculated sorting position, which improves the calculation speed of the sorting position of all overlay layers, thereby improving the processing speed of layer overlay, realizing fast layer overlay, and enhancing the user experience.
[0054] The layer overlay method, apparatus, video processing equipment, and storage medium provided in this application will be described in detail below.
[0055] First, this application provides a layer overlay method. The execution subject of this method can be a layer overlay device, or a video processing device, display device, user equipment (UE), or other different types of electronic devices that integrate the layer overlay device. Specifically, the display device can be a commercial display screen, a conference tablet, etc., and the UE can be a terminal device such as a smartphone, tablet computer, laptop computer, handheld computer, or desktop computer.
[0056] Please see Figure 3 , Figure 3This is a flowchart illustrating a layer overlay method provided in an embodiment of this application. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here. The layer overlay method may include the following multiple steps.
[0057] Step S301: Obtain the priority information of multiple overlay layers in the area to be processed.
[0058] In this embodiment, the area to be processed can be an area where multiple layers overlap. This overlap can be two, three, or more layers. In a single frame, there may be one or more areas where layers overlap. Therefore, the area to be processed in this embodiment can be one or more, depending on the specific application scenario.
[0059] Understandably, each overlay layer uniquely corresponds to a priority information, which can be used to characterize the priority order of the overlay layers during layer stacking. For example, a lower priority layer will be covered by a higher priority layer. In this embodiment, different priority information can be configured for different overlay layers, enabling each overlay layer to achieve layer overlap based on its own priority information.
[0060] Step S302: For each layer in the multiple overlay layers, calculate the sorting position of each layer in the multiple overlay layers synchronously based on the sorting counting algorithm and the obtained priority information.
[0061] In this embodiment, unlike the serial sorting method used in related technologies to prioritize overlay layers, the sorting order of each overlay layer is calculated synchronously based on a sorting counting algorithm. That is, for N overlay layers, the sorting order of the first overlay layer is calculated simultaneously with the sorting order of the second, third, ..., and Nth overlay layers.
[0062] The ranking is calculated based on the sorting and counting algorithm and the priority information of each overlay layer. This can be understood as comparing the priority information of a certain overlay layer with the priority information of other overlay layers to obtain the ranking of a certain overlay layer among all overlay layers.
[0063] Taking N overlay layers as an example, when calculating the ranking of the first overlay layer, its priority information is compared with the priority information of the remaining N-1 overlay layers. After N-1 comparisons, the ranking of the first overlay layer among the N overlay layers can be obtained. Similarly, when calculating the ranking of the Nth overlay layer, its priority information is compared with the priority information of the remaining N-1 overlay layers. After N-1 comparisons, the ranking of the Nth overlay layer among the N overlay layers can be obtained.
[0064] Since the calculation of the sorting order of all overlay layers is performed synchronously, in this embodiment of the application, it only takes N-1 time units to complete the calculation of the sorting order of all overlay layers.
[0065] Step S303: Based on the calculated sorting position of each layer in the multiple overlay layers, perform overlay processing on the multiple overlay layers to obtain the overlay image of the area to be processed.
[0066] After obtaining the sorting position of each overlay layer in step S302, multiple overlay layers can be overlaid according to their sorting positions to obtain the overlay image corresponding to the area to be processed.
[0067] In this embodiment, for each of the multiple overlay layers, the sorting position of each layer is calculated synchronously based on the sorting counting algorithm and the priority information of each overlay layer. Then, the multiple overlay layers are overlaid according to the calculated sorting position to obtain the corresponding overlay image. Compared with the serial sorting method in related technologies, this greatly improves the calculation speed of the sorting position of each overlay layer, thereby improving the processing speed of layer overlay and realizing the rapid overlay of overlay layers.
[0068] Next, continue with Figure 3 The steps shown are explained in detail, as well as the specific implementation methods that may be used in practical applications.
[0069] In some embodiments of this application, the synchronous calculation of the ranking position of each layer among multiple overlay layers based on the sorting and counting algorithm and the acquired priority information may further include:
[0070] For the current layer, the priority information of the current layer is compared with the priority information of other layers in the multiple overlay layers. The ranking of the current layer in the multiple overlay layers is obtained based on the comparison results of each comparison.
[0071] Understandably, the process of synchronously calculating the sorting position of each overlay layer based on the sorting and counting algorithm involves comparing the priority information of each overlay layer with the priority information of other overlay layers one by one, and calculating the sorting position of the overlay layer based on the comparison result of each comparison.
[0072] In this embodiment, the priority information of the overlay layer can be a priority value, which includes, but is not limited to, numbers, letters, special symbols, graphics, or custom symbols. For example, if the priority value is in the form of numbers such as 1, 2, and 3, the comparison result can be obtained by directly comparing the numbers; if the priority value is in the form of letters such as A, B, and C, the size of the letters can be set first, for example, A=1, B=2, and C=3, and then the value corresponding to the letter can be retrieved for comparison each time; similarly, if the priority value is in the form of special symbols, graphics, or custom symbols, the size of the special symbols, graphics, or custom symbols can be set first, and then the value corresponding to the special symbols, graphics, or custom symbols can be retrieved for comparison each time to obtain the comparison result.
[0073] In this embodiment, the sorting position of each overlay layer is calculated using a sorting and counting algorithm. This method is simple and highly reliable, ensuring that the calculated sorting position is accurate.
[0074] In some embodiments of this application, obtaining the sorting position of the current layer among multiple overlay layers based on the comparison results of each comparison may further include:
[0075] During each comparison, if the current layer has a higher priority, the current count value of the current layer is updated based on the preset step size; otherwise, the current count value is kept unchanged. When all comparisons are completed, the current layer's ranking among multiple overlay layers is obtained based on the current count value.
[0076] For the overlay layer whose sorting position is to be calculated, its priority information is compared with the priority information of other overlay layers. For example, if the priority value of the overlay layer N whose sorting position is to be calculated is P, then the priority value P is compared with the priority value P-1 of the overlay layer N-1. If P is greater than P-1, then the current count value is updated based on the preset step size. If P is less than P-1, then the current count value is kept unchanged.
[0077] In this embodiment, the preset step size can be any value such as 1, 1.5, or 2, and the current count value can be initialized to any value such as 0, 1, or 2. The specific value can be determined according to the actual application scenario, and is not limited here.
[0078] For example, with a preset step size of 1, the current count value is initially 0. If P is greater than P-1, the current count value is updated from 0 to 1. If P is less than P-1, the current count value remains at 0. Then, the priority value P is compared with the priority value P-2 of the overlay layer N-2. The current count value is adjusted and updated according to the aforementioned rules until the priority value P is compared with the priority values of all other overlay layers. The current count value at this time determines the ranking of the overlay layer N among all overlay layers.
[0079] For example, if the current count value is 5, it can be determined that the priority value of overlay layer N is greater than the priority values of the 5 overlay layers in all overlay layers. That is, when sorting the priority values from smallest to largest, overlay layer N is ranked 6th among all overlay layers, that is, the sorting position of overlay layer N is 6.
[0080] It is understood that in other embodiments of this application, obtaining the sorting position of the current layer among multiple overlay layers based on the comparison results of each comparison may further include:
[0081] During each comparison, if the priority information of the current layer is smaller, the current count value of the current layer is updated based on the preset step size; otherwise, the current count value is kept unchanged. When all comparisons are completed, the sorting position of the current layer among multiple overlay layers is obtained based on the current count value.
[0082] For example, with a preset step size of 1 and an initial count value of 10, for the current overlay layer N, if its priority value P is less than the priority value P-1 of overlay layer N-1, the current count value is updated from 10 to 9. If P is greater than P-1, the current count value remains at 10. Then, the priority value P is compared with the priority value P-2 of overlay layer N-2, and the current count value is adjusted and updated according to the aforementioned rules until the priority value P is compared with the priority values of all other overlay layers. The current count value at this point determines the ranking of overlay layer N among all overlay layers.
[0083] For example, if the current count is 5, then it can be determined that the priority value of overlay layer N is smaller than the priority values of the 5 overlay layers in all overlay layers. That is, there are 5 overlay layers with a higher priority value than overlay layer N. In other words, when sorting the priority values from smallest to largest, overlay layer N is ranked 6th from the bottom among all overlay layers. If the total number of overlay layers is 10, then the sorting position of overlay layer N is 5.
[0084] In this embodiment, the current count value can be updated in ascending or descending order to determine the sorting position of the current layer, which is highly flexible and can be selected according to the actual application scenario.
[0085] In some embodiments of this application, multiple overlay layers are overlaid according to the calculated ranking of each layer in multiple overlay layers to obtain an overlay image of the area to be processed, which may further include:
[0086] Multiple layers are superimposed sequentially according to a preset superposition order and the corresponding sorting position of each layer to obtain a superimposed image.
[0087] In this embodiment, the preset overlay order can be from bottom to top, which means overlaying layers from smallest to largest, or from largest to smallest, which means overlaying layers from top to bottom. This forms a corresponding overlay image in the area to be processed, ensuring the presentation effect of the overlay image, quickly generating the overlay image, and improving display efficiency.
[0088] In some embodiments of this application, obtaining priority information of multiple overlay layers in the area to be processed may further include:
[0089] In response to the overlay trigger command, the region to be processed in the acquired video frame is determined, and the priority information of multiple overlay layers in the region to be processed is obtained. The overlay trigger command is used to instruct the multiple overlay layers to be overlaid with transparency attributes.
[0090] In this embodiment of the application, the overlay trigger instruction may be an instruction sent by the user to the layer overlay device or the video processing device. The overlay trigger instruction may be used to instruct the layer overlay device or the video processing device to perform overlay processing with transparency attributes on multiple overlay layers in the current video frame.
[0091] In response to the overlay trigger command, the layer overlay device or video processing device can determine the area with layer overlap in the acquired video frame as the area to be processed, then determine the number of overlapping layers in the area to be processed, and simultaneously obtain the priority information corresponding to each overlapping layer in the area to be processed. Then, after synchronously and quickly sorting each overlapping layer according to the priority information, the layer overlay processing is realized to obtain the overlapping image.
[0092] In this embodiment, when sorting overlapping layers according to priority information, a sorting counting algorithm is used to synchronously and parallelly process the sorting position of each overlapping layer, greatly improving the sorting speed. Compared to the computation cycle of serial sorting, which is N*(N-1) / 2, the method in this embodiment requires only N-1 computation cycles. For example, when performing overlay processing with N=10 layers, the traditional calculation method requires 45 computation cycles, while the embodiment in this application requires only 9. Furthermore, the more overlapping layers there are, the more significant the acceleration effect of parallel processing becomes.
[0093] To better implement the layer overlay method in this application, based on the above embodiments, this application also provides a layer overlay device, such as... Figure 4 As shown, Figure 4 This is a schematic diagram of a layer overlay device provided in an embodiment of this application. The layer overlay device 400 may include a priority register 410, a parallel computing module 420, and an overlay processing module 430, wherein:
[0094] The priority register 410 can be used to acquire and store the priority information of multiple overlay layers in the area to be processed; the parallel computing module 420 can be used to synchronously calculate the sorting position of each layer in the multiple overlay layers based on the sorting counting algorithm and the acquired priority information; the overlay processing module 430 can be used to overlay the multiple overlay layers according to the calculated sorting position of each layer in the multiple overlay layers to obtain the overlay image of the area to be processed.
[0095] In this embodiment, the layer overlay device 400 can be implemented based on a field programmable gate array (FPGA) with parallel processing capabilities. The priority register 410 can store the priority information of all overlay layers, so that the parallel computing module 420 can perform multiple parallel accesses to the priority register 410 while synchronously calculating the sorting position of each overlay layer to obtain the priority information of each overlay layer.
[0096] In this embodiment, for each of the multiple overlay layers, the parallel computing module 420 synchronously calculates the sorting position of each layer based on the sorting counting algorithm and the priority information of each overlay layer. Then, the overlay processing module 430 performs overlay processing on the multiple overlay layers according to the calculated sorting position to obtain the corresponding overlay image. Compared with the serial sorting method in related technologies, this greatly improves the calculation speed of the sorting position of each overlay layer, thereby improving the processing speed of layer overlay and realizing the rapid overlay of overlay layers.
[0097] like Figure 5As shown, in some embodiments of this application, the parallel computing module 420 may include multiple comparators and multiple sorting counters, each of which corresponds to a multiple overlay layer. Each comparator can be used to compare the priority information of the corresponding overlay layer with the priority information of other layers in the multiple overlay layers, and output the comparison result of each comparison to the corresponding sorting counter. Each sorting counter can be used to update the count value according to the received comparison result, and obtain the sorting position of the corresponding overlay layer according to the count value.
[0098] In this embodiment, the sorting position of each overlay layer is calculated using a sorting counter and a comparator corresponding to each overlay layer. Each sorting counter and its associated comparator can work synchronously, thereby achieving parallel calculation of the sorting position of each overlay layer and improving sorting efficiency.
[0099] Please continue reading. Figure 5 In some embodiments of this application, the overlay processing module 430 may include a remapping unit and a layer overlay unit, which may be configured with multiple overlay channels. The remapping unit may be used to send the overlay layers to the corresponding overlay channel of the layer overlay unit according to the sorting position of each overlay layer. The layer overlay unit may be used to perform overlay processing on the overlay layers in each overlay channel according to a preset overlay order to obtain an overlay image.
[0100] In this embodiment, the overlay layers with different sorting positions are sent to the corresponding overlay channels in the layer overlay unit through the remapping unit, and then the layers are overlaid according to the set overlay order. This can improve the accuracy of the overlay processing, ensure that the obtained overlay image is accurate, and further improve the efficiency of the overlay processing.
[0101] It should be noted that in this application, the relevant contents of priority register 410, parallel computing module 420, and overlay processing module 430 correspond one-to-one with those described above. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the layer overlay device and its corresponding unit modules described above can be referred to as follows: Figure 3 The description of the layer overlay method corresponding to any embodiment will not be repeated here.
[0102] To better implement the layer overlay method of this application, embodiments of this application also provide a video processing device that integrates any of the layer overlay devices provided in this application. The video processing device may include a processor 601 and a memory 602. The memory 602 can be used to store a computer program, which, when executed by the processor 601, can be used to implement the following functions:
[0103] Obtain priority information for multiple overlay layers in the area to be processed;
[0104] For each layer in multiple overlay layers, the sorting position of each layer in the multiple overlay layers is calculated synchronously based on the sorting and counting algorithm and the obtained priority information.
[0105] Based on the calculated ranking of each layer in multiple overlay layers, the multiple overlay layers are overlaid to obtain an overlay image of the area to be processed.
[0106] like Figure 6 As shown, it illustrates a structural schematic diagram of the video processing device involved in this application, specifically:
[0107] The video processing device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 6 The device structure shown does not constitute a limitation on the device. The video processing device may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0108] The processor 601 is the control center of the device, connecting various parts of the device through various interfaces and lines. It executes software programs and / or unit modules stored in the memory 602, and calls data stored in the memory 602 to perform various functions and process data, thereby providing overall monitoring of the video processing device. Optionally, the processor 601 may include one or more processing cores; the processor 601 may be a Central Processing Unit (CPU), or 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, etc. The general-purpose processor may be a microprocessor or any conventional processor. Preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may not be integrated into the processor 601.
[0109] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to the use of the video processing device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0110] The video processing device may also include a power supply 603 that supplies power to the various components. Preferably, the power supply 603 is logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, a recharging system, a power fault detection circuit, a power converter or inverter, a power status indicator, or any other components.
[0111] The video processing device may also include an input unit 604 and an output unit 605. The input unit 604 can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0112] Although not shown, the video processing device may also include a display unit, etc., which will not be described in detail here. Specifically, in this application, the processor 601 in the video processing device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602 to realize various functions, as follows:
[0113] Obtain priority information for multiple overlay layers in the area to be processed;
[0114] For each layer in multiple overlay layers, the sorting position of each layer in the multiple overlay layers is calculated synchronously based on the sorting and counting algorithm and the obtained priority information.
[0115] Based on the calculated ranking of each layer in multiple overlay layers, the multiple overlay layers are overlaid to obtain an overlay image of the area to be processed.
[0116] Those skilled in the art will understand that all or part of the steps in the various methods described above can be accomplished by instructions, or by controlling related hardware with instructions. These instructions can be stored in a computer-readable storage medium and loaded and executed by the processor 601.
[0117] Therefore, this application provides a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc. Computer instructions are stored thereon, and these computer instructions are loaded by processor 601 to execute the steps in any of the layer overlay methods provided in this application. For example, when the computer instructions are executed by processor 601, they perform the following functions:
[0118] Obtain priority information for multiple overlay layers in the area to be processed;
[0119] For each layer in multiple overlay layers, the sorting position of each layer in the multiple overlay layers is calculated synchronously based on the sorting and counting algorithm and the obtained priority information.
[0120] Based on the calculated ranking of each layer in multiple overlay layers, the multiple overlay layers are overlaid to obtain an overlay image of the area to be processed.
[0121] The computer instructions stored in the computer-readable storage medium can execute the present application as follows. Figure 3 Corresponding to the steps in the layer overlay method in any embodiment, this application can be implemented as described above. Figure 3 For details on the beneficial effects that the layer overlay method can achieve in any embodiment, please refer to the preceding description, which will not be repeated here.
[0122] The above are merely preferred embodiments of this application and are not intended to limit this application in any way. Although this application has disclosed preferred embodiments as above, it is not intended to limit this application. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the technical solution of this application. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of this application without departing from the scope of the technical solution of this application shall still fall within the scope of the technical solution of this application.
Claims
1. A method of layer compositing, the method comprising: The method comprises the following steps: obtaining priority information of a plurality of overlay layers of a to-be-processed region; for each layer in the plurality of overlay layers, synchronously calculating the ranking position of each layer in the plurality of overlay layers based on a ranking counting algorithm and the obtained priority information; performing overlay processing on the plurality of overlay layers according to the calculated ranking position of each layer in the plurality of overlay layers to obtain an overlay image of the to-be-processed region.
2. The method of claim 1, wherein, The synchronously calculating the ranking position of each layer in the plurality of overlay layers based on the ranking counting algorithm and the obtained priority information comprises: for a current layer, comparing the priority information of the current layer with the priority information of other layers in the plurality of overlay layers respectively, and obtaining the ranking position of the current layer in the plurality of overlay layers according to the comparison result of each comparison.
3. The method of claim 2, wherein, The obtaining the ranking position of the current layer in the plurality of overlay layers according to the comparison result of each comparison comprises: in each comparison, if the priority information of the current layer is larger, updating a current counting value of the current layer based on a preset step length; otherwise, maintaining the current counting value unchanged; and when all comparisons are completed, obtaining the ranking position of the current layer in the plurality of overlay layers according to the current counting value; or in each comparison, if the priority information of the current layer is smaller, updating a current counting value of the current layer based on the preset step length; otherwise, maintaining the current counting value unchanged; and when all comparisons are completed, obtaining the ranking position of the current layer in the plurality of overlay layers according to the current counting value.
4. The method of claim 1-3, wherein, The performing overlay processing on the plurality of overlay layers according to the calculated ranking position of each layer in the plurality of overlay layers to obtain an overlay image of the to-be-processed region comprises: performing overlay processing on the plurality of overlay layers according to a preset overlay sequence and the ranking position of each layer to obtain the overlay image.
5. The method of claim 1-3, wherein, The obtaining priority information of a plurality of overlay layers of a to-be-processed region comprises: in response to an overlay triggering instruction, determining a to-be-processed region in a video frame and obtaining priority information of a plurality of overlay layers in the to-be-processed region, wherein the overlay triggering instruction is used to instruct to perform overlay processing with transparency attribute on the plurality of overlay layers.
6. A layer superimposition apparatus characterized by comprising: comprise a priority register, a parallel computing module and an overlay processing module; The priority register is configured to obtain and store priority information of a plurality of overlay layers of a to-be-processed region. The parallel computing module is configured to, for each layer in the plurality of overlay layers, synchronously calculate the ranking position of each layer in the plurality of overlay layers based on a ranking counting algorithm and the obtained priority information. The overlay processing module is configured to perform overlay processing on the plurality of overlay layers according to the calculated ranking position of each layer in the plurality of overlay layers to obtain an overlay image of the to-be-processed region.
7. The layer superposition apparatus according to claim 6, characterized by The parallel computing module comprises a plurality of comparators and a plurality of sorting counters, which are in one-to-one correspondence with the plurality of superimposed layers respectively; Each comparator is configured to compare priority information of the corresponding superimposed layer with priority information of other layers in the plurality of superimposed layers respectively, and output a comparison result of each comparison to the corresponding sorting counter; Each sorting counter is configured to update a count value according to the received comparison result, and obtain a sorting position of the corresponding superimposed layer according to the count value.
8. The layer superposition apparatus according to claim 6, characterized by The superimposition processing module comprises a remapping unit and a layer superimposer, and the layer superimposer is configured with a plurality of superimposition channels; The remapping unit is configured to send the superimposed layers to corresponding superimposition channels of the layer superimposer according to the sorting positions of the superimposed layers; The layer superimposer is configured to perform superimposition processing on the superimposed layers in each superimposition channel according to a preset superimposition order, and obtain the superimposed image.
9. A video processing device, comprising: The computer readable storage medium stores computer instructions, and the computer instructions are executed by the processor to implement the steps of the layer superimposition method in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are executed by the processor to implement the steps of the layer superimposition method in any one of claims 1-5.
Citation Information
Patent Citations
A method for realizing image layer overlapping
CN101170651A
Image layer overlapping processing method, image layer overlapping processing apparatus and video processor
CN107682730A