A multi-video stream overlay method based on FPGA and software

Through the multi-video stream overlay method that combines software and FPGA, sub-rectangular areas are divided and only part of the image is read and displayed in the FPGA, which solves the problem of high resource requirements and cost when overlaying multiple video streams, and achieves more efficient video stream overlay. and image quality improvement.

CN118573795BActive Publication Date: 2024-10-18BEIJING DIGITAL BIRD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411035612.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-10-18
Estimated Expiration
2044-07-31

AI Technical Summary

Technical Problem

In the existing technology, when multiple video streams are superimposed, the CPU is overloaded and the memory bandwidth is occupied. When implemented in pure FPGA, resource requirements increase sharply, resulting in high costs and a limited number of video superimpositions.

Method used

Through the method of combining software and FPGA, the parameters of the sub-rectangular area of ​​the target image are determined, divided into multiple sub-rectangular areas, and only the part of the image required for display is read in the FPGA, reducing data reading bandwidth and resource calculation.

Benefits of technology

It significantly saves data reading bandwidth and FPGA resources, increases the number and quality of video stream overlays, and reduces the overall system cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118573795B_ABST
    Figure CN118573795B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of image communication, and specifically relates to a multi-video stream superposition method based on FPGA and software, including: determining the boundary coordinates and signal sources of different layers of a target image by running software on a control unit; dividing the target image into a plurality of sub-rectangular regions according to the boundaries of different layers; determining the coordinates of the sub-rectangular regions in the target image; determining the layers displayed in the sub-rectangular regions; determining the scaling ratio of the layers displayed in the sub-rectangular regions and the corresponding signal source size; inputting the sub-rectangular region parameters of the target image into the FPGA, determining the sub-rectangular region in the corresponding reading region of the signal source based on the FPGA, and scanning the image of the signal source reading region to the corresponding sub-rectangular region of the target image according to the scaling ratio. The present invention saves a large amount of communication bandwidth for image data, can significantly increase the total number of superimposed video streams, and improve the image quality and bandwidth processing capacity of a single-channel video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of image communication, and in particular relates to a multi-video stream superposition method based on the combination of FPGA and software. Background Art

[0002] Using pure software to overlay video data will greatly increase the CPU and other processor load ratios when there are a large number of videos and occupy a large amount of memory bandwidth, and it may even be impossible in some cases. For example, in a certain scene, 128 4K60 images are overlaid on a 4K60 output, and the overlay relationship is arbitrary position, arbitrary size, and arbitrary layer order. The software needs to read out the data of 128 4K60 video images separately within one frame (16.667ms), and then overlay them in sequence according to the coordinate relationship. According to bandwidth estimation: the required bandwidth is approximately the total bandwidth of 128 4K60 videos, and the bandwidth of each 4K60 video is 18Gbps, so the total memory bandwidth required is 2304Gbps, which obviously occupies too many resources.

[0003] Pure FPGA (Field Programmable Gate Array) is used to perform multi-layer overlay of video images. In order to save memory bandwidth, only the final overlay display part is usually read. Due to the processing characteristics of the algorithm, each pixel needs to determine the signal source where the point is located and the coordinates in the signal source. Therefore, pure FPGA implementation requires a large amount of comparison and judgment logic such as coordinates, scaling, and layer order. The judgment logic in FPGA is usually implemented with DSP (Digital Signal Processing, a chip that implements digital signal processing technology, here refers to a computing resource in FPGA) and some logic resources. When the number of video sources to be overlaid increases, the demand for FPGA DSP or logic resources will increase sharply, which also means a sharp increase in the scale of required FPGA devices, which in turn leads to a sharp increase in costs. This also means that under a certain FPGA scale, the number of video overlays that can be achieved is limited. Assume that the display of each layer is controlled by a set of coordinates (x0, y0, x1, y1, Z). When 128 video layers are overlaid, there will be 128 sets of such coordinates. The (x0, y0, x1, y1) coordinates of each point within the screen range need to be compared with these 128 sets of coordinates, and then all the Z coordinates in these 128 sets of coordinates are compared, and finally the layer on which the content displayed by the pixel is located is calculated, and then the required content is obtained from the signal source. To determine whether each pixel on the screen is in a layer, 4 DSPs are required for comparison and calculation. When processing 128 layers, 512 DSPs and related logic resources are required. In addition, 128 Z coordinates need to be compared, which will also consume a lot of DSP and logic resources. Summary of the invention

[0004] In order to solve the above-mentioned problems in the prior art, namely, the limited number of video sources that can be superimposed or the high cost at the same scale, the present invention provides a multi-video stream superposition method based on a combination of FPGA and software, comprising:

[0005] Determining the sub-rectangular area parameters of the target image by the control unit includes: determining the boundary coordinates and signal sources of different layers of the target image; dividing the target image into a plurality of sub-rectangular areas according to the boundaries of different layers; determining the coordinates of the sub-rectangular areas in the target image; determining the layers displayed in the sub-rectangular areas; determining the scaling ratio of the layers displayed in the sub-rectangular areas and the corresponding signal source size;

[0006] The target image sub-rectangular area parameters are input into the FPGA, and based on the FPGA, the sub-rectangular area is determined in the corresponding reading area of ​​the signal source, and the image of the signal source reading area is scanned to the corresponding sub-rectangular area of ​​the target image according to the scaling ratio.

[0007] The method proposed by the present invention is more flexible and has stronger scalability, and can realize real-time superposition of a larger number of video streams.

[0008] Specifically, the target image sub-rectangular region parameters are stored in the DDR, the FPGA reads the target image sub-rectangular region parameters from the DDR, and stores the target image sub-rectangular region parameters in the parameter cache of the FPGA.

[0009] Optionally, the target image is divided into multiple sub-rectangular areas according to the boundaries of different layers, including: dividing the target image into multiple rectangular areas according to the straight lines where the upper and lower boundaries of each layer are located; dividing each rectangular area into one or more sub-rectangular areas according to the straight lines where the left and right boundaries of each layer are located.

[0010] Optionally, the target image is divided into a plurality of sub-rectangular regions according to the boundaries of different layers, including: dividing the target image into (2LN-1) sub-rectangular regions according to the number of layers LN 2 A sub-rectangular area.

[0011] Specifically, determining the coordinates of the sub-rectangular area in the target image includes: determining the upper boundary coordinates of the layer whose upper boundary and the upper boundary of the sub-rectangular area are in the same straight line as the upper boundary coordinates of the sub-rectangular area in the target image; determining the lower boundary coordinates of the layer whose lower boundary and the lower boundary of the sub-rectangular area are in the same straight line as the lower boundary coordinates of the sub-rectangular area in the target image; determining the left boundary coordinates of the layer whose left boundary and the left boundary of the sub-rectangular area are in the same straight line as the left boundary coordinates of the sub-rectangular area in the target image; and determining the right boundary coordinates of the layer whose right boundary and the right boundary of the sub-rectangular area are in the same straight line as the right boundary coordinates of the sub-rectangular area in the target image.

[0012] Specifically, determining the layer displayed in the sub-rectangular area includes: determining the covering relationship of the layers according to the Z coordinate of each layer; determining all the layers in the sub-rectangular area, and determining the layer displayed in the sub-rectangular area according to the covering relationship of the layers.

[0013] Specifically, determining the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size includes:

[0014] pass , determine the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size, where, Indicates the horizontal scaling factor of layer i displayed in the sub-rectangular area, where i represents the layer number. Indicates the width of the signal source corresponding to layer i, Indicates the right boundary coordinates of layer i. Indicates the left border coordinates of layer i. Indicates the vertical scaling factor of layer i, Indicates the height of the signal source corresponding to layer i, Indicates the lower boundary coordinates of layer i, Indicates the boundary coordinates of layer i.

[0015] Specifically, determining the sub-rectangular area in the reading area corresponding to the signal source includes:

[0016] according to , determine the sub-rectangular area corresponding to the reading area of ​​the signal source, where, Indicates the left boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Indicates the left boundary coordinates of the sub-rectangular area in the target image. The layer displayed in the sub-rectangular area is i, where i represents the layer number. Indicates the left border coordinates of layer i. Indicates the horizontal scaling factor of layer i, Indicates the right boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Indicates the right boundary coordinates of the sub-rectangular area in the target image. Indicates the upper boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Represents the upper boundary coordinates of the sub-rectangular area in the target image. Indicates the lower boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Represents the lower boundary coordinates of the sub-rectangular area in the target image. Indicates the boundary coordinates on layer i, Indicates the vertical scaling factor of layer i.

[0017] Specifically, the coordinates of the sub-rectangular area in the reading area corresponding to the signal source are stored in the DDR, the FPGA reads the coordinates of the sub-rectangular area in the reading area corresponding to the signal source from the DDR, and stores the coordinates of the sub-rectangular area in the reading area corresponding to the signal source in the row cache of the FPGA.

[0018] Specifically, according to the scaling ratio, the image of the signal source reading area is scanned to the corresponding sub-rectangular area of ​​the target image, including: scanning the signal source reading area image line by line in order from top to bottom, and obtaining the image of the corresponding position of the target image after converting the scaling ratio; under the control of the video output timing, outputting the image of each sub-rectangular area of ​​the target image.

[0019] Beneficial effects of the present invention:

[0020] (1) The implementation method combining software and FPGA saves a lot of data reading bandwidth compared to pure software processing solutions such as CPU, CPU+GPU or ARM. The FPGA-based implementation only reads the part required for display, and does not need to read the image of the covered layer in the signal source, thus saving a lot of bandwidth and reducing the overall system cost.

[0021] (2) The software divides the sub-rectangular area and determines the display layer, and then passes the sub-rectangular area parameters of the target image to the FPGA for processing, reducing the large amount of coordinate calculation and layer sorting work on the FPGA, thereby significantly saving the FPGA's DSP and logic resources, thereby reducing the cost of multi-video stream overlay applications.

[0022] (3) Compared with other pure software or pure FPGA solutions, when the software computing power, memory capacity and FPGA scale are limited, the present invention can significantly increase the total number of superimposed video streams, or when the number of superimposed streams is the same, the present invention can significantly improve the image quality and bandwidth processing capability of a single-channel video.

[0023] Other features and advantages of the present invention will be described in the following description. The purpose and other advantages of the present invention can be realized and obtained through the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0025] Figure 1 This is a flow chart of a multi-video stream superposition method based on a combination of FPGA and software provided by an embodiment of the present invention;

[0026] Figure 2 is a block diagram of a video stream overlay system provided by an embodiment of the present invention;

[0027] Figure 3 is a schematic diagram of layer overlay provided by an embodiment of the present invention;

[0028] Figure 4 is a schematic diagram of sub-rectangular area division provided by an embodiment of the present invention;

[0029] Figure 5 It is a schematic diagram of image line-by-line scanning provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0031] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0032] The embodiment of the present invention provides a multi-video stream superposition method based on the combination of FPGA and software, such as Figure 1 As shown, it includes step S1 to step S2, and each step is described in detail as follows:

[0033] S1: Determine the sub-rectangular area parameters of the target image by running the software in the control unit, including: determining the boundary coordinates and signal sources of different layers of the target image; dividing the target image into multiple sub-rectangular areas according to the boundaries of different layers; determining the coordinates of the sub-rectangular area in the target image; determining the layer displayed in the sub-rectangular area; determining the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size.

[0034] In some specific embodiments, such as Figure 2 As shown, the video stream overlay system is composed of a control unit, an FPGA unit, a DDR (Double Data Rate SDRAM, double rate synchronous dynamic random access memory) storage unit and other parts. The control unit and the FPGA unit are interconnected through internal or external buses such as PCI-E (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) and AXI4 (Advanced eXtensible Interface, generation 4, a high-speed interconnect bus). The FPGA unit is composed of multiple video input units (video input unit 1, video input unit 2, video input unit 3 to video input unit N), a DDR access control unit, a layer overlay unit and a video output unit. Signal source S1, signal source S2, signal source S3 to signal source SN are respectively connected to video input unit 1, video input unit 2, video input unit 3 to video input unit N.

[0035] The control unit can be a chip with computing and control functions such as ARM (Advanced RISC Machine), MCU (MicroController Unit), CPU (Central Processing Unit). ARM refers to a processing chip using the ARM architecture. The control unit involves the calculation of a large number of coordinates and parameters, which is implemented in this embodiment by software running on a carrier such as ARM / MCU / CPU.

[0036] The video input / output unit, layer overlay unit, etc. involve the reading and writing of a large amount of video image data and some simple calculations, which are mainly implemented by the internal logic of FPGA.

[0037] The DDR access control unit is used for storage control, reading data from the DDR storage unit, or storing data in the DDR storage unit.

[0038] The user determines the boundary coordinates and signal sources of different layers in the target image as needed. For example, the user opens multiple windows in the target image interface with the mouse, and selects the signal sources of different windows through the list. Each window is displayed as a layer, and the window can be stretched or reduced by the mouse to adjust the boundary coordinates of the layer. The boundary coordinates and signal sources of different layers of the target image are sent to the control unit. Taking the superposition of 16 video streams as an example, it should be understood that the solution provided in this embodiment can be extended to the superposition of any video streams of 32, 64, 128 or more. In the target image, 16 layers are superimposed, and the layers are defined as L1, L2 to L16 respectively. In an application scenario, the arrangement of the 16 layers is as follows: Figure 3 As shown, S1 to S16 represent signal sources, for example, Figure 3 In the above, L1(S1) represents layer L1, and its corresponding signal source is S1. In the practical application of the present invention, the number and arrangement of layers are not limited to Figure 3 In order to facilitate the understanding of the technical solution of the present invention, the method shown in the figure is selected. Figure 3 The layer coverage relationship shown is explained in a relatively intuitive way. The coordinates of layer L1 are (L1x0, L1y0, L1x1, L1y1, L1Z), where L1x0 is the left boundary coordinate of layer L1, Lxy0 is the upper boundary coordinate of layer L1, L1x1 is the right boundary coordinate of layer L1, L1y1 is the lower boundary coordinate of layer L1, and L1Z is the Z coordinate, indicating the coverage relationship between layer L1 and the other 15 layers.

[0039] Figure 3 In the code, the coordinates of the 16 layers, the selected signal source and the scaling factor are defined as:

[0040] L1( L1x0 , L1y0 , L1x1 , L1y1 , L1Z), signal source S1, horizontal scaling factor L1StepX, vertical scaling factor L1StepY;

[0041] L2(L2x0, L2y0, L2x1, L2y1, L2Z), signal source S2, horizontal scaling factor L2StepX, vertical scaling factor L2StepY;

[0042] L3 (L3x0, L3y0, L3x1, L3y1, L3Z), signal source S3, horizontal scaling factor L3StepX, vertical scaling factor L3StepY;

[0043] L4 (L4x0, L4y0, L4x1, L4y1, L4Z), signal source S4, horizontal scaling factor L4StepX, vertical scaling factor L4StepY;

[0044] L5 (L5x0, L5y0, L5x1, L5y1, L5Z), signal source S5, horizontal scaling factor L5StepX, vertical scaling factor L5StepY;

[0045] L6 (L6x0, L6y0, L6x1, L6y1, L6Z), signal source S6, horizontal scaling factor L6StepX, vertical scaling factor L6StepY;

[0046] L7 (L7x0, L7y0, L7x1, L7y1, L7Z), signal source S7, horizontal scaling factor L7StepX, vertical scaling factor L7StepY;

[0047] L8 (L8x0, L8y0, L8x1, L8y1, L8Z), signal source S8, horizontal scaling factor L8StepX, vertical scaling factor L8StepY;

[0048] L9 (L9x0, L9y0, L9x1, L9y1, L9Z), signal source S9, horizontal scaling factor L9StepX, vertical scaling factor L9StepY;

[0049] L10(L10x0, L10y0, L10x1, L10y1, L10Z), signal source S10, horizontal scaling factor L10StepX, vertical scaling factor L10StepY;

[0050] L11(L11x0, L11y0, L11x1, L11y1, L11Z), signal source S11, horizontal scaling factor L11StepX, vertical scaling factor L11StepY;

[0051] L12(L12x0, L12y0, L12x1, L12y1, L12Z), signal source S12, horizontal scaling factor L12StepX, vertical scaling factor L12StepY;

[0052] L13(L13x0, L13y0, L13x1, L13y1, L13Z), signal source S13, horizontal scaling factor L13StepX, vertical scaling factor L13StepY;

[0053] L14(L14x0, L14y0, L14x1, L14y1, L14Z), signal source S14, horizontal scaling factor L14StepX, vertical scaling factor L14StepY;

[0054] L15(L15x0, L15y0, L15x1, L15y1, L15Z), signal source S15, horizontal scaling factor L15StepX, vertical scaling factor L15StepY;

[0055] L16(L16x0, L16y0, L16x1, L16y1, L16Z), signal source S16, horizontal scaling factor L16StepX, vertical scaling factor L16StepY;

[0056] And L16Z>L15Z>L14Z>L13Z>L12Z>L11Z>L10Z>L9Z>L8Z>L7Z>L6Z>L5Z>L4Z>L3Z>L2Z>L1Z.

[0057] In some specific implementations, the target image is divided into a plurality of sub-rectangular regions according to the boundaries of different layers, including: dividing the target image into a plurality of rectangular regions according to the straight lines where the upper and lower boundaries of each layer are located; and dividing each rectangular region into one or more sub-rectangular regions according to the straight lines where the left and right boundaries of each layer are located. Figure 3 Based on the straight lines where the upper and lower boundaries of layers L1 to L16 are located, the target image is divided into 31 rows, that is, 31 rectangular areas. The 31 rectangular areas are as follows Figure 4 As shown, they are R1 to R31, and then each rectangular area is divided into one or more sub-rectangular areas according to the straight lines where the left and right boundaries of layers L1 to L16 are located. For example, rectangular area R1 is only divided by the straight lines where the left and right boundaries of layer L1 are located, so R1 is a sub-rectangular area as a whole, recorded as R1Sub1, and rectangular area R2 is divided by the straight lines where the left and right boundaries of layers L1 and L2 are located, and is divided into 3 horizontally parallel sub-rectangular areas, recorded from left to right as R2Sub1, R2Sub2, and R2Sub3. Similarly, rectangular area R16 is divided into 31 horizontally parallel sub-rectangular areas in the horizontal direction, recorded from left to right as R16Sub1~ R16Sub31.

[0058] In some specific implementations, the target image is divided into a plurality of sub-rectangular regions according to the boundaries of different layers, including: dividing the target image into (2LN-1) sub-rectangular regions according to the number of layers LN 2 When the boundaries of each layer do not overlap or overlap, the largest number of sub-rectangular areas can be obtained, for example Figure 3The 16 layers shown in the figure divide the other rectangular areas R1 to R15 and R17 to R31 according to the left and right boundaries of R16Sub1 to R16Sub31, so the target image can be divided into (32-1) at most. 2 sub-rectangular areas, that is, divided into a maximum of 31 2 A sub-rectangular area.

[0059] By comparing the Z coordinates of all layers covered on each sub-area, the layer number finally displayed on this sub-area is obtained. In some specific implementations, determining the layer displayed in the sub-rectangular area includes: determining the covering relationship of the layers according to the Z coordinate of each layer; determining all the layers in the sub-rectangular area, and determining the layer displayed in the sub-rectangular area according to the covering relationship of the layers. For example, the R1Sub1 area is only covered by layer L1, then the layer displayed by the sub-rectangular area R1Sub1 is L1, the R2Sub2 area is covered by both L1 and L2, if L2Z>L1Z, then the sub-area R2Sub2 displays the content of L2, the R16Sub16 area is covered by L1~L16 at the same time, then it is necessary to find the layer with the largest Z among the 16 layers, if L16Z>max{L1Z,L2Z,L3Z,…L15Z}, then the sub-rectangular area R16Sub16 displays the content of layer L16.

[0060] In some specific implementations, determining the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size includes:

[0061] pass , determine the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size, where, Indicates the horizontal scaling factor of layer i displayed in the sub-rectangular area. Indicates the width of the signal source corresponding to layer i, Indicates the right boundary coordinates of layer i. Indicates the left border coordinates of layer i. Indicates the vertical scaling factor of layer i, Indicates the height of the signal source corresponding to layer i, Indicates the lower boundary coordinates of layer i, Indicates the upper boundary coordinates of layer i. For example, the horizontal scaling factor of layer L1 is L1StepX = S1_Width / (L1x1-L1x0), the vertical scaling factor of layer L1 is L1StepY = S1_Height / (L1y1-L1y0), S1_Width indicates the width of signal source S1 corresponding to layer L1, and S1_Height indicates the height of signal source S1 corresponding to layer L1.

[0062] In some specific embodiments, determining the coordinates of the sub-rectangular area in the target image includes: determining the upper boundary coordinates of the layer whose upper boundary and the upper boundary of the sub-rectangular area are in the same straight line as the upper boundary coordinates of the sub-rectangular area in the target image; determining the lower boundary coordinates of the layer whose lower boundary and the lower boundary of the sub-rectangular area are in the same straight line as the lower boundary coordinates of the sub-rectangular area in the target image; determining the left boundary coordinates of the layer whose left boundary and the left boundary of the sub-rectangular area are in the same straight line as the left boundary of the sub-rectangular area; determining the right boundary coordinates of the layer whose right boundary and the right boundary of the sub-rectangular area are in the same straight line as the right boundary coordinates of the sub-rectangular area in the target image.

[0063] For example, taking the rectangular area R16 as an example, the rectangular area is divided into 31 sub-rectangular areas in the horizontal direction. The vertical starting coordinates and ending coordinates of the 31 sub-rectangular areas are the same, such as Figure 4 In the layer shown, the starting ordinate of R16 is the upper boundary coordinate L16y0 of the layer L16, and the ending ordinate is the lower boundary coordinate L16y1 of the layer L16.

[0064] According to the horizontal start and end coordinates of the 16 layers, the R16 area is divided into 31 sub-area coordinates:

[0065] R16Sub1(L1x0, L16y0, L2x0, L16y1, L1Z);

[0066] R16Sub2(L2x0, L16y0, L3x0, L16y1, L2Z);

[0067] R16Sub3(L3x0, L16y0, L4x0, L16y1, L3Z);

[0068] R16Sub4(L4x0, L16y0, L5x0, L16y1, L4Z);

[0069] R16Sub5(L5x0, L16y0, L6x0, L16y1, L5Z);

[0070] R16Sub6 (L6x0, L16y0, L7x0, L16y1, L6Z);

[0071] R16Sub7(L7x0, L16y0, L8x0, L16y1, L7Z);

[0072] R16Sub8( L8x0 , L16y0 , L9x0 , L16y1 , L8Z);

[0073] R16Sub9( L9x0 , L16y0 , L10x0 , L16y1 , L9Z);

[0074] R16Sub10( L10x0 , L16y0 , L11x0 , L16y1 , L10Z);

[0075] R16Sub11( L11x0 , L16y0 , L12x0 , L16y1 , L11Z);

[0076] R16Sub12( L12x0 , L16y0 , L13x0 , L16y1 , L12Z);

[0077] R16Sub13( L13x0 , L16y0 , L14x0 , L16y1 , L13Z);

[0078] R16Sub14( L14x0 , L16y0 , L15x0 , L16y1 , L14Z);

[0079] R16Sub15( L15x0 , L16y0 , L16x0 , L16y1 , L15Z);

[0080] R16Sub16( L16x0 , L16y0 , L16x1 , L16y1 , L16Z);

[0081] R16Sub17( L16x1 , L16y0 , L15x1 , L16y1 , L15Z);

[0082] R16Sub18( L15x1 , L16y0 , L14x1 , L16y1 , L14Z);

[0083] R16Sub19( L14x1 , L16y0 , L13x1 , L16y1 , L13Z);

[0084] R16Sub20( L13x1 , L16y0 , L12x1 , L16y1 , L12Z);

[0085] R16Sub21(L12x1, L16y0, L11x1, L16y1, L11Z);

[0086] R16Sub22 (L11x1, L16y0, L10x1, L16y1, L10Z);

[0087] R16Sub23 (L10x1, L16y0, L9x1, L16y1, L9Z);

[0088] R16Sub24 (L9x1, L16y0, L8x1, L16y1, L8Z);

[0089] R16Sub25(L8x1, L16y0, L7x1, L16y1, L7Z);

[0090] R16Sub26(L7x1, L16y0, L6x1, L16y1, L6Z);

[0091] R16Sub27 (L6x1, L16y0, L5x1, L16y1, L5Z);

[0092] R16Sub28(L5x1, L16y0, L4x1, L16y1, L4Z);

[0093] R16Sub29 (L4x1, L16y0, L3x1, L16y1, L3Z);

[0094] R16Sub30(L3x1, L16y0, L2x1, L16y1, L2Z);

[0095] R16Sub31 (L2x1, L16y0, L1x1, L16y1, L1Z).

[0096] Taking the calculation algorithm of quadratic linear image scaling as an example, the parameters required for calculating the display content of each sub-rectangular area are: the horizontal starting coordinate of the sub-rectangular area (that is, the left boundary coordinate of the sub-rectangular area), the horizontal ending coordinate of the sub-rectangular area (that is, the right boundary coordinate of the sub-rectangular area), the vertical starting coordinate of the sub-rectangular area (that is, the upper boundary coordinate of the sub-rectangular area), the vertical ending coordinate of the sub-rectangular area (that is, the lower boundary coordinate of the sub-rectangular area), the horizontal scaling factor of the sub-rectangular area, the vertical scaling factor of the sub-rectangular area, and the signal source of the layer where the sub-rectangular area is located.

[0097] Taking the sub-rectangular area R16Sub1 as an example, these parameters are expressed as follows:

[0098] Horizontal starting coordinate R16Sub1_x0 = L1x0,

[0099] The horizontal cut-off coordinate is R16Sub1_x1=L2x0,

[0100] The vertical starting coordinate is R16Sub1_y0=L16y0,

[0101] The vertical cut-off coordinate is R16Sub1_y1=L16y1,

[0102] Horizontal scaling factor R16Sub1_StepX=L1StepX,

[0103] Vertical scaling factor R16Sub1_StepY=L1StepY,

[0104] The signal source R16Sub1_Src of the layer where the sub-rectangular area R16Sub1 is located is S1.

[0105] S2: Input the sub-rectangular area parameters of the target image into the FPGA, determine the sub-rectangular area in the corresponding reading area of ​​the signal source based on the FPGA, and scan the image of the signal source reading area to the corresponding sub-rectangular area of ​​the target image according to the scaling ratio.

[0106] The way the FPGA scans the image of the signal source reading area is as follows Figure 5 As shown, scan line by line from top to bottom, scan each line from left to right, and after scanning one line, return to the left end of the next line and start scanning to the right. Figure 5 In the figure, the solid arrows represent the scan path and the dashed arrows represent the return path.

[0107] In some specific implementations, the target image sub-rectangular region parameters are stored in the DDR, and the FPGA reads the target image sub-rectangular region parameters from the DDR and stores the target image sub-rectangular region parameters in the parameter buffer (param_buffer) of the FPGA. 2 Each row corresponds to a row rectangular area, and each column in the row rectangular area corresponds to the sub-rectangular area of ​​the row. Since the video generation method in FPGA is generated row by row from top to bottom, under the control of the video output timing, all regional parameters of R1 are first read from the DDR cache and stored in the parameter cache param_buffer.

[0108] In some specific implementations, determining that the sub-rectangular area corresponds to a reading area of ​​the signal source includes:

[0109] according to , determine the sub-rectangular area corresponding to the reading area of ​​the signal source, where, Indicates the left boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Indicates the left boundary coordinates of the sub-rectangular area in the target image. The layer displayed by the sub-rectangular area is i. Indicates the left border coordinates of layer i. Indicates the horizontal scaling factor of layer i, Indicates the right boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Indicates the right boundary coordinates of the sub-rectangular area in the target image. Indicates the upper boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Represents the upper boundary coordinates of the sub-rectangular area in the target image. Indicates the lower boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Represents the lower boundary coordinates of the sub-rectangular area in the target image. Indicates the boundary coordinates on layer i, Indicates the vertical scaling factor of layer i.

[0110] In some specific implementations, the coordinates of the sub-rectangular area in the reading area corresponding to the signal source are stored in the DDR, the FPGA reads the coordinates of the sub-rectangular area in the reading area corresponding to the signal source from the DDR, and stores the coordinates of the sub-rectangular area in the reading area corresponding to the signal source in the row cache of the FPGA.

[0111] In some other specific embodiments, the processing process of the sub-rectangular region parameters of the target image in the FPGA is illustrated by way of example:

[0112] The coordinates of layer L1 are (0, 0, 3840, 2160, 1), and the horizontal and vertical scaling factors are (1.0, 0.8). The coordinates of layer L2 are (100, 50, 3800, 2100, 2), and the horizontal and vertical scaling factors are (2.0, 1.5). The coordinates of layer L3 are (160, 120, 3750, 2050, 3), and the horizontal and vertical scaling factors are (1, 1).

[0113] Take the parameters of R2Sub1 and R2Sub2 as an example, where R2Sub1 represents the first sub-rectangular area from left to right in the second row of rectangular areas, and R2Sub2 represents the second sub-rectangular area from left to right in the second row of rectangular areas.

[0114] The left boundary coordinate of R2Sub1 is R2Sub1_x0 = 0,

[0115] The right boundary coordinate of R2Sub1 is R2Sub1_x1 = 100,

[0116] The upper boundary coordinate of R2Sub1 is R2Sub1_y0= 50,

[0117] The lower boundary coordinate of R2Sub1 is R2Sub1_y1 = 120,

[0118] The horizontal scaling factor of R2Sub1 is R2Sub1_StepX=1.0,

[0119] The vertical scaling factor of R2Sub1 is R2Sub1_StepY=0.8,

[0120] The left boundary coordinate of R2Sub2 is R2Sub2_x0 = 100,

[0121] The right boundary coordinate of R2Sub2 is R2Sub2_x1 = 160,

[0122] The upper boundary coordinate of R2Sub2 is R2Sub2_y0= 50,

[0123] The lower boundary coordinate of R2Sub2 is R2Sub2_y1= 120,

[0124] The horizontal scaling factor of R2Sub2 is R2Sub2_StepX=2,

[0125] The vertical scaling factor of R2Sub2 is R2Sub2_StepY=1.5.

[0126] When the scan sequence scans to the 50th row and the 1st column, it enters the R2Sub1 area. The layer displayed by R2Sub1 is L1, and the corresponding signal source is S1.

[0127] The sub-area is mapped to the position in the signal source as follows:

[0128] Sub_in_src_x0=(horizontal starting coordinate of the sub-area - horizontal starting coordinate of the layer where the sub-area is located)*horizontal scaling factor of the layer;

[0129] Sub_in_src_x1=(the horizontal cutoff coordinate of the sub-region - the horizontal starting coordinate of the layer where the sub-region is located)*the horizontal scaling factor of the layer;

[0130] Sub_in_src_y0=(the vertical starting coordinate of the sub-area - the vertical starting coordinate of the layer where the sub-area is located)*the vertical scaling factor of the layer;

[0131] Sub_in_src_y1=(the vertical cutoff coordinate of the sub-area - the vertical starting coordinate of the layer where the sub-area is located)*the vertical scaling factor of the layer.

[0132] According to the coordinates of the sub-rectangular area R2Sub1 and the scaling factor, we can get:

[0133] The left boundary coordinates of the sub-rectangular area R2Sub1 in the corresponding reading area of ​​the signal source are (R2Sub1_x0-L1x0)*R2Sub1_StepX, which is 0; the right boundary coordinates of the sub-rectangular area R2Sub1 in the corresponding reading area of ​​the signal source are (R2Sub1_x1-L1x0)*R2Sub1_StepX, which is 100; the upper boundary coordinates of the sub-rectangular area R2Sub1 in the corresponding reading area of ​​the signal source are (R2Sub1_y0-L1y0)*R2Sub1_StepY, which is 40; the left boundary coordinates of the sub-rectangular area R2Sub1 in the corresponding reading area of ​​the signal source are (R2Sub1_y1-L1y0)*R2Sub1_StepY, which is 96; so in the S1 signal source, the rectangular area with coordinates (0,40,100,96) is the corresponding reading area of ​​the sub-rectangular area R2Sub1 in the signal source.

[0134] The layer displayed by R2Sub2 is L2, and the corresponding signal source is S2. According to the coordinates and scaling factor of the sub-rectangular area R2Sub2, we can calculate:

[0135] The left boundary coordinates of the sub-rectangular area R2Sub2 in the corresponding reading area of ​​the signal source are (R2Sub2_x0-L2x0)*R2Sub2_StepX, which is 0; the right boundary coordinates of the sub-rectangular area R2Sub2 in the corresponding reading area of ​​the signal source are (R2Sub2_x1-L2x0)*R2Sub2_StepX, which is 120; the upper boundary coordinates of the sub-rectangular area R2Sub2 in the corresponding reading area of ​​the signal source are (R2Sub2_y0-L2y0)*R2Sub2_StepY, which is 0; the left boundary coordinates of the sub-rectangular area R2Sub2 in the corresponding reading area of ​​the signal source are (R2Sub2_y1-L2y0)*R2Sub2_StepY, which is 105; so in the S2 signal source, the rectangular area with coordinates (0,0,120,105) is the corresponding reading area of ​​the sub-rectangular area R2Sub2 in the signal source.

[0136] In the above embodiment, the implementation based on FPGA is to read only the part required for display from the signal source, for example, only read the rectangular area with coordinates (0,40,100,96) in the S1 signal source and the rectangular area with coordinates (0,0,120,105) in the S2 signal source, without reading the image of the covered layer in the signal source, and without reading the entire area of ​​the signal source, thus saving a large amount of communication bandwidth for image data, thereby reducing the overall cost of the system, and saving communication and computing resources. Through the multi-channel video stream superposition method combining software and FPGA, the computing power of the software and the high concurrency and large-capacity data processing capabilities of FPGA are fully utilized, and real-time superposition of video streams from a larger number of signal sources can be achieved.

[0137] In some specific embodiments, the image of the signal source reading area is scanned to the corresponding sub-rectangular area of ​​the target image according to the scaling ratio, including: scanning the signal source reading area image line by line from top to bottom, and obtaining the image of the corresponding position of the target image after converting the scaling ratio; and outputting the image of each sub-rectangular area of ​​the target image under the control of the video output timing.

[0138] The row number of the S1 signal source where the image content required for the 50th row is calculated is (50-0)*0.8 = 40; the horizontal starting coordinate of the read data is (0-0)*1.0 = 0, and the horizontal ending coordinate is (100-0)*1.0=100. Therefore, when the FPGA scans the 50th row of the target image, the signal source S1 image coordinates that need to be read from the DDR are [0,40] to [100,40].

[0139] FPGA starts scanning horizontally from row 50 to column 100 of the target image and enters sub-rectangular area R2Sub2. In the R2Sub2 area, the row number of the signal source S2 image to be read is (50-50)*1.5 = 0; the horizontal starting coordinate of the read data is (100-100)*2.0=0, and the horizontal end coordinate is (160-100)*2.0=120. Therefore, when FPGA scans horizontally to row 50 and column 100 of the target image, the image coordinates of the signal source S1 to be read from DDR are [0,0]. When scanning horizontally from row 50 to column 100 of the target image, the image coordinates of the signal source S1 to be read from DDR are [0,0] to [120,0].

[0140] Similarly, the position of each sub-rectangular area of ​​the target image in the corresponding signal source can be determined. According to the calculated coordinates, the content of the DDR storage space where the corresponding signal source is located is read into the line buffer of the FPGA to obtain the material required for the target image.

[0141] Furthermore, according to methods such as a quadratic linear image scaling algorithm, a target image of each sub-region is calculated.

[0142] Since all images are calculated in real time during the scanning process, the obtained images also meet the scanning timing. Therefore, the calculation results are directly output to video output interfaces such as HDMI (High Definition Multimedia Interface) to obtain the superimposed target video.

[0143] By combining FPGA and software, we can give full play to the advantages of software in processing complex calculations and judgments, maximize the advantages of FPGA in high-speed and large-capacity processing, reduce the dependence of traditional pure FPGA solutions on DSP and logic resources, and reduce the dependence on software memory and computing power.

[0144] In the above embodiments, the implementation method combining software and FPGA saves a lot of data reading bandwidth compared to pure software processing solutions such as CPU and CPU+GPU or ARM. The implementation based on FPGA only reads the part required for display, and does not need to read the image of the covered layer in the signal source, thus saving a lot of bandwidth and reducing the overall cost of the system. By dividing the sub-rectangular area and determining the displayed layer through software, and then passing the sub-rectangular area parameters of the target image to the FPGA for processing, the calculation of a large number of coordinates on the FPGA and the layer sorting work are reduced, thereby significantly saving the DSP and logic resources of the FPGA, thereby reducing the cost of multi-video stream overlay applications. Compared with other pure software or pure FPGA solutions, under the condition of limited software computing power, memory capacity and FPGA scale, the present invention can significantly increase the total number of video streams superimposed, or under the condition of the same number of superimposed, the present invention can significantly improve the image quality and bandwidth processing capacity of a single-channel video.

[0145] Although the various steps in the above embodiment are described in the above-mentioned order, those skilled in the art can understand that in order to achieve the effect of this embodiment, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in a reverse order. These simple changes are within the scope of protection of the present invention.

[0146] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A multi-video stream superposition method based on the combination of FPGA and software, characterized in that: include: Determine the sub-rectangular area parameters of the target image by running the software in the control unit, including: determine the boundary coordinates and signal sources of different layers of the target image; divide the target image into a plurality of sub-rectangular areas according to the boundaries of different layers; determine the coordinates of the sub-rectangular areas in the target image; determine the layers displayed in the sub-rectangular areas; determine the scaling ratio of the layers displayed in the sub-rectangular areas and the corresponding signal source size; Input the sub-rectangular area parameters of the target image into the FPGA, determine the sub-rectangular area in the corresponding reading area of ​​the signal source based on the FPGA, and scan the image of the signal source reading area to the corresponding sub-rectangular area of ​​the target image according to the scaling ratio; The target image is divided into a plurality of sub-rectangular regions according to the boundaries of different layers, including: dividing the target image into a plurality of rectangular regions according to the straight lines where the upper and lower boundaries of each layer are located; dividing each rectangular region into one or more sub-rectangular regions according to the straight lines where the left and right boundaries of each layer are located; Wherein, determining the coordinates of the sub-rectangular area in the target image includes: determining the upper boundary coordinates of the layer whose upper boundary and the upper boundary of the sub-rectangular area are in the same straight line as the upper boundary coordinates of the sub-rectangular area in the target image; determining the lower boundary coordinates of the layer whose lower boundary and the lower boundary of the sub-rectangular area are in the same straight line as the lower boundary coordinates of the sub-rectangular area in the target image; determining the left boundary coordinates of the layer whose left boundary and the left boundary of the sub-rectangular area are in the same straight line as the left boundary coordinates of the sub-rectangular area in the target image; and determining the right boundary coordinates of the layer whose right boundary and the right boundary of the sub-rectangular area are in the same straight line as the right boundary coordinates of the sub-rectangular area in the target image.

2. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: The target image sub-rectangular region parameters are stored in the DDR, and the FPGA reads the target image sub-rectangular region parameters from the DDR and stores the target image sub-rectangular region parameters in the parameter cache of the FPGA.

3. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: According to the boundaries of different layers, the target image is divided into multiple sub-rectangular areas, including: According to the number of layers LN, the target image is divided into (2LN-1) 2 A sub-rectangular area.

4. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: Determines the layers displayed in the sub-rectangular area, including: Determine the coverage relationship of the layers based on the Z coordinate of each layer; Determine all layers in the sub-rectangular area, and determine the layers displayed in the sub-rectangular area based on the layer coverage relationship.

5. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: Determine the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size, including: pass , determine the scaling ratio of the layer displayed in the sub-rectangular area and the corresponding signal source size, where, Indicates the horizontal scaling factor of layer i displayed in the sub-rectangular area, where i represents the layer number. Indicates the width of the signal source corresponding to layer i, Indicates the right boundary coordinates of layer i. Indicates the left border coordinates of layer i. Indicates the vertical scaling factor of layer i, Indicates the height of the signal source corresponding to layer i, Indicates the lower boundary coordinates of layer i, Indicates the boundary coordinates of layer i.

6. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: Determine the sub-rectangular area corresponding to the reading area of ​​the signal source, including: according to , determine the sub-rectangular area corresponding to the reading area of ​​the signal source, where, Indicates the left boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Indicates the left boundary coordinates of the sub-rectangular area in the target image. The layer displayed in the sub-rectangular area is i, where i represents the layer number. Indicates the left border coordinates of layer i. Indicates the horizontal scaling factor of layer i, Indicates the right boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Indicates the right boundary coordinates of the sub-rectangular area in the target image. Indicates the upper boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Represents the upper boundary coordinates of the sub-rectangular area in the target image. Indicates the lower boundary coordinates of the sub-rectangular area in the corresponding reading area of ​​the signal source. Represents the lower boundary coordinates of the sub-rectangular area in the target image. Indicates the boundary coordinates on layer i, Indicates the vertical scaling factor of layer i.

7. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: The coordinates of the sub-rectangular area in the reading area corresponding to the signal source are stored in the DDR. The FPGA reads the coordinates of the sub-rectangular area in the reading area corresponding to the signal source from the DDR, and stores the coordinates of the sub-rectangular area in the reading area corresponding to the signal source in the row cache of the FPGA.

8. The multi-video stream superposition method based on the combination of FPGA and software according to claim 1 is characterized in that: Scanning the image of the signal source reading area to the corresponding sub-rectangular area of ​​the target image according to the scaling ratio includes: Scanning the signal source line by line from top to bottom to read the regional image, and obtaining the image at the corresponding position of the target image after converting the scaling ratio; Under the control of the video output timing, the image of each sub-rectangular area of ​​the target image is output.

Citation Information

Patent Citations

  • Video superposition method, device and equipment based on FPGA (Field Programmable Gate Array) and medium

    CN114257704A

  • Image processing method, system and device and storage medium

    CN115941952A