Map rendering method, system, terminal and storage medium
By storing map rendering objects and the final transformation matrix in the object storage unit, asynchronous operations between the logic thread and the rendering thread are achieved, solving the problem of mutual waiting between the CPU and GPU, and improving map rendering performance and refresh rate.
Patent Information
- Application Number
- CN202010761547.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-31
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2040-07-31
AI Technical Summary
In existing technologies, the waiting between the CPU and GPU leads to reduced map rendering performance, affecting the normal operation of navigation software.
By setting up an object storage unit to store map rendering objects and the final transformation matrix, the logic thread organizes and calculates them, while the rendering thread asynchronously obtains and triggers the graphics processing unit to perform rendering operations, thus achieving asynchronous operation between the logic thread and the rendering thread.
It reduces the waiting time during map rendering, improves map rendering efficiency and refresh rate, and optimizes CPU and GPU resource utilization.
Smart Images

Figure CN114064826B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of map drawing, and in particular to a map rendering method, system, terminal and storage medium. BACKGROUND
[0002] The vehicle-mounted information entertainment device installed in the car, referred to as the car machine, can realize information communication between people and cars, cars and the outside world (cars and cars) in function. Various different vehicle-mounted front-mounted car machines have different performances, and the CPU usage rate of the thread of the navigation software cannot be greater than a certain threshold value due to the influence of the system bandwidth, otherwise, the normal operation of other software on the car machine will be affected. In vehicle navigation, map drawing accounts for 80% of the active life cycle of all application threads, and the performance of map rendering largely determines the performance of the navigation software.
[0003] At present, the map primitive element classification is rendered according to the primitive, the Central Processing Unit (CPU) prepares map rendering primitive data of each primitive by a rendering thread, and after the map rendering objects corresponding to each map rendering primitive of the primitive are organized, a drawing instruction is directly sent to a Graphics Processing Unit (GPU) to execute the drawing instruction by the GPU to perform map primitive rendering. After the GPU rendering is completed, the rendering process of the next primitive is entered, and the rendering process of all primitives of a frame of map picture is completed.
[0004] The inventor found through research that the above rendering process causes mutual waiting between the CPU and the GPU, which greatly reduces the map rendering performance. SUMMARY
[0005] Therefore, the embodiments of the present specification provide a map rendering method, system, terminal and storage medium, which can improve the map rendering performance.
[0006] The embodiments of the present specification provide a map rendering method, comprising:
[0007] The logical thread comprises:
[0008] Based on the obtained attitude data, a corresponding map rendering primitive is obtained, the map rendering primitive is organized into a corresponding map rendering object, a final transformation matrix is obtained based on the attitude data, and the map rendering object and the final transformation matrix are stored in an object storage unit;
[0009] The rendering thread comprises:
[0010] acquire the map rendering object and the final transformation matrix from the object storage unit, send a rendering instruction to a graphics processing unit, and trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix.
[0011] Optionally, the corresponding map rendering primitives are acquired based on the acquired attitude data, and the map rendering object is organized from the map rendering primitives, including:
[0012] Based on the acquired attitude data, the map level to be rendered and the corresponding map level tiles are determined, the map rendering primitives in the corresponding tiles are acquired according to a rendering order, the map rendering object of the corresponding tiles is organized from the map rendering primitives of the corresponding tiles, and the map rendering object of the corresponding tiles is stored in the object storage unit according to an organization order.
[0013] Optionally, the attitude data includes map center point data and scale data, and the map level to be rendered and the corresponding map level tiles are determined based on the acquired attitude data, including:
[0014] The map level to be rendered is determined according to the acquired map center point data and scale data, the corresponding geographical range is calculated according to the map level to be rendered, the scale data, and the range data of the screen, and the number of the map level tiles and the identification of the map level tiles are determined according to the corresponding geographical range and the size of the map level tiles.
[0015] Optionally, the map rendering object is acquired from the object storage unit, and a rendering instruction is sent to a graphics processing unit to trigger the graphics processing unit to perform a drawing operation on the map rendering object, including:
[0016] The map rendering object and the final transformation matrix are acquired from the object storage unit according to the storage time sequence of the map rendering object and the final transformation matrix, and rendering instructions are sequentially sent to the graphics processing unit to trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix.
[0017] Optionally, the map rendering object is acquired from the object storage unit according to the storage time sequence of the map rendering object, including:
[0018] The map rendering object and the final transformation matrix are synchronously acquired from the object storage unit according to the storage time sequence of the map rendering object and the final transformation matrix.
[0019] Optionally, the rendering thread further performs the following operations:
[0020] In response to the pose transformation message, a transformed map level to be rendered and a corresponding map level tile are determined according to pose transformation data delivered by the pose transformation message, an updated final transformation matrix is obtained according to the pose transformation data, and it is determined whether the transformed corresponding map level tile is consistent with a tile corresponding to a map rendering object stored in the object storage unit, and when the tiles are consistent, the updated final transformation matrix is stored in the object storage unit.
[0021] Optionally, the rendering thread method further performs the following operations:
[0022] When the transformed corresponding map level tile is partially consistent with the tile corresponding to the map rendering object stored in the object storage unit, for the same tile, an updated final transformation matrix corresponding to the tile is determined, for different tiles, a pose transformation message is delivered to the logical thread by the main thread, so that the logical thread re-determines a map level to be rendered and a corresponding map level tile based on pose data delivered in the pose transformation message, and map rendering primitives in the corresponding tile are obtained in a rendering order, map rendering primitives in the corresponding tile are organized into a map rendering object of the corresponding tile, and the map rendering object of the corresponding tile is stored in the object storage unit in an organization order.
[0023] Optionally, the rendering thread further performs the following operations:
[0024] When the transformed corresponding map level tile is completely inconsistent with the tile corresponding to the map rendering object stored in the object storage unit, a pose transformation message is delivered to the logical thread by the main thread, so that the logical thread re-determines a map level to be rendered and a corresponding map level tile based on pose data delivered in the pose transformation message, and map rendering primitives in the corresponding tile are obtained in a rendering order, map rendering primitives in the corresponding tile are organized into a map rendering object of the corresponding tile, and the map rendering object of the corresponding tile is stored in the object storage unit in an organization order.
[0025] Optionally, the response to the pose transformation message includes at least one of the following:
[0026] a pose transformation message triggered in response to a gesture interaction event;
[0027] a pose transformation message triggered in response to an interactive navigation movement;
[0028] a pose transformation message triggered in response to an interactive control voice instruction.
[0029] The embodiments of the specification also provide a map rendering system, which comprises:
[0030] an object storage unit adapted to store map rendering objects and final transformation matrices;
[0031] a logic processing unit adapted to run a logic thread to obtain a corresponding map rendering primitive based on the obtained pose data, organize the map rendering primitive into a corresponding map rendering object, obtain a final transformation matrix based on the pose data, and store the map rendering object and the final transformation matrix to an object storage unit;
[0032] a rendering unit adapted to run a rendering thread to obtain the map rendering object and the final transformation matrix from the object storage unit, send a rendering instruction to a graphics processing unit, and trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix.
[0033] Embodiments of the present specification also provide a map rendering terminal, comprising:
[0034] a microprocessor adapted to run a logic thread to obtain a corresponding map rendering primitive based on the obtained pose data, organize the map rendering primitive into a corresponding map rendering object, obtain a final transformation matrix based on the pose data, and store the map rendering object and the final transformation matrix to a memory, and run a rendering thread to obtain the map rendering object and the final transformation matrix from the memory, send a rendering instruction to a graphics processor, and trigger the graphics processor to perform a drawing operation on the map rendering object according to the final transformation matrix.
[0035] a graphics processor adapted to perform a drawing operation on the map rendering object according to the final transformation matrix in response to the rendering instruction and the map rendering object and the final transformation matrix transmitted by the rendering thread.
[0036] a memory adapted to store the map rendering object and the final transformation matrix.
[0037] Optionally, the microprocessor is further adapted to run the rendering thread to determine a transformed map level to be rendered and a tile of a corresponding map level according to pose transformation data transmitted by a pose transformation message in response to the pose transformation message, obtain an updated final transformation matrix according to the pose transformation data, determine whether the tile of the corresponding map level after transformation corresponds to a tile of the map rendering object stored in the memory according to the pose transformation data, and directly update the final transformation matrix in the memory or trigger the logic thread to reorganize the map rendering object according to a result of the determination.
[0038] Optionally, the memory is a cache queue.
[0039] The embodiment of the present specification also provides another map rendering terminal, comprising a memory, a microprocessor and a graphics processor, wherein the memory stores computer instructions executable on the microprocessor, and the microprocessor executes the computer instructions to perform the steps of the method of any one of the preceding embodiments; and the graphics processor performs rendering operations based on rendering instructions of the microprocessor.
[0040] The embodiment of the present specification also provides a computer readable storage medium storing computer instructions, wherein the computer instructions perform the steps of the method of any one of the preceding embodiments when executed.
[0041] The map rendering method of the embodiment of the present specification organizes map rendering objects and obtains final transformation matrices through logical threads, stores the map rendering objects and the final transformation matrices in an object storage unit, and obtains the map rendering objects and the final transformation matrices from the object storage unit by a rendering thread to trigger the graphics processing unit to perform map rendering operations, so that asynchronous operations of the logical thread and the rendering thread can be realized. As long as the object storage unit stores the map rendering objects, the rendering thread can continuously perform rendering operations, and the logical thread does not need to wait for the rendering thread to complete the drawing before performing the organization and operation of the next map rendering object, so that the waiting time in the map rendering process can be greatly reduced, thereby improving the map rendering efficiency, and the refresh frame rate of the map can also be improved.
[0042] Further, the rendering thread synchronously obtains the map rendering objects and the final transformation matrices from the object storage unit according to the storage time sequence of the map rendering objects and the final transformation matrices, so that the read and write of the object storage unit are synchronized, the occupation of a large amount of storage space caused by too fast writing speed is avoided, and the situation of waiting caused by too fast reading speed is also avoided, so that the processing resources are efficiently utilized.
[0043] Further, in response to the pose transformation message, the rendering thread determines the transformed map level to be rendered and the tiles of the corresponding map level according to the pose transformation data transmitted by the pose transformation message, obtains the updated final transformation matrix according to the pose transformation data, and determines whether the tiles of the corresponding map level after transformation correspond to the tiles corresponding to the map rendering objects stored in the object storage unit, and when the tiles are consistent, the rendering thread stores the updated final transformation matrix in the object storage unit, so that only the final transformation matrix in the object storage unit needs to be updated, and the logical thread does not need to reorganize the map rendering objects, thereby further saving data processing resources.
[0044] Further, the rendering thread updates the final transformation matrix corresponding to the same tile when the transformed tile of the corresponding map level is consistent with the tile part corresponding to the map rendering object stored in the object storage unit; and the rendering thread transmits a pose transformation message to the logical thread through the main thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data transmitted in the pose transformation message, and acquires the map rendering primitives in the corresponding tile according to the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores the map rendering object into the object storage unit according to the organization order. As can be seen from the above rendering process, the logical thread only needs to re-organize and calculate the map rendering primitives in different tiles, and the rendering thread only needs to update the final transformation matrix in the object storage unit for the same tile, so that the data processing resources can be saved. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1 An execution timing diagram of a map rendering method is shown;
[0046] Figure 2 A flowchart of a map rendering method in an embodiment of the present specification is shown;
[0047] Figure 3 A timing flowchart of a map rendering method in an embodiment of the present specification is shown;
[0048] Figure 4 A map rendering process schematic diagram in an application scenario in an embodiment of the present specification is shown;
[0049] Figure 5 A map rendering process schematic diagram in another application scenario in an embodiment of the present specification is shown;
[0050] Figure 6 A structure schematic diagram of a map rendering system in an embodiment of the present specification is shown;
[0051] Figure 7 A structure schematic diagram of a map rendering terminal in an embodiment of the present specification is shown;
[0052] Figure 8 A structure schematic diagram of a map rendering terminal in an embodiment of the present specification is shown. DETAILED DESCRIPTION
[0053] As mentioned in the background section, currently, map primitive elements are classified and rendered in primitive order. The rendering thread of the Central Processing Unit (CPU) prepares the map rendering primitive data for each primitive. After the map rendering primitive data for each primitive is prepared, it directly sends drawing instructions to the Graphics Processing Unit (GPU). The GPU executes the drawing instructions to render the map primitives. Only after the GPU finishes rendering will the rendering process of the next primitive begin.
[0054] like Figure 1 The diagram illustrates the execution timing of the map rendering method. The CPU rendering thread renders the map primitives according to a preset order. Specifically, the CPU rendering thread starts by drawing the base map primitives, determines the map rendering primitives layer by layer, and organizes the map rendering primitives of the corresponding layers into map rendering objects for the corresponding layers. For example, first, the map rendering primitives of the base map layer are organized into a base map rendering object. Then, the CPU rendering thread directly sends GPU drawing instructions to the GPU kernel, and the GPU executes the drawing operation of the map rendering object of the base map layer. After that, the CPU rendering thread draws the map rendering objects of the road layer in the same way and in the same order, and so on, executing the drawing of map rendering objects of other layers in sequence, until the map rendering objects of all layers of the frame to be rendered have been rendered.
[0055] Through research on the above rendering process, the inventors discovered that the CPU rendering thread can only start drawing the next primitive after the GPU kernel has completed the rendering operation of the previous primitive. The GPU kernel can only draw the map rendering object corresponding to the primitive of the corresponding layer after receiving the GPU drawing instruction for the corresponding layer. Before that, the GPU kernel needs to wait for the CPU rendering thread to organize the map rendering primitive of the corresponding layer into the map rendering object of the corresponding layer. Therefore, in this rendering process, the task processing of the CPU and GPU depends on the completion of the other's task processing. The two wait for each other, which greatly reduces the map rendering performance.
[0056] To solve the above problems, the embodiment of the present specification provides a corresponding rendering scheme, by setting an object storage unit to store map rendering objects and a final transformation matrix, and organizing map rendering objects by a logical thread, the rendering thread obtains the map rendering objects and the final transformation matrix from the object storage unit, and triggers the graphic processing unit to perform map rendering operation, which can realize asynchronous operation of the logical thread and the rendering thread. As long as the object storage unit stores the map rendering objects, the rendering thread can continuously perform rendering operation, and the logical thread does not need to wait for the rendering thread to complete the drawing before executing the organization and operation of the next primitive map rendering object. Therefore, the waiting time in the map rendering process can be greatly reduced, thereby improving the map rendering efficiency and the refresh frame rate of the map rendering terminal.
[0057] To make those skilled in the art better understand and implement the embodiment of the present specification, the following will be described in detail with reference to the accompanying drawings through specific embodiments.
[0058] Referring to Figure 2 In the embodiment of the present specification, two different threads are started for asynchronous processing, wherein the logical thread performs the organization of map rendering objects and the calculation of the final transformation matrix, and the rendering thread interacts with the graphic processing unit to realize map rendering operation. The specific steps are as follows:
[0059] S21, the logical thread obtains corresponding map rendering primitives based on the obtained attitude data, and organizes the map rendering primitives into corresponding map rendering objects.
[0060] In a specific implementation, the logical thread can determine the map level to be rendered and the corresponding map level tile based on the obtained attitude data, and obtain the map rendering primitives in the corresponding tile according to the rendering order, organize the map rendering primitives of the corresponding tile into the map rendering objects of the corresponding tile, and store them in the object storage unit according to the organization order.
[0061] The attitude data can include at least one of map center point data, scale data, view angle, and map angle.
[0062] In some embodiments of the present specification, the logical thread can obtain map center point data, scale data and other attitude data, determine the map level to be rendered according to the scale data, calculate the corresponding geographical range according to the map level to be rendered, the scale data and the range data of the screen, and then determine the number and identification of the map level tile according to the corresponding geographical range and the size of the map level tile.
[0063] As a specific example, the size of a tile can be determined by the coordinates of the top-left vertex and the bottom-right vertex of the tile, the identification of a tile can be implemented by a tile label, the tiles of a corresponding map level can be pre-labeled in a certain order, and the level of a tile, the identification of a tile, and the like can be stored in the map vector data of the corresponding level.
[0064] As can be known from the above embodiments, a logical thread can obtain map rendering primitives in units of tiles and organize the map rendering primitives into corresponding map rendering objects. The map rendering primitives can include various types of primitive data such as roads, surfaces, buildings, and points.
[0065] In specific implementations, map data can be obtained from a local storage space or through a network, the map data can be parsed, and the map rendering primitives contained in the tiles can be obtained. Then, the map rendering primitives contained in the tiles can be organized into corresponding map rendering objects in a format required for rendering.
[0066] S22, the logical thread calculates a final transformation matrix based on the pose data.
[0067] In addition to performing logical operations such as organization of map rendering objects, the logical thread also needs to calculate a final transformation matrix based on pose data. In specific implementations, the logical thread can obtain a corresponding pose transformation matrix P based on map center point data, view angle data, and map angle data, obtain a preset perspective projection matrix T, and obtain a final transformation matrix M by multiplying the two matrices. The formula can be represented as: T*P=M.
[0068] It should be noted that, in specific implementations, the steps S21 and S22 are not strictly limited in time sequence, and step S21 can be performed first or step S22 can be performed first.
[0069] S23, the logical thread stores the map rendering objects and the final transformation matrix in an object storage unit.
[0070] The logical thread can store the map rendering objects and the final transformation matrix obtained through steps S21 and S22 in a preset object storage unit.
[0071] As an optional example, one final transformation matrix can be stored in the object storage unit as the final transformation matrix of all map rendering objects of the map level to be rendered tiles, or one final transformation matrix can be stored in each map rendering object of the map level to be rendered tiles. The specific storage method of the final transformation matrix is not limited in the embodiments of the present disclosure.
[0072] In a specific implementation, the storage space can be preset as the object storage unit. To improve the reading speed, a cache can be used as the object storage unit as a specific example. For example, a first-in first-out (FIFO) cache queue can be selected as the object storage unit.
[0073] In S24, the rendering thread acquires the map rendering object and the final transformation matrix from the object storage unit.
[0074] In S25, the rendering thread sends a rendering instruction to the graphics processing unit to trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix.
[0075] For ease of understanding, steps S24 and S25 are combined and described by way of example as follows. The rendering thread can acquire the map rendering object and the final transformation matrix from the object storage unit according to the storage time sequence of the map rendering object and the final transformation matrix, and sequentially send a rendering instruction to the graphics processing unit to trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix.
[0076] In a specific implementation, the rendering thread can synchronously acquire the map rendering object and the final transformation matrix from the object storage unit according to the storage time sequence of the map rendering object and the final transformation matrix, so that the reading and writing of the object storage unit can be synchronized, the occupation of a large amount of storage space by excessively fast writing can be avoided, and the situation of waiting caused by excessively fast reading can also be avoided, so that the processing resources can be efficiently utilized.
[0077] In the foregoing example, if a FIFO cache queue is used as the object storage unit, as long as there is a map rendering object in the cache queue, the rendering unit can read the map rendering object from the cache queue and trigger the graphics processing unit to perform a subsequent rendering operation, without waiting for the logical thread to store the map rendering objects of all tiles of the level to the object storage unit.
[0078] In some embodiments of the present specification, the graphics processing unit is specifically a GPU, and the rendering thread can call a preset Open Graphics Library (OpenGL) instruction to drive the GPU to perform a drawing operation through a GPU driver. The rendering thread can pass the map rendering object and the final transformation matrix to the GPU for drawing operation through a corresponding OpenGL instruction.
[0079] It can be understood that in specific implementation, the rendering thread can also use other interface instructions to interact with the GPU, to call the GPU to perform specific map rendering operations, and the specific type of interface is not limited in the embodiments of the present specification.
[0080] S26, the graphics processing unit performs a drawing operation on the map rendering object according to the final transformation matrix.
[0081] In specific implementation, the graphics processing unit performs a drawing operation according to the final transformation matrix, and a map rendering picture corresponding to a view angle can be obtained. For example, based on the input pose data, a three-dimensional map corresponding to a view point can be finally rendered.
[0082] From the above rendering process, it can be seen that the logical thread organizes the map rendering object and calculates the final transformation matrix, stores the map rendering object and the final transformation matrix in the object storage unit, and the rendering thread obtains the map rendering object and the final transformation matrix from the object storage unit, to trigger the graphics processing unit to perform a map rendering operation. Asynchronous operation of the logical thread and the rendering thread can be realized. As long as the object storage unit stores the map rendering object, the rendering thread can continuously perform the rendering operation, and the logical thread does not need to wait for the rendering thread to complete the drawing before performing the organization and operation of the next map rendering object of the primitive. Therefore, the waiting time in the map rendering process can be greatly reduced, and the map rendering efficiency can be improved.
[0083] In addition, since the waiting time in the map rendering process can be reduced, the refresh frame rate of the map can also be improved.
[0084] Referring to Figure 3 A timing flow chart of a map rendering method is shown. In a certain CPU, two independent threads, a CPU logical thread and a CPU rendering thread, can be run. The CPU logical thread mainly performs the acquisition of map rendering primitives, the organization of map rendering objects, and the calculation of final transformation matrices based on the acquired pose data. The CPU rendering thread can perform a drawing operation of the map rendering object corresponding to the corresponding map primitive. A cache queue is used to store the map rendering object and the final transformation matrix.
[0085] In specific implementation, the CPU logical thread can obtain pose data such as map center point data and scale data. The map level to be rendered is determined according to the scale data. The corresponding geographical range is calculated according to the scale data, the range data of the screen, and the map level tile size, and the number and identification of the map level tiles are determined according to the corresponding geographical range and the map level tile size.
[0086] Afterwards, the CPU logical thread can obtain the map rendering primitives of the corresponding layer in the rendering order of the primitives of each tile, and organize the map rendering primitives of the corresponding layer, so as to obtain the rendering object of the primitives of the corresponding layer. For the convenience of description, it can be referred to as "primitives" hereinafter. Figure 3 According to the rendering order of the layers, the CPU logical thread can first organize the base map primitives to obtain the base map primitive rendering object and output it to the cache queue, then organize the road primitives to obtain the road primitive rendering object and output it to the cache queue, then organize the building primitives to obtain the building primitive rendering object and output it to the cache queue, and so on, to sequentially organize other primitives to obtain the primitive rendering objects of other primitives and output them to the cache queue, until the rendering objects of all primitives corresponding to the map layer are output to the cache queue, that is, the logical operation of the frame picture is realized. Figure 1
[0087] Continuing to refer to Figure 3 After the primitives rendering objects are stored in the cache queue, the CPU rendering thread can sequentially obtain the corresponding rendering objects from the cache queue in the order of storage, and issue a drawing instruction to the GPU (not shown in the figure), and the GPU sequentially executes the drawing operation of the corresponding primitives, specifically, sequentially executes the drawing of the map primitive rendering object, the drawing of the road primitive rendering object, the drawing of the building layer rendering object and the drawing of other primitive rendering objects.
[0088] As can be seen from the above, the CPU logical thread performs logical operation processes such as organization of map rendering objects and calculation of final transformation matrix, and the CPU rendering thread reads the primitive rendering objects and final transformation matrix from the cache queue in the order of first in first out, and interacts with the GPU to sequentially draw the corresponding primitive rendering objects. The process of the CPU logical thread and the CPU rendering thread controlling the GPU for map rendering is relatively independent, as long as there are primitive rendering objects in the cache queue, the CPU thread can perform map rendering, and the CPU rendering thread does not need to wait in the organization and calculation process of the CPU logical thread, and the two are executed asynchronously, so as to improve the map rendering efficiency.
[0089] During the map rendering process, the attitude data of the map will usually change continuously. For example, during the driving of a vehicle, the attitude data such as the center point of the map and the elevation angle may change in real time, or due to user interaction, the center point of the map, the scale, the coordinate system and the like may also change.
[0090] Based on the changes of the above attitude data obtained in real time, the corresponding attitude transformation message can be generated. In an embodiment of the present specification, as shown in Figure 4 The map rendering process diagram of the application scenario shown, for example, a navigation application software, in the running process, the user can interact through the client, if in response to a client gesture interaction event, generate a pose transformation message, in some embodiments of the present specification, the pose transformation message can be delivered to the logical thread, the logical thread can obtain pose data from the pose transformation message, and then the map rendering method shown in the foregoing embodiments of the present specification can be used to re-render the map, wherein the logical thread reacquires the corresponding map rendering primitives based on the updated pose data, and calculates the updated final transformation matrix based on the updated pose data, and organizes the updated map rendering object of the map rendering primitive, and then the logical thread can send the updated map rendering object and the final transformation matrix to the rendering object pool, here the rendering object pool is used as the object storage unit, so that the rendering thread can obtain the updated map rendering object and the updated final transformation matrix from the rendering object pool, and perform drawing operation on the updated map rendering object according to the updated final transformation matrix.
[0091] In some other embodiments of the present specification, in order to further improve the rendering efficiency, when the pose is updated, the rendering thread can determine the update range of the data in the object storage unit (such as the rendering object pool) based on the pose transformation data, and then use different processing mechanisms for processing.
[0092] In specific implementation, in response to the pose transformation message, the rendering thread determines the transformed to-be-rendered map level and the corresponding map level tile according to the pose transformation data delivered by the pose transformation message, and determines whether the transformed corresponding map level tile is consistent with the tile corresponding to the map rendering object stored in the object storage unit according to the updated final transformation matrix obtained from the pose transformation data.
[0093] The following will be described respectively according to the different update ranges of the data in the object storage unit.
[0094] 1) The transformed corresponding map level tile is consistent with the tile corresponding to the map rendering object stored in the object storage unit
[0095] When it is determined that the transformed corresponding map level tile is consistent with the tile corresponding to the map rendering object stored in the object storage unit, the rendering thread can store the updated final transformation matrix to the object storage unit.
[0096] 2) The rendering thread in the transformed corresponding map level tile is partially consistent with the tile corresponding to the map rendering object stored in the object storage unit
[0097] In a case where it is determined that the transformed tile of the corresponding map level is consistent with the tile corresponding to the map rendering object stored in the object storage unit, the rendering thread updates the final transformation matrix corresponding to the tile for the same tile, and transmits a pose transformation message to the logical thread through the main thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data transmitted in the pose transformation message, and obtains the map rendering primitives in the corresponding tile according to the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores the map rendering object into the object storage unit according to the organization order.
[0098] 3) the rendering thread determines that the transformed tile of the corresponding map level is completely different from the tile corresponding to the map rendering object stored in the object storage unit
[0099] In a case where the rendering thread determines that the transformed tile of the corresponding map level is completely different from the tile corresponding to the map rendering object stored in the object storage unit, the main thread transmits a pose transformation message to the logical thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data transmitted in the pose transformation message, and obtains the map rendering primitives in the corresponding tile according to the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores the map rendering object into the object storage unit according to the organization order.
[0100] As shown in the map rendering process diagram, for example, a navigation application software, in the running process, the user can interact through the client, if responding to a gesture interaction event of a client, a pose transformation message is generated, in some other embodiments of the present specification, the pose transformation message can be transmitted to the rendering thread, the rendering thread can determine the map level to be rendered and the tile of the corresponding map level after transformation according to the pose transformation data transmitted in the pose transformation message, and obtain the updated final transformation matrix according to the pose transformation data, and determine whether the tile of the corresponding map level after transformation is consistent with the tile corresponding to the map rendering object stored in the object storage unit. Figure 5
[0101] In a case where it is determined that the transformed tile of the corresponding map level is consistent with the tile corresponding to the map rendering object stored in the object storage unit, the rendering thread can store the updated final transformation matrix into the object storage unit, so that only the final transformation matrix in the object storage unit needs to be updated, and the logical thread does not need to reorganize the map rendering object, so that the data processing resources can be further saved.
[0102] When it is determined that the transformed tile of the corresponding map level is consistent with the tile corresponding to the map rendering object stored in the object storage unit, the rendering thread can update the final transformation matrix corresponding to the tile in the rendering object pool for the same tile, and for different tiles, the main thread can pass a pose transformation message to the logical thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data passed in the pose transformation message, obtains the map rendering primitives in the corresponding tile in the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores it in the object storage unit in the organization order. As can be seen from the above rendering process, the logical thread only needs to re-organize and calculate the map rendering primitives in different tiles, and for the same tile, the rendering thread only needs to update the final transformation matrix in the object storage unit, so that the data processing resources can be saved.
[0103] Finally, when the transformed tile of the corresponding map level is completely inconsistent with the tile corresponding to the map rendering object stored in the object storage unit, the main thread can pass a pose transformation message to the logical thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data passed in the pose transformation message, obtains the map rendering primitives in the corresponding tile in the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores it in the object storage unit in the organization order.
[0104] In specific implementations, the gesture interaction event can be a center point translation event, a scale zoom-in / zoom-out event, a view angle transformation event, and the like.
[0105] In specific implementations, in addition to triggering the generation of the pose transformation message based on the gesture interaction event, there can be multiple ways or application scenarios that can trigger the generation of the pose transformation message, for example, in response to interactive navigation movement, the generation of the pose transformation message can be triggered, and for another example, in response to interactive control voice, the generation of the pose transformation message can be triggered.
[0106] The above are only exemplary scenarios that can trigger the generation of the pose transformation message and the corresponding actions of the scenarios, and do not constitute a limitation on the protection scope of the present application.
[0107] The embodiments of the present application also provide a system, a terminal, and the like corresponding to the map rendering method in the above-mentioned embodiments. The following will be described in detail with reference to the accompanying drawings.
[0108] Reference Figure 6 The structure of the map rendering system is shown in FIG. 1. In some embodiments of the present application, as shown in FIG. 1, the map rendering system can include a main thread, a logical thread, a rendering thread, a rendering object pool, and an object storage unit. Figure 6As shown, the map rendering system 60 can include a logic processing unit 61, a rendering unit 62, an object storage unit 63 and a graphics processing unit 64, wherein:
[0109] The object storage unit 63 is adapted to store the map rendering objects and the final transformation matrix;
[0110] The logic processing unit 61 is adapted to run the logic thread to obtain the map rendering primitives corresponding to the obtained pose data, organize the map rendering primitives into the corresponding map rendering objects, and calculate the final transformation matrix based on the pose data, and store the map rendering objects and the final transformation matrix to the object storage unit;
[0111] The rendering unit 62 is adapted to run the rendering thread to obtain the map rendering objects and the final transformation matrix from the object storage unit, and send a rendering instruction to the graphics processing unit 64 to trigger the graphics processing unit to perform the drawing operation on the map rendering objects according to the final transformation matrix;
[0112] The graphics processing unit 64 is adapted to perform the drawing operation on the map rendering objects according to the final transformation matrix in response to the rendering instruction.
[0113] With the above map rendering system, the logic thread is run by the logic processing unit to organize the map rendering objects and calculate the final transformation matrix, the object storage unit is set to store the map rendering objects and the final transformation matrix, the rendering thread is run by the rendering unit to obtain the map rendering objects and the final transformation matrix from the object storage unit, and the graphics processing unit is triggered to perform the map rendering operation. Asynchronous operation of the logic thread and the rendering thread can be realized. As long as the object storage unit stores the map rendering objects, the rendering thread can be run by the rendering unit to continuously perform the rendering operation, and the logic processing unit does not need to wait for the rendering unit to complete the drawing before performing the organization and operation of the next primitive map rendering object. Therefore, the waiting time in the map rendering process can be greatly reduced, the map rendering efficiency can be improved, and the refresh frame rate of the map can be improved.
[0114] Reference Figure 6 In specific implementation, the logic processing unit 61 is adapted to run the logic thread to determine the map level to be rendered and the corresponding map tiles of the map level based on the obtained pose data, obtain the map rendering primitives in the corresponding map tiles according to the rendering order, organize the map rendering primitives in the corresponding map tiles into the map rendering objects of the corresponding map tiles, and store the map rendering objects of the corresponding map tiles to the object storage unit 63 according to the organization order.
[0115] In specific implementation, the attitude data can include map center point data, scale data, etc. As a specific example, the logic processing unit 61 is adapted to run the logic thread to determine a map level to be rendered according to the scale data, calculate a corresponding geographical range according to the map level to be rendered, the scale data and range data of a screen, and determine the number and identification of map tiles of the corresponding map level according to the corresponding geographical range and the size of the map level tiles.
[0116] In specific implementation, the rendering unit 62 is adapted to run the rendering thread to acquire the map rendering objects and the final transformation matrix from the object storage unit 63 according to the storage timing of the map rendering objects and the final transformation matrix, and sequentially send rendering instructions to the graphics processing unit 64 to trigger the graphics processing unit 64 to perform drawing operations on the map rendering objects according to the final transformation matrix.
[0117] As an optional example, the rendering unit 62 is adapted to run the rendering thread to synchronously acquire the map rendering objects and the final transformation matrix from the object storage unit 63 according to the storage timing of the map rendering objects and the final transformation matrix.
[0118] In specific implementation, the rendering unit 62 running the rendering thread is further adapted to, in response to an attitude transformation message, determine a transformed map level to be rendered and map tiles of the corresponding map level according to attitude transformation data delivered by the attitude transformation message, obtain an updated final transformation matrix according to the attitude transformation data, and determine whether the transformed map tiles of the corresponding map level are consistent with the map rendering objects stored in the object storage unit according to the attitude transformation data, and store the updated final transformation matrix to the object storage unit 63 when consistent.
[0119] In specific implementation, the rendering unit 62 running the rendering thread is further adapted to, when the transformed map tiles of the corresponding map level are partially consistent with the map rendering objects stored in the object storage unit 63, update the final transformation matrix corresponding to the same map tiles stored in the object storage unit 63, and for different map tiles, pass an attitude transformation message to the logic thread through the main thread, so that the logic thread re-determines the map level to be rendered and the map tiles of the corresponding map level based on the attitude data delivered by the attitude transformation message, acquires map rendering primitives in the corresponding map tiles according to the rendering order, organizes the map rendering primitives of the corresponding map tiles into map rendering objects of the corresponding map tiles, and stores to the object storage unit 63 according to the organization order.
[0120] In a specific implementation, the rendering unit 62 executes the rendering thread and is also adapted to transmit a pose transformation message to the logic thread through the main thread when the tiles of the corresponding map level after transformation are completely different from the tiles corresponding to the map rendering objects stored in the object storage unit 63. This allows the logic thread to redetermine the map level to be rendered and the tiles of the corresponding map level based on the pose data transmitted in the pose transformation message, and to obtain the map rendering primitives in the corresponding tiles according to the rendering order. The map rendering primitives of the corresponding tiles are then organized into map rendering objects of the corresponding tiles and stored in the object storage unit 63 according to the organization order.
[0121] In specific implementation, the map rendering unit can be application software that needs to perform map rendering, such as navigation software, map software, or browsers or mini-programs that include map rendering functions. The map rendering system can be coupled to the browser or mini-program as a plug-in or module, or built into it.
[0122] This specification also provides corresponding map rendering terminals in its embodiments, see below. Figure 7 The schematic diagram of the map rendering terminal shown illustrates that the map rendering terminal 70 may include: a microprocessor 71, a graphics processor 72, and a memory 73, wherein:
[0123] The microprocessor 71 is adapted to run a logic thread to acquire corresponding map rendering primitives based on the acquired pose data, organize the map rendering primitives into corresponding map rendering objects, and calculate a final transformation matrix based on the pose data, and store the map rendering objects and the final transformation matrix in a memory; and to run a rendering thread to acquire the map rendering objects and the final transformation matrix from the memory, and send a rendering command to the graphics processor to trigger the graphics processor to perform a drawing operation on the map rendering objects according to the final transformation matrix;
[0124] The graphics processor 72 is adapted to respond to rendering instructions and perform drawing operations on the map rendering object according to the final transformation matrix, based on the map rendering object passed by the rendering thread and the final transformation matrix.
[0125] The memory 73 is adapted to store the map rendering object and the final transformation matrix.
[0126] In specific implementation, the microprocessor 71 is further adapted to run the rendering thread to determine a transformed to-be-rendered map level and a tile of the corresponding map level according to pose transformation data delivered by the pose transformation message in response to the pose transformation message, and to obtain an updated final transformation matrix according to the pose transformation data, and to determine whether the tile of the corresponding map level after transformation is consistent with a tile corresponding to a map rendering object stored in the memory 73, and to directly update the final transformation matrix in the memory or trigger the logic thread to reorganize the map rendering object according to a judgment result.
[0127] The specific and different execution logic adopted by the microprocessor 71 according to the judgment result can be referred to the corresponding example description of the aforementioned map rendering method, and will not be described here.
[0128] In specific implementation, the memory 73 can be a cache queue.
[0129] The embodiments of the present specification further provide another map rendering terminal, which can be referred to the aforementioned map rendering terminal. Figure 8 The map rendering terminal 80 comprises a memory 81, a microprocessor 82 and a graphics processor 83, wherein the memory 81 stores computer instructions executable on the microprocessor, the microprocessor 82 executes the steps of the method according to any one of the aforementioned embodiments when executing the computer instructions; and the graphics processor 83 performs rendering operation based on rendering instructions of the microprocessor 82.
[0130] In specific implementation, the map rendering terminal can further comprise a display 84 adapted to display a map rendered by the graphics processor 83. As an optional solution, the display 84 can also be an external device.
[0131] The map rendering terminal can be specifically a car machine device, a handheld terminal such as a mobile phone, a terminal device such as a tablet computer, etc.
[0132] The embodiments of the present specification further provide a computer readable storage medium having computer instructions stored thereon, wherein the computer instructions can execute the steps of the method according to any one of the aforementioned embodiments when running.
[0133] In specific implementation, the computer readable storage medium can be an optical disc, a mechanical hard disk, a solid state disk and various appropriate readable storage media.
[0134] Although the embodiments of the present specification are disclosed as above, the present application is not limited thereto. Any person skilled in the art can make various modifications and changes without departing from the spirit and scope of the present application, and the protection scope of the present application should be subject to the scope defined by the claims.
Claims
1. A map rendering method, wherein, Comprise: Logical thread: Based on the obtained attitude data, obtain the corresponding map rendering primitive, organize the map rendering primitive into the corresponding map rendering object, obtain the final transformation matrix based on the attitude data, and store the map rendering object and the final transformation matrix to the object storage unit; Rendering thread: Obtain the map rendering object and the final transformation matrix from the object storage unit, send a rendering instruction to the graphics processing unit, and trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix; Wherein, the logical thread and the rendering thread operate asynchronously.
2. The method of claim 1, wherein, Based on the obtained attitude data, obtain the corresponding map rendering primitive, organize the map rendering primitive into the corresponding map rendering object, comprising: Based on the obtained attitude data, determine the to-be-rendered map level and the corresponding map level tile, and obtain the map rendering primitive in the corresponding tile according to the rendering order, organize the map rendering primitive of the corresponding tile into the map rendering object of the corresponding tile, and store it to the object storage unit according to the organization order.
3. The method of claim 2, wherein, The attitude data includes map center point data and scale data, and the determination of the to-be-rendered map level and the corresponding map level tile based on the obtained attitude data comprises: Based on the obtained map center point data and scale data, determine the to-be-rendered map level according to the scale data, calculate the corresponding geographical range according to the to-be-rendered map level, the scale data and the range data of the screen, and determine the number and identification of the corresponding map level tile according to the corresponding geographical range and the size of the map level tile.
4. The method of claim 2, wherein, The map rendering object and the final transformation matrix are obtained from the object storage unit, and a rendering instruction is sent to the graphics processing unit to trigger the graphics processing unit to perform a drawing operation on the map rendering object, comprising: According to the storage time sequence of the map rendering object and the final transformation matrix, the map rendering object and the final transformation matrix are obtained from the object storage unit, and the rendering instruction is sequentially sent to the graphics processing unit to trigger the graphics processing unit to perform a drawing operation on the map rendering object according to the final transformation matrix.
5. The method of claim 4, wherein, According to the storage time sequence of the map rendering object, the map rendering object is obtained from the object storage unit, comprising: According to the storage time sequence of the map rendering object and the final transformation matrix, the map rendering object and the final transformation matrix are synchronously obtained from the object storage unit.
6. The method according to any one of claims 2 to 5, wherein, The rendering thread further performs the following operations: In response to the attitude transformation message, determine the transformed to-be-rendered map level and the corresponding map level tile according to the attitude transformation data transmitted by the attitude transformation message, obtain the updated final transformation matrix according to the attitude transformation data, and determine whether the transformed corresponding map level tile is consistent with the tile corresponding to the map rendering object stored in the object storage unit, and store the updated final transformation matrix to the object storage unit when consistent.
7. The method of claim 6, wherein, The rendering thread further performs the following operations: when the transformed tile of the corresponding map level is consistent with the tile part corresponding to the map rendering object stored in the object storage unit, for the same tile, updating the final transformation matrix corresponding to the tile; for different tiles, passing a pose transformation message to the logical thread through the main thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data passed in the pose transformation message, and acquires the map rendering primitives in the corresponding tile in the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores it to the object storage unit in the organization order.
8. The method of claim 7, wherein, The rendering thread further performs the following operations: when the transformed tile of the corresponding map level is completely inconsistent with the tile corresponding to the map rendering object stored in the object storage unit, passing a pose transformation message to the logical thread through the main thread, so that the logical thread re-determines the map level to be rendered and the tile of the corresponding map level based on the pose data passed in the pose transformation message, and acquires the map rendering primitives in the corresponding tile in the rendering order, organizes the map rendering primitives in the corresponding tile into a map rendering object of the corresponding tile, and stores it to the object storage unit in the organization order.
9. The method of claim 6, wherein, The response to the pose transformation message includes at least one of: a pose transformation message triggered in response to a gesture interaction event; a pose transformation message triggered in response to an interactive navigation movement; a pose transformation message triggered in response to an interactive control voice instruction.
10. A map rendering system, wherein, It includes: an object storage unit adapted to store map rendering objects and final transformation matrices; a logical processing unit adapted to run a logical thread to acquire corresponding map rendering primitives based on acquired pose data, organize the map rendering primitives into corresponding map rendering objects, obtain a final transformation matrix based on the pose data, and store the map rendering objects and the final transformation matrix to the object storage unit; a rendering unit adapted to run a rendering thread to acquire the map rendering objects and the final transformation matrix from the object storage unit, send a rendering instruction to a graphics processing unit, and trigger the graphics processing unit to perform a drawing operation on the map rendering objects according to the final transformation matrix. Wherein, the logical thread and the rendering thread operate asynchronously.
11. A map rendering terminal, wherein, It includes: a microprocessor adapted to run a logical thread to acquire corresponding map rendering primitives based on acquired pose data, organize the map rendering primitives into corresponding map rendering objects, obtain a final transformation matrix based on the pose data, and store the map rendering objects and the final transformation matrix to the memory; and run a rendering thread to acquire the map rendering objects and the final transformation matrix from the memory, and send a rendering instruction to a graphics processor, and trigger the graphics processor to perform a drawing operation on the map rendering objects according to the final transformation matrix; a graphics processor adapted to perform a rendering operation on a map rendering object according to a final transformation matrix in response to a rendering instruction, the rendering instruction being passed by the logic thread and the final transformation matrix being passed by the rendering thread; a memory adapted to store the map rendering object and the final transformation matrix; wherein the logic thread and the rendering thread operate asynchronously.
12. The map rendering terminal of claim 11, wherein, The microprocessor is further adapted to run the rendering thread to determine a transformed map level to be rendered and a tile of the corresponding map level according to pose transformation data passed by the pose transformation message in response to the pose transformation message, to obtain an updated final transformation matrix according to the pose transformation data, to determine whether the tile of the corresponding map level after transformation corresponds to a tile corresponding to the map rendering object stored in the memory according to the pose transformation data, and to directly update the final transformation matrix in the memory or trigger the logic thread to reorganize the map rendering object according to a result of the determination.
13. The map rendering terminal of claim 11 or 12, wherein, The memory is a cache queue.
14. A map rendering terminal comprising a memory, a microprocessor and a graphic processor, said memory having stored thereon computer instructions executable on said microprocessor, wherein, The microprocessor executes the steps of the method of any one of claims 1 to 9 when running the computer instructions; and the graphics processor performs a rendering operation based on a rendering instruction of the microprocessor.
15. A computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions, when executed, perform the steps of the method of any one of claims 1 to 9.
Citation Information
Patent Citations
Map rendering method and device, storage medium and computer program product
CN110047123A
Map drawing method and device
CN110956673A
Incremental generation method of digital orthoimage map and related components
CN113094457A