Image processing method, processing unit, processor, system on chip, electronic device, computer storage medium and computer program product

By judging the difference in transparency parameters of layer pixels and processing the primary color parameter according to the differences, the problem of insufficient processing efficiency of layer mixing tasks in the prior art is solved, and more efficient layer pixel mixing is achieved.

CN119624746APending Publication Date: 2025-03-14ZHEJIANG LAKESIDE DATA SCIENCE & APPLICATION LABORATORY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411606270.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The processing efficiency of existing processors in layer mixing tasks has not been optimized, especially when the proportion of pixels in edge neighborhoods of layer objects is small.

Method used

By obtaining the channel parameters of the source layer pixel to be mixed and the destination layer pixel, it is determined whether the transparency parameter difference exceeds the preset threshold range. If it is exceeded, the primary color parameter of the layer pixel with a larger transparency parameter is determined as the primary color parameter of the mixed pixel; if it is not exceeded, the primary color parameter is mixed according to the complementary relationship of the transparency parameter.

Benefits of technology

The mixing efficiency of layer pixels is significantly improved, especially when the proportion of pixels in the edge neighborhood of layer objects is small, the efficiency of layer mixing processing is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119624746A_ABST
    Figure CN119624746A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image processing method, a processing unit, a processor, a system on chip, electronic equipment, a computer storage medium and a computer program product. The image processing method comprises the steps that channel parameters of source image layer pixels to be mixed and channel parameters of target image layer pixels to be mixed are obtained, the channel parameters at least comprise primary color parameters and transparency parameters, and the transparency parameters of the source image layer pixels and the transparency parameters of the target image layer pixels have a complementary relation; according to the complementary relationship, judging whether the transparency parameter difference between the source layer pixel and the target layer pixel exceeds a preset threshold range or not; if yes, judging the primary color parameter of the image layer pixel with the larger transparency parameter in the source image layer pixel and the target image layer pixel as the primary color parameter of the mixed pixel; and if not, mixing the primary color parameters of the pixels of the source image layer and the primary color parameters of the pixels of the target image layer according to the complementary relationship to obtain the primary color parameters of the mixed pixels.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to an image processing method, a processing unit, a processor, a system on a chip, an electronic device, a computer storage medium, and a computer program product. Background Art

[0002] Currently, SIMD (Single Instruction Multiple Data) technology allows the processor to perform the same operation on multiple data in a single instruction cycle, greatly improving the parallel computing effect of the processor in image processing. For example, SIMD processors such as RISC-V (Reduced Instruction Set Computer V, the fifth generation of computers based on reduced instruction sets) processors can use various vector instruction sets to perform image processing tasks.

[0003] Generally, in order to perform high-precision image synthesis and display processing, SIMD processors that support 2D graphics acceleration engines can perform image processing such as alpha layer blending, color filling, and image scaling through pixel-level operations. However, the processing efficiency of current processors for layer blending tasks still needs to be further improved. Summary of the invention

[0004] In view of this, embodiments of the present invention provide an image processing method, a processing unit, a processor, a system on chip, an electronic device, a computer storage medium and a computer program product to solve the above problems.

[0005] According to a first aspect of an embodiment of the present invention, an image processing method is provided, comprising: obtaining channel parameters of source layer pixels and destination layer pixels to be mixed, wherein the channel parameters include at least primary color parameters and transparency parameters, and the transparency parameters of the source layer pixels and the transparency parameters of the destination layer pixels have a complementary relationship; judging whether the difference in transparency parameters between the source layer pixels and the destination layer pixels exceeds a preset threshold range based on the complementary relationship; if yes, judging the primary color parameters of the layer pixels with larger transparency parameters between the source layer pixels and the destination layer pixels as the primary color parameters of the mixed pixels; if no, mixing the primary color parameters of the source layer pixels and the primary color parameters of the destination layer pixels based on the complementary relationship to obtain the primary color parameters of the mixed pixels.

[0006] In another implementation of the present invention, the base color parameters of the source layer pixels include a first transparency value vector of a plurality of pixels in the source layer, and the base color parameters of the target layer pixels include a second base color value vector of a plurality of pixels in the target layer. According to the complementary relationship, judging whether the transparency difference between the source layer pixels and the target layer pixels exceeds a preset threshold range includes: calculating a first comparison result vector between the first transparency value vector and a transparency lower limit value vector; when the first comparison result vector is a zero value vector, judging the second base color value vector as the base color value vector of the mixed pixel.

[0007] In another implementation of the present invention, a first comparison result vector between the first transparency value vector and the transparency lower limit value vector for mask processing is calculated, including: comparing each element value of the first transparency value vector with the lower limit value in the transparency lower limit value vector through a first vector comparison instruction; when an element value is not less than the lower limit value, writing a zero value to the corresponding element position in the first comparison result vector, and when an element value is less than the lower limit value, writing a non-zero value to the corresponding element position in the first comparison result vector.

[0008] In another implementation of the present invention, the method also includes: searching for non-zero mask bits in the first comparison result vector through a first mask bit search instruction; when the first comparison result vector is a zero value vector, determining the second primary color value vector as the primary color value vector of the mixed pixel, including: if the execution result of the first mask bit search instruction indicates that there is no non-zero mask bit, reading the second primary color value vector as the primary color value vector of the mixed pixel.

[0009] In another implementation of the present invention, the base color parameters of the source layer pixels also include the first base color value vectors of the multiple pixels in the source layer, and the base color parameters of the target layer pixels also include the second transparency value vectors of the multiple pixels in the target layer. According to the complementary relationship, it is judged whether the transparency difference between the source layer pixels and the target layer pixels exceeds the preset threshold range, and further includes: when the first comparison result vector is a non-zero value vector, calculating the second comparison result vector between the transparency value of the target layer pixels and the transparency upper limit value vector; when the second comparison result vector is a zero value vector, determining the first base color value vector as the base color value vector of the mixed pixel.

[0010] In another implementation of the present invention, a second comparison result vector between the transparency value of the target layer pixel and the transparency upper limit value vector is calculated, including: comparing each element value of the second transparency value vector with the upper limit value in the transparency upper limit value vector through a second vector comparison instruction; when an element value is not less than the upper limit value, writing a zero value to the corresponding element position in the second comparison result vector, and when an element value is less than the upper limit value, writing a non-zero value to the corresponding element position in the second comparison result vector.

[0011] In another implementation of the present invention, the method also includes: searching for non-zero mask bits in the second comparison result vector through a second mask bit search instruction; when the second comparison result vector is a zero value vector, determining the first primary color value vector as the primary color value vector of the mixed pixel, including: if the execution result of the second mask bit search instruction indicates that there is no non-zero mask bit, reading the first primary color value vector as the primary color value vector of the mixed pixel.

[0012] In another implementation of the present invention, the primary color parameters of the pixels of the source layer include a first primary color value vector and a first transparency value vector of multiple pixels in the source layer, and the primary color parameters of the pixels of the destination layer include a second primary color value vector and a second transparency value vector of multiple pixels in the destination layer; according to the complementary relationship, the primary color parameters of the pixels of the source layer and the primary color parameters of the pixels of the destination layer are mixed to obtain the primary color parameters of the mixed pixels, including: obtaining a vector multiplication instruction, the bit length of the operation result of the vector multiplication instruction is less than the sum of the bit lengths of the two vector operands of the vector multiplication instruction, wherein the operation result is a high-order bit part of the vector multiplication result of the two vector operands of the vector multiplication instruction with the bit length of the operation result; using the first primary color value vector and the first transparency value vector as two vector operands of the vector multiplication instruction, respectively, performing a multiplication operation to obtain a first operation result; using the second primary color value vector and the second transparency value vector as two vector operands of the vector multiplication instruction, respectively, performing a multiplication operation to obtain a second operation result; summing the first operation result and the second operation result to obtain the primary color value of the mixed pixel.

[0013] In another implementation of the present invention, the channel parameters of the source layer pixels and the destination layer pixels to be mixed are obtained, including: loading the first base color value vector and the second base color value vector from the memory into a first vector register through a vector loading instruction, and loading the first transparency value vector and the second transparency value vector into a second vector register, wherein the first transparency value vector and the second transparency value vector have the complementary relationship, and the base color value vector stored in the first vector register and the transparency value vector stored in the second vector register are used for reading by the vector multiplication instruction.

[0014] According to a second aspect of an embodiment of the present invention, a processing unit is provided, including: an acquisition unit, which acquires channel parameters of source layer pixels and destination layer pixels to be mixed, wherein the channel parameters include at least base color parameters and transparency parameters, and the transparency parameters of the source layer pixels and the transparency parameters of the destination layer pixels have a complementary relationship; a judgment unit, which judges whether the difference in transparency parameters between the source layer pixels and the destination layer pixels exceeds a preset threshold range based on the complementary relationship; a first mixing unit, which determines the base color parameters of the layer pixels with larger transparency parameters between the source layer pixels and the destination layer pixels as the base color parameters of the mixed pixels when the difference in transparency parameters exceeds the preset threshold range; and a second mixing unit, which mixes the base color parameters of the source layer pixels and the base color parameters of the destination layer pixels based on the complementary relationship when the difference in transparency parameters does not exceed the preset threshold range to obtain the base color parameters of the mixed pixels.

[0015] According to a third aspect of an embodiment of the present invention, a processor is provided, the processor comprising a plurality of processing units, each processing unit being a processing unit according to the second aspect.

[0016] According to a fourth aspect of an embodiment of the present invention, a system on chip is provided, which includes a processor and a memory according to the third aspect, and the memory is used to store channel parameters of source layer pixels and destination layer pixels respectively, and base color parameters of mixed pixels.

[0017] According to a fifth aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method described in the first aspect.

[0018] According to a sixth aspect of an embodiment of the present invention, there is provided a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.

[0019] According to a seventh aspect of an embodiment of the present invention, there is provided a computer program product, comprising computer instructions, which, when executed by a processor, implement the method as described in the first aspect.

[0020] In the scheme of the embodiment of the present invention, when the difference in transparency parameters between the source layer pixel and the destination layer pixel does not exceed the preset threshold range, the primary color parameters of the source layer pixel and the primary color parameters of the destination layer pixel are mixed according to the complementary relationship of the transparency parameters to obtain the primary color parameters of the mixed pixel, which is conducive to the processing flow of compatible layer pixel mixing. In addition, when the difference in transparency parameters between the source layer pixel and the destination layer pixel exceeds the preset threshold range, the primary color parameters of the layer pixel with the larger transparency parameter between the source layer pixel and the destination layer pixel are determined as the primary color parameters of the mixed pixel, that is, the primary color parameters of the mixed pixel are directly determined, which is conducive to improving the mixing efficiency of the layer pixels, especially when the proportion of edge neighborhood pixels of the layer object is small, the mixing efficiency of the layer pixels is significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0022] Figure 1A is a schematic block diagram of a software architecture of an image processing application according to some examples.

[0023] Figure 1B The figure is a schematic structural diagram of a system on a chip applicable to some embodiments of the present invention.

[0024] Figure 2 is a flowchart of the steps of an image processing method according to some embodiments of the present invention.

[0025] Figure 3 Based on Figure 2 A flowchart of the steps of an image processing method of some examples of embodiments.

[0026] Figure 4 is a structural block diagram of a processing unit according to some other embodiments of the present invention.

[0027] Figure 5 Schematic diagram of the structure of a processing unit according to some other embodiments of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present invention should fall within the scope of protection of the embodiments of the present invention.

[0029] The specific implementation of the embodiment of the present invention is further described below in conjunction with the accompanying drawings of the embodiment of the present invention.

[0030] Figure 1A A software architecture for an image processing application according to some examples is shown. Figure 1A The image processing software architecture 100 includes an application 110, a graphic interface framework 120, a graphics acceleration library 130, and a computing layer 140.

[0031] Specifically, the application 110 can directly interact with the user and provide the operation and function implementation of the graphical user interface (GUI). The application 110 is used to parse user operation instructions, display image processing results, and manage the entire image processing process. For example, during the development process, the application 110 relies on the graphic interface framework 120 to build a user interface and provide graphical elements and layout management for user interaction.

[0032] Specifically, the image interface framework 120 can be software configurations related to the development of graphical user interfaces (GUIs), such as LVGL, SKIA, and AWTK. For example, LVGL packages and functions such as buttons, sliders, charts, and support for animation, layout, input devices, etc., are used for the development of graphical interfaces for embedded systems and microcontrollers. For another example, SKIA is a 2D graphics library that can be used as a graphics engine for various operating systems, and is used for calls in multiple languages ​​such as C++, C#, Java, Python, Rust, WASM, etc., to implement 2D graphics processing in various hardware environments via GPU accelerated rendering. For another example, AWTK is a GUI framework developed based on the C language, and supports cross-platform synchronous development.

[0033] Furthermore, the graphical interface framework 120 further relies on the graphics acceleration library 130 to implement efficient graphics rendering and image processing functions, such as graphics acceleration operations such as layer blending, color filling and graphics transformation. The graphics acceleration library 130 improves the performance of these operations by utilizing hardware acceleration (such as CPU or GPU).

[0034] Furthermore, the computing power layer 140, as the foundation of the entire architecture, provides the necessary computing resources and processing capabilities for the operation and hardware acceleration of the graphics acceleration library 130. For example, the computing power layer 140 includes but is not limited to processors such as SISD or SIMD, and SIMD processors can be processors such as CPUs or GPUs. For example, a SIMD processor can support SIMD instructions, so that the processor can process multiple data items at one time, greatly improving the efficiency of pixel operations in image processing. For example, a vector multiplication instruction can simultaneously multiply the base color value and the transparency value of a pixel array. In addition, the SIMD processor can also have configurable data length and register grouping, so that it can be flexibly configured according to data characteristics and application requirements to obtain optimal performance.

[0035] The computing power layer 140 can also be implemented as a system on chip (SoC) 10. The system on chip 10 includes a memory 20 and a processor 30. The system on chip 10 further integrates the processor 30 and the memory 20 to form a complete computing platform, making the data transmission between the processor 30 and the memory 20 more efficient, reducing the need for external interfaces, thereby reducing power consumption and improving overall performance.

[0036] Furthermore, the processor 30 may be implemented as a processor such as SISD or SIMD. The processor 30 includes at least one processing unit 40, such as a processing core. The graphics acceleration library 130 may schedule at least some of the processing units 40 of the processor 30 to perform graphics acceleration operations such as layer blending, color filling, and graphics transformation. In the system on chip (SoC) technology. The processor portion is composed of a plurality of processing units, which are Figure 4 The processing unit 400 of the specific embodiment shown in . This design allows the processor to process multiple tasks in parallel, improving computing efficiency and performance. Each processing unit 400 may have specific computing capabilities and can work independently or collaboratively to meet different processing requirements.

[0037] That is to say, the image processing software architecture 100 realizes from user operation to image processing, and then to hardware acceleration through the application 110, the image interface framework 120, the graphics acceleration library 130, and the computing power layer 140, and together constitutes an efficient and stable image processing solution. For example, in the compilation stage, the computing power layer 140 provides hardware interface and underlying algorithm support. The computing power layer 140 is compiled first, and then the graphics acceleration library 130 relies on the hardware acceleration capability provided by the computing power layer 140 to compile to ensure that image processing and graphics rendering operations can be efficiently executed. Further, the image interface framework 120 uses the rendering function provided by the graphics acceleration library to build the user interface, and is compiled after the graphics acceleration library 130. Then, the application 110 integrates the image interface framework 120, and calls the functions of the graphics acceleration library 130 and the computing power layer 140 to compile after all the underlying modules are compiled. In the execution stage, the application 110, as an interface for user interaction, receives user instructions and calls the image interface framework 120 to update the user interface, and performs image processing tasks through the graphics acceleration library 130. Furthermore, the graphics acceleration library 130 utilizes the computing power provided by the computing power layer 140 to accelerate image processing tasks.

[0038] In some example layer blending schemes, the expansion calculation between the base color value and the transparency value of the layer pixel is performed by multiplication vector instructions, and the blending result of the layer pixels is obtained by using the reduction calculation after the pixels of different layers are blended. Although this method can ensure the reliability and accuracy of the layer pixels, the processing efficiency of the layer blending task is low. To this end, various embodiments of the present invention provide a layer blending scheme that can improve the layer blending processing efficiency while ensuring the layer blending effect. Figure 2 An image processing method according to some embodiments of the present invention is shown. Figure 2 The image processing method 200 may be applied to a processor. In some examples, the processor may be, for example, Figure 1B The processor 30 shown. Specifically, the image processing method 200 includes:

[0039] Step S210: Obtain channel parameters of the source layer pixels and the destination layer pixels to be mixed, wherein the channel parameters include at least base color parameters and transparency parameters, and the transparency parameters of the source layer pixels and the transparency parameters of the destination layer pixels are complementary.

[0040] It should be understood that in the process of mixing the source layer pixels and the destination layer pixels, the layer pixels of the source layer are mixed with the layer pixels of the destination layer, and the mixed pixels are aligned with the destination layer pixels and filled into the destination layer. The channel parameters of the layer pixels may include the base color value in the color format, or the base color value vector composed of multiple base color values ​​of multiple pixels. The color standard includes but is not limited to the RGB color format or the CMYK color format. In the RGB color format, the base color value may be the red R channel value, the green G channel value and the blue B channel value or the grayscale value, and the base color parameter may be at least one of the above various base color values. In addition, transparency parameters such as the Alpha channel value indicate the degree of pixel opacity, and the parameter pixel opacity indicates the degree of mixing of the base color value of the source layer and the base color value of the destination layer. For example, the value range of the Alpha channel value is between 0-255, and the higher the value, the higher the transparency of the layer pixel.

[0041] In the layer blending process, the transparency parameters of the source layer pixels and the transparency parameters of the destination layer pixels have a complementary relationship. For example, the sum of the transparency value X of the source layer pixels and the transparency value Y of the destination layer pixels is a given value, for example, X+Y=255. In other words, for a given value, the higher the transparency of the source layer pixels, the lower the transparency of the destination layer pixels, and the lower the transparency of the source layer pixels, the higher the transparency of the destination layer pixels. For example, for a given value of 255, the Alpha channel value of the source layer pixels is 100, and the Alpha channel value of the destination layer pixels is 255-100=155.

[0042] Step S220: judging whether the difference in transparency parameters between the source layer pixels and the destination layer pixels exceeds a preset threshold range according to the complementary relationship.

[0043] It should be understood that if the difference in transparency parameters exceeds the preset threshold range, it means that the difference in transparency between the two layers is large enough, and it can be considered that the transparency of one layer is significantly higher than that of the other layer. For example, the Alpha channel value of the source layer pixel is 100, the Alpha channel value of the destination layer pixel is 255-100=155, and the transparency parameter difference is 155-100=55. If the preset threshold range is 235, then 55<235, which does not exceed the preset threshold range. For another example, the Alpha channel value of the source layer pixel is 254, the Alpha channel value of the destination layer pixel is 255-254=1, and the transparency parameter difference is 254-1=253. If the preset threshold range is 235, then 253>235, which exceeds the preset threshold range.

[0044] Step S230: If yes, the base color parameter of the layer pixel with the larger transparency parameter among the source layer pixel and the destination layer pixel is determined as the base color parameter of the mixed pixel.

[0045] It should be understood that the primary color parameters of the source layer pixels can be determined as the primary color parameters of the mixed pixels. For example, the alpha channel value of the source layer pixels is 254, the alpha channel value of the destination layer pixels is 255-254=1, and the transparency parameter difference is 254-1=253. If the preset threshold range is 235, then 253>235, which exceeds the preset threshold range, and the primary color value of the source layer pixels can be determined as the primary color value of the mixed pixels. Alternatively, the primary color parameters of the destination layer pixels can be determined as the primary color parameters of the mixed pixels. For example, the alpha channel value of the destination layer pixels is 254, the alpha channel value of the source layer pixels is 255-254=1, and the transparency parameter difference is 254-1=253. If the preset threshold range is 235, then 253>235, which exceeds the preset threshold range, and the primary color value of the destination layer pixels can be determined as the primary color value of the mixed pixels.

[0046] Step S240: If not, the primary color parameters of the source layer pixels and the primary color parameters of the destination layer pixels are mixed according to the complementary relationship to obtain the primary color parameters of the mixed pixels.

[0047] It should be understood that when mixing the primary color parameters of the source layer pixels and the primary color parameters of the destination layer pixels, the primary color parameters of the source layer and the primary color parameters of the destination layer can be weighted averaged based on the complementary relationship to obtain the primary color parameters of the mixed pixels.

[0048] In the scheme of the embodiment of the present invention, when the difference in transparency parameters between the source layer pixel and the destination layer pixel does not exceed the preset threshold range, the primary color parameters of the source layer pixel and the primary color parameters of the destination layer pixel are mixed according to the complementary relationship of the transparency parameters to obtain the primary color parameters of the mixed pixel, which is conducive to the processing flow of compatible layer pixel mixing. In addition, when the difference in transparency parameters between the source layer pixel and the destination layer pixel exceeds the preset threshold range, the primary color parameters of the layer pixel with the larger transparency parameter between the source layer pixel and the destination layer pixel are determined as the primary color parameters of the mixed pixel, that is, the primary color parameters of the mixed pixel are directly determined, which is conducive to improving the mixing efficiency of the layer pixels, especially when the proportion of edge neighborhood pixels of the layer object is small, the mixing efficiency of the layer pixels is significantly improved.

[0049] In other embodiments, the base color parameters of the source layer pixels include a first transparency value vector of a plurality of pixels in the source layer, and the base color parameters of the destination layer pixels include a second base color value vector of a plurality of pixels in the destination layer. Accordingly, when determining whether the transparency difference between the source layer pixels and the destination layer pixels exceeds a preset threshold range, a first comparison result vector between the first transparency value vector and the transparency lower limit value vector may be calculated, and when the first comparison result vector is a zero value vector, the second base color value vector is determined as the base color value vector of the mixed pixel.

[0050] Specifically, the transparency upper limit value vector and the transparency lower limit value vector may be examples representing a preset threshold range. For example, the preset threshold range is [10, 245], and the number of elements of the vector processing instruction configured in the processing unit is 4, then the transparency upper limit value vector is [245; 245; 245; 245], and the transparency lower limit value vector is [10; 10; 10; 10]. It should be understood that the number of vector elements being 4 is merely exemplary, and the transparency upper limit value vector and the transparency lower limit value vector may be the same as the number of elements of the vector processing instruction configured in the processing unit.

[0051] For example, as an element of the first transparency value vector, the Alpha channel value of the source layer pixel is 100. As an element of the second transparency value vector, the Alpha channel value of the destination layer pixel is 255-100=155. The preset threshold range is [10, 245], and both 155 and 100 are within the preset threshold range [10, 245]. Generally, the preset threshold range can be the value range of the Alpha channel value, that is, [0, 255]. Alternatively, the preset threshold range can also be within the value range of the Alpha channel value, and make the upper limit of transparency very close to 255 and the lower limit of transparency very close to 0, for example, [10, 245] or [5, 250].

[0052] That is to say, the processing unit can obtain the first comparison result vector through vector calculation, thereby being compatible with the instruction set of the processing unit including vector operation instructions.

[0053] In some examples, as an example of calculating the first comparison result vector between the first transparency value vector and the transparency lower limit value vector for mask processing, each element value of the first transparency value vector can be compared with the lower limit value in the transparency lower limit value vector through a first vector comparison instruction, and when an element value is not greater than the lower limit value, a zero value is written to the corresponding element position in the first comparison result vector, and when an element value is greater than the lower limit value, a non-zero value is written to the corresponding element position in the first comparison result vector. It should be understood that the first vector comparison instruction can be a VMSLTU (Vector Set Less Than Unsigned, unsigned integer comparison operation) instruction in the vector instruction set configured by the processing unit, or it can be other vector comparison instructions in the vector instruction set. In this embodiment, the first vector comparison instruction can perform vector calculations on multiple layer pixels in parallel, thereby improving the processing efficiency of layer pixels.

[0054] For example, the transparency upper limit value vector is [255; 255; 255; 255], the transparency lower limit value vector is [10; 10; 10; 10], the first transparency value vector is [5; 10; 15; 20], the second transparency value vector is [250; 240; 230; 220], the first comparison result vector is [0; 0; 1; 1] which is a non-zero vector, and the second comparison result vector between the transparency value of the target layer pixel and the transparency upper limit value vector is calculated.

[0055] Alternatively, if the transparency lower limit value vector is [20; 20; 20; 20], the first comparison result vector is [0; 0; 0; 0] which is a zero vector, and the second transparency value vector [250; 240; 230; 220] is determined as the base color value vector of the mixed pixel.

[0056] More specifically, when the first comparison result vector is a zero value vector, as an example of determining the second primary color value vector as the primary color value vector of the mixed pixel, a first mask bit search instruction can be used to search for non-zero mask bits in the first comparison result vector, and if the execution result of the first mask bit search instruction indicates that there are no non-zero mask bits, the second primary color value vector is read as the primary color value vector of the mixed pixel.

[0057] For example, the first comparison result vector is the first mask vector, and the position of the non-zero element corresponds to the mask bit of 1. The Vfirst instruction can be used to find the position of a non-zero element in the first mask vector, and the index of a non-zero element in the first mask vector is returned to the first scalar register. Then, according to the return value of the Vfirst instruction, it is determined whether the non-zero element is found and the position of the element. If the value in the first scalar register is greater than or equal to 0, it means that the non-zero element is found; if the value in the first scalar register is 0, it means that the non-zero element is not found.

[0058] That is to say, by using the first mask bit search instruction's search capability for non-zero mask bits in the vector, the processing efficiency of determining whether the transparency difference exceeds a preset threshold range is improved.

[0059] In some other embodiments, the base color parameters of the source layer pixels also include the first base color value vector of multiple pixels in the source layer, and the base color parameters of the destination layer pixels also include the second transparency value vector of multiple pixels in the destination layer. Accordingly, when judging whether the transparency difference between the source layer pixels and the destination layer pixels exceeds the preset threshold range, when the first comparison result vector is a non-zero value vector, the second comparison result vector between the transparency value of the destination layer pixels and the transparency upper limit value vector can be calculated, and then, when the second comparison result vector is a zero value vector, the first base color value vector is determined as the base color value vector of the mixed pixel. In other words, the processing unit can obtain the second comparison result vector through vector calculation, thereby being compatible with the instruction set including vector operation instructions in the processing unit.

[0060] In some examples, in order to calculate the second comparison result vector between the transparency value of the target layer pixel and the transparency upper limit value vector, each element value of the second transparency value vector can be compared with the upper limit value in the transparency upper limit value vector through a second vector comparison instruction, and then, when an element value is not less than the upper limit value, a zero value is written to the corresponding element position in the second comparison result vector, and when an element value is less than the upper limit value, a non-zero value is written to the corresponding element position in the second comparison result vector. It should be understood that the second vector comparison instruction can be a VMSLTU (Vector Set Less Than Unsigned, unsigned integer comparison operation) instruction in the vector instruction set configured by the processing unit, or it can be other vector comparison instructions in the vector instruction set. In this embodiment, the second vector comparison instruction can perform vector calculations on multiple layer pixels in parallel, thereby improving the processing efficiency of the layer pixels.

[0061] For example, the transparency upper limit value vector is [255; 255; 255; 255], the transparency lower limit value vector is [10; 10; 10; 10], the first transparency value vector is [5; 10; 15; 20], the second transparency value vector is [250; 240; 230; 220], the second comparison result vector [0; 0; 0; 0] is a zero vector, and the first transparency value vector [5; 10; 15; 20] is determined as the base color value vector of the mixed pixel.

[0062] More specifically, when the second comparison result vector is a zero value vector, as an example of determining the first primary color value vector as the primary color value vector of the mixed pixel, a second mask bit search instruction can be used to search for non-zero mask bits in the second comparison result vector, and then, if the execution result of the second mask bit search instruction indicates that there are no non-zero mask bits, the first primary color value vector is read as the primary color value vector of the mixed pixel.

[0063] For example, the second comparison result vector is the second mask vector, and the position of the non-zero element corresponds to the mask bit of 1. The Vfirst instruction can be used to find the position of a non-zero element in the second mask vector, and the index of a non-zero element in the second mask vector is returned to the second scalar register. Then, according to the return value of the Vfirst instruction, it is determined whether the non-zero element is found and the position of the element. If the value in the second scalar register is greater than or equal to 0, it means that the non-zero element is found; if the value in the second scalar register is 0, it means that the non-zero element is not found.

[0064] That is to say, by using the search capability of the second mask bit search instruction for non-zero mask bits in the vector, the processing efficiency of determining whether the transparency difference exceeds a preset threshold range is improved.

[0065] In some other embodiments, the base color parameters of the source layer pixels include the first base color value vector and the first transparency value vector of the plurality of pixels in the source layer, and the base color parameters of the target layer pixels include the second base color value vector and the second transparency value vector of the plurality of pixels in the target layer. Accordingly, according to the complementary relationship, the base color parameters of the source layer pixels and the base color parameters of the target layer pixels are mixed to obtain the base color parameters of the mixed pixels, including: obtaining a vector multiplication instruction, and then using the first base color value vector and the first transparency value vector as two vector operands of the vector multiplication instruction, respectively, to perform a multiplication operation to obtain a first operation result, and using the second base color value vector and the second transparency value vector as two vector operands of the vector multiplication instruction, respectively, to perform a multiplication operation to obtain a second operation result, and then summing the first operation result and the second operation result to obtain the base color value of the mixed pixel. Wherein, the bit length of the operation result of the vector multiplication instruction is less than the sum of the bit lengths of the two vector operands of the vector multiplication instruction, and wherein the operation result is the high-order bit portion of the vector multiplication result of the two vector operands of the vector multiplication instruction that has the bit length of the operation result.

[0066] It should be understood that the vector multiplication instruction can be a VMULHU (Vector Multiply High Unsigned) instruction in the vector instruction set configured for the processing unit, or it can be other vector multiplication instructions that have the high bit portion of the bit length of the operation result in the vector multiplication result.

[0067] In this embodiment, the operation result of the vector multiplication instruction is the high-order bit portion of the bit length of the operation result in the vector multiplication result of the two vector operands of the vector multiplication instruction, which avoids data overflow of the vector multiplication result in the case of large base color values ​​and transparency values, and ensures the reliability of the layer pixel blending process.

[0068] In some examples, the transparency upper limit value vector is [255; 255; 255; 255], the transparency lower limit value vector is [0; 0; 0; 0], the first transparency value vector is [155; 145; 135; 125], the second transparency value vector is [100; 120; 130; 140], the first comparison result vector [1; 1; 1; 1] is a non-zero vector, and the second comparison result vector [1; 1; 1; 1] is a non-zero vector. For example, the first base color value vector (e.g., R channel value) is [255; 255; 255; 255], and the second base color value vector (e.g., R channel value) is [200; 200; 200; 200].

[0069] Further, when the multiplication operation is performed on the first base color value vector and the first transparency value vector, the operation result is the upper 8-bit portion of the vector multiplication result of the two vector operands of the vector multiplication instruction having the bit length of the operation result, [255; 255; 255; 255]*[155; 145; 135; 125]=[154; 144; 134; 124]. In addition, when the multiplication operation is performed on the second base color value vector and the second transparency value vector, the operation result is the upper 8-bit portion of the vector multiplication result of the two vector operands of the vector multiplication instruction having the bit length of the operation result, [200; 200; 200; 200]*[100; 120; 130; 140]=[78; 93; 101; 109].

[0070] Then, the first operation result and the second operation result are summed to obtain the primary color value of the mixed pixel. That is, [154; 144; 134; 124] + [78; 93; 101; 109] = [232; 237; 235; 233]. In other words, [232; 237; 235; 233] is the primary color value of the mixed pixel.

[0071] In some examples, as an example of obtaining the channel parameters of the source layer pixels and the destination layer pixels to be mixed, the first base color value vector and the second base color value vector can be loaded from the memory into the first vector register through a vector load instruction, and the first transparency value vector and the second transparency value vector can be loaded into the second vector register. The first transparency value vector and the second transparency value vector have a complementary relationship, and the base color value vector stored in the first vector register and the transparency value vector stored in the second vector register are used for reading by a vector multiplication instruction. Furthermore, the base color parameters of the mixed pixels can also be written to the memory through a vector write instruction. That is to say, loading using vector load instructions such as vlseg4e8 is conducive to the vector loading process in the compatible processing unit, and the vector data in the vector register can be read independently and flexibly.

[0072] Further, Figure 3 Shows Figure 2 Further examples of image processing methods. Figure 3 The image processing methods include:

[0073] Step S301: Get the first base color value vector and the first transparency value vector of multiple pixels in the source layer, and then continue to execute step S302. For example, extract the RGB values ​​(i.e., the channel values ​​of at least one base color in RGB) and Alpha values ​​(or RGBA values) of multiple pixels from the data buffer of the source layer in the memory, the base color values ​​of multiple pixels of the source layer constitute the first base color value vector of the source layer pixels, and the transparency values ​​of multiple pixels of the source layer constitute the first transparency value vector of the source layer pixels. Specifically, the first base color value vector and the first transparency value vector can be loaded through vectors such as vlseg4e8 instructions.

[0074] Step S302: Get the second base color value vector and the second transparency value vector of the multiple pixels in the target layer, and then continue to execute step S303. For example, extract the RGB values ​​(i.e., the channel values ​​of at least one base color in RGB) and the Alpha value (or RGBA value) of the multiple pixels from the data buffer of the target layer in the memory, the base color values ​​of the multiple pixels of the target layer constitute the second base color value vector of the pixels of the target layer, and the transparency values ​​of the multiple pixels of the target layer constitute the second transparency value vector of the pixels of the target layer. Specifically, the second base color value vector and the second transparency value vector can be loaded through vectors such as the vlseg4e8 instruction.

[0075] Step S303: Calculate the first comparison result vector between the first transparency value vector and the transparency lower limit value vector, and then proceed to step S304. For example, compare each element value of the first transparency value vector with the lower limit value in the transparency lower limit value vector, and when an element value is not greater than the lower limit value, write a zero value to the corresponding element position in the first comparison result vector, and when an element value is greater than the lower limit value, write a non-zero value to the corresponding element position in the first comparison result vector.

[0076] Step S304: Determine whether the first comparison result vector is a zero value vector? If yes, execute step S311; if not, execute step S305. For example, through the first mask bit search instruction, search for non-zero mask bits in the first comparison result vector. For example, the first comparison result vector is the first mask vector, and the position of the non-zero element corresponds to the mask bit of 1. The Vfirst instruction can be used to search for the position of a non-zero element in the first mask vector, and the index of a non-zero element in the first mask vector is returned to the first scalar register. Then, according to the return value of the Vfirst instruction, determine whether the non-zero element is found and the position of the element. If the value in the first scalar register is greater than or equal to 0, it means that the non-zero element is found; if the value in the first scalar register is 0, it means that the non-zero element is not found.

[0077] Step S305: Calculate the second comparison result vector between the transparency value of the target layer pixel and the transparency upper limit value vector, and then continue to execute step S306. For example, compare each element value of the second transparency value vector with the upper limit value in the transparency upper limit value vector, and when an element value is not less than the upper limit value, write a zero value to the corresponding element position in the second comparison result vector, and when an element value is less than the upper limit value, write a non-zero value to the corresponding element position in the second comparison result vector.

[0078] Step S306: Determine whether the second comparison result vector is a zero value vector? If yes, execute step S310; if not, execute step S307. For example, through the second mask bit search instruction, search for non-zero mask bits in the second comparison result vector. For example, the second comparison result vector is a second mask vector, and the position of the non-zero element corresponds to a mask bit of 1. The Vfirst instruction can be used to search for the position of a non-zero element in the second mask vector, and the index of a non-zero element in the second mask vector is returned to the second scalar register. Then, according to the return value of the Vfirst instruction, determine whether a non-zero element is found and the position of the element. If the value in the second scalar register is greater than or equal to 0, it means that a non-zero element is found; if the value in the second scalar register is 0, it means that no non-zero element is found.

[0079] Step S307: multiply the first base color value vector and the first transparency value vector to obtain a first operation result, and then proceed to step S308. For example, the first base color value vector and the first transparency value vector are respectively used as two vector operands of the vector multiplication instruction, and a multiplication operation is performed to obtain the first operation result.

[0080] Step S308: multiply the second base color value vector and the second transparency value vector to obtain a second operation result, and then proceed to step S309. For example, the second base color value vector and the second transparency value vector are respectively used as two vector operands of the vector multiplication instruction, and a multiplication operation is performed to obtain a second operation result.

[0081] Step S309: sum the first operation result and the second operation result to obtain the base color value vector of the mixed pixel, and then proceed to step S312. For example, sum the first operation result and the second operation result to obtain the base color value of the mixed pixel.

[0082] Step S310: Determine the second primary color value vector as the primary color value vector of the mixed pixel, and then proceed to step S312. For example, if the execution result of the second mask bit search instruction indicates that there is no non-zero mask bit, read the first primary color value vector as the primary color value vector of the mixed pixel.

[0083] Step S311: Determine the first base color value vector as the base color value vector of the mixed pixel, and then proceed to step S312. For example, if the execution result of the first mask bit search instruction indicates that there is no non-zero mask bit, read the second base color value vector as the base color value vector of the mixed pixel.

[0084] Step S312: Write the base color parameters of the target layer pixel into the memory as the base color parameters of the mixed pixel through a vector write instruction, for example, write the base color parameters of the mixed pixel into the memory through a vector write instruction such as vsseg4e8.

[0085] It should be understood that in step S309, step S310 and step S311, the base color value vector of the mixed pixel can be cached in the first vector register. Then, in step S312, a vector write instruction such as vsseg4e8 reads the base color value vector of the mixed pixel from the first vector register and writes it to the memory address. In addition, the transparency value vector of the base color value vector of the mixed pixel in the first vector register can be updated to the transparency upper limit value, and the transparency upper limit value is also stored in the memory address.

[0086] Further, Figure 4 FIG. 4 shows a block diagram of a processing unit according to some other embodiments of the present invention. The processing unit 400 may be Figure 1BThe processing unit 40 shown. Specifically, the processing unit 400 includes:

[0087] The acquisition unit 410 acquires the channel parameters of the source layer pixels and the destination layer pixels to be mixed, wherein the channel parameters include at least a base color parameter and a transparency parameter, and the transparency parameter of the source layer pixels is complementary to the transparency parameter of the destination layer pixels.

[0088] The judging unit 420 judges whether the difference in transparency parameter between the source layer pixel and the destination layer pixel exceeds a preset threshold range according to the complementary relationship.

[0089] The first mixing unit 430 determines the base color parameter of the layer pixel with the larger transparency parameter between the source layer pixel and the destination layer pixel as the base color parameter of the mixed pixel when the difference in transparency parameter exceeds a preset threshold range;

[0090] The second mixing unit 440 mixes the primary color parameters of the source layer pixels and the primary color parameters of the destination layer pixels according to the complementary relationship to obtain the primary color parameters of the mixed pixels when the transparency parameter difference does not exceed a preset threshold range.

[0091] When the difference in transparency parameters between the source layer pixel and the destination layer pixel does not exceed the preset threshold range, the base color parameters of the source layer pixel and the base color parameters of the destination layer pixel are mixed according to the complementary relationship of the transparency parameters to obtain the base color parameters of the mixed pixel, which is conducive to the compatible layer pixel mixing process. In addition, when the difference in transparency parameters between the source layer pixel and the destination layer pixel exceeds the preset threshold range, the base color parameters of the layer pixel with the larger transparency parameter between the source layer pixel and the destination layer pixel are determined as the base color parameters of the mixed pixel, that is, the base color parameters of the mixed pixel are directly determined, which is conducive to improving the mixing efficiency of the layer pixels, especially when the proportion of edge neighborhood pixels of the layer object is small, the mixing efficiency of the layer pixels is significantly improved.

[0092] In some other embodiments, the base color parameters of the source layer pixels include a first transparency value vector of multiple pixels in the source layer, and the base color parameters of the destination layer pixels include a second base color value vector of multiple pixels in the destination layer. The judgment unit is specifically used to: calculate a first comparison result vector between the first transparency value vector and the transparency lower limit value vector; when the first comparison result vector is a zero value vector, determine the second base color value vector as the base color value vector of the mixed pixel.

[0093] In other embodiments, the judgment unit is specifically used to: compare each element value of the first transparency value vector with the lower limit value in the transparency lower limit value vector through a first vector comparison instruction; when an element value is not less than the lower limit value, write a zero value to the corresponding element position in the first comparison result vector, and when an element value is less than the lower limit value, write a non-zero value to the corresponding element position in the first comparison result vector.

[0094] In some other embodiments, the first mixing unit is specifically used to: search for non-zero mask bits in the first comparison result vector through a first mask bit search instruction; if the execution result of the first mask bit search instruction indicates that there are no non-zero mask bits, read the second primary color value vector as the primary color value vector of the mixed pixel.

[0095] In some other embodiments, the base color parameters of the source layer pixels also include the first base color value vector of the plurality of pixels in the source layer, and the base color parameters of the target layer pixels also include the second transparency value vector of the plurality of pixels in the target layer. The judgment unit is further configured to: when the first comparison result vector is a non-zero value vector, calculate the second comparison result vector between the transparency value of the target layer pixels and the transparency upper limit value vector; when the second comparison result vector is a zero value vector, determine the first base color value vector as the base color value vector of the mixed pixel.

[0096] In other embodiments, the judgment unit is specifically used to: compare each element value of the second transparency value vector with the upper limit value in the transparency upper limit value vector through a second vector comparison instruction; when an element value is not less than the upper limit value, write a zero value to the corresponding element position in the second comparison result vector, and when an element value is less than the upper limit value, write a non-zero value to the corresponding element position in the second comparison result vector.

[0097] In some other embodiments, the first mixing unit is specifically used to: search for non-zero mask bits in the second comparison result vector through a second mask bit search instruction; if the execution result of the second mask bit search instruction indicates that there are no non-zero mask bits, read the first primary color value vector as the primary color value vector of the mixed pixel.

[0098] In some other embodiments, the base color parameters of the source layer pixels include a first base color value vector and a first transparency value vector of a plurality of pixels in the source layer, and the base color parameters of the target layer pixels include a second base color value vector and a second transparency value vector of a plurality of pixels in the target layer. The second mixing unit is specifically used to: obtain a vector multiplication instruction, the bit length of the operation result of the vector multiplication instruction is less than the sum of the bit lengths of the two vector operands of the vector multiplication instruction, wherein the operation result is the high-order bit portion of the vector multiplication result of the two vector operands of the vector multiplication instruction having the bit length of the operation result; use the first base color value vector and the first transparency value vector as the two vector operands of the vector multiplication instruction, respectively, perform a multiplication operation to obtain a first operation result; use the second base color value vector and the second transparency value vector as the two vector operands of the vector multiplication instruction, respectively, perform a multiplication operation to obtain a second operation result; sum the first operation result and the second operation result to obtain the base color value of the mixed pixel.

[0099] In some other embodiments, the acquisition unit is specifically used to: load the first base color value vector and the second base color value vector from the memory into a first vector register through a vector load instruction, and load the first transparency value vector and the second transparency value vector into a second vector register. The first transparency value vector and the second transparency value vector have the complementary relationship, and the base color value vector stored in the first vector register and the transparency value vector stored in the second vector register are used for reading by the vector multiplication instruction.

[0100] It should be understood that the specific implementation of each unit in the processing unit can refer to the corresponding description of the corresponding steps in the above method embodiment, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of each unit described above can refer to the corresponding process description in the above method embodiment, which will not be repeated here.

[0101] Reference Figure 5 , shows a schematic structural diagram of an electronic device according to another embodiment of the present invention. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.

[0102] like Figure 5 As shown, the electronic device may include: a processor (processor) 502 for executing a program 510 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .

[0103] The processor, the communication interface, and the memory communicate with each other via a communication bus.

[0104] Communication interface, used to communicate with other devices or servers.

[0105] The processor is used to execute the program, and specifically can execute the relevant steps in the above method embodiment.

[0106] Specifically, the program may include program codes including computer operation instructions.

[0107] The processor may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0108] The memory is used to store programs. The memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.

[0109] The program may include multiple computer instructions. Specifically, the program may enable a processor to execute each method described in any of the aforementioned method embodiments through the multiple computer instructions.

[0110] The specific implementation of each step in the program can refer to the corresponding description of the corresponding steps, modules or units in the above method embodiments, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device, equipment or module can refer to the corresponding process description in the above method embodiments, which will not be repeated here.

[0111] The embodiment of the present invention further provides a processor, the processor comprising a plurality of processing units. Each processing unit can be Figure 4 The processing unit 400 of an embodiment.

[0112] The embodiment of the present invention further provides a system on chip, which includes a processor and a memory, wherein the memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory. The memory is used to store channel parameters of source layer pixels and destination layer pixels, and base color parameters of mixed pixels.

[0113] The embodiment of the present invention further provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes, but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.

[0114] An embodiment of the present invention further provides a computer program product, including computer instructions, which instruct a computing device to execute each method in the above-mentioned multiple method embodiments.

[0115] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant regulations and standards, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0116] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present invention can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.

[0117] The above-described method according to an embodiment of the present invention may be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code that is originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and will be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA). It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (e.g., a random access memory (RAM), a read-only memory (ROM), a flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor, or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.

[0118] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present invention.

[0119] The above implementation methods are only used to illustrate the embodiments of the present invention, and are not limitations of the embodiments of the present invention. Ordinary technicians in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present invention. The patent protection scope of the embodiments of the present invention should be defined by the claims.

Claims

1. An image processing method, characterized in that: Applicable to processors, including: Obtaining channel parameters of the source layer pixel and the destination layer pixel to be mixed, wherein the channel parameters at least include a base color parameter and a transparency parameter, and the transparency parameter of the source layer pixel and the transparency parameter of the destination layer pixel have a complementary relationship; According to the complementary relationship, determining whether the difference in transparency parameters between the source layer pixels and the destination layer pixels exceeds a preset threshold range; If yes, the base color parameter of the layer pixel with the larger transparency parameter among the source layer pixel and the target layer pixel is determined as the base color parameter of the mixed pixel; If not, then according to the complementary relationship, the primary color parameters of the pixels of the source layer and the primary color parameters of the pixels of the destination layer are mixed to obtain the primary color parameters of the mixed pixels.

2. The method according to claim 1, wherein: The base color parameters of the source layer pixels include a first transparency value vector of a plurality of pixels in the source layer, and the base color parameters of the destination layer pixels include a second base color value vector of a plurality of pixels in the destination layer; According to the complementary relationship, judging whether the transparency difference between the source layer pixel and the destination layer pixel exceeds a preset threshold range includes: Calculating a first comparison result vector between the first transparency value vector and the transparency lower limit value vector; When the first comparison result vector is a zero value vector, the second primary color value vector is determined as the primary color value vector of the mixed pixel.

3. The method according to claim 2, wherein: Calculating a first comparison result vector between the first transparency value vector and the transparency lower limit value vector for mask processing includes: By means of a first vector comparison instruction, each element value of the first transparency value vector is compared with a lower limit value in a transparency lower limit value vector; When an element value is not less than the lower limit value, a zero value is written to the corresponding element position in the first comparison result vector, and when an element value is less than the lower limit value, a non-zero value is written to the corresponding element position in the first comparison result vector.

4. The method according to claim 3, wherein: The method further comprises: Searching for non-zero mask bits in the first comparison result vector using a first mask bit search instruction; When the first comparison result vector is a zero value vector, determining the second primary color value vector as the primary color value vector of the mixed pixel includes: If the execution result of the first mask bit search instruction indicates that there is no non-zero mask bit, the second primary color value vector is read as the primary color value vector of the mixed pixel.

5. The method according to claim 2, wherein: The base color parameters of the source layer pixels also include a first base color value vector of a plurality of pixels in the source layer, and the base color parameters of the target layer pixels also include a second transparency value vector of a plurality of pixels in the target layer; According to the complementary relationship, determining whether the transparency difference between the source layer pixel and the destination layer pixel exceeds a preset threshold range further includes: When the first comparison result vector is a non-zero value vector, a second comparison result vector between the transparency value of the target layer pixel and the transparency upper limit value vector is calculated; When the second comparison result vector is a zero value vector, the first primary color value vector is determined as the primary color value vector of the mixed pixel.

6. The method according to claim 5, wherein: Calculating a second comparison result vector between the transparency value of the target layer pixel and the transparency upper limit value vector, comprising: By means of a second vector comparison instruction, each element value of the second transparency value vector is compared with an upper limit value in the transparency upper limit value vector; When an element value is not less than the upper limit value, a zero value is written to the corresponding element position in the second comparison result vector, and when an element value is less than the upper limit value, a non-zero value is written to the corresponding element position in the second comparison result vector.

7. The method according to claim 6, wherein: The method further comprises: Searching for non-zero mask bits in the second comparison result vector using a second mask bit search instruction; When the second comparison result vector is a zero value vector, determining the first primary color value vector as the primary color value vector of the mixed pixel includes: If the execution result of the second mask bit search instruction indicates that there is no non-zero mask bit, the first primary color value vector is read as the primary color value vector of the mixed pixel.

8. The method according to claim 1, wherein: The base color parameters of the source layer pixels include a first base color value vector and a first transparency value vector of a plurality of pixels in the source layer, and the base color parameters of the target layer pixels include a second base color value vector and a second transparency value vector of a plurality of pixels in the target layer; According to the complementary relationship, the primary color parameters of the pixels of the source layer and the primary color parameters of the pixels of the destination layer are mixed to obtain the primary color parameters of the mixed pixels, including: Obtain a vector multiplication instruction, wherein the bit length of an operation result of the vector multiplication instruction is less than the sum of the bit lengths of two vector operands of the vector multiplication instruction, wherein the operation result is a high-order bit portion of the vector multiplication result of the two vector operands of the vector multiplication instruction having the bit length of the operation result; Using the first base color value vector and the first transparency value vector as two vector operands of the vector multiplication instruction, respectively, to perform a multiplication operation to obtain a first operation result; Using the second base color value vector and the second transparency value vector as two vector operands of the vector multiplication instruction, respectively, to perform a multiplication operation to obtain a second operation result; The first operation result and the second operation result are summed to obtain a base color value of a mixed pixel.

9. The method according to claim 8, wherein: Get the channel parameters of the source layer pixels and the destination layer pixels to be mixed, including: By means of a vector load instruction, the first base color value vector and the second base color value vector are loaded from a memory into a first vector register, and the first transparency value vector and the second transparency value vector are loaded into a second vector register, The first transparency value vector and the second transparency value vector have the complementary relationship, and the base color value vector stored in the first vector register and the transparency value vector stored in the second vector register are used for reading by the vector multiplication instruction.

10. A processing unit, comprising: An acquisition unit, which acquires channel parameters of the source layer pixel and the destination layer pixel to be mixed, wherein the channel parameters at least include a base color parameter and a transparency parameter, and the transparency parameter of the source layer pixel and the transparency parameter of the destination layer pixel have a complementary relationship; A judging unit, judging whether the difference in transparency parameters between the source layer pixels and the destination layer pixels exceeds a preset threshold range according to the complementary relationship; A first mixing unit, when the difference in transparency parameters exceeds a preset threshold range, determines the base color parameter of the layer pixel with a larger transparency parameter between the source layer pixel and the target layer pixel as the base color parameter of the mixed pixel; The second mixing unit mixes the primary color parameters of the source layer pixels and the primary color parameters of the destination layer pixels according to the complementary relationship to obtain the primary color parameters of the mixed pixels when the difference in the transparency parameters does not exceed a preset threshold range.

11. A processor, comprising: A plurality of processing units, each processing unit being a processing unit according to claim 10.

12. A system on chip, comprising: The processor according to claim 11; The memory is used to store the channel parameters of the source layer pixels and the destination layer pixels respectively, and the base color parameters of the mixed pixels.

13. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method according to any one of claims 1-9.

14. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

15. A computer program product, comprising computer instructions, which implement the method according to any one of claims 1 to 9 when executed by a processor.