Movatterモバイル変換


[0]ホーム

URL:


CN117671103A - VTS radar PPI display method based on GPU and OpenGL - Google Patents

VTS radar PPI display method based on GPU and OpenGL
Download PDF

Info

Publication number
CN117671103A
CN117671103ACN202311463585.6ACN202311463585ACN117671103ACN 117671103 ACN117671103 ACN 117671103ACN 202311463585 ACN202311463585 ACN 202311463585ACN 117671103 ACN117671103 ACN 117671103A
Authority
CN
China
Prior art keywords
radar
opengl
display
texture
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311463585.6A
Other languages
Chinese (zh)
Inventor
李敏杰
陈龙
郭强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuang Electronics Co ltd
Original Assignee
Sichuang Electronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuang Electronics Co ltdfiledCriticalSichuang Electronics Co ltd
Priority to CN202311463585.6ApriorityCriticalpatent/CN117671103A/en
Publication of CN117671103ApublicationCriticalpatent/CN117671103A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了基于GPU和OpenGL的VTS雷达PPI显示方法,包括如下步骤:创建一个基于QGLWidget的主显示视图;初始化CUDA和OpenGL的环境和各项参数;新建PPI显示背景地图渲染线程;新建雷达信息层渲染线程;新建雷达原始视频显示处理线程;新建数据接收线程,根据配置文件,初始化雷达原始视频和雷达点航迹数据的接收地址和端口;启动各个CPU处理线程;根据接收到的数据和用户操作,进行相应的坐标转换和纹理更新;根据图层的叠加顺序,完成PPI显示模式下三层图层的显示。该显示方法应用在VTS雷达显示终端,能够达到拖拽和缩放时,显示画面清晰流畅,保证了雷达PPI显示画面的平滑性和连续性。

The invention discloses a VTS radar PPI display method based on GPU and OpenGL, which includes the following steps: creating a main display view based on QGLWidget; initializing the environment and various parameters of CUDA and OpenGL; creating a new PPI display background map rendering thread; creating new radar information Layer rendering thread; create a new radar original video display processing thread; create a new data receiving thread, and initialize the receiving address and port of the radar original video and radar point track data according to the configuration file; start each CPU processing thread; according to the received data and user Operation, perform corresponding coordinate conversion and texture update; complete the display of three layers in PPI display mode according to the overlay sequence of layers. This display method is applied to the VTS radar display terminal, which enables the display screen to be clear and smooth when dragging and zooming, ensuring the smoothness and continuity of the radar PPI display screen.

Description

Translated fromChinese
基于GPU和OpenGL的VTS雷达PPI显示方法VTS radar PPI display method based on GPU and OpenGL

技术领域Technical field

本发明属于雷达显示控制技术领域,尤其涉及基于GPU和OpenGL的VTS雷达PPI显示方法。The invention belongs to the technical field of radar display control, and in particular relates to a VTS radar PPI display method based on GPU and OpenGL.

背景技术Background technique

为使船舶能顺畅通航于有限水域或拥挤水域,各海运国家逐渐建立起岸船之间合作的船舶交通管理系统,简称VTS系统,主要包括岸基雷达、AIS基站、光电设备、北斗定位系统和船载移动终端等设备。作为VTS系统的重要组成部分,VTS雷达探测是主动探测,不必受目标条件的限制;且VTS雷达可以探测和获取覆盖范围的全景图像,在雷达的PPI显示界面需要显示雷达目标的原始视频图像和目标的点迹和航迹数据,并可根据雷达原始视频判断目标的大小和形状。In order to enable ships to navigate smoothly in limited or congested waters, various maritime countries have gradually established a ship traffic management system for cooperation between shore and ships, referred to as the VTS system, which mainly includes shore-based radar, AIS base stations, optoelectronic equipment, Beidou positioning systems and Shipborne mobile terminals and other equipment. As an important part of the VTS system, VTS radar detection is active detection and does not need to be restricted by target conditions; and VTS radar can detect and obtain panoramic images of the coverage area. The original video image of the radar target and the original video image of the radar target need to be displayed on the radar's PPI display interface. The target's point trace and track data can be used to determine the size and shape of the target based on the original radar video.

雷达PPI模式显示除了要显示更新频率快、实时性高的雷达视频,还要显示检测后的点航迹信息以及量程线。传统的雷达原始视频显示是基于FPGA或DSP在硬件板卡上来实现的,虽然采用硬件板卡显示具有实时性好、精度高和专用性强等优点,但是也存在成本高、可移植性差、系统开发、更新和维护易受硬件平台限制等缺点。随着计算机技术飞速发展,在计算机上采用软件来实现雷达视频显示已经成为一种趋势。经过多年的应用,用户对雷达终端画质的要求不断提高,原本基于CPU的图形渲染显示无法满足用户的需求。In addition to displaying radar video with fast update frequency and high real-time performance, the radar PPI mode display also displays the detected point track information and range lines. The traditional radar original video display is implemented on a hardware board based on FPGA or DSP. Although the use of hardware board display has the advantages of good real-time performance, high precision and strong specificity, it also has high cost, poor portability and system problems. Development, updates and maintenance are susceptible to disadvantages such as hardware platform limitations. With the rapid development of computer technology, it has become a trend to use software on computers to realize radar video display. After years of application, users’ requirements for radar terminal image quality have continued to increase, and the original CPU-based graphics rendering display cannot meet users’ needs.

发明内容Contents of the invention

为了克服现有技术在VTS雷达PPI显示方面所存在的难点和缺点,本发明提出基于GPU和OpenGL的VTS雷达PPI显示方法。在本发明中使用的GPU是英伟达公司的CUDA并行计算架构,该显示方法使用OpenGL的多重纹理映射技术和GPU的高速并行计算能力,实现了VTS雷达PPI显示中雷达原始视频、航迹、点迹、坐标、量程线和方位指示线的稳定显示,提高了雷达原始视频和余辉绘制的在屏幕缩放以及拖拽时的渲染速率和显示精度,同时也提高了软件的可靠性和维护性。In order to overcome the difficulties and shortcomings of the existing technology in VTS radar PPI display, the present invention proposes a VTS radar PPI display method based on GPU and OpenGL. The GPU used in this invention is NVIDIA's CUDA parallel computing architecture. This display method uses OpenGL's multi-texture mapping technology and the high-speed parallel computing capability of the GPU to realize the original radar video, track, and point traces in the VTS radar PPI display. The stable display of , coordinates, range lines and azimuth indicator lines improves the rendering rate and display accuracy of the original radar video and afterglow drawing during screen scaling and dragging, and also improves the reliability and maintainability of the software.

本发明为解决上述技术问题采用以下技术方案:The present invention adopts the following technical solutions to solve the above technical problems:

本发明第一方面提供了基于GPU和OpenGL的VTS雷达PPI显示方法,主要包括初始化环境和设备、接收实时网络数据或读取回放文件数据并传递到GPU显存、CUDA内核并行数据提取、用户交互、互操作方式显示雷达视频等步骤。其中,雷达原始视频的并行计算以及从缓冲到纹理的转换两部分主要在GPU设备端执行,点航迹数据和背景地图的纹理转换在CPU端完成,最终纹理的渲染调用OpenGL的API接口实现。The first aspect of the present invention provides a VTS radar PPI display method based on GPU and OpenGL, which mainly includes initializing the environment and equipment, receiving real-time network data or reading playback file data and transferring it to the GPU memory, CUDA kernel parallel data extraction, user interaction, Interoperable display of radar video and other steps. Among them, the parallel calculation of the radar original video and the conversion from buffer to texture are mainly executed on the GPU device side. The texture conversion of point track data and background map is completed on the CPU side. The final texture rendering is implemented by calling the OpenGL API interface.

具体步骤如下:Specific steps are as follows:

S1,创建一个基于QGLWidget的主显示视图,并初始化一个逻辑视图管理类,该视图管理类完成显示窗口改变、鼠标移动和鼠标滚轮时,主显示视图随之进行中心点变换、移动和缩放动作。最后调用视图工厂创建一个PPI显示区域,至此,PPI显示的窗口和视口已建立完成;S1, create a main display view based on QGLWidget and initialize a logical view management class. When the view management class completes the display window change, mouse movement and mouse wheel, the main display view will subsequently perform center point transformation, movement and scaling actions. Finally, the view factory is called to create a PPI display area. At this point, the PPI display window and viewport have been established;

S2,初始化CUDA和OpenGL的环境和各项参数,按照地图背景层、雷达原始视频层和雷达信息层初始化三个图层,并为各个图层设置叠加信号量以及图层的叠加顺序。其中,雷达原始视频的绘制通过CUDA和OpenGL的交互完成,地图背景层和雷达信息层的绘制通过OpenGL的纹理渲染接口完成;S2, initialize the environment and various parameters of CUDA and OpenGL, initialize three layers according to the map background layer, radar original video layer and radar information layer, and set the overlay signal amount and the overlay order of the layers for each layer. Among them, the drawing of the original radar video is completed through the interaction between CUDA and OpenGL, and the drawing of the map background layer and radar information layer is completed through the texture rendering interface of OpenGL;

S3,新建PPI显示背景地图渲染线程,初始化该图层对应纹理参数,包含两个QImage变量和两个OpenGL纹理对象。在线程运行期间,轮流将图层数据渲染到这两个QImage中,当Image发生变化时,绘制图像到对应的纹理中;S3, create a new PPI display background map rendering thread, initialize the texture parameters corresponding to the layer, including two QImage variables and two OpenGL texture objects. During the running of the thread, the layer data is rendered to the two QImages in turn. When the Image changes, the image is drawn to the corresponding texture;

S4,新建雷达信息层渲染线程,初始化该图层对应纹理参数,包含两个QImage变量和两个OpenGL纹理对象。在线程运行期间,轮流将图层数据渲染到这两个QImage中,当Image发生变化时,绘制图像到对应的纹理中;S4, create a new radar information layer rendering thread and initialize the texture parameters corresponding to this layer, including two QImage variables and two OpenGL texture objects. During the running of the thread, the layer data is rendered to the two QImages in turn. When the Image changes, the image is drawn to the corresponding texture;

S5,新建雷达原始视频显示处理线程,注册雷达原始视频数据对象和雷达原始视频视图对象、分配设备端回波参数对象、分配颜色表内存、分配回波数据内存、分配显示数据内存、分配时间表内存、分配存放当前回波的内存。该线程主要完成将雷达原始视频数据从CPU拷贝到GPU,在CUDA中更新GPU数据,然后更新相应的雷达原始视频纹理内存;S5, create a new radar original video display processing thread, register the radar original video data object and the radar original video view object, allocate device-side echo parameter objects, allocate color table memory, allocate echo data memory, allocate display data memory, allocate schedule Memory, allocates memory to store the current echo. This thread mainly completes copying the radar original video data from the CPU to the GPU, updating the GPU data in CUDA, and then updating the corresponding radar original video texture memory;

S6,新建数据接收线程,根据配置文件,初始化雷达原始视频和雷达点航迹数据的UDP接收地址和端口;S6, create a new data receiving thread, and initialize the UDP receiving address and port of the radar original video and radar point track data according to the configuration file;

S7,启动各个CPU处理线程,在该方法中,除了主线程和GPU的并行计算线程外,另外有4个线程,通信线程1负责数据的收发;绘图线程2负责雷达信息层数据的绘制;绘图线程3为雷达原始视频绘制线程,通过完成CUDA和OpenGL的交互,负责雷达原始视频的绘制;绘图线程4负责地图背景层的绘制;S7, start each CPU processing thread. In this method, in addition to the main thread and the parallel computing thread of the GPU, there are 4 additional threads. Communication thread 1 is responsible for sending and receiving data; drawing thread 2 is responsible for drawing radar information layer data; drawing Thread 3 is the radar original video drawing thread, and is responsible for drawing the radar original video by completing the interaction between CUDA and OpenGL; drawing thread 4 is responsible for drawing the map background layer;

S8,根据接收到的数据和用户操作,确定相应的图层是否需要修改,若需要修改则根据图层的类型,进行相应的坐标转换和纹理更新;S8, based on the received data and user operations, determine whether the corresponding layer needs to be modified. If modification is required, perform corresponding coordinate conversion and texture update according to the type of the layer;

S9,根据图层的叠加顺序,使用OpenGL的纹理渲染接口,绘制各个图层的图像,完成PPI显示模式下三层图层的显示。S9, according to the overlay sequence of the layers, uses OpenGL's texture rendering interface to draw the images of each layer, completing the display of the three layers in the PPI display mode.

其中雷达原始视频绘制相关的CUDA和OpenGL数据交互步骤如下:The steps for interacting with CUDA and OpenGL data related to radar original video rendering are as follows:

S51,设置CUDA和OpenGL的数据共享区。设置cudaGraphicsResource*类型和GLuint类型的两个变量完成数据的共享;S51, set the data sharing area of CUDA and OpenGL. Set two variables of cudaGraphicsResource* type and GLuint type to complete data sharing;

S52,初始化OpenGL。雷达PPI除了要显示更新频率快、实时性高的雷达视频,还要显示检测后的点航迹信息以及量程线,本文采用OpenGL的多重纹理技术,创建3个纹理图层,第一层是瓦片地图层,第二层是雷达原始视频层,第三层是点迹航迹和方位线量程线等数据信息层。在OpenGL初始化阶段初始化三个纹理图层;S52, initialize OpenGL. In addition to displaying radar videos with fast update frequency and high real-time performance, radar PPI also displays detected point track information and range lines. This article uses OpenGL's multi-texture technology to create three texture layers. The first layer is tiles. The second layer is the original radar video layer, and the third layer is the data information layer such as point track, bearing line and range line. Initialize three texture layers during the OpenGL initialization phase;

S53,使用OpenGLAPI创建数据缓冲区。glGenBuffers(1,&m_pbo)生成一个缓冲区句柄,glBindBuffer(GL_PIXEL_UNPACK_BUFFER,m_pbo)将句柄绑定到像素缓冲区,glBufferData(GL_PIXEL_UNPACK_BUFFER,w*h*4,0,GL_STREAMS53, use OpenGLAPI to create a data buffer. glGenBuffers(1,&m_pbo) generates a buffer handle, glBindBuffer(GL_PIXEL_UNPACK_BUFFER,m_pbo) binds the handle to the pixel buffer, glBufferData(GL_PIXEL_UNPACK_BUFFER,w*h*4,0,GL_STREAM

_DRAW_ARB)申请内存空间并设置相关属性以及初始值;_DRAW_ARB) applies for memory space and sets related attributes and initial values;

S54,数据缓冲区分享给CUDA。本方法需要使用GPU的并行计算能力,需要设置CUDA能够访问共享缓冲区,cudaGraphicsGLRegisterBuffer(&m_cudaGLResource,m_pbo,cudaGraphicsM apFlagsWriteDiscard)将缓冲区句柄注册为一个图形资源;S54, the data buffer is shared with CUDA. This method requires the use of parallel computing capabilities of the GPU, and requires setting CUDA to be able to access the shared buffer. cudaGraphicsGLRegisterBuffer(&m_cudaGLResource,m_pbo,cudaGraphicsM apFlagsWriteDiscard) registers the buffer handle as a graphics resource;

S55,CUDA映射共享资源,获取相对于显卡而言的设备指针。按顺序调用cudaGraphicsMapResources()、cudaGraphicsResourceGetMappedPointer完成该操作。映射完成后,我们需要获得缓冲区对于显卡(设备)而言的指针,获得设备指针后,就可以使用CUDA的并行计算功能了;S55, CUDA maps shared resources and obtains the device pointer relative to the graphics card. Call cudaGraphicsMapResources() and cudaGraphicsResourceGetMappedPointer in sequence to complete the operation. After the mapping is completed, we need to obtain the pointer of the buffer to the graphics card (device). After obtaining the device pointer, we can use the parallel computing function of CUDA;

S56,执行CUDA核函数进行并行计算。执行核函数UpdatePViewTextureFull<<<numBlocks,threadsPerBlock>>>将雷达的原始视频数据更新到像素缓冲区。按照雷达的方位更新雷达原始视频数据,每当接收到一个方位的视频数据,CPU就将当前的方位信息视频数据和该方位数据包长度信息传入显卡,更新显卡中保存的屏幕视频强度表。显卡GPU的块内线程数blockDim为512个,GPU的块数gridDim由传入的方位数据长度决定,显卡GPU对应的总的线程数为blockDim*gridDim个,每个线程对应一个视频点。每个线程根据当前的缩放比例进行坐标变换,获得屏幕坐标,进而更新屏幕雷达视频强度表。由于整个显示屏幕是定时刷新的,在需要刷新雷达视频画面时,根据GPU当前的块数和块内线程数和线程索引获得该像素点的回波强度,计算出该点对应的颜色值,并将结果更新到视频对应的地址,从而达到更新雷达像素缓冲区的目的;S56: Execute the CUDA kernel function for parallel computing. Execute the kernel function UpdatePViewTextureFull<<<numBlocks,threadsPerBlock>>> to update the radar's original video data to the pixel buffer. The original radar video data is updated according to the radar's orientation. Whenever video data from an orientation is received, the CPU transfers the current orientation information video data and the orientation packet length information to the graphics card, and updates the screen video intensity table saved in the graphics card. The number of threads in the block of the graphics card GPU, blockDim, is 512. The number of blocks in the GPU, gridDim, is determined by the length of the incoming azimuth data. The total number of threads corresponding to the graphics card GPU is blockDim*gridDim, and each thread corresponds to one video point. Each thread performs coordinate transformation according to the current zoom ratio to obtain screen coordinates, and then updates the screen radar video intensity table. Since the entire display screen is refreshed regularly, when the radar video screen needs to be refreshed, the echo intensity of the pixel is obtained based on the current number of blocks of the GPU, the number of threads within the block, and the thread index, and the color value corresponding to the point is calculated, and Update the result to the address corresponding to the video to achieve the purpose of updating the radar pixel buffer;

S57,像素缓冲区数据传输到纹理缓冲。在上述核函数中调用DrawPixel(),将显存上的像素缓冲传输到纹理缓冲中;S57, the pixel buffer data is transferred to the texture buffer. Call DrawPixel() in the above kernel function to transfer the pixel buffer on the display memory to the texture buffer;

S58,解除CUDA对共享缓冲区的映射。S58: Release CUDA's mapping of the shared buffer.

调用cudaGraphicsUnmapResources(1,&m_cudaGLResource,0)解除CUDA对共享数据的占用,如果不解除映射,那么OpenGL将没有权限访问共享数据区,因此也就没有办法完成图像的渲染显示了。因为在CUDA对资源的访问过程中,OpenGL不能对该数据区其进行任何操作,直到CUDA对数据区解除映射(unmap)为止;Call cudaGraphicsUnmapResources(1,&m_cudaGLResource,0) to release CUDA from occupying the shared data. If the mapping is not released, OpenGL will not have permission to access the shared data area, so there will be no way to complete the rendering and display of the image. Because during CUDA's access to resources, OpenGL cannot perform any operations on the data area until CUDA unmaps the data area;

S59,调用OpenGLAPI显示,调用OpenGL的接口,绘制更新的雷达原始视频纹理。S59, call the OpenGLAPI display, call the OpenGL interface, and draw the updated radar original video texture.

本发明第二方面提供了一种计算机设备,所述计算机设备包括处理器和存储器,所述存储器中存储有计算机程序,所述计算机程序由所述处理器加载并执行第一方面提供的基于GPU和OpenGL的VTS雷达PPI显示方法。A second aspect of the present invention provides a computer device. The computer device includes a processor and a memory. A computer program is stored in the memory. The computer program is loaded by the processor and executes the GPU-based method provided in the first aspect. and OpenGL's VTS radar PPI display method.

本发明第二方面提供了一种计算机可读存储介质,所述存储介质中存储有计算机程序,所述计算机程序由处理器加载并执行第一方面提供的基于GPU和OpenGL的VTS雷达PPI显示方法。A second aspect of the present invention provides a computer-readable storage medium. A computer program is stored in the storage medium. The computer program is loaded by a processor and executes the VTS radar PPI display method based on GPU and OpenGL provided by the first aspect. .

本发明的有益效果在于:The beneficial effects of the present invention are:

本发明基于CUDA的高速并行处理技术和OpenGL的实时渲染技术相结合,通过利用GPU显卡的高速并行化处理能力完成雷达原始视频的并行计算和纹理映射,采用OpenGL的纹理渲染方法,实现了背景地图、雷达原始视频、雷达点航迹以及量程线和方位线的PPI显示。This invention combines the high-speed parallel processing technology of CUDA and the real-time rendering technology of OpenGL, and uses the high-speed parallel processing capability of the GPU graphics card to complete the parallel calculation and texture mapping of the original radar video, and uses the texture rendering method of OpenGL to realize the background map. , radar original video, radar point track, and PPI display of range lines and bearing lines.

本发明解决了雷达原始视频叠加背景地图和雷达点航迹等信息数据时的实时渲染和缩放等问题,在目前研制的VTS雷达的PPI显示界面中应用了该技术,能够达到拖拽和缩放时,显示画面清晰流畅,保证了雷达PPI显示画面的平滑性和连续性,提高了雷达原始视频和余辉绘制的在屏幕缩放以及拖拽时的渲染速率和显示精度,同时也提高了软件的可靠性和维护性。This invention solves the problems of real-time rendering and zooming when the original radar video is superimposed with background map, radar point track and other information data. This technology is applied in the PPI display interface of the VTS radar currently developed, which can achieve drag and zoom time. , the display screen is clear and smooth, ensuring the smoothness and continuity of the radar PPI display screen, improving the rendering rate and display accuracy of the radar original video and afterglow drawing during screen scaling and dragging, and also improving the reliability of the software. and maintainability.

附图说明Description of drawings

下面结合附图和具体实施方式对本发明做更进一步的具体说明,本发明的上述和其他方面的优点将会更加清楚。The above and other advantages of the present invention will become clearer when the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

图1为地图背景层、雷达原始视频层和雷达信息层三个图层的总体工作流程图。Figure 1 is the overall workflow diagram of the three layers: map background layer, radar original video layer and radar information layer.

图2为雷达原始视频数据的并行计算处理以及渲染显示中CUDA和OpenGL的具体交互操作流程。Figure 2 shows the specific interactive operation process of CUDA and OpenGL in the parallel computing processing of radar original video data and rendering display.

具体实施方式Detailed ways

下面结合附图和具体较佳实施方式,对本发明做进一步详细的说明。The present invention will be described in further detail below with reference to the accompanying drawings and specific preferred embodiments.

如图1所示,基于GPU和OpenGL的VTS雷达PPI显示方法,主要流程包括如下步骤:As shown in Figure 1, the main process of the VTS radar PPI display method based on GPU and OpenGL includes the following steps:

S1,创建一个基于QGLWidget的主显示视图,并初始化一个逻辑视图管理类,该视图管理类完成显示窗口改变、鼠标移动和鼠标滚轮时,主显示视图随之进行中心点变换、移动和缩放动作。最后调用视图工厂创建一个PPI显示区域,至此,PPI显示的窗口和视口已建立完成;S1, create a main display view based on QGLWidget and initialize a logical view management class. When the view management class completes the display window change, mouse movement and mouse wheel, the main display view will subsequently perform center point transformation, movement and scaling actions. Finally, the view factory is called to create a PPI display area. At this point, the PPI display window and viewport have been established;

S2,初始化CUDA和OpenGL的环境和各项参数,按照地图背景层、雷达原始视频层和雷达信息层初始化三个图层,并为各个图层设置叠加信号量以及图层的叠加顺序。其中,雷达原始视频的绘制通过CUDA和OpenGL的交互完成,地图背景层和雷达信息层的绘制通过OpenGL的纹理渲染接口完成;S2, initialize the environment and various parameters of CUDA and OpenGL, initialize three layers according to the map background layer, radar original video layer and radar information layer, and set the overlay signal amount and the overlay order of the layers for each layer. Among them, the drawing of the original radar video is completed through the interaction between CUDA and OpenGL, and the drawing of the map background layer and radar information layer is completed through the texture rendering interface of OpenGL;

S3,新建PPI显示背景地图渲染线程,初始化该图层对应纹理参数,包含两个QImage变量和两个OpenGL纹理对象。在线程运行期间,轮流将图层数据渲染到这两个QImage中,当Image发生变化时,绘制图像到对应的纹理中;S3, create a new PPI display background map rendering thread, initialize the texture parameters corresponding to the layer, including two QImage variables and two OpenGL texture objects. During the running of the thread, the layer data is rendered to the two QImages in turn. When the Image changes, the image is drawn to the corresponding texture;

S4,新建雷达信息层渲染线程,初始化该图层对应纹理参数,包含两个QImage变量和两个OpenGL纹理对象。在线程运行期间,轮流将图层数据渲染到这两个QImage中,当Image发生变化时,绘制图像到对应的纹理中;S4, create a new radar information layer rendering thread and initialize the texture parameters corresponding to this layer, including two QImage variables and two OpenGL texture objects. During the running of the thread, the layer data is rendered to the two QImages in turn. When the Image changes, the image is drawn to the corresponding texture;

S5,新建雷达原始视频显示处理线程,注册雷达原始视频数据对象和雷达原始视频视图对象、分配设备端回波参数对象、分配颜色表内存、分配回波数据内存、分配显示数据内存、分配时间表内存、分配存放当前回波的内存。该线程主要完成将雷达原始视频数据从CPU拷贝到GPU,在CUDA中更新GPU数据,然后更新相应的雷达原始视频纹理内存;S5, create a new radar original video display processing thread, register the radar original video data object and the radar original video view object, allocate device-side echo parameter objects, allocate color table memory, allocate echo data memory, allocate display data memory, allocate schedule Memory, allocates memory to store the current echo. This thread mainly completes copying the radar original video data from the CPU to the GPU, updating the GPU data in CUDA, and then updating the corresponding radar original video texture memory;

S6,新建数据接收线程,根据配置文件,初始化雷达原始视频和雷达点航迹数据的UDP接收地址和端口;S6, create a new data receiving thread, and initialize the UDP receiving address and port of the radar original video and radar point track data according to the configuration file;

S7,启动各个CPU处理线程,在该方法中,除了主线程和GPU的并行计算线程外,另外有4个线程,通信线程1负责数据的收发;绘图线程2负责雷达信息层数据的绘制;绘图线程3为雷达原始视频绘制线程,通过完成CUDA和OpenGL的交互,负责雷达原始视频的绘制;绘图线程4负责地图背景层的绘制;S7, start each CPU processing thread. In this method, in addition to the main thread and the parallel computing thread of the GPU, there are 4 additional threads. Communication thread 1 is responsible for sending and receiving data; drawing thread 2 is responsible for drawing radar information layer data; drawing Thread 3 is the radar original video drawing thread. It is responsible for the drawing of the radar original video by completing the interaction between CUDA and OpenGL; drawing thread 4 is responsible for the drawing of the map background layer;

S8,根据接收到的数据和用户操作,确定相应的图层是否需要修改,若需要修改则根据图层的类型,进行相应的坐标转换和纹理更新;S8, based on the received data and user operations, determine whether the corresponding layer needs to be modified. If modification is required, perform corresponding coordinate conversion and texture update according to the type of the layer;

S9,根据图层的叠加顺序,使用OpenGL的纹理渲染接口,绘制各个图层的图像,完成PPI显示模式下三层图层的显示。S9, according to the overlay sequence of the layers, uses OpenGL's texture rendering interface to draw the images of each layer, completing the display of the three layers in the PPI display mode.

如图2所示,其中雷达原始视频绘制相关的CUDA和OpenGL数据交互步骤如下:As shown in Figure 2, the CUDA and OpenGL data interaction steps related to radar original video rendering are as follows:

S51,设置CUDA和OpenGL的数据共享区。设置cudaGraphicsResource*类型和GLuint类型的两个变量完成数据的共享;S51, set the data sharing area of CUDA and OpenGL. Set two variables of cudaGraphicsResource* type and GLuint type to complete data sharing;

S52,初始化OpenGL。雷达PPI除了要显示更新频率快、实时性高的雷达视频,还要显示检测后的点航迹信息以及量程线,本文采用OpenGL的多重纹理技术,创建3个纹理图层,第一层是瓦片地图层,第二层是雷达原始视频层,第三层是点迹航迹和方位线量程线等数据信息层。在OpenGL初始化阶段初始化三个纹理图层;S52, initialize OpenGL. In addition to displaying radar videos with fast update frequency and high real-time performance, radar PPI also displays detected point track information and range lines. This article uses OpenGL's multi-texture technology to create three texture layers. The first layer is tiles. The second layer is the original radar video layer, and the third layer is the data information layer such as point track, bearing line and range line. Initialize three texture layers during the OpenGL initialization phase;

S53,使用OpenGLAPI创建数据缓冲区。glGenBuffers(1,&m_pbo)生成一个缓冲区句柄,glBindBuffer(GL_PIXEL_UNPACK_BUFFER,m_pbo)将句柄绑定到像素缓冲区,glBufferData(GL_PIXEL_UNPACK_BUFFER,w*h*4,0,GL_STREAMS53, use OpenGLAPI to create a data buffer. glGenBuffers(1,&m_pbo) generates a buffer handle, glBindBuffer(GL_PIXEL_UNPACK_BUFFER,m_pbo) binds the handle to the pixel buffer, glBufferData(GL_PIXEL_UNPACK_BUFFER,w*h*4,0,GL_STREAM

_DRAW_ARB)申请内存空间并设置相关属性以及初始值;_DRAW_ARB) applies for memory space and sets related attributes and initial values;

S54,数据缓冲区分享给CUDA。本方法需要使用GPU的并行计算能力,需要设置CUDA能够访问共享缓冲区,cudaGraphicsGLRegisterBuffer(&m_cudaGLResource,m_pbo,cudaGraphicsM apFlagsWriteDiscard)将缓冲区句柄注册为一个图形资源;S54, the data buffer is shared with CUDA. This method requires the use of parallel computing capabilities of the GPU, and requires setting CUDA to be able to access the shared buffer. cudaGraphicsGLRegisterBuffer(&m_cudaGLResource,m_pbo,cudaGraphicsM apFlagsWriteDiscard) registers the buffer handle as a graphics resource;

S55,CUDA映射共享资源,获取相对于显卡而言的设备指针。按顺序调用cudaGraphicsMapResources()、cudaGraphicsResourceGetMappedPointer完成该操作。映射完成后,我们需要获得缓冲区对于显卡(设备)而言的指针,获得设备指针后,就可以使用CUDA的并行计算功能了;S55, CUDA maps shared resources and obtains the device pointer relative to the graphics card. Call cudaGraphicsMapResources() and cudaGraphicsResourceGetMappedPointer in sequence to complete the operation. After the mapping is completed, we need to obtain the pointer of the buffer to the graphics card (device). After obtaining the device pointer, we can use the parallel computing function of CUDA;

S56,执行CUDA核函数进行并行计算。执行核函数UpdatePViewTextureFull<<<numBlocks,threadsPerBlock>>>将雷达的原始视频数据更新到像素缓冲区。按照雷达的方位更新雷达原始视频数据,每当接收到一个方位的视频数据,CPU就将当前的方位信息视频数据和该方位数据包长度信息传入显卡,更新显卡中保存的屏幕视频强度表。显卡GPU的块内线程数blockDim为512个,GPU的块数gridDim由传入的方位数据长度决定,显卡GPU对应的总的线程数为blockDim*gridDim个,每个线程对应一个视频点。S56: Execute the CUDA kernel function for parallel computing. Execute the kernel function UpdatePViewTextureFull<<<numBlocks,threadsPerBlock>>> to update the radar's original video data to the pixel buffer. The original radar video data is updated according to the radar's orientation. Whenever video data from an orientation is received, the CPU transfers the current orientation information video data and the orientation packet length information to the graphics card, and updates the screen video intensity table saved in the graphics card. The number of threads in the block of the graphics card GPU, blockDim, is 512. The number of blocks in the GPU, gridDim, is determined by the length of the incoming azimuth data. The total number of threads corresponding to the graphics card GPU is blockDim*gridDim, and each thread corresponds to one video point.

每个线程根据当前的缩放比例进行坐标变换,获得屏幕坐标,进而更新屏幕雷达视频强度表。由于整个显示屏幕是定时刷新的,在需要刷新雷达视频画面时,根据GPU当前的块数和块内线程数和线程索引获得该像素点的回波强度,计算出该点对应的颜色值,并将结果更新到视频对应的地址,从而达到更新雷达像素缓冲区的目的;Each thread performs coordinate transformation according to the current zoom ratio to obtain screen coordinates, and then updates the screen radar video intensity table. Since the entire display screen is refreshed regularly, when the radar video screen needs to be refreshed, the echo intensity of the pixel is obtained based on the current number of blocks of the GPU, the number of threads within the block, and the thread index, and the color value corresponding to the point is calculated, and Update the result to the address corresponding to the video to achieve the purpose of updating the radar pixel buffer;

S57,像素缓冲区数据传输到纹理缓冲。在上述核函数中调用DrawPixel(),将显存上的像素缓冲传输到纹理缓冲中;S57, the pixel buffer data is transferred to the texture buffer. Call DrawPixel() in the above kernel function to transfer the pixel buffer on the display memory to the texture buffer;

S58,解除CUDA对共享缓冲区的映射。S58: Release CUDA's mapping of the shared buffer.

调用cudaGraphicsUnmapResources(1,&m_cudaGLResource,0)解除CUDA对共享数据的占用,如果不解除映射,那么OpenGL将没有权限访问共享数据区,因此也就没有办法完成图像的渲染显示了。因为在CUDA对资源的访问过程中,OpenGL不能对该数据区其进行任何操作,直到CUDA对数据区解除映射(unmap)为止;Call cudaGraphicsUnmapResources(1,&m_cudaGLResource,0) to release CUDA from occupying the shared data. If the mapping is not released, OpenGL will not have permission to access the shared data area, so there will be no way to complete the rendering and display of the image. Because during CUDA's access to resources, OpenGL cannot perform any operations on the data area until CUDA unmaps the data area;

S59,调用OpenGLAPI显示,调用OpenGL的接口,绘制更新的雷达原始视频纹理。S59, call the OpenGLAPI display, call the OpenGL interface, and draw the updated radar original video texture.

综上所述,本发明的PPI显示方法利用了GPU的高速并行计算和OpenGL的多纹理实时渲染,确保了本发明的高精度雷达原始视频和背景地图以及雷达信息数据的绘制效率,本发明所涉及的VTS雷达PPI显示方法具有绘制效率高、雷达原始视频显示连续、跨平台和可移植性好的优点。In summary, the PPI display method of the present invention utilizes the high-speed parallel computing of GPU and the multi-texture real-time rendering of OpenGL to ensure the rendering efficiency of the high-precision radar original video and background map as well as radar information data of the present invention. The involved VTS radar PPI display method has the advantages of high rendering efficiency, continuous radar original video display, cross-platform and good portability.

以上详细描述了本发明的优选实施方式,但是本发明并不限于上述实施方式中的具体细节,在本发明的技术构思范围内,可以对本发明的技术方案进行多种等同变换,这些等同变换均属于本发明的保护范围。The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solution of the present invention. These equivalent transformations are all belong to the protection scope of the present invention.

Claims (7)

Translated fromChinese
1.基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于,包括以下步骤:1. The VTS radar PPI display method based on GPU and OpenGL is characterized by including the following steps:S1,创建一个基于QGLWidget的主显示视图,并初始化一个逻辑视图管理类,调用视图工厂创建一个PPI显示区域;S1, create a main display view based on QGLWidget, initialize a logical view management class, and call the view factory to create a PPI display area;S2,初始化CUDA和OpenGL的环境和各项参数;S2, initialize the CUDA and OpenGL environments and various parameters;S3,新建PPI显示背景地图渲染线程,初始化该图层对应纹理参数;S3, create a new PPI display background map rendering thread, and initialize the corresponding texture parameters of the layer;S4,新建雷达信息层渲染线程,初始化该图层对应纹理参数;S4, create a new radar information layer rendering thread and initialize the corresponding texture parameters of this layer;S5,新建雷达原始视频显示处理线程,初始化该图层对应纹理参数;S5, create a new radar original video display processing thread and initialize the corresponding texture parameters of this layer;S6,新建数据接收线程,根据配置文件,初始化雷达原始视频和雷达点航迹数据的UDP接收地址和端口;S6, create a new data receiving thread, and initialize the UDP receiving address and port of the radar original video and radar point track data according to the configuration file;S7,启动各个CPU处理线程;S7, start each CPU processing thread;S8,根据接收到的数据和用户操作,进行相应的坐标转换和纹理更新;S8, perform corresponding coordinate conversion and texture update based on the received data and user operations;S9,根据图层的叠加顺序,使用OpenGL的纹理渲染接口,绘制各个图层的图像,完成PPI显示模式下三层图层的显示。S9, according to the overlay sequence of the layers, uses OpenGL's texture rendering interface to draw the images of each layer, completing the display of the three layers in the PPI display mode.2.如权利要求1所述的基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于,步骤S1中,主显示区的显示视图由一个视图管理类进行管理。2. The VTS radar PPI display method based on GPU and OpenGL as claimed in claim 1, characterized in that in step S1, the display view of the main display area is managed by a view management class.3.如权利要求1所述的基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于,步骤S3中,背景地图的渲染显示采用独立线程和单独纹理图层。3. The VTS radar PPI display method based on GPU and OpenGL according to claim 1, characterized in that, in step S3, the rendering and display of the background map uses independent threads and independent texture layers.4.如权利要求1所述的基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于,步骤S4中,该显示雷达信息层的渲染显示采用独立线程和单独纹理图层。4. The VTS radar PPI display method based on GPU and OpenGL as claimed in claim 1, characterized in that, in step S4, the rendering display of the radar information layer uses independent threads and independent texture layers.5.如权利要求1所述的基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于,步骤S2和步骤S9中,所述雷达原始视频的渲染采用GPU和OpenGL的交互操作具体包括如下步骤:5. The VTS radar PPI display method based on GPU and OpenGL as claimed in claim 1, characterized in that, in step S2 and step S9, the rendering of the radar original video adopts the interactive operation of GPU and OpenGL and specifically includes the following steps:S51,设置CUDA和OpenGL的数据共享区;S51, set the data sharing area of CUDA and OpenGL;S52,初始化OpenGL,创建地图背景层、雷达原始视频层和雷达信息层三个图层对应的纹理对象;S52, initialize OpenGL and create texture objects corresponding to three layers: map background layer, radar original video layer and radar information layer;S53,使用OpenGLAPI创建数据缓冲区,生成一个缓冲区句柄,将句柄绑定到像素缓冲区,申请内存空间并设置相关属性以及初始值;S53, use OpenGLAPI to create a data buffer, generate a buffer handle, bind the handle to the pixel buffer, apply for memory space and set related attributes and initial values;S54,将OpenGL的数据缓冲区分享给CUDA,将缓冲区句柄注册为一个图形资源;S54, share the OpenGL data buffer with CUDA and register the buffer handle as a graphics resource;S55,CUDA映射共享资源,获取相对于显卡而言的设备指针;S55, CUDA maps shared resources and obtains the device pointer relative to the graphics card;S56,执行CUDA核函数进行并行计算,执行核函数将雷达的原始视频数据更新到像素缓冲区,按照雷达的方位更新雷达原始视频数据,每当接收到一个方位的视频数据,CPU就将当前的方位信息视频数据和该方位数据包长度信息传入显卡,更新显卡中保存的屏幕视频强度表,根据GPU当前的块数和块内线程数和线程索引获得该像素点的回波强度,计算出该点对应的颜色值,并将结果更新到视频对应的地址,从而达到更新雷达像素缓冲区的目的;S56, execute the CUDA kernel function to perform parallel calculations, execute the kernel function to update the radar’s original video data to the pixel buffer, and update the radar’s original video data according to the radar’s orientation. Whenever video data from an orientation is received, the CPU will update the current The orientation information video data and the orientation packet length information are transmitted to the graphics card, the screen video intensity table saved in the graphics card is updated, and the echo intensity of the pixel is obtained based on the current number of blocks in the GPU, the number of threads in the block, and the thread index, and the calculation is The color value corresponding to the point, and the result is updated to the address corresponding to the video, thereby achieving the purpose of updating the radar pixel buffer;S57,像素缓冲区数据传输到纹理缓冲,将显存上的像素缓冲传输到纹理缓冲中;S57, the pixel buffer data is transferred to the texture buffer, and the pixel buffer on the display memory is transferred to the texture buffer;S58,解除CUDA对共享缓冲区的映射;S58, release CUDA's mapping of the shared buffer;S59,调用OpenGLAPI显示,调用OpenGL的接口,绘制更新的雷达原始视频纹理。S59, call the OpenGLAPI display, call the OpenGL interface, and draw the updated radar original video texture.6.如权利要求1所述的基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于在,步骤S5中,雷达原始视频的渲染显示采用独立线程和单独纹理图层。6. The VTS radar PPI display method based on GPU and OpenGL according to claim 1, characterized in that in step S5, the rendering and display of the radar original video uses independent threads and independent texture layers.7.如权利要求1所述的基于GPU和OpenGL的VTS雷达PPI显示方法,其特征在于在,在步骤S6中,雷达输出的数据包括雷达原始视频、雷达航迹和雷达点迹。7. The VTS radar PPI display method based on GPU and OpenGL according to claim 1, characterized in that in step S6, the data output by the radar includes radar original video, radar track and radar point trace.
CN202311463585.6A2023-11-062023-11-06 VTS radar PPI display method based on GPU and OpenGLPendingCN117671103A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202311463585.6ACN117671103A (en)2023-11-062023-11-06 VTS radar PPI display method based on GPU and OpenGL

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202311463585.6ACN117671103A (en)2023-11-062023-11-06 VTS radar PPI display method based on GPU and OpenGL

Publications (1)

Publication NumberPublication Date
CN117671103Atrue CN117671103A (en)2024-03-08

Family

ID=90070401

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202311463585.6APendingCN117671103A (en)2023-11-062023-11-06 VTS radar PPI display method based on GPU and OpenGL

Country Status (1)

CountryLink
CN (1)CN117671103A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119052524A (en)*2024-10-312024-11-29江西联创精密机电有限公司Video display method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119052524A (en)*2024-10-312024-11-29江西联创精密机电有限公司Video display method and system

Similar Documents

PublicationPublication DateTitle
US12347016B2 (en)Image rendering method and apparatus, device, medium, and computer program product
US11941752B2 (en)Streaming a compressed light field
CN114445257B (en)Method for streaming light field compression using lossless or lossy compression and storage medium
JP5166552B2 (en) Multi-buffer support for off-screen surfaces in graphics processing systems
US10825129B2 (en)Eliminating off screen passes using memoryless render target
US10055883B2 (en)Frustum tests for sub-pixel shadows
CN105487848B (en)A kind of the display method for refreshing and system of 3D application
CN102609971A (en)Quick rendering system using embedded GPU (Graphics Processing Unit) for realizing 3D-GIS (Three Dimensional-Geographic Information System)
CN112017101B (en) Variable Rasterization Rate
US20160140737A1 (en)Bandwidth reduction using vertex shader
WO2024040815A1 (en)Graphic processing method and system
CN116091329B (en)Image processing method, device, equipment and storage medium
CN113393564B (en)Pool-based spatio-temporal importance resampling using global illumination data structures
CN114782612A (en) Image rendering method, device, electronic device and storage medium
CN105023234A (en)Figure acceleration method based on storage optimization of embedded system
CN117671103A (en) VTS radar PPI display method based on GPU and OpenGL
CN113051491B (en)Map data processing method, apparatus, storage medium, and program product
CN117170883A (en)Method, device, equipment and storage medium for rendering display
WO2024027286A1 (en)Rendering method and apparatus, and device and storage medium
WO2023051590A1 (en)Render format selection method and device related thereto
CN119718238A (en) A display method and related equipment
CN112149383B (en)Text real-time layout method based on GPU, electronic device and storage medium
WO2024199097A1 (en)Rendering method and corresponding device
US8203567B2 (en)Graphics processing method and apparatus implementing window system
US9251557B2 (en)System, method, and computer program product for recovering from a memory underflow condition associated with generating video signals

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp