Image transmission method and device, memory mapping method and image processing method
By configuring the receiving buffer and descriptor in the ultrasonic device, directly copying the ultrasonic image data to shared memory, the problems of image transmission delay and memory resource waste in the ultrasonic device are solved, and low-latency and efficient image transmission is achieved.
Patent Information
- Application Number
- CN202510412995.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-07-22
AI Technical Summary
In existing ultrasonic devices, the image transmission delay between the host and the ultrasonic acquisition device is high, the network IO path is too long, and the buffer management efficiency is low, resulting in waste of memory resources and increased image transmission delay.
By configuring the receiving buffer and the receiving descriptor, the ultrasonic image data is cached in the receiving buffer in shards and copied directly to the target shared memory. Bypassing partial levels of the network protocol stack, the target application can directly read image frames in the shared memory.
It reduces image transmission delay, saves processor computing resources, improves the packet processing efficiency of network card drivers, reduces the workload of target applications, and realizes memory recycling.
Smart Images

Figure CN120353619A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data transmission, and in particular, to an image processing method and apparatus, a memory mapping method and apparatus, an image processing method and apparatus, an electronic device, a storage medium, and a computer program product. Background Art
[0002] In some ultrasonic devices, an ultrasonic acquisition device and a host can be connected through a network cable. A Field-Programmable Gate Array (FPGA) in the ultrasonic acquisition device can transmit image data of an ultrasonic image to the host through a gigabit network. Usually, the FPGA can encapsulate the image data based on Ethernet protocols (such as arp, ip, and udp network protocols, etc.). The host can have a complete network protocol stack function. Correspondingly, an application program in the host for processing ultrasonic images can receive the image data of the ultrasonic image sent by the ultrasonic acquisition device based on the network protocol stack.
[0003] Currently, the transmission between the host and the ultrasonic acquisition device of an ultrasonic device can be implemented based on the standard socket interface communication mechanism of the Ethernet protocol. For some ultrasonic devices, the networking topology of its host and ultrasonic acquisition device is relatively simple, and the image content to be transmitted is relatively simple, but usually requires high transmission performance, such as high frame rate, low latency, etc. However, this communication mechanism has the following problems: (1) Since both the ultrasonic acquisition device and the host use the Ethernet protocol, the network IO path is too long, resulting in a high latency for image transmission; (2) The management efficiency of the buffer for receiving packets is low: The host kernel allocates a physical page for each data frame in the packet received from the FPGA and maps the physical page to a socket buffer for Direct Memory Access (DMA). The storage structure of the packet adopts a chained storage structure. The host kernel allocates header information for the corresponding socket buffer (sk_buff), then unmaps the DMA of the physical page, and adds the physical page as a shard to the sk_buff. Even if the value of the Minimum Transmission Unit (MTU) is increased to reduce the number of required sk_buffs, however, the header information and data copy operations of the chained storage mechanism will be correspondingly more complex. And after unmapping the DMA of the physical page, the physical page is used to store the data frame. Therefore, when receiving a new data frame each time, new physical pages must be reallocated, DMA mapping and corresponding unmapping operations must be performed, and the previous physical pages must be released. This process fails to effectively recycle physical pages, resulting in a waste of memory resources and an increase in the latency of image transmission. Summary of the Invention
[0004] The present invention is proposed in view of the above problems. The present invention provides an image processing method and apparatus, a memory mapping method and apparatus, an image processing method and apparatus, an electronic device, a storage medium, and a computer program product. Such a solution can bypass at least some levels of the network protocol stack when transmitting ultrasonic images, and the transmission delay is relatively low.
[0005] According to one aspect of the present invention, there is provided an image transmission method for transmitting a data packet including a target image frame, the data packet including at least one target data frame, and each target data frame of the at least one target data frame including a plurality of target shards. The method is executed by a network card driver of a network card, and the method includes: configuring a plurality of receive buffers and receive descriptors corresponding to each receive buffer, the receive descriptors being used to indicate the physical addresses of the corresponding receive buffers; for each target data frame of the at least one target data frame, caching the received target data frame in different receive buffers according to the receive descriptors in shards, each receive buffer being used to cache one target shard of the target data frame; copying each target shard from the corresponding receive buffer to a target shared memory according to the receive descriptors, the target shared memory being mapped to both the network card driver and a target application program at the same time, and the target application program being able to directly read the target image frame from the target shared memory through a preset operation interface.
[0006] Optionally, the method further includes: after copying the last target shard of the last target data frame to the target shared memory, sending a notification instruction to the target application program to notify the target application program to read the target image frame.
[0007] Optionally, the first target shard of each target data frame of the at least one target data frame includes header information, the header information includes a data frame end flag bit, and when the value of the data frame end flag bit conforms to a corresponding preset value, it indicates that the corresponding target data frame is the last target data frame of the target image frame. Each receive descriptor corresponding to each target shard includes a shard end flag bit, and when the value of the shard end flag bit conforms to a corresponding preset value, it indicates that the target shard is the last target shard of the target data frame to which it belongs; before sending a notification instruction to the target application program to notify the target application program to read the target image frame, the method further includes: for each target shard, determining whether the target shard is the last target shard of the last target data frame of the target image frame based on the data frame end flag bit in the header information included in the first target shard of the target data frame to which the target shard belongs, and the shard end flag bit of the receive descriptor corresponding to the target shard, and when the values of the data frame end flag bit and the shard end flag bit both conform to the corresponding preset values, determining that the target shard is the last target shard of the last target data frame.
[0008] Optionally, configure multiple receive buffers and the receive descriptors corresponding to each receive buffer, including: allocating multiple physical pages in a preset buffer; performing a mapping operation on the multiple physical pages to convert the multiple physical pages into multiple receive buffers; and configuring a corresponding receive descriptor for each receive buffer among the multiple receive buffers.
[0009] Optionally, in at least one target data frame, each target shard contains image data of a target image frame, and the first target shard of each target data frame contains header information; according to the receive descriptor, copy each target shard from the corresponding receive buffer to the target shared memory, including: when the target shard in the receive buffer corresponding to the receive descriptor is the first target shard, parsing the header information to obtain the target storage address of the target shard in the target shared memory, and copying the target shard from the corresponding receive buffer to the target shared memory; when the target shard in the receive buffer corresponding to the receive descriptor is not the first target shard, according to the target storage address obtained from the recently parsed header information, copying the target shard from the corresponding receive buffer to the target shared memory.
[0010] Optionally, at least one target data frame is received from an ultrasound acquisition device, and the operation of copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor is performed when the packet format of the shard in the receive buffer corresponding to the receive descriptor conforms to a preset packet format; and / or, each time a data frame is transmitted between the ultrasound acquisition device and the network card, the data frame is a target data frame or a non-target data frame that does not belong to the target image frame; before copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: when the packet format of the shard in the receive buffer corresponding to the receive descriptor does not conform to the preset packet format, if the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is greater than a preset length threshold, discarding the non-target data frame, and if the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is less than or equal to the preset length threshold, sending the shard to the upper layer protocol stack for processing.
[0011] Optionally, the receive descriptor corresponding to each shard of the non-target data frame includes a shard end flag bit, and the value of the shard end flag bit conforming to the corresponding preset value indicates that the shard is the last shard of the non-target data frame to which it belongs; the value of the shard end flag bit of the receive descriptor does not conform to the corresponding preset value, indicating that the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is greater than the preset length threshold; the value of the shard end flag bit of the receive descriptor conforms to the corresponding preset value, indicating that the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is less than or equal to the preset length threshold.
[0012] Optionally, the first target shard of each target data frame among at least one target data frame contains header information, and the header information includes target protocol type information of the target data frame; when the protocol type of the data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs conforms to the protocol type indicated by the target protocol type information, it indicates that the packet format of the shard conforms to the preset packet format; when the protocol type of the data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs does not conform to the protocol type indicated by the target protocol type information, it indicates that the packet format of the shard does not conform to the preset packet format.
[0013] Optionally, among at least one target data frame, each target shard contains image data of a target image frame, and the first target shard of each target data frame contains header information, and the header information includes the shard offset of the first target shard in the target data frame to which it belongs, and the receive descriptor includes the image data length of the target shard cached in the corresponding receive buffer; copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor includes: when the target shard in the receive buffer corresponding to the receive descriptor is the first target shard in the current target data frame, obtaining a write pointer; determining the target storage address of the first target shard in the target shared memory based on the write pointer and the shard offset included in the first target shard; for each non-first target shard in the current target data frame, determining the target storage address of the current target shard in the target shared memory based on the target storage address of the previous target shard in the target shared memory and the image data length of the previous target shard; copying the target shard from the corresponding receive buffer to the target shared memory based on the target storage address corresponding to each target shard.
[0014] Optionally, the method further includes: after copying the last target shard of the last target data frame to the target shared memory, updating the write pointer to the end position of the target storage address corresponding to the last target shard of the last target data frame.
[0015] Optionally, the first target shard of each target data frame among at least one target data frame contains header information, the header information contains a data frame end flag bit, and the value of the data frame end flag bit conforming to a corresponding preset value indicates that the corresponding target data frame is the last target data frame of the target image frame. Each receive descriptor corresponding to each target shard contains a shard end flag bit, and the value of the shard end flag bit conforming to a corresponding preset value indicates that the target shard is the last target shard of the target data frame to which it belongs; after copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: for each target shard, based on the data frame end flag bit in the header information contained in the first target shard of the target data frame to which the target shard belongs, and the shard end flag bit of the receive descriptor corresponding to the target shard, determining whether the target shard is the last target shard of the last target data frame. When the values of the data frame end flag bit and the shard end flag bit both conform to the corresponding preset values, it is determined that the target shard is the last target shard of the last target data frame.
[0016] Optionally, before copying each target shard from the corresponding receive buffer to the target shared memory for each target data frame among at least one target data frame, the method further includes: initializing a preset identifier to a first value; during the process of copying each target shard from the corresponding receive buffer to the target shared memory for each target data frame among at least one target data frame, the method further includes: after copying the first target shard of each target data frame from the corresponding receive buffer to the target shared memory according to the receive descriptor, setting the preset identifier to a second value; after copying the last target shard of each target data frame from the corresponding receive buffer to the target shared memory according to the receive descriptor, setting the preset identifier to the first value; before copying each target shard from the corresponding receive buffer to the target shared memory, the method further includes: when the preset identifier is the first value, determining that the shard in the receive buffer corresponding to the receive descriptor is the first shard of the data frame to which it belongs; when the preset identifier is the second value, determining that the shard in the receive buffer corresponding to the receive descriptor is a non-first target shard of the target data frame to which it belongs.
[0017] Optionally, the network card driver runs on a host, the host is connected to an ultrasound acquisition device, and the ultrasound acquisition device is configured to transmit at least one data frame to the network card of the host; the maximum transmission unit when transmitting image data between the network card driver and the ultrasound acquisition device is larger than the maximum transmission unit when transmitting other types of data other than image data, and the maximum transmission unit is the amount of data transmitted in a single transmission.
[0018] According to another aspect of the present invention, there is also provided a memory mapping method, which is executed by a character driver. The method includes: when the character driver is loaded, calling the initialization interface of the character driver; mapping the reserved physical memory as a kernel virtual address through the initialization interface for the above network card driver to write data; in response to the call operation of the above target application to the first operation interface, mapping the reserved physical memory as a process virtual address for the target application to read data; wherein the target shared memory is the reserved physical memory.
[0019] Optionally, the method further includes: providing a second operation interface to the network card driver, and the network card driver obtains a write pointer by calling the second operation interface, where the write pointer is used to determine the target storage address corresponding to the image data of the target image frame when being copied to the target shared memory; providing a third operation interface to the network card driver, and after the network card driver notifies the target application to read the target image frame, updating the write pointer by calling the third operation interface.
[0020] Optionally, the method further includes: providing a fourth operation interface to the target application, and the target application obtains a read pointer by calling the fourth operation interface to read the target image frame in the target shared memory; providing a fifth operation interface to the target application, and after the target application performs a preset image processing operation on the target image frame, updating the read pointer by calling the fifth operation interface.
[0021] According to still another aspect of the present invention, there is also provided an image processing method, which is executed by the above target application. The method includes: when receiving the notification instruction of the above network card driver, reading the target image frame in the target shared memory; performing a preset image processing operation on the target image frame.
[0022] Optionally, reading the target image frame in the target shared memory includes: obtaining a read pointer by calling the fourth operation interface provided by the character driver to read the target image frame in the target shared memory; after performing a preset image processing operation on the target image frame, the method further includes: updating the read pointer by calling the fifth operation interface provided by the character driver.
[0023] According to another aspect of the present invention, there is also provided an image transmission device for transmitting data packets containing target image frames. The data packets include at least one target data frame, and each target data frame of the at least one target data frame includes a plurality of target shards. The device includes: a configuration module for configuring a plurality of receive buffers and receive descriptors corresponding to each receive buffer, where the receive descriptors are used to indicate the physical addresses of the corresponding receive buffers; a caching module for, for each target data frame of the at least one target data frame, caching the target shards of the target data frame received from the ultrasonic acquisition device in different receive buffers according to the receive descriptors, and each receive buffer is used to cache one target shard of the target data frame; a copy module for copying each target shard from the corresponding receive buffer to a target shared memory according to the receive descriptors, where the target shared memory is mapped to both the image transmission device and the target application program, and the target application program can directly read the target image frame from the target shared memory through a preset operation interface.
[0024] According to another aspect of the present invention, there is also provided a memory mapping device. The device includes: a call module for calling the initialization interface of the memory mapping device when the memory mapping device is loaded; a first mapping module for mapping the reserved physical memory as a kernel virtual address through the initialization interface for the above-mentioned network card driver to write data; a second mapping module for, in response to the call operation of the above-mentioned target application program on the first operation interface, mapping the reserved physical memory as a process virtual address for the target application program to read data; where the target shared memory is the reserved physical memory.
[0025] According to another aspect of the present invention, there is also provided an image processing device. The device includes: a reading module for reading the target image frame in the target shared memory when receiving the notification instruction of the above-mentioned network card driver; an execution module for performing a preset image processing operation on the target image frame.
[0026] According to another aspect of the present invention, there is also provided an electronic device, including: a processor and a memory, where computer program instructions are stored in the memory, and when the computer program instructions are run by the processor, they are used to execute the above-mentioned image transmission method or the above-mentioned memory mapping method or the above-mentioned image processing method.
[0027] According to another aspect of the present invention, there is also provided a storage medium on which program instructions are stored, and when the program instructions are run, they are used to execute the above-mentioned image transmission method or the above-mentioned memory mapping method or the above-mentioned image processing method.
[0028] According to another aspect of the present invention, there is also provided a computer program product, including computer program instructions which are used to execute the image transmission method, the memory mapping method or the image processing method as described above when running.
[0029] In the above technical solution, each target shard of each data frame of the target image frame is directly copied from the receive buffer to the target shared memory, so that the target application program can directly read the target image frame in the target shared memory. This can bypass at least some levels of the network protocol stack, save the computing resources of the processor, and effectively shorten the latency of transmitting the image. In addition, by copying the target image frame to the target shared memory, the target application program does not have to prepare its own memory and frequently receive the image data of the target image frame, which is also beneficial to reducing the workload of the target application program. On the other hand, since the receive buffer and the corresponding receive descriptors can be pre-configured, the receive buffer can be regarded as a transit area for image data and can be recycled during the entire transmission process of the target image frame without considering the allocation and release of the receive buffer, and the packet processing efficiency of the network card driver can be greatly improved.
[0030] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are specifically given below. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] By describing the embodiments of the present invention in more detail in conjunction with the drawings, the above and other purposes, features and advantages of the present invention will become more obvious. The drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the description, and are used to explain the present invention together with the embodiments of the present invention, and do not constitute a limitation to the present invention. In the drawings, the same reference numerals generally represent the same components or steps.
[0032] Figure 1 FIG. shows a schematic flowchart of an image transmission method according to an embodiment of the present invention;
[0033] Figure 2 FIG. shows a schematic diagram of each target data frame of a single target image frame according to an embodiment of the present invention;
[0034] Figure 3 FIG. shows a schematic diagram of the network card driver writing data to the target shared memory and the target application program reading data from the target shared memory according to an embodiment of the present invention;
[0035] Figure 4 FIG. shows a schematic diagram of a shard whose packet format conforms to a preset packet format according to an embodiment of the present invention;
[0036] Figure 5 A schematic diagram of a receive descriptor according to an embodiment of the present invention is shown;
[0037] Figure 6 A schematic diagram of the operation logic of a network card driver according to an embodiment of the present invention is shown;
[0038] Figure 7 A schematic diagram of the operation flow of a character driver, a network card driver, and a target application program according to an embodiment of the present invention is shown. Detailed implementation manners
[0039] In order to make the objectives, technical solutions, and advantages of the present invention more obvious, exemplary embodiments according to the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments of the present invention. It should be understood that the present invention is not limited by the exemplary embodiments described herein. Based on the embodiments of the present invention described herein, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
[0040] To at least partially solve the above technical problems, embodiments of the present invention provide an image processing method and apparatus, a memory mapping method and apparatus, an image processing method and apparatus, an electronic device, a storage medium, and a computer program product. This solution can bypass at least some levels of the network protocol stack when transmitting ultrasonic images, and the transmission delay is relatively low.
[0041] Please refer to Figure 1 As shown, it is a schematic flowchart of an image transmission method according to an embodiment of the present invention. According to one aspect of the present invention, an image transmission method is provided for transmitting a data packet containing a target image frame. The data packet includes at least one target data frame, and each target data frame of the at least one target data frame includes a plurality of target shards. The method is executed by a network card driver of a network card, and the method includes: step S110, step S120, and step S130.
[0042] Exemplarily, the target image frame in the embodiments of the present invention refers to an ultrasonic image collected by an ultrasonic device. The ultrasonic device may include a host and an ultrasonic acquisition device. The ultrasonic acquisition device may include a front end board, or may include a front end board and a probe. The FPGA in the front end board may transmit the data packet of the target image frame to the host. The target image frame may be an ultrasonic image collected for any target tissue. For example, it may be an intravascular ultrasonic image collected for a target blood vessel. For each target image frame, the data packet of the target image frame may include one or more target data frames, and each target data frame may include at least part of the image data of the target image frame. When the data volume of the image data of the target image frame is greater than the maximum transmission unit of the FPGA, the number of target data frames included in the data packet of the target image frame is multiple, and the data volume of each target data frame does not exceed the maximum transmission unit of the FPGA.
[0043] In step S110, configure a plurality of receive buffers and the receive descriptors corresponding to each receive buffer. The receive descriptors are used to indicate the physical addresses of the corresponding receive buffers.
[0044] Exemplarily, when the target data frame is transmitted to the physical layer of the host, the network card driver in the host may configure a plurality of receive buffers. Each receive buffer has a cache capacity. The number of configured receive buffers may be determined based on the data volume of the target data frame, or based on the maximum transmission unit of the FPGA. It can be understood that the total cache capacity of the configured plurality of receive buffers is greater than or equal to the data volume of the target data frame. When configuring a plurality of receive buffers, the receive descriptors corresponding to each buffer may be configured accordingly. Taking the e1000 network card as an example, the network card driver of the e1000 network card may be configured with 256 receive descriptors. Accordingly, receive buffers corresponding to the 256 receive descriptors may be configured. The receive descriptor may at least indicate the physical address of the corresponding receive buffer, and may also indicate the length (i.e., cache capacity) of the corresponding receive buffer, status information (such as an error flag for indicating whether an error occurs in the transmission of the data in the corresponding receive buffer, an end flag for indicating whether the transmission is completed), etc.
[0045] In step S120, for each target data frame of at least one target data frame, according to the receive descriptor, the received target data frame is fragmented and cached in different receive buffers, and each receive buffer is used to cache one target fragment of the target data frame.
[0046] Exemplarily, each received target data frame can be cached in different receiving buffers in the form of shards, and each receiving buffer can cache one target shard of the target data frame. In other words, during the process of caching the target data frame into the receiving buffer, the target data frame is divided into multiple target shards. Among them, the data volume of each target shard does not exceed the cache capacity of a single receiving buffer. For each target data frame, part of the data of the target data frame can be cached into the receiving buffer corresponding to the current receive descriptor according to the current receive descriptor, and the data in this receiving buffer can be regarded as one target shard of the target data frame. For example, if the data volume of a target data frame is 9000B and the cache capacity of a receiving buffer is 4096B, this target data frame can be divided into 3 target shards, and can be cached in 3 different receiving buffers respectively according to the receive descriptor, and the data volumes of the 3 target shards can be 4096B, 4096B, and 808B respectively. Please refer to Figure 2 shown, which is a schematic diagram of each target data frame of a single target image frame according to an embodiment of the present invention. In Figure 2 the illustrated embodiment, the target image frame ( Figure 2 shown as "image frame") can include N target data frames ( Figure 2 shown as Ethernet data frames), and each target data frame can be divided into N target shards ( Figure 2 shown as frag1-fragN).
[0047] In step S130, according to the receive descriptor, each target shard is copied from the corresponding receiving buffer to the target shared memory. The target shared memory is simultaneously mapped to the network card driver and the target application program, and the target application program can directly read the target image frame from the target shared memory through a preset operation interface.
[0048] Exemplarily, the network card driver can copy the target shard in the corresponding receiving buffer to the target shared memory according to the receive descriptor. Specifically, the target shared memory can be a physical memory of the host kernel, and this physical memory can be mapped to the network card driver and the target application program at the same time. The network card driver can directly write data to the target shared memory. For example, it can copy the target shard in the receiving buffer to the receiving buffer. The target application program can directly read data from the target shared memory through a preset operation interface. For example, the image data of the target image frame written to the target shared memory by the network card driver.
[0049] In the above technical solution, each target shard of each data frame of the target image frame is directly copied from the receive buffer to the target shared memory, so that the target application can directly read the target image frame in the target shared memory. This can bypass at least some levels of the network protocol stack, save the computing resources of the processor, and effectively reduce the latency of image transmission. In addition, by copying the target image frame to the target shared memory, the target application does not need to prepare its own memory and frequently receive the image data of the target image frame, which is also beneficial to reducing the workload of the target application. On the other hand, since the receive buffer and the corresponding receive descriptors can be pre-configured, the receive buffer can be regarded as a transit area for image data and can be recycled during the entire transmission process of the target image frame without considering the allocation and release of the receive buffer, which can greatly improve the packet processing efficiency of the network card driver.
[0050] Optionally, the method further includes: after copying the last target shard of the last target data frame to the target shared memory, sending a notification instruction to the target application to notify the target application to read the target image frame.
[0051] Exemplarily, after copying the last target shard of the last target data frame to the target shared memory, the network card driver can send a notification instruction to the target application. After receiving the notification instruction, the target application can read the target image frame in the target shared memory. In other words, after copying all the image data of the target image frame to the target shared memory, the network card driver can send a notification instruction to the target application.
[0052] The above technical solution can notify the target application to read the image data after all the image data of the target image frame is copied to the target shared memory. That is to say, the target application does not need to read the target shared memory immediately every time a target shard is copied to the target shared memory by the network card driver. In particular, in the existing packet transmission technology based on sk_buff, the target application needs to process and move the data in each sk_buff. Compared with the existing packet transmission technology based on sk_buff, this greatly reduces the running burden of the target application process.
[0053] Optionally, the first target shard of each target data frame among at least one target data frame contains header information, and the header information contains a data frame end flag bit. When the value of the data frame end flag bit conforms to the corresponding preset value, it indicates that the corresponding target data frame is the last target data frame of the target image frame. Each receive descriptor corresponding to a target shard contains a shard end flag bit. When the value of the shard end flag bit conforms to the corresponding preset value, it indicates that the target shard is the last target shard of the target data frame to which it belongs; Before sending a notification instruction to the target application to notify the target application to read the target image frame, the method further includes: for each target shard, based on the data frame end flag bit in the header information contained in the first target shard of the target data frame to which the target shard belongs, and the shard end flag bit of the receive descriptor corresponding to the target shard, determine whether the target shard is the last target shard of the last target data frame of the target image frame. When the values of the data frame end flag bit and the shard end flag bit both conform to the corresponding preset values, determine that the target shard is the last target shard of the last target data frame.
[0054] Exemplarily, for each target data frame of at least one target data frame, the first target shard of the target data frame may include header information. The header information may include a data frame end flag bit, and may also optionally include one or more pieces of information such as a destination Media Access Control (MAC) address, a source MAC address, target protocol type information, a fragment offset, etc. When the value of the data frame end flag bit conforms to the corresponding preset value, it may indicate that the corresponding target data frame is the last target data frame of the target image frame. The preset value of the data frame end flag bit may be, for example, a preset numerical value, a preset character, etc. The receive descriptor corresponding to at least a part of the target shards of each target data frame of the at least one target data frame may include a shard end flag bit. For example, it may be that only the receive descriptor corresponding to the last target shard of the target data frame includes the shard end flag bit. Another example is that the receive descriptor corresponding to each target shard of each target data frame may also include the shard end flag bit. When the value of the shard end flag bit of the receive descriptor conforms to the corresponding preset value, it may indicate that the target shard corresponding to the receive descriptor is the last target shard of the target data frame to which it belongs. Similarly, the preset value of the shard end flag bit may be, for example, a preset numerical value, a preset character, etc. Exemplarily, before the network card driver sends a notification instruction to the target application, for each target shard of each target data frame, it may first determine whether the target shard is the last target shard of the last target data frame of the target image frame. Specifically, if the value of the data frame flag bit in the header information included in the first target shard of the target data frame to which the target shard belongs conforms to the corresponding preset value, it may be determined that the target data frame to which the target shard belongs is the last data frame of the target image frame. If the value of the shard end flag bit of the receive descriptor corresponding to the target shard conforms to the corresponding preset value, it may be determined that the target shard is the last target shard of the data frame to which it belongs. It can be understood that when the values of both the data frame end flag bit and the shard end flag bit conform to the corresponding preset values, it may be determined that the target shard is the last target shard of the last target data frame of the target image frame.
[0055] The above technical solution can quickly determine whether each target shard is the last target shard of the last target data frame of the target image frame, so that it can quickly and accurately determine whether to copy all the image data of the target image frame to the target shared memory.
[0056] Optionally, configuring a plurality of receive buffers and the receive descriptors corresponding to each receive buffer includes: allocating a plurality of physical pages in a preset buffer; performing a mapping operation on the plurality of physical pages to convert the plurality of physical pages into a plurality of receive buffers; and configuring a corresponding receive descriptor for each receive buffer among the plurality of receive buffers.
[0057] Exemplarily, in step S110, after the network card driver receives each target data frame from the network card, it can allocate a corresponding physical page in a preset buffer for the target shard. The preset buffer can usually be the physical memory of the host. A mapping operation can be performed on the physical page. This mapping operation can usually be a Direct Memory Access Mapping (DMA mapping). The physical page after the mapping operation can be converted into a receive buffer, and the network card driver can configure a corresponding receive descriptor for the receive buffer. Please refer to Figure 5 as shown. It is a schematic diagram of a receive descriptor according to an embodiment of the present invention. It should be noted that Figure 5 the information included in the shown receive descriptor is only part of the information actually included in the receive descriptor. In this embodiment, the target data frame can be divided into three target shards, which are cached one by one in three receive buffers. The three receive buffers are configured with three corresponding receive descriptors. The shard in the receive buffer corresponding to the first receive descriptor is the first target shard of the target data frame. The first receive descriptor can include status information. "DD" can be the abbreviation of Descriptor Done, indicating that the target shard corresponding to this receive descriptor has been correctly cached in the corresponding receive buffer. The first receive descriptor can also include the data length of the target shard in the corresponding receive buffer. 4096 can indicate that the data length of this target shard is 4096 bytes. The first receive descriptor can also include the length of the header information (hdr len) of the target shard in the corresponding receive buffer. 18 can indicate that the length of the header information included in this target shard is 18 bytes. The first receive descriptor can also include the payload length (payload) of the target shard in the corresponding receive buffer. 4078 can indicate that the payload length (i.e., the data length of the image data) included in this target shard is 4078 bytes. The second receive descriptor and the third receive descriptor are similar to the first receive descriptor. It should be noted that the target shards corresponding to the second receive descriptor and the third descriptor do not include header information. Therefore, these two receive descriptors may not include the length of the header information of the target shards in the corresponding receive buffers. The status information of the third receive descriptor can be set with an end-of-fragment flag bit (EOP), and the third receive descriptor can also include a cyclic redundancy checksum (crc). The cyclic redundancy checksum is used to detect whether the target data frame received by the network card has changed relative to the target data frame sent by the ultrasonic acquisition device.
[0058] Through configuring a receive buffer and receive descriptors corresponding to the receive buffer, the network card driver can accurately copy the target shards in each receive buffer to the target shared memory based on the correspondence between the receive descriptors and the receive buffer.
[0059] Optionally, in at least one target data frame, each target shard contains image data of a target image frame, and the first target shard of each target data frame contains header information; copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor includes: when the target shard in the receive buffer corresponding to the receive descriptor is the first target shard, parsing the header information to obtain the target storage address of the target shard in the target shared memory, and copying the target shard from the corresponding receive buffer to the target shared memory; when the target shard in the receive buffer corresponding to the receive descriptor is not the first target shard, copying the target shard from the corresponding receive buffer to the target shared memory according to the target storage address obtained from the most recently parsed header information.
[0060] Exemplarily, for each target data frame of at least one target data frame, each target shard of the target data frame may contain image data of a target image frame, wherein the first target shard may further contain header information, and the header information may at least indicate the target storage address of the image data in the corresponding target data frame in the target shared memory, that is, the position of the image data in the corresponding target data frame in the target shared memory after being copied to the target shared memory. Exemplarily, when the target shard in the receive buffer corresponding to the receive descriptor is the first target shard, the target shard contains header information, and by parsing the header information, the target shard can be copied from the corresponding receive buffer to the target shared memory according to the parsed header information. When the target shard in the receive buffer corresponding to the receive descriptor is not the first target shard, the target shard can be copied from the corresponding receive buffer to the target shared memory according to the header information contained in the first target shard of the target data frame to which the target shard belongs, that is, the most recently parsed header information.
[0061] The above technical solution parses the header information contained in the first target shard of each target data frame to copy the target shards of the target data frame to the target shared memory, which helps to ensure that the image data is stored in the target shared memory in the correct arrangement order, and thus can ensure that the target image frame is readable.
[0062] Optionally, at least one target data frame is received from the ultrasound acquisition device. The operation of copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor is performed when the packet format of the shard in the receive buffer corresponding to the receive descriptor conforms to a preset packet format; and / or, each time a data frame is transmitted between the ultrasound acquisition device and the network card, the data frame is a target data frame or a non-target data frame that does not belong to the target image frame; before copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: when the packet format of the shard in the receive buffer corresponding to the receive descriptor does not conform to the preset packet format, if the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is greater than the preset length threshold, discard the non-target data frame, and if the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is less than or equal to the preset length threshold, send the shard to the upper layer protocol stack for processing; the target data frame and the non-target data frame are the data received by the network card in a single reception.
[0063] Exemplarily, some receive buffers may cache shards of non-target data frames, and the network card driver usually does not copy these shards to the target shared memory. It should be noted that the ultrasound acquisition device can transmit one data frame to the network card of the host each time, and the data frame can be a non-target data frame, or can be a target data frame. In other words, each target data frame / non-target data frame is the data received by the network card in a single reception. Specifically, when the packet format of the shard in the receive buffer corresponding to the receive descriptor conforms to the preset packet format, it can be considered that the shard is a target shard, so that the shard can be copied from the corresponding receive buffer to the target shared memory. Please refer to Figure 4 shown, which is a schematic diagram of a shard whose packet format conforms to the preset packet format according to an embodiment of the present invention. Figure 4 The shown shard is the first shard of the data frame to which it belongs. The data structure of the shard can include header information and a payload (the payload is part of the image data of the target image frame). The header information can include the destination MAC address, the source MAC address, the target protocol type information ( Figure 4 shown as 0x00ff), and the fragment offset. The data structure of other shards except the first shard can only include the payload. The data structure can be regarded as the packet format, Figure 4 and the shown packet format is the preset packet format of the first shard in this embodiment. In this embodiment, if the packet format of the first shard conforms to the preset packet format, it can be considered that the packet formats of all shards of the data frame to which the first shard belongs conform to the corresponding preset packet formats. The conditions for conforming to the preset packet format can include, for example: if the current shard is the first shard, the data structure of the shard conforms to Figure 4The data structure of the shard shown; for another example, it may include: the protocol type of the data frame to which the current shard belongs conforms to Figure 4 The protocol type of the data frame to which the shard shown belongs. For another example, it may include: if the current shard is the first shard, the data structure of this shard conforms to Figure 4 The data structure of the shard shown, and the protocol type of the data frame to which the current shard belongs conforms to Figure 4 The protocol type of the data frame to which the shard shown belongs. When the packet format of the shard in the receive buffer corresponding to the receive descriptor does not conform to the preset packet format, the processing method of the shard can be determined based on the length of the non-target data frame to which the shard belongs. Generally speaking, among the valid data sent by the FPGA to the shard, the data length (i.e., the data volume) of other valid data except the data packet of the target image frame is usually small, mostly not exceeding a preset length threshold. For example, the preset length threshold may be the buffer length (i.e., the buffer capacity) of the receive buffer. In other words, among the non-target data frames except the target data frame, the non-target data frame whose total length of the shards contained does not exceed the preset length threshold can be regarded as valid data, and the non-target data frame whose total length of the shards contained exceeds the preset length threshold can be regarded as invalid data. When the packet format of the shard does not conform to the preset packet format, if the length of the non-target data frame to which the shard belongs is greater than the preset length threshold, the non-target data frame can be discarded. If the length of the non-target data frame to which the shard belongs is less than or equal to the preset length threshold, the shard can be sent to the upper protocol stack for processing.
[0064] The above technical solution can quickly and accurately distinguish between the target data frame and the non-target data frame, thereby effectively avoiding copying the non-target data frame into the target shared memory. In addition, determining the processing method of the non-target data frame by the length of the non-target data frame can fully combine the length rule of the data transmitted by the FPGA of the ultrasonic device and transmit various types of data more reasonably.
[0065] Optionally, the receive descriptor corresponding to each shard of the non-target data frame includes a shard end flag bit. The value of the shard end flag bit conforming to the corresponding preset value indicates that this shard is the last shard of the non-target data frame to which it belongs; the value of the shard end flag bit of the receive descriptor not conforming to the corresponding preset value indicates that the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is greater than the preset length threshold; the value of the shard end flag bit of the receive descriptor conforming to the corresponding preset value indicates that the length of the non-target data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs is less than or equal to the preset length threshold.
[0066] Exemplarily, the receive descriptor corresponding to each shard of the non-target data frame may include an end-of-shard flag bit. When the value of the end-of-shard flag bit conforms to the corresponding preset value, it may indicate that the corresponding shard is the last shard of the non-target data frame to which it belongs. When the value of the end-of-shard flag bit does not conform to the corresponding preset value, it may indicate that the shard in the corresponding receive buffer belongs to other shards of the non-target data frame except the last shard. Specifically, when the data length of the non-target data frame is greater than the buffer length of a single receive buffer, the non-target data frame may include multiple shards, and each shard is stored in a receive buffer. It can be understood that the values of the end-of-shard flag bits of the receive descriptors corresponding to other shards of the non-target data frame except the last shard do not conform to the corresponding preset values. In this case, the network card driver can discard each shard of the non-target data frame including the last shard according to the value of the end-of-shard flag bit of the receive descriptor corresponding to the first shard. When the data length of the non-target data frame is less than or equal to the buffer length of a single receive buffer, it can be understood that the non-target data frame only contains a single shard, and this shard serves as both the first shard and the last shard of the non-target data frame, and the value of the end-of-shard flag bit of the corresponding receive descriptor conforms to the corresponding preset value. In this case, the network card driver can send this shard to the upper layer protocol stack for processing. It can be understood that the preset length threshold may be the buffer length of a single receive buffer.
[0067] Through simply comparing the value of the end-of-shard flag bit of the receive descriptor with the corresponding preset value, the above technical solution can quickly and accurately determine whether the length of the non-target data frame to which the corresponding shard belongs is greater than the preset length threshold.
[0068] Optionally, the first target shard of each target data frame among at least one target data frame includes header information, and the header information includes the target protocol type information of the target data frame; when the protocol type of the data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs conforms to the protocol type indicated by the target protocol type information, it indicates that the message format of this shard conforms to the preset message format; when the protocol type of the data frame to which the shard in the receive buffer corresponding to the receive descriptor belongs does not conform to the protocol type indicated by the target protocol type information, it indicates that the message format of this shard does not conform to the preset message format.
[0069] Exemplarily, whether the message format of a shard conforms to the preset message format can be determined by the protocol type of the data frame to which the shard belongs, and the protocol type of the data frame to which the shard belongs is determined by the header information of the data frame to which the shard belongs. Specifically, for each target data frame, the header information of the first target shard of this target data frame may include the target protocol type information of this target data frame, and the target protocol type information may indicate the protocol type of this target data frame. For example, Figure 4The protocol type indicated by the shown target protocol type information is 0x00ff. Generally, the target protocol type information is a set of protocol type information preset for the target data frame, which can be defined by the user himself / herself, and the embodiments of the present invention do not make specific limitations thereto. For a non-target data frame, the first fragment of the non-target data frame may include header information, and the header information may not include information for indicating the protocol type of the non-target data frame, or may include non-target protocol type information. It can be understood that the non-target protocol type information can be used to indicate the protocol type of the non-target data frame, and the indicated protocol type is other protocol types except the protocol type indicated by the target protocol type information. For each data frame, if the header information included in the first fragment includes the target protocol type information, that is, the protocol type of the data frame to which the fragment belongs conforms to the protocol type indicated by the target protocol type information, it can be considered that the protocol types of all fragments of the data frame to which the fragment belongs conform to the protocol type indicated by the target protocol type information. Correspondingly, it can be considered that the message formats of all fragments of the data frame to which the fragment belongs conform to the preset message format. On the contrary, if the header information included in the first fragment does not include the target protocol type information, that is, the protocol type of the data frame to which the fragment belongs does not conform to the protocol type indicated by the target protocol type information, it can be considered that the protocol types of all fragments of the data frame to which the fragment belongs do not conform to the protocol type indicated by the target protocol type information. Correspondingly, it can be considered that the message formats of all fragments of the data frame to which the fragment belongs do not conform to the preset message format.
[0070] By comparing the protocol type of the data frame to which the fragment belongs with the protocol type indicated by the target protocol type information, the above technical solution can quickly and simply determine whether the message format of the fragment conforms to the preset message format, so as to efficiently determine whether the fragment is a target fragment.
[0071] Optionally, in at least one target data frame, each target shard contains the image data of the target image frame, and the first target shard of each target data frame contains header information, where the header information includes the shard offset of the first target shard in the target data frame to which it belongs, and the receive descriptor contains the length of the image data of the target shard cached in the corresponding receive buffer; copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor includes: when the target shard in the receive buffer corresponding to the receive descriptor is the first target shard in the current target data frame, obtaining a write pointer; determining the target storage address of the first target shard in the target shared memory based on the write pointer and the shard offset included in the first target shard; for each non-first target shard in the current target data frame, determining the target storage address of the current target shard in the target shared memory based on the target storage address of the previous target shard in the target shared memory and the length of the image data of the previous target shard; and copying the target shard from the corresponding receive buffer to the target shared memory based on the target storage address corresponding to each target shard.
[0072] Exemplarily, the header information included in the first target shard of each target data frame may include the shard offset of the first target shard in the target data frame. The shard offset can be understood as the starting position of the shard in the image data of the target image frame. For each receive buffer caching the target shard, the receive descriptor corresponding to the receive buffer may include the length of the image data of the target shard cached in the receive buffer. In step S130, when the target shard in the receive buffer corresponding to the receive descriptor is the first target shard in the current target data frame, the network card driver can obtain a write pointer. The write pointer usually can indicate the starting position of the target shared memory, and the shard offset can indicate the position of the starting data of the first shard in the image data of the target image frame. Based on the write pointer and the shard offset, the position of the starting data of the first shard in the target shared memory after the first shard is copied to the target shared memory can be determined, that is, the target storage address in the target shared memory. In a specific embodiment, if the starting position indicated by the write pointer is base and the shard offset of the first shard is offset, the target storage address of the first shard in the target shared memory can be expressed as base + offset. For each non-first target shard, based on the target storage address of the previous target shard in the target shared memory and the length of the image data of the previous target shard, the target storage address of the current target shard in the target shared memory can be determined. For example, if the target storage address of the first target shard of a certain target data frame in the target shared memory is denoted as A1, then the target storage address A2 of the second target shard in the target shared memory can be A1 + length1, where length1 can represent the length of the image data of the first target shard. Similarly, the target storage address A3 of the third target shard in the target shared memory can be A2 + length2, where length2 can represent the length of the image data of the second target shard, and so on. Based on the target storage address corresponding to each target shard, the target shard can be copied from the corresponding receive buffer to the target shared memory.
[0073] The above technical solution can determine the target storage addresses of the target shards of the target data frame in the target shared memory based on the write pointer, the shard offset of the first target shard, and the data lengths of the target shards. The information in the header information used to determine the target storage address may only include the shard offset of the first target shard. The setting of the header information is relatively simple and the amount of information is small, which is easy to parse and process.
[0074] Optionally, the method further includes: after copying the last target shard of the last target data frame to the target shared memory, updating the write pointer to the end position of the target storage address corresponding to the last target shard of the last target data frame.
[0075] Exemplarily, after copying the last target shard of the last target data frame to the target shared memory, the network card driver can update the write pointer. The position indicated by the updated write pointer can be the end position of the target storage address corresponding to the last target shard of the last target data frame. Specifically, each target data frame can be regarded as a segment of data, and the end position of the data is the end position of the target storage address corresponding to the last target shard of the last target data frame. Please refer to Figure 3 as shown, which is a schematic diagram of the network card driver writing data to the target shared memory and the target application reading data from the target shared memory according to an embodiment of the present invention. In Figure 3 the illustrated embodiment, 6 storage areas (i.e., areas 1-6) of the target shared memory store ultrasonic images copied by the network card driver, and each storage area stores one ultrasonic image. It can be understood that in this embodiment, each target image frame is an ultrasonic image. The target application can currently read the target image frame in area 1 through the read pointer. The network card driver can currently copy this shard to area 7 of the target shared memory through the write pointer and the shard offset of the first shard of the first target data frame of the next target image frame. It can be understood that after the last target shard of the last target data frame of the next target image frame is copied to area 7, the write pointer can be updated to the start position of area 8, and this start position is also the end position of the target storage address corresponding to the last target shard of the last target data frame of the next target image frame.
[0076] The above technical solution can update the write pointer in time after all the image data of a target image frame are copied to the target shared memory, so that the data of the next target image frame can be quickly and smoothly copied to the target shared memory without affecting the image data of the previous target image frame.
[0077] Optionally, the first target shard of each target data frame among at least one target data frame contains header information, the header information contains a data frame end flag bit, and the value of the data frame end flag bit conforming to the corresponding preset value indicates that the corresponding target data frame is the last target data frame of the target image frame. Each receive descriptor corresponding to a target shard contains a shard end flag bit, and the value of the shard end flag bit conforming to the corresponding preset value indicates that the target shard is the last target shard of the target data frame to which it belongs; after copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: for each target shard, based on the data frame end flag bit in the header information contained in the first target shard of the target data frame to which the target shard belongs, and the shard end flag bit of the receive descriptor corresponding to the target shard, determine whether the target shard is the last target shard of the last target data frame. When the values of the data frame end flag bit and the shard end flag bit both conform to the corresponding preset values, determine that the target shard is the last target shard of the last target data frame.
[0078] Exemplarily, the header information contained in the first target shard may contain a data frame end flag bit. The relevant description of the data frame end flag bit may refer to the foregoing embodiments and will not be elaborated here. After step S130, it is possible to determine whether each target shard is the last target shard of the last target data frame based on the data frame end flag bit in the header information contained in the first target shard of the target data frame to which it belongs and the shard end flag bit. The specific description of determining whether a target shard is the last target shard of the last target data frame may also refer to the foregoing embodiments and will not be elaborated here.
[0079] The above technical solution can quickly determine whether each target shard is the last target shard of the last target data frame, so that it is possible to quickly and accurately determine whether to update the write pointer each time the current target shard is copied to the target shared memory.
[0080] Optionally, before copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor for each target data frame of at least one target data frame, the method further includes: initializing a preset identifier to a first value; during the process of copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor for each target data frame of at least one target data frame, the method further includes: after copying the first target shard of each target data frame from the corresponding receive buffer to the target shared memory according to the receive descriptor, setting the preset identifier to a second value; after copying the last target shard of each target data frame from the corresponding receive buffer to the target shared memory according to the receive descriptor, setting the preset identifier to the first value; before copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: when the preset identifier is the first value, determining that the shard in the receive buffer corresponding to the receive descriptor is the first shard of the data frame to which it belongs; when the preset identifier is the second value, determining that the shard in the receive buffer corresponding to the receive descriptor is a non-first target shard of the target data frame to which it belongs.
[0081] Exemplarily, before step S130, the network card driver can initialize the preset identifier to the first value. The network card driver can determine whether the shard of the receive buffer corresponding to the current receive descriptor is the first shard of the data frame to which it belongs according to the current value of the preset identifier. Specifically, when the current value of the preset identifier is the first value, it can be determined that the shard in the receive buffer corresponding to the current receive descriptor is the first shard of the data frame to which it belongs. In some embodiments, after determining that the shard is the first shard of the data frame to which it belongs, it can be determined whether the shard is the first target shard of the target data frame based on the packet format of the shard. In other embodiments, when the current value of the preset identifier is the first value, it can be directly determined that the shard in the receive buffer corresponding to the current receive descriptor is the first target shard of the target data frame to which it belongs. After copying the first target shard of each target data frame from the corresponding receive buffer to the target shared internal memory, the preset identifier can be set to the second value. When the current value of the preset identifier is the second value, it can be directly determined that the shard in the receive buffer corresponding to the current receive descriptor is a non-first target shard of the target data frame to which it belongs, and the target shard is copied to the target shared memory. After copying the last target shard of each target data frame from the corresponding receive buffer to the target shared memory, the preset identifier can be set to the first value.
[0082] Through the value of the preset identifier, the above technical solution can quickly determine whether the current shard is the first shard of the belonging data frame, and can reset the value of the preset identifier when the current shard is the first target shard of the target data frame. This helps to quickly determine whether each shard is the first target shard or a non-first target shard of the target data frame, and helps to accurately obtain the header information contained in the first target shard, so that the data belonging to the target image frame can be quickly and accurately copied to the target shared memory.
[0083] Optionally, the network card driver runs on the host, and the host is connected to the ultrasonic acquisition device, which is used to transmit at least one data frame to the network card of the host; the maximum transmission unit when transmitting image data between the network card driver and the ultrasonic acquisition device is larger than the maximum transmission unit when transmitting other types of data other than image data, and the maximum transmission unit is the data volume of the data transmitted at one time.
[0084] Exemplarily, the network card driver can run on the host, and the host can be connected to the ultrasonic acquisition device. Specifically, the host can be connected to the field programmable gate array (FPGA) in the ultrasonic acquisition device, and the FPGA can transmit the data frame to the network card of the host. The maximum transmission unit of the network card and the FPGA when transmitting image data is usually much larger than the maximum transmission unit when transmitting other types of data other than image data. For example, when transmitting image data, the maximum transmission unit of the network card and the FPGA can be 9000fps. When transmitting other types of data, the maximum transmission unit of the network card and the FPGA can be 1500fps. It can be understood that the maximum transmission unit is equivalent to the maximum data volume of the data allowed to be transmitted at one time.
[0085] In the above technical solution, the maximum transmission unit when transmitting image data can be greater than the maximum transmission unit when transmitting other types of data, which can complete the transmission of image data between the network card and the ultrasonic acquisition device relatively quickly, and is beneficial to improving the transmission efficiency of the image.
[0086] Please refer to Figure 6 shown, which is a schematic diagram of the operation logic of the network card driver according to an embodiment of the present invention. The target image frame in this embodiment is an intravascular ultrasound image obtained based on a catheter controller (CCU), and is abbreviated as a CCU image in Figure 6 . The network card driver can parse the current receive descriptor to determine the status information of the corresponding receive buffer and the data length of the shard cached therein. The network card can cache the received target data frame in different receive buffers according to the receive descriptor. Then, the network card driver can first judge the preset identifier ( Figure 6Check whether the current value of the value shown as img_data is the first value. If the current value is empty (an empty current value means the current value is the first value), it is possible to determine the protocol type information contained in the shard in the corresponding receive buffer. When the protocol type indicated by the protocol type information does not match the protocol type indicated by the target protocol type information (in this embodiment, it is 0x00ff), it is possible to determine whether the end-of-fragment flag bit (EOP) in the current receive descriptor matches the corresponding preset value. If it matches, the shard can be sent to the upper protocol stack as an ordinary message. If it does not match, the shard can be discarded. When the protocol type indicated by the protocol type information matches the protocol type indicated by the target protocol type information, it is possible to parse the header information contained in the current target shard of the image message (i.e., the current target data frame of the target image frame). Parsing the header information can obtain the fragment offset (img_offset), the data frame end flag bit (img_done), and it is also possible to set the value of the preset identifier to the second value. The network card driver can obtain the write pointer, and it can also determine the target storage address of the shard in the target shared memory based on the write pointer and the fragment offset. Based on this target storage address, the shard can be copied to the target shared memory. The network card driver can update the current fragment offset to determine the storage location of the next target shard in the target shared memory. The updated fragment offset is equal to the fragment offset before the update plus the image data length of the current target shard. Specifically, if the fragment offset of the first target shard of the target data frame is offset1 and the image data length is length1, then after copying the first target shard to the target shared memory, the updated current fragment offset can be offset1 + length1. After copying the second target shard to the target shared memory, the updated current fragment offset can be offset1 + length1 + length2, where length2 represents the image data length of the second target shard, and so on. After updating the fragment offset, the network card driver can determine whether the value of the end-of-fragment flag bit of the receive descriptor matches the corresponding preset value. If it does not match, the next receive descriptor can be processed; if it matches, it is possible to determine whether the data frame end flag bit of the target data frame to which the current target shard belongs matches the corresponding preset value. If the data frame end flag bit matches the corresponding preset value, update the write pointer (set the write pointer), and send a notification instruction to the target application to notify the target application that it can read the target image frame. Then, it is possible to reset all of the preset identifier, the current fragment offset, and the data frame end flag bit. After resetting, the preset identifier is empty, and the current fragment offset and the data frame end flag are both 0, and the next receive descriptor can be continued to be processed. It can be understood that in this case, the shard cached in the receive buffer corresponding to the next receive descriptor can be the first target shard of the first target data frame of the next target image frame.If the data frame end flag does not match the corresponding preset value, the preset identifier, the current fragment offset, and the data frame end flag can all be reset, and the processing of the next receive descriptor can be continued. It can be understood that in this case, the fragment cached in the receive buffer corresponding to the next receive descriptor can be the first target fragment of the next target data frame of the current target image frame.
[0087] According to another aspect of the present invention, there is also provided a memory mapping method, which is executed by a character driver. The method includes: when the character driver is loaded, calling the initialization interface of the character driver; mapping the reserved physical memory to a kernel virtual address through the initialization interface for the above-mentioned network card driver to write data; in response to the call operation of the above-mentioned target application to the first operation interface, mapping the reserved physical memory to a process virtual address for the target application to read data; wherein the target shared memory is the reserved physical memory.
[0088] Exemplarily, a character driver can also run on the host. When the character driver is loaded, the character driver can call its initialization interface. The initialization interface can map the reserved physical memory to a kernel virtual address, and the network card driver can write data to the preset physical memory based on the kernel virtual address. The character driver can also provide a first operation interface to the target application. The target application can call the first operation interface. In response to this call operation, the character driver can map the preset physical memory to a process virtual address, and the target application can read data from the preset physical memory based on the process virtual address. The preset physical memory is the target shared memory in the foregoing embodiment.
[0089] The above technical solution can map the preset physical memory to the target application and the network card driver at the same time, which is beneficial to enabling the data copied by the network card driver to the target shared memory to be directly read by the target application in the target shared memory, so that at least some levels of the network protocol stack can be bypassed, improving the transmission efficiency of image data.
[0090] Optionally, the memory mapping method as above further includes: providing a second operation interface to the network card driver, and the network card driver obtains a write pointer by calling the second operation interface, where the write pointer is used to determine the target storage address corresponding to when the image data of the target image frame is copied to the target shared memory; providing a third operation interface to the network card driver, and after the network card driver notifies the target application to read the target image frame, updating the write pointer by calling the third operation interface.
[0091] Exemplarily, the character driver can provide a second operation interface to the network card driver. The network card driver can call the second operation interface to obtain the write pointer to determine the target storage address corresponding to copying the image data of the target image frame to the target shared memory. The character driver can also provide a third operation interface to the network card driver. The network card driver can call the third operation interface to update the current write pointer after notifying the target application to read the target image frame.
[0092] Through the above technical solution, by providing a second operation interface to the network card driver, it can ensure that the network card driver can obtain the writing position when writing data to the target shared memory, so that the image data can be successfully written into the target shared memory. By providing a third operation interface to the network card driver, it can ensure that after copying a target image frame to the target shared memory, the network card driver can quickly and successfully copy the image data of the next target image frame to the target shared memory by updating the write pointer without affecting the image data of the previous target image frame.
[0093] Optionally, the method further includes: providing a fourth operation interface to the target application, and the target application can obtain the read pointer through calling the fourth operation interface to read the target image frame in the target shared memory; providing a fifth operation interface to the target application, and the target application can update the read pointer through calling the fifth operation interface after performing a preset image processing operation on the target image frame.
[0094] Exemplarily, the character driver can also provide a fourth operation interface and a fifth operation interface to the target application. The target application can obtain the read pointer through calling the fourth operation and read the target image frame in the target shared memory according to the read pointer. After performing a preset image processing operation (such as any operation like denoising, enhancement, grayscale conversion, etc.) on the target image frame in the target shared memory, the target application can call the fifth operation interface to update the read pointer to read the next target image frame.
[0095] Through the above technical solution, by providing a fourth operation interface and a fifth operation interface to the target application, the target application can accurately obtain the position of the target image frame to be read in the target shared memory, and after performing a preset image processing operation on the current target image frame, it can accurately obtain the position of the next target image frame to be read by updating the read pointer.
[0096] According to another aspect of the present invention, there is also provided an image processing method, which is executed by the above-mentioned target application. The method includes: when receiving the notification instruction of the above-mentioned network card driver, reading the target image frame in the target shared memory; performing a preset image processing operation on the target image frame.
[0097] Exemplarily, when the target application receives a notification instruction from the network card driver, it can read the target image frame in the target shared memory in response to the notification instruction. When the target image frame is read, any preset image processing operations such as denoising, enhancement, grayscale conversion, binarization, etc. can be performed on the target image frame.
[0098] In the above technical solution, the target application can directly read the target image frame in the target shared memory and can directly perform preset image processing operations on the target image frame therein. The target application does not have to read the target shared memory immediately every time the network card driver copies a target shard to the target shared memory. In particular, in the existing sk_buff-based packet transmission technology, the target application needs to process and transfer the data in each sk_buff. Compared with the existing sk_buff-based packet transmission technology, this greatly reduces the running burden of the target application process.
[0099] Optionally, reading the target image frame in the target shared memory includes: obtaining a read pointer through the fourth operation interface provided by the character driver to read the target image frame in the target shared memory; after performing the preset image processing operation on the target image frame, the method further includes: updating the read pointer by calling the fifth operation interface provided by the character driver.
[0100] Exemplarily, the target application can obtain a read pointer by calling the fourth operation interface provided by the character driver, and based on the read pointer, it can read the target image frame in the target shared memory. After performing the preset image processing operation on the target image frame, the fifth operation interface provided by the character driver can be called to update the current read pointer to read the next target image frame in the target shared memory.
[0101] In the above technical solution, by calling the fourth operation interface and the fifth operation interface, the target application can accurately obtain the position of the target image frame to be read in the target shared memory, and after performing the preset image processing operation on the current target image frame, it can accurately obtain the position of the next target image frame to be read by updating the read pointer.
[0102] Please refer to Figure 7As shown, it is a schematic diagram of the operation processes of a character driver, a network card driver, and a target application according to an embodiment of the present invention. The character driver can be loaded first. During the loading process, its own initialization interface can be called. The initialization interface can map a preset physical memory to a kernel virtual address for the network card driver to write data. The target application can call a first operation interface provided by the character driver. In response to the operation of calling the first operation interface, the character driver maps a reserved physical memory to a process virtual address for the target application to read data. The target application can wait for a notification instruction from the network card driver to wait for reading a target image frame. The network card driver can be loaded after determining the kernel virtual address. For a data frame whose protocol type indicated by the protocol type information included in the first shard is 0*00ff, the header information of the first shard can be parsed, a preset identifier can be set, and a write pointer can be obtained, and each target shard of the data frame can be copied to a target shared memory. The specific process can refer to the foregoing embodiment and will not be elaborated here. After the network card driver copies each target data frame of the target image frame to the target shared memory, a notification instruction can be sent to the target application to notify the target application that it can read the target image frame. In response to the notification instruction, the target application can obtain a read pointer, read the target image frame in the target shared memory through the read pointer, and perform image processing on it. After the processing is completed, the read pointer can be updated and wait for reading the next target image frame.
[0103] According to another aspect of the present invention, an electronic device is further provided, including: a processor and a memory. Among them, computer program instructions are stored in the memory, and when the computer program instructions are run by the processor, they are used to execute the above-mentioned image transmission method, or the above-mentioned memory mapping method, or the above-mentioned image processing method.
[0104] According to another aspect of the present invention, a storage medium is further provided. Program instructions are stored on the storage medium. When the program instructions are run by a computer or a processor, the computer or the processor is caused to execute the corresponding steps of the above-mentioned image transmission method, or the above-mentioned memory mapping method, or the above-mentioned image processing method according to the embodiments of the present invention, and are used to implement the corresponding modules in the above-mentioned image transmission device, or the above-mentioned memory mapping device, or the above-mentioned image processing device according to the embodiments of the present invention, or the corresponding modules in the above-mentioned image transmission device, memory mapping device, or image processing device. The storage medium can, for example, include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. The computer-readable storage medium can be any combination of one or more computer-readable storage media.
[0105] According to another aspect of the present invention, there is also provided a computer program product, including computer program instructions which are used to execute the image transmission method, the memory mapping method, or the image processing method as described above when running.
[0106] Those of ordinary skill in the art can understand the specific implementation and beneficial effects of the above-mentioned image transmission device, memory mapping device, image processing device, electronic device, and storage medium by reading the above specific descriptions of the image transmission method, memory mapping method, or image processing method. For the sake of brevity, they will not be elaborated here.
[0107] Although example embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above example embodiments are merely exemplary and are not intended to limit the scope of the present invention thereto. Those of ordinary skill in the art can make various changes and modifications therein without departing from the scope and spirit of the present invention. All such changes and modifications are intended to be included within the scope of the present invention as claimed in the appended claims.
[0108] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0109] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0110] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and technologies are not shown in detail so as not to obscure the understanding of this specification.
[0111] Similarly, it should be understood that, in order to streamline the present invention and assist in understanding one or more of the various inventive aspects, in the description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the method of the present invention should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected by the corresponding claims, the inventive point lies in that the corresponding technical problem can be solved by features that are fewer than all the features of a single disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into the detailed description, where each claim itself serves as a separate embodiment of the present invention.
[0112] Those skilled in the art will appreciate that, except where features are mutually exclusive, any combination can be used to combine all the features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all the processes or units of any method or apparatus so disclosed. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) can be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0113] Furthermore, those skilled in the art will be able to understand that, although some of the embodiments herein include certain features included in other embodiments rather than other features, the combination of features of different embodiments means that it is within the scope of the present invention and forms different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.
[0114] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that in practice, a microprocessor or a digital signal processor (DSP) can be used to implement some or all of the functions of some of the modules for the above-described image transmission device, or the above-described memory mapping device, or the above-described image processing device according to the embodiments of the present invention. The present invention can also be implemented as a device program (e.g., a computer program and a computer program product) for performing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier signal, or in any other form.
[0115] It should be noted that the above embodiments are illustrative of the present invention rather than restrictive of the present invention, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in the claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim listing several devices, several of these devices may be embodied by the same item of hardware. The use of the words first, second, and third, etc. does not denote any order. These words may be interpreted as names.
[0116] The above is only a specific implementation manner or an illustration of the specific implementation manner of the present invention, and the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should be covered within the protection scope of the present invention. The protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An image transmission method, characterized in that, For transmitting data packets containing target image frames, the data packets including at least one target data frame, each target data frame of the at least one target data frame including a plurality of target shards, the method being executed by a network card driver of a network card, the method comprising: Configuring a plurality of receive buffers and receive descriptors corresponding to each receive buffer, the receive descriptors being used to indicate the physical addresses of the corresponding receive buffers; For each target data frame of the at least one target data frame, Buffering the received target data frame in different receive buffers according to the shards based on the receive descriptors, each receive buffer being used to buffer one target shard of the target data frame; Copying each target shard from the corresponding receive buffer to a target shared memory according to the receive descriptors, the target shared memory being mapped to both the network card driver and a target application, and the target application being able to directly read the target image frame from the target shared memory through a preset operation interface.
2. The method according to claim 1, characterized in that The method further comprises: After copying the last target shard of the last target data frame to the target shared memory, sending a notification instruction to the target application to notify the target application to read the target image frame.
3. The method according to claim 2, characterized in that, The first target shard of each target data frame of the at least one target data frame contains header information, the header information containing a data frame end flag bit, and the value of the data frame end flag bit conforming to a corresponding preset value indicates that the corresponding target data frame is the last target data frame of the target image frame. Each receive descriptor corresponding to a target shard contains a shard end flag bit, and the value of the shard end flag bit conforming to a corresponding preset value indicates that the target shard is the last target shard of the target data frame to which it belongs; Before the sending the notification instruction to the target application to notify the target application to read the target image frame, the method further comprises: For each target shard, determining whether the target shard is the last target shard of the last target data frame of the target image frame based on the data frame end flag bit in the header information contained in the first target shard of the target data frame to which the target shard belongs and the shard end flag bit of the receive descriptor corresponding to the target shard. When the values of the data frame end flag bit and the shard end flag bit both conform to the corresponding preset values, determining that the target shard is the last target shard of the last target data frame.
4. The method according to claim 1, wherein The configuring the plurality of receive buffers and the receive descriptors corresponding to each receive buffer comprises: Allocating a plurality of physical pages in a preset buffer; Performing a mapping operation on the plurality of physical pages to convert the plurality of physical pages into the plurality of receive buffers; Configuring corresponding receive descriptors for each of the plurality of receive buffers.
5. The method according to claim 1, wherein In the at least one target data frame, each target shard contains the image data of the target image frame, and the first target shard of each target data frame contains header information; The copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptors comprises: When the target shard in the receive buffer corresponding to the receive descriptor is the first target shard, parse the header information to obtain the target storage address of the target shard in the target shared memory, and copy the target shard from the corresponding receive buffer to the target shared memory; When the target shard in the receive buffer corresponding to the receive descriptor is not the first target shard, copy the target shard from the corresponding receive buffer to the target shared memory according to the target storage address obtained from the most recently parsed header information.
6. The method according to claim 1, characterized in that, The at least one target data frame is received from an ultrasound acquisition device, and the operation of copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor is performed when the packet format of the shards in the receive buffer corresponding to the receive descriptor conforms to a preset packet format; and / or, Each time a data frame is transmitted between the ultrasound acquisition device and the network card, the data frame is the target data frame or a non-target data frame that does not belong to the target image frame; Before copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: When the packet format of the shards in the receive buffer corresponding to the receive descriptor does not conform to the preset packet format, if the length of the non-target data frame to which the shards in the receive buffer corresponding to the receive descriptor belong is greater than a preset length threshold, discard the non-target data frame, and if the length of the non-target data frame to which the shards in the receive buffer corresponding to the receive descriptor belong is less than or equal to the preset length threshold, send the shards to the upper layer protocol stack for processing.
7. The method according to claim 6, wherein Each receive descriptor corresponding to a shard of the non-target data frame includes a shard end flag bit, and the value of the shard end flag bit conforming to the corresponding preset value indicates that the shard is the last shard of the non-target data frame to which it belongs; The value of the shard end flag bit of the receive descriptor does not conform to the corresponding preset value, indicating that the length of the non-target data frame to which the shards in the receive buffer corresponding to the receive descriptor belong is greater than the preset length threshold; The value of the shard end flag bit of the receive descriptor conforms to the corresponding preset value, indicating that the length of the non-target data frame to which the shards in the receive buffer corresponding to the receive descriptor belong is less than or equal to the preset length threshold.
8. The method according to claim 6, wherein The first target shard of each target data frame of the at least one target data frame includes header information, and the header information includes target protocol type information of the target data frame; The protocol type of the data frame to which the shards in the receive buffer corresponding to the receive descriptor belong conforms to the protocol type indicated by the target protocol type information, indicating that the packet format of the shards conforms to the preset packet format; The protocol type of the data frame to which the shards in the receive buffer corresponding to the receive descriptor belong does not conform to the protocol type indicated by the target protocol type information, indicating that the packet format of the shards does not conform to the preset packet format.
9. The method according to any one of claims 1-8, characterized in that, In the at least one target data frame, each target shard contains the image data of the target image frame, and the first target shard of each target data frame contains header information, where the header information includes the shard offset of the first target shard in the target data frame to which it belongs, and the receive descriptor contains the length of the image data of the target shard cached in the corresponding receive buffer; The copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor includes: When the target shard in the receive buffer corresponding to the receive descriptor is the first target shard in the current target data frame, obtaining a write pointer; Based on the write pointer and the shard offset included in the first target shard, determining the target storage address of the first target shard in the target shared memory; For each non-first target shard in the current target data frame, based on the target storage address of the previous target shard in the target shared memory and the length of the image data of the previous target shard, determining the target storage address of the current target shard in the target shared memory; Copying the target shard from the corresponding receive buffer to the target shared memory based on the target storage address corresponding to each target shard.
10. The method according to claim 9, wherein The method further includes: After copying the last target shard of the last target data frame to the target shared memory, updating the write pointer to the end position of the target storage address corresponding to the last target shard of the last target data frame.
11. The method according to claim 10, wherein The first target shard of each target data frame of the at least one target data frame contains header information, where the header information contains a data frame end flag bit, and the value of the data frame end flag bit conforming to the corresponding preset value indicates that the corresponding target data frame is the last target data frame of the target image frame. Each receive descriptor corresponding to each target shard contains a shard end flag bit, and the value of the shard end flag bit conforming to the corresponding preset value indicates that the target shard is the last target shard of the target data frame to which it belongs; After the copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: For each target shard, based on the data frame end flag bit in the header information contained in the first target shard of the target data frame to which the target shard belongs, and the shard end flag bit of the receive descriptor corresponding to the target shard, determining whether the target shard is the last target shard of the last target data frame. When the values of the data frame end flag bit and the shard end flag bit both conform to the corresponding preset values, determining that the target shard is the last target shard of the last target data frame.
12. The method according to any one of claims 3, 5, and 8, characterized in that Before the copying each target shard from the corresponding receive buffer to the target shared memory for each target data frame of the at least one target data frame according to the receive descriptor, the method further includes: Initializing a preset identifier to a first value; In the process of copying each target shard from the corresponding receive buffer to the target shared memory for each target data frame of the at least one target data frame, the method further includes: After copying the first target shard of each target data frame from the corresponding receive buffer to the target shared memory according to the receive descriptor, setting the preset identifier to a second value; After copying the last target shard of each target data frame from the corresponding receive buffer to the target shared memory according to the receive descriptor, setting the preset identifier to the first value; Before copying each target shard from the corresponding receive buffer to the target shared memory according to the receive descriptor, the method further includes: When the preset identifier is the first value, determining that the shard in the receive buffer corresponding to the receive descriptor is the first shard of the data frame to which it belongs; when the preset identifier is the second value, determining that the shard in the receive buffer corresponding to the receive descriptor is a non-first target shard of the target data frame to which it belongs.
13. The method according to any one of claims 1-8, characterized in that, The network card driver runs on a host, the host is connected to an ultrasound acquisition device, and the ultrasound acquisition device is configured to transmit the at least one data frame to the network card of the host; The maximum transmission unit when transmitting the image data between the network card driver and the ultrasound acquisition device is larger than the maximum transmission unit when transmitting other types of data other than the image data, and the maximum transmission unit is the amount of data transmitted in a single transmission.
14. A memory mapping method, characterized in that, The method is executed by a character driver, and the method includes: When the character driver is loaded, calling the initialization interface of the character driver; Mapping the reserved physical memory to a kernel virtual address through the initialization interface for the network card driver as described in any one of claims 1-13 to write data; In response to a call operation of a target application as described in any one of claims 1-13 to a first operation interface, mapping the reserved physical memory to a process virtual address for the target application to read data; Wherein, the target shared memory is the reserved physical memory.
15. The method according to claim 14, characterized in that, The method further includes: Providing a second operation interface to the network card driver, and the network card driver obtains a write pointer by calling the second operation interface, and the write pointer is used to determine a target storage address corresponding to when the image data of the target image frame is copied to the target shared memory; Providing a third operation interface to the network card driver, and after the network card driver notifies the target application to read the target image frame, updating the write pointer by calling the third operation interface.
16. The method according to claim 14, wherein The method further includes: Providing a fourth operation interface to the target application, and the target application obtains a read pointer by calling the fourth operation interface to read the target image frame in the target shared memory; Provide a fifth operation interface to the target application program, and after the target application program performs a preset image processing operation on the target image frame, update the read pointer by calling the fifth operation interface.
17. An image processing method, characterized in that, The method is executed by the target application program according to any one of claims 1-13, and the method includes: When receiving a notification instruction of the network card driver according to any one of claims 1-13, read the target image frame in the target shared memory; Perform a preset image processing operation on the target image frame.
18. The method according to claim 17, wherein The reading of the target image frame in the target shared memory includes: By calling a fourth operation interface provided by the character driver, obtain a read pointer to read the target image frame in the target shared memory; After performing the preset image processing operation on the target image frame, the method further includes: Update the read pointer by calling a fifth operation interface provided by the character driver.
19. An electronic device, comprising a processor and a memory, characterized in that, The memory stores computer program instructions, and when the computer program instructions are run by the processor, they are used to execute the image transmission method according to any one of claims 1-13, or the memory mapping method according to any one of claims 14-16, or the image processing method according to claim 17 or 18.
20. A storage medium, on which program instructions are stored, characterized in that, The program instructions are used to execute the image transmission method according to any one of claims 1-13, or the memory mapping method according to any one of claims 14-16, or the image processing method according to claim 17 or 18 when running.
21. A computer program product, comprising computer program instructions, characterized in that, The computer program instructions are used to execute the image transmission method according to any one of claims 1-13, or the memory mapping method according to any one of claims 14-16, or the image processing method according to claim 17 or 18 when running.