Image data transmission method and device and medium

By setting first-level and second-level data identifiers on the computer, combined with the frame start flag bit, the problems of high CPU occupancy and data errors during the acquisition card transmission process are solved, and efficient and reliable image data transmission is achieved.

CN120295756APending Publication Date: 2025-07-11HEFEI I TEK OPTOELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510263541.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the prior art, when the acquisition card transmits image data through the PCIe bus, frequent CPU participation is required, resulting in high CPU occupancy. Due to the inconsistent image sizes per frame, the buffer control is complex, which can easily lead to data errors.

Method used

The combination of first-level data identification and second-level data identification is adopted to characterize several consecutive first-level data identification through second-level data identification, and combine the frame start flag bit to achieve efficient transmission of image data, reduce CPU occupancy, and process data identification reading and writing in parallel.

Benefits of technology

Effectively reduce CPU occupancy, ensure the continuity and accuracy of image data transmission, improve transmission efficiency, and avoid bandwidth reduction and data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295756A_ABST
    Figure CN120295756A_ABST
Patent Text Reader

Abstract

The invention discloses an image data transmission method and device, and a medium. The transmission method comprises the following steps: constructing a secondary data identification queue at a computer end; obtaining second-level data identifiers in the second-level data identifier queue, and writing the second-level data identifiers into the acquisition card end in sequence; two first-level data identifiers FIFOs are adopted for alternate storage; and adding a frame start mark, and alternately completing the reading of the corresponding first-level data identifiers in the two first-level data identifier FIFOs. The method only needs to inform the CPU to participate when all image data corresponding to the secondary data identifier is transmitted every time, can effectively reduce the CPU occupancy rate, enables the data corresponding to the frame start mark to serve as the start data correspondingly transmitted by the primary data identifier read for the first time in the current primary data identifier FIFO by adding the frame start mark, and improves the data transmission efficiency. When the data volume of a single frame of image is larger than or smaller than the maximum data volume which can be stored in the image buffer area, the problem of transmission errors of the current frame of image data can be effectively solved, and it is guaranteed that subsequent image data transmission is continuously and normally carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image transmission, and particularly relates to an image data transmission method, device, and medium. Background Art

[0002] Currently, a capture card can directly write data to or read data from a computer memory through a PCIe bus. Due to its high transmission bandwidth (only limited by the PCIe bus bandwidth and DDR read / write bandwidth) and the characteristic of not requiring the CPU to perform memory transfer (low CPU occupancy rate), it has a wide range of applications in the field of data acquisition.

[0003] Each time the capture card directly transmits data to the computer memory, it can be characterized by a data identifier, which generally needs to include three pieces of information: the source memory address of the data (generally 32 bits, i.e., 4 bytes at the capture card end), the destination memory address of the data (generally 64 bits, i.e., 8 bytes at the computer end), and the amount of data transmitted (data length, generally only 10 - 16 bits, and usually rounded up to 4B for scheme alignment). Therefore, a single data identifier generally requires at least 16 bytes. When the computer end applies for an image buffer in the memory, if the image buffer is large, it is impossible to ensure that continuous physical memory can be obtained. Therefore, for the transmission of a single piece of data (such as a frame of image), it usually needs to be split into multiple direct memory transmissions characterized by several data identifiers. For example, for the transmission of a 12MB image, if the average data amount corresponding to a single data identifier is 4KB, then a frame of image requires 3072 data identifiers and 3072 independent transmissions. Calculated by 16B for a single data identifier, the transmission of a frame of image requires 48KB of data identifier storage space. If 100 image buffers are allocated, about 4.8MB of space is required to store data identifiers. If a single capture card involves multiple data streams, the required storage space needs to be increased exponentially. For the FPGA at the capture card end, generally there is not such a large on-chip cache to store all data identifiers, so an additional off-chip memory (such as DDR) is required for caching. At the same time, in order to avoid occupying a large amount of memory space at the computer end when the application program is not started, the memory space at the computer end is generally determined when applying for an image buffer. Therefore, the data identifier cannot be fixedly pre-stored in the capture card.

[0004] In the prior art, a relatively small data identification buffer space is opened in the FPGA at the acquisition card end, and after the computer determines the data identification, it writes to the acquisition card through the PCIe bus. The acquisition card end only stores a small amount of data identifications required for the next transmission, and stops writing after the buffer space is full. During the transmission process, after all or part of the transmission data represented by this part of the data identifications is completed, the CPU at the computer end monitors the remaining capacity of the data identification buffer space at the acquisition card end, and writes the next data identification when the capacity is released. In addition, in general data transmission, including image transmission and other types of data transmission, in addition to performing data transmission, buffer control is mostly required. For example, there is only one buffer. Before the start of transmission, the buffer is in a writable state. When writing is performed and one frame of data is written into the buffer, it becomes in a non-writable state. It is necessary to wait for the user to process the data in this buffer before this buffer is released to allow writing again. Regarding the update of the buffer control state, it also needs to be sent from the CPU to the acquisition card. At this time, the CPU only writes the data identifications of the buffer that allows writing to the acquisition card, and avoids the acquisition card writing data to the buffer that does not allow writing in this way. This solution requires the CPU to participate intensively, with a high occupancy rate, and since the size of each frame of image may be different and cannot be known in advance, it causes errors in the image data in the buffer, affecting subsequent processing.

[0005] Therefore, in order to solve the transmission problem caused by different frames of images while reducing the CPU occupancy rate, the present invention provides an image data transmission method, device and medium. Summary of the Invention

[0006] The object of the present invention is to overcome the above problems existing in the prior art, and provide an image data transmission method, device and medium. Aiming at the problems of large storage space for primary data identifications and high CPU occupancy rate, by setting both primary data identifications and secondary data identifications at the computer end, the storage space requirements for primary data identifications are met. The secondary data identifications are used to describe the memory address and data volume information of the primary data identifications, so as to reduce the CPU occupancy rate. Combined with the reading of the acquisition card for direct memory transmission, by adding a frame start flag bit, the start position of each frame of image can be effectively identified, ensuring the normal progress of the entire image transmission process.

[0007] To achieve the above technical objectives and reach the above technical effects, the present invention is realized through the following technical solutions: An image data transmission method, by constructing a number of primary data identifications corresponding to the image data, enabling the acquisition card end to directly access the image buffer at the computer end to transmit the image data, wherein the primary data identifications include the target storage address and the transmission data volume of the image data, and the transmission method includes: Build a secondary data identifier queue on the computer side so that any secondary data identifier corresponds to a number of primary data identifiers continuously stored in the computer side, where the secondary data identifier is used to represent the starting storage address and storage quantity of the corresponding number of primary data identifiers; Obtain the secondary data identifiers in the secondary data identifier queue and write them into the acquisition card side in sequence, so that the acquisition card side sequentially reads the corresponding number of primary data identifiers according to different secondary data identifiers; Sequentially store all the primary data identifiers corresponding to the current secondary data identifier into the same primary data identifier FIFO of the acquisition card side, and use two primary data identifier FIFOs to store alternately to complete the reading of all secondary data identifiers; Add a frame start flag to mark the first data written into the acquisition card side in each frame of image data, and sequentially read all the primary data identifiers in the current primary data identifier FIFO, so that the data corresponding to the frame start flag is used as the starting data corresponding to the first read primary data identifier in the current primary data identifier FIFO, thereby alternately completing the reading of the corresponding primary data identifiers in the two primary data identifier FIFOs; Among them, the completion of the reading of all secondary data identifiers and the alternate completion of the reading of the corresponding primary data identifiers in the two primary data identifier FIFOs are carried out in parallel in time.

[0008] Furthermore, a stream data FIFO is set on the acquisition card side to write each frame of image data, and the corresponding flag bit is configured to be high or low when the first data of each frame of image data is written to distinguish it from other data.

[0009] Furthermore, when starting the transmission of the image data corresponding to the first primary data identifier in the current primary data identifier FIFO, if the data read from the stream data FIFO at this time is not the data corresponding to the frame start flag, the transmission is cancelled until the data corresponding to the frame start flag is read from the stream data FIFO to continue the transmission.

[0010] Furthermore, if the data corresponding to the frame start flag is read from the stream data FIFO and does not correspond to the starting data corresponding to the first read primary data identifier in the current primary data identifier FIFO, the data corresponding to the frame start flag is retained to be used as the starting data corresponding to the first read primary data identifier in another primary data identifier FIFO.

[0011] Furthermore, after retaining the data corresponding to the frame start flag, if the transmission process of the image data corresponding to a primary data identifier is being executed at this time, any data is used to fill the data volume required for the transmission corresponding to this primary data identifier.

[0012] Furthermore, a number of secondary data identifiers in the secondary data identifier queue correspond to one frame of image data.

[0013] Furthermore, each secondary data identifier in the secondary data identifier queue corresponds to a number of frames of image data.

[0014] Furthermore, an image buffer start flag or an image buffer end flag is set in the primary data identifier corresponding to the start or end of a frame of image data.

[0015] The present invention also provides a device, including: a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the above-mentioned processing method is implemented.

[0016] The present invention also provides a computer-readable storage medium, including a computer program, and when the computer program is executed by a processor, the above-mentioned transmission method is implemented.

[0017] The beneficial effects of the present invention are as follows: (1) The present invention only needs to inform the CPU to participate when all the image data corresponding to each secondary data identifier is transmitted, which can effectively reduce the CPU occupancy rate. At the same time, by adding a frame start flag, the data corresponding to the frame start flag is used as the start data of the transmission corresponding to the first read primary data identifier in the current primary data identifier FIFO. When the amount of data in a single frame of image data is greater than or less than the maximum amount of data that the image buffer can store, it can effectively solve the transmission error problem of the current frame of image data and ensure the continuous normal transmission of subsequent image data. Moreover, since the reading of all secondary data identifiers and the alternating reading of the corresponding primary data identifiers in the two primary data identifier FIFOs are carried out in parallel in time, the read-back of the primary data identifiers and the corresponding image data transmission can be continuously carried out, effectively avoiding the risk of bandwidth reduction caused by the primary data identifiers being used up and not being written.

[0018] (2) In the present invention, by using one secondary data identifier to correspond to a number of consecutive primary data identifiers stored in the computer terminal, only the allowed secondary data identifiers need to be written to the acquisition card, and all the primary data identifiers in the corresponding primary data identifier storage space can be read back, effectively reducing the amount of operation.

[0019] (3) The present invention can establish an association relationship between the secondary data identifier and the image buffer, enabling the computer terminal memory to arbitrarily increase the number of image buffers, without affecting the amount of resources required by the acquisition card terminal and the buffer control scheme. At the same time, by storing the primary data identifier and the secondary data identifier in the computer terminal, the problem of insufficient storage space of the acquisition card can be effectively solved.

[0020] (4) The primary data identifier and secondary data identifier in the present invention are prepared before the image data is written into the acquisition card. When combined with the stream data FIFO and using the streaming transmission method, once the stream data is written into the stream data FIFO, it can immediately start writing to the computer-side memory, featuring low latency. Description of the Drawings

[0021] The drawings described herein are used to provide a further understanding of the present invention and form a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a flowchart of the transmission method in the present invention; Figure 2 is a schematic structural diagram of the computer side and the acquisition card side in the present invention. Detailed Embodiments

[0022] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0023] In the prior art, by constructing a number of primary data identifiers corresponding to the image data, the acquisition card side directly accesses the image buffer on the computer side according to the primary data identifiers. Among them, the primary data identifiers include the target storage address and the amount of data to be transmitted of the image data. If a relatively small data identifier cache space is opened in the FPGA on the acquisition card side, after the computer determines the data identifier, it writes to the acquisition card through the PCIe bus. The acquisition card side only stores a small number of data identifiers required for the next transmission to be performed. After the cache space is full, the writing stops. This solution requires the CPU to participate intensively, with a high occupancy rate. At the same time, since the size of each frame of image may be different and cannot be known in advance, it causes the image data in the buffer to be incorrect, affecting subsequent processing.

[0024] As Figure 1 shown, in order to reduce the CPU occupancy rate and increase the bandwidth, this embodiment first provides an image data transmission method, and the transmission method includes: Step 1: Construct a secondary data identifier queue on the computer side so that any one secondary data identifier corresponds to a number of consecutive primary data identifiers stored in the computer side. Among them, the secondary data identifier is used to represent the starting storage address and the storage quantity of the corresponding number of primary data identifiers.

[0025] As Figure 2As shown in the figure, it is a schematic structural diagram of the computer side and the acquisition card side. Before starting image transmission, determine the number N (N≥2) of image buffers to be opened on the computer side; for each image buffer, first apply for the image buffer in the computer memory. At this time, since the size of each frame of image may be different and may change, and it is impossible to know in advance, the applied size cannot be less than the maximum possible image size, and according to the actual memory space obtained, generate the first-level data identifier of the image buffer. For example, the first image buffer requires K1 first-level data identifiers for description, and the second image buffer requires K2 first-level data identifiers. According to the number of first-level data identifiers required for each image buffer, calculate the storage space size required to store these first-level data identifiers, and apply for the corresponding capacity of computer memory, and store the first-level data identifiers of the image buffer continuously in sequence in the corresponding storage space; according to the specific information of the storage space of the first-level data identifier (the starting address of the storage space, the number of first-level data identifiers stored, or the size of the storage space), form the corresponding second-level data identifier; N image buffers correspond to N second-level data identifiers, constituting a second-level data identifier queue. At this time, through any second-level data identifier, several corresponding first-level data identifiers of the image buffer can be quickly read, without the need for one-to-one correspondence between the first-level data identifier and the second-level data identifier (one second-level data identifier represents the storage address of one first-level data identifier), effectively improving the subsequent reading efficiency.

[0026] Step 2: Obtain the second-level data identifiers in the second-level data identifier queue and write them into the acquisition card side in sequence, so that the acquisition card side sequentially reads several corresponding first-level data identifiers according to different second-level data identifiers.

[0027] As Figure 2 shown, the acquisition card side stores the second-level data identifiers obtained from the second-level data identifier queue by setting a second-level data identifier FIFO. Since the second-level data identifier corresponds to the starting storage address and storage quantity of several first-level data identifiers, therefore, for each second-level data identifier read from the second-level data identifier FIFO, multiple consecutive first-level data identifiers can be read from the first-level data identifier storage space according to the starting storage address and storage quantity.

[0028] Step 3: Store all the first-level data identifiers corresponding to the current second-level data identifier into the same first-level data identifier FIFO on the acquisition card side in sequence, and use two first-level data identifier FIFOs to store alternately to complete the reading of all second-level data identifiers.

[0029] As Figure 2As shown, the acquisition card side stores the first-level data identifiers read from the first-level data identifier storage space by setting two first-level data identifier FIFOs (first-level data identifier FIFO-A and first-level data identifier FIFO-B). For the first-level data identifier FIFOs, data can be read while being written, without the need to store all the first-level data identifiers corresponding to the second-level data identifier at once.

[0030] Among them, whenever a second-level data identifier is read out, finally, the storage of all corresponding first-level data identifiers is completed through one of the first-level data identifier FIFOs. At the same time, during the writing and reading process of the current first-level data identifier FIFO, the writing operation of the other first-level data identifier FIFO can be carried out synchronously, which can effectively reduce the delay caused by the waiting for reading of the first-level data identifier FIFO and meet the high-bandwidth requirements.

[0031] Step 4: Add a frame start flag to mark the first data written to the acquisition card side in each frame of image data, and sequentially read all the first-level data identifiers in the current first-level data identifier FIFO, so that the data corresponding to the frame start flag serves as the start data corresponding to the first-level data identifier read for the first time in the current first-level data identifier FIFO, thereby alternately completing the reading of the corresponding first-level data identifiers in the two first-level data identifier FIFOs.

[0032] Although before the start of image transmission for each frame of image data, the number N of computer-side image buffers to be opened up and the number of first-level data identifiers required for each graphics buffer have been estimated, and one first-level data identifier FIFO corresponds to multiple first-level data identifiers of one second-level data identifier, however, when the image size is inconsistent with the pre-applied image buffer size, it is impossible to determine whether all the data of the current frame of image data has been transmitted based on the number of first-level data identifiers represented by the second-level data identifier, and it will also affect the data transmission of all subsequent image buffers when facing streaming data transmission. Therefore, by using the data corresponding to the frame start flag as the start data corresponding to the first-level data identifier read for the first time in the current first-level data identifier FIFO, it can effectively ensure that the start data of each frame of image corresponds to the start position of each image buffer, ensuring the continuous and normal progress of the entire image data transmission process.

[0033] Whenever the transmission of the current frame of image data is completed, an interrupt signal is fed back to the CPU indicating that the writing of an image buffer has been completed, and the application layer can be notified to process the data in this image buffer. During the entire image data transmission process, the CPU only participates once when all the data corresponding to an image buffer is completed.

[0034] Among them, the reading of all second-level data identifiers and the alternate reading of the corresponding first-level data identifiers in the two first-level data identifier FIFOs are carried out in parallel in terms of time.

[0035] Step 3 shows how to complete the reading of all secondary data identifiers. Its essence lies in reading the primary data identifier according to the secondary data identifier. Step 4 shows how to alternately complete the reading of the corresponding primary data identifiers in two primary data identifier FIFOs. Its essence lies in performing the corresponding data transmission according to the primary data identifier, that is, directly writing to the image buffer. Therefore, Step 3 and Step 4 can be performed in parallel during the specific execution process to achieve the synchronous writing and reading of the primary data identifier, effectively improving the data transmission efficiency and bandwidth.

[0036] In summary, after the primary data identifier is determined by the computer side and stored in the computer side memory, the CPU sends the memory address of the stored primary data identifier and the number of stored primary data identifiers (i.e., the data volume of the stored primary data identifier) characterized by the secondary data identifier to the acquisition card. When the acquisition card needs the primary data identifier for corresponding image data transmission and writing, it reads these primary data identifiers from the computer side memory according to the secondary data identifier by itself. Still calculated based on an average of 4KB of transmission data volume described by each primary data identifier and a primary data identifier size of 16B, the transmission of a 12MB image data frame requires 3072 primary data identifiers, and 48KB of primary data identifier storage space needs to be opened up in the computer side memory for storage. The secondary data identifier corresponding to this frame of image data needs to describe this 48KB of storage space.

[0037] In order to reasonably and orderly read the secondary data identifiers in the secondary data identifier queue, whenever the transmission of the current frame of image data is completed, judge the number of secondary data identifiers allowed to be written at the acquisition card end, and obtain the secondary data identifiers that do not exceed this number and are allowed to be written to the acquisition card end from the secondary data identifier queue. At the same time, mark the secondary data identifiers in the secondary data identifier queue that have completed the processing of the corresponding frame of image data to allow them to be written to the acquisition card end again.

[0038] At the start of the transmission, all image buffers are in a writable state. The CPU reads the number of secondary data identifiers currently stored in the secondary data identifier FIFO at the acquisition card end, so as to judge how many secondary data identifiers can be written to it at most, and obtains the secondary data identifiers that do not exceed this number from the secondary data identifier queue and writes them to the secondary data identifier FIFO in sequence. For the secondary data identifiers that have been written in the secondary data identifier queue on the computer side, the CPU marks them as in a state where they cannot be written to the acquisition card secondary data identifier FIFO again.

[0039] After receiving an interrupt signal indicating that the writing to an image buffer has been completed, the CPU knows that the data in the corresponding image buffer is ready and can notify the application layer to process the data in this buffer. After completing the data processing of this image buffer, the CPU updates the corresponding secondary data identifier of this buffer to a state where it can write to the secondary data identifier FIFO of the acquisition card again. Each time the CPU receives an interrupt signal indicating that the writing to an image buffer has been completed, it can simultaneously read the number of secondary data identifiers currently stored in the secondary data identifier FIFO at the acquisition card end, so as to judge how many secondary data identifiers can be written to it at most, and obtain from the secondary data identifier queue the secondary data identifiers that do not exceed this number and are in a state allowing writing to the acquisition card, and write them to the secondary data identifier FIFO in sequence.

[0040] In order to store all the primary data identifiers corresponding to the current secondary data identifier in sequence into the same primary data identifier FIFO at the acquisition card end, the specific method includes: real-time monitoring of the number of primary data identifiers in the current primary data identifier FIFO: If this number is greater than the first threshold, stop writing the primary data identifier; If this number is less than the second threshold, continue writing the primary data identifier until this number is greater than the first threshold or all the primary data identifiers corresponding to the current secondary data identifier have been completely read.

[0041] For each secondary data identifier read from the secondary data identifier FIFO, it is necessary to read back the corresponding stored quantity of primary data identifiers from the primary data identifier storage space at the computer end and write them into the primary data identifier FIFO. At this time, the first threshold is the almost full threshold. If the number of primary data identifiers in the primary data identifier FIFO is greater than this almost full threshold at this time, it is necessary to stop writing. As can be seen from the above, the primary data identifier FIFO performs parallel writing and reading. When a certain number of primary data identifiers in it are read out, it will be less than the almost empty threshold, that is, the second threshold. At this time, continue to perform the read-back writing of the remaining primary data identifiers until all the primary data identifiers corresponding to the current secondary data identifier have been completely read and written into this primary data identifier FIFO, and then it is possible to switch to another primary data identifier FIFO and repeat the above steps in sequence. When one of the primary data identifier FIFOs performs the above operations, the other primary data identifier FIFO can perform the writing operation of the primary data identifier in parallel.

[0042] Through the reasonable setting of the almost full threshold by the first threshold, a certain buffer space is reserved, which can effectively avoid data overflow caused by response lag. Through the reasonable setting of the almost empty threshold by the second threshold, the minimum amount of data retained can provide a buffer for the restart operation and avoid system stagnation. By reasonably setting the almost full threshold and the almost empty threshold, the first-level data identifier FIFO can achieve a balance between reliability (preventing overflow / underflow) and efficiency (high bandwidth utilization).

[0043] In order to avoid multiple first-level data identifiers of image buffers being aliased and written into the same first-level data identifier FIFO simultaneously, the write state of the current first-level data identifier FIFO can be controlled in real time. The specific methods include: During the writing process, it is adjusted to the Busy state to limit the first-level data identifiers corresponding to different second-level data identifiers from being written into the current first-level data identifier FIFO simultaneously; After the transmission of the current frame of image data is completed, it is adjusted to the non-Busy state to allow the first-level data identifiers corresponding to new second-level data identifiers to be written into the current first-level data identifier FIFO.

[0044] The following combines specific embodiments to jointly illustrate the real-time control of the write state of the current first-level data identifier FIFO and the real-time monitoring of the number of first-level data identifiers in the current first-level data identifier FIFO: Before the start of transmission, the acquisition card clears the second-level data identifier FIFO, the first-level data identifier FIFO-A, and the first-level data identifier FIFO-B, and sets the first-level data identifier FIFO-A and the first-level data identifier FIFO-B to the non-Busy state. After the start of transmission, when the acquisition card detects that there are second-level data identifiers in the second-level data identifier FIFO, it starts to perform the first-level data identifier readback.

[0045] The readback and write process corresponding to the first second-level data identifier is as follows: First, read out a secondary data identifier, set the primary data identifier FIFO-A to the Busy state, record the number of primary data identifiers described by this secondary data identifier, denoted as FIFO-A-NUM. At the same time, according to the starting address and storage quantity of the primary data identifier storage space on the computer side described by this secondary data identifier, read the primary data identifiers from the corresponding primary data identifier storage space on the computer side and write them into the primary data identifier FIFO-A until the primary data identifier FIFO-A is written to the almost full state (greater than the almost full threshold), or all the primary data identifiers corresponding to this secondary data identifier have been completely read and written into the primary data identifier FIFO-A; if not all have been read back, continuously monitor the state of the primary data identifier FIFO-A. If the primary data identifier FIFO-A returns to the almost empty state (less than the almost empty threshold), continue to perform the read-back and write operations for the remaining primary data identifiers until all the primary data identifiers corresponding to this secondary data identifier have been completely read and written into the primary data identifier FIFO-A.

[0046] The read-back and write process for the second secondary data identifier is as follows: After completing the read-back and write process for the first secondary data identifier, if there is still data in the secondary data identifier FIFO, determine whether the primary data identifier FIFO-B is in the Busy state (since the transmission has just started, the primary data identifier FIFO-B must be non-Busy). If it is in the non-Busy state, read out the second secondary data identifier, perform the same logic operation on the primary data identifier FIFO-B with reference to the read-back and write process for the first secondary data identifier, and at the same time set the primary data identifier FIFO-B to the Busy state and record FIFO-B-NUM; if it is in the Busy state, do not make a response.

[0047] The read-back and write process for the third secondary data identifier is as follows: After completing the read-back and write process corresponding to the second secondary data identifier, check whether there is still data in the secondary data identifier FIFO and whether the primary data identifier FIFO-A is in the Busy state. If there is data in the secondary data identifier FIFO and the primary data identifier FIFO-A is not in the Busy state, read out the third secondary data identifier, perform the same logic operation on the primary data identifier FIFO-A with reference to the read-back and write process corresponding to the first secondary data identifier, set the primary data identifier FIFO-A to the Busy state again, and update FIFO-A-NUM; if there is no data in the secondary data identifier FIFO or the primary data identifier FIFO-A is in the Busy state, do not make a response; repeat this cycle to alternately perform the primary data identifier writing to the primary data identifier FIFO-A and the primary data identifier FIFO-B. During this process, through the Busy state control, it is possible to avoid the situation where the primary data identifiers of multiple image buffers are aliased and written to the same FIFO simultaneously.

[0048] The processing flow of the primary data identifier in the primary data identifier FIFO-A is as follows: After the start of transmission, the acquisition card monitors the state of the primary data identifier FIFO-A. If there is a primary data identifier in the primary data identifier FIFO-A, read out the first primary data identifier, and wait until the amount of data in the stream data FIFO reaches the amount of transmitted data described by this primary data identifier, then write the corresponding amount of data in the stream data FIFO to the computer-side memory address described by this primary data identifier. After completing the data transmission corresponding to one primary data identifier, accumulate through FIFO-A-CNT and increment the count from zero. If the FIFO-A-CNT count has not reached FIFO-A-NUM and there is still a new primary data identifier in the primary data identifier FIFO-A, read out the second primary data identifier, perform the same logic operation again with reference to the first primary data identifier, and directly perform the second image data transmission to the computer-side memory; execute in sequence. For each image data transmission corresponding to one primary data identifier, increment FIFO-A-CNT one by one until FIFO-A-CNT reaches FIFO-A-NUM, which means that all the image data transmissions corresponding to the primary data identifiers in this image buffer have been completed, and all the image data has been written into the corresponding image buffer in the computer-side memory. At this time, set the primary data identifier FIFO-A to the non-Busy state, and at the same time, the acquisition card sends an interrupt signal to the computer-side through PCIe to inform the CPU that the image data transmission of one image buffer has been completed.

[0049] Similarly, the processing flow of the primary data identifier in the primary data identifier FIFO-B is as follows: After all the first-level data identifiers in the first-level data identifier FIFO-A are executed, the status of the first-level data identifier FIFO-B is monitored, and the same logic operation is performed on the first-level data identifier FIFO-B with reference to the first-level data identifier processing flow in the first-level data identifier FIFO-A. The accumulation is carried out through FIFO-B-CNT. After all the image buffer first-level data identifiers corresponding to the first-level data identifier FIFO-B are written, the first-level data identifier FIFO-B is set to the non-Busy state. At the same time, the acquisition card sends an interrupt signal to the computer end through PCIe to inform the CPU that the image data transmission of an image buffer has been completed. Subsequently, the status of the first-level data identifier FIFO-A is monitored again, and this cycle continues.

[0050] By repeatedly executing the above steps, the direct image data transmission from the acquisition card end to the computer end memory can be continuously realized until the transmission stops.

[0051] To further reduce the storage space consumption of the first-level data identifier, the image data in the acquisition card can be stored using a stream data FIFO and transmitted in a streaming manner. In this case, the first-level data identifier only needs the computer end memory address and the amount of data to be transmitted, without the acquisition card end memory address. Of course, an address-mapped cache form such as DDR on or off the FPGA can also be used. In this case, the acquisition card end memory address is also required in the first-level data identifier. After reading out the first-level data identifier, the required data needs to be read out from the address-mapped cache according to the acquisition card end memory address and data volume information corresponding to the first-level data identifier, and then directly written to the corresponding memory address on the computer end.

[0052] As a specific implementation manner of the present invention, a stream data FIFO is provided at the acquisition card end to write each frame of image data, and the corresponding flag bit is configured as high or low when the first data of each frame of image data is written to distinguish it from other data. By adding the corresponding flag bit in the stream data FIFO, it can be quickly confirmed whether the current data is the first data of a frame of image when the subsequent data is read out, thus providing a basis for subsequent rapid and effective response.

[0053] When the data volume of the previous frame of image exceeds the maximum data volume that the pre-applied image buffer can store, to ensure the normal storage of the subsequent image buffer, when starting the image data transmission corresponding to the first first-level data identifier in the current first-level data identifier FIFO, if the data read from the stream data FIFO at this time is not the data corresponding to the frame start flag, the transmission is cancelled until the data corresponding to the frame start flag is read from the stream data FIFO to continue the transmission. Taking one image buffer corresponding to one second-level data identifier as an example, the specific situation is as follows: Add a frame start flag bit to the streaming data FIFO. When the first data of each frame of image is written into the streaming data FIFO, the corresponding flag bit is configured to high, and the corresponding flag bits of other data are configured to low. That is, when reading the data from the streaming data FIFO, if the flag bit is high, it is the first data of a frame. When starting the first transmission of a first-level data identification FIFO (i.e., the first first-level data identification of an image buffer), it is necessary to require the first transmission to start from a data with a high flag bit in the streaming data FIFO. If the flag bit of the first data read from the FIFO at this time is low, it indicates that there is an abnormality in the transmission (for example, the data volume of the previous frame exceeds the maximum data volume that the image buffer can store). At this time, directly read the data in the streaming data FIFO, but do not perform the corresponding image data transmission until a data with a high flag bit is read from the streaming data FIFO, and use this data as the first valid data to start executing the first-level data identification processing flow similar to that in the first-level data identification FIFO-A; when starting the next first-level data identification FIFO, it is similar, and it is also necessary to wait for a data with a high flag bit in the streaming data FIFO.

[0054] When the data volume of a single-frame image is less than the maximum data volume that the pre-applied image buffer can store, there will be a situation where the first-level data identifications in the first-level data identification FIFO have not been all read out, but the transmission task of the current frame of image data has been completed. Therefore, if the data corresponding to the frame start flag is read from the streaming data FIFO and does not correspond to the starting data of the transmission corresponding to the first first-level data identification read from the current first-level data identification FIFO, then retain the data corresponding to the frame start flag to be used as the starting data of the transmission corresponding to the first first-level data identification read from another first-level data identification FIFO. Moreover, after retaining the data corresponding to the frame start flag, if an image data transmission process corresponding to a first-level data identification is being executed at this time, use any data to fill the data volume required for the transmission corresponding to this first-level data identification to avoid errors in this transmission. Specifically as follows: If there are still remaining first-level data identifiers in the first-level data identifier FIFO being read, or when reading a data with a high flag bit from the stream data FIFO during the transmission of image data corresponding to a first-level data identifier, this data is retained: If an image data transmission corresponding to a first-level data identifier is being executed at this time and the data volume is not enough for the current transmission, any data is used to supplement the transmission of this data identifier to avoid errors in this transmission. At the same time, after the image data transmission of this time is completed, the first-level data identifier FIFO used in this transmission is cleared; If a first-level data identifier is being read from the first-level data identifier storage space on the computer side and written to the first-level data identifier FIFO at this time, this operation is aborted and switched to the next first-level data identifier FIFO. If no first-level data identifier reading is being executed or a write to another first-level data identifier FIFO is being executed, there is no need to abort; At the same time, the acquisition card sends an interrupt signal to the computer side through PCIe to inform the CPU that the image data of an image buffer has been written. During the transmission, the effective data volume of this transmission can also be counted and synchronized to inform the CPU so that the CPU can master the effective data volume of this variable-length image acquisition.

[0055] To understand the occurrence of frame incomplete events in real time, whenever a data with a high flag bit is read from the stream data FIFO and the first-level data identifiers in the first-level data identifier FIFO have not all completed DMA write transmission in this instance, the acquisition card sends an interrupt to the CPU through the PCIe bus to inform the CPU that a frame incomplete event has occurred, that is, the amount of image data transmitted in this instance is less than the set size of the image buffer.

[0056] As can be seen from the above, the first-level data identifiers corresponding to a single image buffer need to be stored entirely in a continuous storage space and correspond to a second-level data identifier. When a single image buffer is large, the continuous storage space required for the first-level data identifier storage space will also be large, and there may be a possibility of failure in applying for such a space in the memory. Therefore, in response to this situation, several second-level data identifiers in the second-level data identifier queue can correspond to one frame of image data, that is, several second-level data identifiers correspond to one image buffer, as follows: The first-level data identifiers corresponding to an image buffer can be split and stored in T continuous small spaces and correspond to T second-level data identifiers. The length of the second-level data identifier queue then becomes T1 + T2 +... + TN. For the S-th image buffer, the CPU considers that the entire image buffer has been transmitted only when all TS second-level data identifiers have been transmitted.

[0057] When the size of a single image buffer is small, since the CPU will receive an interrupt signal and perform corresponding status reading and processing every time the image data transfer of all the first-level data identifiers corresponding to a second-level data identifier is completed, the interrupt rate will be relatively high and the CPU occupancy rate will increase. Therefore, in response to this situation, each second-level data identifier in the second-level data identifier queue can correspond to several frames of image data, that is, a second-level data identifier corresponds to several image buffers, as follows: The first-level data identifiers of multiple image buffers can be stored in a continuous storage space and correspond to a second-level data identifier. When the CPU receives an interrupt signal after the image data transfer of all the first-level data identifiers corresponding to the second-level data identifier is completed, it is considered that the image data transfer of this batch of image buffers corresponding to the second-level data identifier is completed, and the status reading and update of these image buffers are processed together. In this way, the CPU occupancy rate can be effectively reduced.

[0058] As can be seen from the above, when not considering the size of a single image buffer, each second-level data identifier corresponds to an image buffer and is mutually associated. When the image data transfer of all the first-level data identifiers in the storage space of the first-level data identifiers corresponding to each second-level data identifier is completed, the CPU interrupts and processes the status reading and update of the image buffer. However, when the size of a single image buffer is large or small, in order to effectively reduce the CPU occupancy rate and ensure the normal sending of the CPU interrupt signal, an image buffer start flag or an image buffer end flag can be set in the first-level data identifier to correspond to the start or end of a frame of image data, respectively, as follows: Taking the image buffer end flag as an example, the first-level data identifier with an end flag of 1 is the last first-level data identifier of an image buffer. When the end flag of the first-level data identifier is read as 1, after the image data transfer corresponding to the first-level data identifier is completed, the acquisition card can send an interrupt signal to inform the CPU that the transfer of an image buffer has been completed; at the same time, when starting to execute the image data transfer of the next first-level data identifier, if there is a frame concept for the streaming data or cached data, the image transfer of a new buffer should start from the start of the next frame. According to this scheme, the first-level data identifier storage space (bound to the second-level data identifier) and the image buffer can no longer have any association relationship, and can be debugged according to the actual application situation to achieve a better CPU occupancy rate.

[0059] As described above, every time after the transmission of a frame of image data is completed, the CPU will be informed to process the status reading and updating of the corresponding image buffer. However, when a single image buffer is large, there will be a certain delay waiting time, which affects the overall transmission response efficiency. Therefore, the number of first-level data identifiers read in the first-level data identifier FIFO can be monitored in real time, and when this number reaches a preset value, it is fed back to the CPU to process the data of the transmitted part of the current frame of image data in advance. For example, in the processing flow of the first-level data identifiers in the first-level data identifier FIFO-A, when the FIFO-A-CNT reaches half or other thresholds of the FIFO-A-NUM, an interrupt signal can be sent to the CPU to inform it that half or other proportions of the current image buffer have been transmitted, and the application layer can start processing the data of the transmitted part of the image buffer in advance, reducing the delay waiting time and improving the overall transmission response efficiency.

[0060] The second aspect of the present invention also provides a device, including: a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the above-mentioned processing method is implemented.

[0061] The third aspect of the present invention also provides a computer-readable storage medium, including a computer program, and when the computer program is executed by a processor, the above-mentioned transmission method is implemented.

[0062] In practical applications, the computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device.

[0063] A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.

[0064] The program code contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0065] The computer program code for performing the operations of this application may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0066] In the description of this specification, the description referring to terms such as "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0067] The basic principles, main features, and advantages of the present invention have been shown and described above. Those skilled in the art of this industry should understand that the present invention is not limited by the above embodiments. The above embodiments and the descriptions in the specification only illustrate the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed.

Claims

1. An image data transmission method, by constructing a number of first-level data identifiers corresponding to the image data, enabling the acquisition card side to directly access the image buffer on the computer side according to the first-level data identifiers to transmit the image data, where The primary data identifier includes the target storage address and the amount of transmitted data of the image data. It is characterized in that the transmission method includes: Construct a secondary data identifier queue on the computer side, so that any secondary data identifier corresponds to a number of consecutive primary data identifiers stored in the computer side. Among them, the secondary data identifier is used to represent the starting storage address and the storage quantity of the corresponding number of primary data identifiers; Obtain the secondary data identifiers in the secondary data identifier queue and write them into the acquisition card side in sequence, so that the acquisition card side reads the corresponding number of primary data identifiers according to different secondary data identifiers in sequence; Store all the primary data identifiers corresponding to the current secondary data identifier into the same primary data identifier FIFO of the acquisition card side in sequence, and use two primary data identifier FIFOs to store alternately to complete the reading of all secondary data identifiers; Add a frame start flag to mark the first data written into the acquisition card side in each frame of image data, and read all the primary data identifiers in the current primary data identifier FIFO in sequence, so that the data corresponding to the frame start flag is used as the starting data corresponding to the transmission of the primary data identifier read for the first time in the current primary data identifier FIFO, so as to alternately complete the reading of the corresponding primary data identifiers in the two primary data identifier FIFOs; Among them, the completion of the reading of all secondary data identifiers and the alternate completion of the reading of the corresponding primary data identifiers in the two primary data identifier FIFOs are carried out in parallel in time.

2. The image data transmission method according to claim 1, wherein The acquisition card side is provided with a stream data FIFO to write each frame of image data, and the flag bit corresponding to the first data of each frame of image data is configured to be high or low when written, so as to distinguish it from other data.

3. A method for transmitting image data according to claim 1, characterized in that, When starting the transmission of the image data corresponding to the first primary data identifier in the current primary data identifier FIFO, if the data read from the stream data FIFO at this time is not the data corresponding to the frame start flag, the transmission is cancelled until the data corresponding to the frame start flag is read from the stream data FIFO to continue the transmission.

4. A method for transmitting image data according to claim 1, characterized in that, If when the data corresponding to the frame start flag is read from the stream data FIFO, it does not correspond to the starting data corresponding to the transmission of the primary data identifier read for the first time in the current primary data identifier FIFO, then the data corresponding to the frame start flag is retained to be used as the starting data corresponding to the transmission of the primary data identifier read for the first time in another primary data identifier FIFO.

5. A method for transmitting image data according to claim 4, characterized in that, After retaining the data corresponding to the frame start flag, if an image data transmission process corresponding to a primary data identifier is being executed at this time, any data is used to make up the data volume required for the transmission corresponding to this primary data identifier.

6. The image data transmission method according to claim 1, characterized in that A number of secondary data identifiers in the secondary data identifier queue correspond to one frame of image data.

7. An image data transmission method according to claim 1, characterized in that, Each secondary data identifier in the secondary data identifier queue corresponds to a number of frames of image data.

8. An image data transmission method according to claim 6 or 7, characterized in that An image buffer start flag or an image buffer end flag is set in the primary data identifier corresponding to the start or end of a frame of image data.

9. A device, characterized in that, Including: A memory and a processor, the memory stores a computer program, and it is characterized in that when the processor executes the computer program, it implements the processing method described in any one of claims 1-8.

10. A computer-readable storage medium, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the transmission method according to any one of claims 1-8.